2024-11-21 23:27 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000520mercuryBugpublic2020-10-02 17:46
Reporterkeri 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0000520: possible GCC ICE when compiling library/int.m in asm_fast.gc.tr.debug.stseg grade with -O1
DescriptionI'm not really sure this is even a Mercury bug.

When mercury is configured with --enabled-trail-grades an internal compiler error may occur when compiling library/int.m or library/uint.m in the asm_fast.gc.tr.debug.stseg grade and -O2 optimizations exist in CFLAGS.

To reproduce:

$ ./configure --enable-trail-grades
$ echo "EXTRA_CFLAGS = -O1" >> Mmake.params
$ make
$ make install

Alternatively, if mercury is already installed with a asm_fast.gc.tr.debug.stseg grade:

$ cd mercury-srcdist/library
$ mmc --compile-to-c --grade asm_fast.gc.tr.debug.stseg int
$ mgnuc --grade asm_fast.gc.tr.debug.stseg -- -O1 -c int.c int.o

In both cases the following ICE has been observed:

int.c: In function 'int_module123':
int.c:21687:1: error: unable to generate reloads for:
(insn 162 161 163 11 (parallel [
            (set (reg/v:DI 43 r15 [ MR_mr3 ])
                (ashift:DI (reg/v:DI 42 r14 [ MR_mr2 ])
                    (const_int 6 [0x6])))
            (clobber (reg:CC 17 flags))
        ]) "int.m":1013:18 520 {*ashldi3_1}
     (expr_list:REG_UNUSED (reg:CC 17 flags)
        (nil)))
during RTL pass: reload
int.c21687:1: internal compiler error: in curr_insn_transform, at lra-constraints.c:3962

The ICE only seems to occur with GCC 9.x. I've tried the following versions of GCC:

* 8.3.0: no ICE
* 9.2.0: ICE
* 9.3.0: ICE
* 10.2.0: no ICE
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0001104

juliensf (administrator)

It's a Mercury bug to the extent that we would ideally apply workarounds to avoid the bugs in the affected versions of GCC.

~0001106

juliensf (administrator)

This is the issue from bug 0000492. The compiler already has a workaround for the problem, but by setting EXTRA_CFLAGS=-O1 you are overriding that workaround.

The underlying issue is not present in the GCC 8 and 10 branches, but seems to affect all versions of GCC 9 for x86_64.
+Notes

-Issue History
Date Modified Username Field Change
2020-09-18 02:23 keri New Issue
2020-09-18 16:28 juliensf Note Added: 0001104
2020-10-02 17:46 juliensf Note Added: 0001106
+Issue History