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

            Bug ID: 126574
           Summary: [17 Regression] ICE with nested functions
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---

void
foo (int n)
{
  struct S { int a[n]; };

  struct S
  fn (void)
  {
    struct S s;
    s.a[0] = 42;
    return s;
  }

  auto struct S
  fn2 (void)
  {
    return fn ();
  }

  struct S x;
  fn ();
  fn2 ();
  x = fn ();

  if (x.a[0] != 42)
    __builtin_abort ();

  if (fn ().a[0] != 42)
    __builtin_abort ();

  __typeof__ (fn ()) *p = &x;
  if (p->a[0] != 42)
    __builtin_abort ();

  if (fn2 ().a[0] != 42)
    __builtin_abort ();
}

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

ICEs on aarch64 with -Os

 In function 'fn':
<source>:43:1: error: invalid conversion in return statement
   43 | }
      | ^
struct S

struct S

# VUSE <.MEM_13>
return <retval>;
during IPA pass: remove_symbols
<source>:43:1: internal compiler error: verify_gimple failed

Reply via email to