https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98228

--- Comment #12 from Marius Hillenbrand <mhillen at linux dot ibm.com> ---
found a miscompilation in gnat1 (that I can trigger to cause a segfault),
a loop in sem_res.adb:2405 in procedure Resolve (N : Node_Id; Typ : Entity_Id)

while Present (It.Typ) loop
  Get_Next_Interp (I, It); // <- from sem_type.adb
end loop;

is optimized into an endless loop, apparently by wrongly concluding that
Get_Next_Interp would not change It (which it does).

              while Present (It.Typ) loop 
 18558fe:      e3 20 f1 14 00 12      lt     %r2,276(%r15)
 1855904:      a7 84 0c 23            je     185714a <sem_res__resolve+0x256a>
 1855908:      b3 cd 00 28            lgdr   %r2,%f8

looping back here:
                        Get_Next_Interp (I, It);
 185590c:      b9 04 00 3a            lgr    %r3,%r10
 1855910:      c0 e5 00 00 cb 70      brasl  %r14,186eff0
<sem_type__get_next_interp>
 1855916:      b9 14 00 22            lgfr   %r2,%r2
 185591a:      a7 f4 ff f9            j      185590c <sem_res__resolve+0xd2c>

when suppressing ipa-modref info for Get_Next_Interp, we get a sane check and
conditional branch instead.

Reply via email to