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

            Bug ID: 121140
           Summary: [ICE] cc1: internal compiler error: in
                    analyze_functions, at cgraphunit.cc:1418
           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/hEcffhxj9


The crash triggering program (compile with `gcc-16 -O0`):
```
#include <fenv.h>
#include <stdlib.h>
#include <stdio.h>
int main(void) {
    char buffer[32];
    float f = 123.456f;
    double d = 789.012345;
    strfromf(buffer, sizeof(buffer), "%g", f);
    printf("strfromf: %s\n", buffer);
    strfromd(buffer, sizeof(buffer), "%.3f", d);
    printf("strfromd: %s\n", buffer);
    char __attribute__((__vector_size__(2))) vec = {0x01, 0x02};
    vec = ~vec;
    printf("Vector bits: 0x%x\n", *(unsigned int*)&vec);
    extern inline int stat_wrapper(const char *path, void *buf) {
        return 42;
    }
    printf("stat_wrapper result: %d\n", stat_wrapper("dummy", NULL));
    return 0;
}
```

The crash output:
```
<source>: In function 'main':
<source>:16:23: error: nested function 'stat_wrapper' declared 'extern'
   16 |     extern inline int stat_wrapper(const char *path, void *buf) {
      |                       ^~~~~~~~~~~~
At top level:
cc1: internal compiler error: in analyze_functions, at cgraphunit.cc:1418
0x253f0d5 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x2560db6 internal_error(char const*, ...)
        ???:0
0xa02454 fancy_abort(char const*, int, char const*)
        ???:0
0xc29ca1 symbol_table::finalize_compilation_unit()
        ???: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
```
  • [Bug c/121140] New: [ICE] cc1: ... njuwy at smail dot nju.edu.cn via Gcc-bugs

Reply via email to