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

            Bug ID: 108930
           Summary: Internal compiler error with -fopenmp
                    (tsubst_omp_for_iterator)
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: michael_greenburg at byu dot edu
  Target Milestone: ---

Created attachment 54533
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54533&action=edit
The source file

GCC VERSION: 12.1.0. The error also occurs with versions 10.2.0, 11.2.0, and
12.2.1; 12.2.1 is the default GCC that comes with Arch, the others I built on
the same system as 12.1.0.

SYSTEM TYPE: Linux x86_64 (RHEL 7.9)

CONFIGURED WITH: /apps/src/gcc/src/gcc-12.1.0/configure
--prefix=/apps/gcc/12.1.0 --with-arch=haswell --with-tune=znver3
--with-fpmath=avx --enable-host-shared --enable-threads --enable-__cxa_atexit
--enable-valgrind-annotations --disable-multilib --with-dwarf2

GCC COMMAND LINE: g++ -std=c++20 -fopenmp -freport-bug -save-temps -Wall
-Wextra trigger_bug.cc

OBSERVED AND EXPECTED BEHAVIOR: I would expect the program to compile and run
successfully (as it does without `-fopenmp`) rather than dying on an internal
compiler error.

I've attached `trigger_bug.cc` (a minimal example) and will also attach the
*.out file that resulted from `-freport-bug` and the *.ii file that resulted
from `-save-temps`.

It seems like this might be related:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105839



COMPILER OUTPUT:
trigger_bug.cc: In instantiation of 'const auto product(std::array<_Tp, _Nm>)
[with T = int; long unsigned int N = 3]':
trigger_bug.cc:39:25:   required from here
trigger_bug.cc:26:9: internal compiler error: in tsubst_omp_for_iterator, at
cp/pt.cc:18126
   26 |         for (auto i=ibegin; i<iend; i++) {
      |         ^~~
0x6ae052 tsubst_omp_for_iterator
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:18126
0x6ae052 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:19095
0x6ae052 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:18450
0x8890dc tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:19028
0x8890dc tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:18450
0x889054 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:18476
0x889054 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:18450
0x888e6e tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:18833
0x888e6e tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:18450
0x889054 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:18476
0x889054 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:18450
0x8a296d tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:19836
0x8803c3 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:21341
0x888488 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:19491
0x888488 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:18450
0x88bec7 tsubst_init
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:16774
0x88b195 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:18643
0x88b195 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:18450
0x889054 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:18476
0x889054 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /apps/src/gcc/src/gcc-12.1.0/gcc/cp/pt.cc:18450
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Preprocessed source stored into /tmp/ccvkbzHf.out file, please attach this to
your bugreport.

Reply via email to