Mercury Bugs - mercury
View Issue Details
0000560mercuryBugpublic2022-05-27 17:372022-05-31 16:24
Reporterwangp 
Assigned To 
PrioritynormalSeveritycrashReproducibilityalways
StatusnewResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000560: asm_fast.gc crashes on aarch64 with gcc 10.2
DescriptionConfigure enables asm_fast.gc by default on aarch64 but it doesn't work with newer versions of gcc:

gcc 10.2, Debian 11 - crash
gcc 8.3.0, Debian 10 - ok
gcc 6.3.0, Debian 9 - ok

reg.gc works so far on a few small programs. I have not tried a bootcheck yet (emulation is slow).
TagsNo tags attached.
Attached Files

Notes
(0001195)
juliensf   
2022-05-27 17:50   
Does the crash with the sample programs occur with GCC 10.2 occur with:

    a. --mercury-linkage shared
    b. --mercury-linkage static
    c. both

Have you tried compiling with gcc -O0?
(0001196)
wangp   
2022-05-30 12:10   
It crashes in all three cases (--mercury-linkage shared, --mercury-linkage static, compiling the standard library and hello.m with gcc -O0).
(0001197)
wangp   
2022-05-31 12:37   
Debian 11 also has a package for gcc version 9.3.0.

The sample programs also crash in asm_fast.gc using gcc 9.3.0 in all three cases (--mercury-linkage shared, --mercury-linkage static, compiling the standard library and hello.m with gcc -O0).
(0001198)
juliensf   
2022-05-31 14:18   
In the absence of an immediate fix, I suggest we disable the use of asm_fast as the LLDS base grade on aarch64 for GCC >= 9 on both the master and release branches (assuming reg.gc is ok.)
(0001199)
wangp   
2022-05-31 16:24   
It has something to do with PIC. Adding this to Mmake.params and compiling the sample programs without PIC makes them not crash:

EXTRA_CFLAGS = -fno-pic -fno-PIC -static
EXTRA_MLFLAGS = -static

(That makes me a bit suspicious that it is something similar to the PIC register issue on x86, but it might be completely unrelated.)

For now I agree we should disable asm_fast on aarch64 with GCC >= 9. I'm doing a partial bootcheck on reg.gc to make sure that works ok.

Issue History
2022-05-27 17:37wangpNew Issue
2022-05-27 17:38wangpSeverityminor => crash
2022-05-27 17:50juliensfNote Added: 0001195
2022-05-30 12:10wangpNote Added: 0001196
2022-05-31 12:37wangpNote Added: 0001197
2022-05-31 14:18juliensfNote Added: 0001198
2022-05-31 16:24wangpNote Added: 0001199