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

            Bug ID: 121423
           Summary: [ICE] nested function leads to internal compiler
                    error: verify_gimple failed
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: njuwy at smail dot nju.edu.cn
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/qoedo41Ma


The crash triggering program (compile with `gcc-16 -Os`):
```
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 ();
}

fn ();
fn2 ();

}

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

```

The crash output:
```
<source>: In function 'fn':
<source>:21:1: error: invalid conversion in return statement
   21 | }
      | ^
struct S

struct S

# VUSE <.MEM_13>
return <retval>;
during IPA pass: remove_symbols
<source>:21:1: internal compiler error: verify_gimple failed
0x254bbc5 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x2541466 internal_error(char const*, ...)
        ???:0
0x11f4ede verify_gimple_in_cfg(function*, bool, bool)
        ???:0
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.
Compiler returned: 1
```

Reply via email to