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

            Bug ID: 128866
           Summary: ICE on valid code at -Os: verify_gimple failed
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

Hi,

$cat repro.c
void foo (int n)
{
  struct S { int a[n]; };
  struct S fn (void) { struct S s; s.a[0] = 42; return s; }
  struct S fn2 (void) { return fn (); }
  if (fn2 ().a[0] != 42)
    __builtin_abort ();
}

int main (void)
{
  foo (1);
  return 0;
}

$gcc-trunk -c -Os repro.c
repro.c: In function ‘fn’:
repro.c:14:1: error: invalid conversion in return statement
   14 | }
      | ^
struct S

struct S

# VUSE <.MEM_13>
return <retval>;
during IPA pass: remove_symbols
repro.c:14:1: internal compiler error: verify_gimple failed
0x2b5ea8f internal_error(char const*, ...)
        ../../gcc/diagnostic-global-context.cc:787
0x13c57f2 verify_gimple_in_cfg(function*, bool, bool)
        ../../gcc/tree-cfg.cc:5653
0x12130fe execute_function_todo
        ../../gcc/passes.cc:2105
0x12135e5 do_per_function
        ../../gcc/passes.cc:1706
0x12135e5 do_per_function
        ../../gcc/passes.cc:1696
0x1213677 execute_todo
        ../../gcc/passes.cc:2157
/home/haoxin/research/gcc/build/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1
-quiet -imultiarch x86_64-linux-gnu repro.c -quiet -dumpbase repro.c
-dumpbase-ext .c -mtune=generic -march=x86-64 -Os -o /tmp/ccfOUjvG.s
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


Reproduced in Godbolt: https://godbolt.org/z/csaY7eK5a

Thanks.

Reply via email to