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

--- Comment #9 from Marius Hillenbrand <mhillen at linux dot ibm.com> ---
The failures in gnat1 during bootstrap have not led me anywhere, yet I found
useful ICEs while running the test suite on the mostly-bootstrapped tree. The
failing code in gnat appears compiled correctly, and I am not familiar enough
with Ada to dig deeper (e.g., the segfault results from overrunning the last
element of All_Interp.Table, which looks "correct" locally but maybe is the
result of a corruption of that table earlier).

The ICE when building gcc/testsuite/gcc.target/s390/target-attribute/tattr-3.c
is caused by a wrongly resolved struct offset for
lang_hooks.types.type_promotes_to() in s390-c.c:s390_fn_types_compatible()

in
if (lang_hooks.types_compatible_p (
  lang_hooks.types.type_promotes_to (in_type),
  lang_hooks.types.type_promotes_to (b_arg_type))) ...
the calls to type_promotes_to() actually call lang_hooks.types.generic_p (two
entries, 0x10, earlier in that struct), which returns 0. c_types_compatible_p
expects non-null arguments and then segfaults.

Program received signal SIGSEGV, Segmentation fault.
c_types_compatible_p (x=0x0, x@entry=<error reading variable: value has been
optimized out>, y=0x0)
    at ../../gcc/c/c-objc-common.c:377
    377       return comptypes (TYPE_MAIN_VARIANT (x), TYPE_MAIN_VARIANT (y));
(gdb) bt
#0  c_types_compatible_p (x=0x0, x@entry=<error reading variable: value has
been optimized out>, y=0x0)
    at ../../gcc/c/c-objc-common.c:377
#1  0x00000000012f72fe in s390_fn_types_compatible (arglist=<optimized out>,
typeindex=<optimized out>)
    at ../../gcc/config/s390/s390-c.c:773
#2  s390_resolve_overloaded_builtin (loc=<optimized out>,
ob_fndecl=0x3fffb3ac400, passed_arglist=0x3fffb3f26b8)
    at ../../gcc/config/s390/s390-c.c:951
...

the stage2 cc1 uses the correct offset yet then miscompiles the stage3 cc1

gcc/config/s390/s390-c.c:773
      if (lang_hooks.types_compatible_p (
 12f72d2:       c4 18 00 b3 97 4f       lgrl    %r1,296a170 <lang_hooks+0x258> 
                                                     offset should be +0x268
 12f72d8:       c4 88 00 b3 96 a0       lgrl    %r8,296a018 <lang_hooks+0x100>
 12f72de:       b9 04 00 2a             lgr     %r2,%r10
 12f72e2:       0d e1                   basr    %r14,%r1
 ...

Reply via email to