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

            Bug ID: 122847
           Summary: [16 Regression] ICE non-trivial conversion in
                    ‘ssa_name’
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kacper.slominski72 at gmail dot com
  Target Milestone: ---

Originally found while compiling Linux 6.17.9 (original preprocessed file and
error attached). Fails at all optimization levels above -O0.

Reduced test case:

struct {
        char x[6];
} *a, b;

int c;

int d() {
        char *p = a ? a->x : b.x;
        char e = *p;

        if (c)
                return *(short *)p & e;
        return 0;
}

Built with the following flags:
$ gcc min.c -c -o min.o -fno-strict-aliasing -O1

I've modified the reduced code a bit to get rid of UB and make it not a no-op
(original reduction did had just a `*(short *)p & *(unsigned int *)0;`
expression in the consequent.

Fails with:

min.c: In function ‘d’:
min.c:14:1: error: non-trivial conversion in ‘ssa_name’
   14 | }
      | ^
short int
char
_4 = e_12;
during GIMPLE pass: phiprop
min.c:14:1: internal compiler error: verify_gimple failed
0x55ab2f465764 internal_error(char const*, ...)
       
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/diagnostic-global-context.cc:787
0x55ab2dc5cf0d verify_gimple_in_cfg(function*, bool, bool)
       
/usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/tree-cfg.cc:5599
0x55ab2da49bfd execute_function_todo
        /usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/passes.cc:2097
0x55ab2da4a03e do_per_function
        /usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/passes.cc:1696
0x55ab2da4a03e execute_todo
        /usr/src/debug/sys-devel/gcc-16.0.9999/gcc-16.0.9999/gcc/passes.cc:2149


gcc version:
gcc (Gentoo 16.0.9999 p, commit d93ac8e926116356695925acea88cb496d9ddaa8)
16.0.0 20251125 (experimental) 6931ba63fc0fc4b9def5d6c4d13a3e29682448b0

Reply via email to