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

            Bug ID: 121187
           Summary: ICE on x86_64-linux-gnu: Segmentation fault with omp
                    for nested loop
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jiangchangwu at smail dot nju.edu.cn
  Target Milestone: ---

Compiler Explorer: https://gcc.godbolt.org/z/Yhd3s4c1W

*******************************************************************************
gcc version:
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/16.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --disable-multilib --disable-bootstrap
--enable-languages=c,c++ --prefix=/home/software/gcc-trunk --enable-coverage
--disable-werror --enable-checking=yes
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 16.0.0 20250613 (experimental) (GCC)

*******************************************************************************
Program:
$ cat mutant.c
void a(int c, int b) {
    #pragma omp for collapse(2)
    for (int i = 0; i < c; i++) {
        #pragma omp tile sizes(4, 4)
        for (int j = 0; j < b; j++){}
    }
}

*******************************************************************************
Command Lines:
$ gcc -fopenmp mutant.c
mutant.c: In function 'a':
mutant.c:5:9: error: not enough nested loops
    5 |         for (int j = 0; j < b; j++){}
      |         ^~~
mutant.c:5:9: internal compiler error: Segmentation fault
0x5554b38 internal_error(char const*, ...)
        ../../gcc/gcc/diagnostic-global-context.cc:517
0x21651ec crash_signal
        ../../gcc/gcc/toplev.cc:321
0xed4231 add_stmt(tree_node*)
        ../../gcc/gcc/c/c-decl.cc:700
0x1010791 c_parser_compound_statement_nostart
        ../../gcc/gcc/c/c-parser.cc:7592
0x100d374 c_parser_compound_statement
        ../../gcc/gcc/c/c-parser.cc:7023
0x1076318 c_parser_omp_loop_nest
        ../../gcc/gcc/c/c-parser.cc:24466
0x10774e3 c_parser_omp_for_loop
        ../../gcc/gcc/c/c-parser.cc:24623
0x107a9e1 c_parser_omp_for
        ../../gcc/gcc/c/c-parser.cc:24935
0x109fad4 c_parser_omp_construct
        ../../gcc/gcc/c/c-parser.cc:29814
0x103f818 c_parser_pragma
        ../../gcc/gcc/c/c-parser.cc:16015
0x10115f7 c_parser_compound_statement_nostart
        ../../gcc/gcc/c/c-parser.cc:7762
0x100d374 c_parser_compound_statement
        ../../gcc/gcc/c/c-parser.cc:7023
0xffac7a c_parser_declaration_or_fndef
        ../../gcc/gcc/c/c-parser.cc:3223
0xff59fd c_parser_external_declaration
        ../../gcc/gcc/c/c-parser.cc:2155
0xff4ea2 c_parser_translation_unit
        ../../gcc/gcc/c/c-parser.cc:2009
0x10a17ee c_parse_file()
        ../../gcc/gcc/c/c-parser.cc:30153
0x11d7aeb c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.cc:1385
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.

Reply via email to