public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108975] New: Internal compiler error on constexpr variable used as nontype template
@ 2023-02-28 20:57 samuelpmish at gmail dot com
  2023-02-28 20:58 ` [Bug c++/108975] " pinskia at gcc dot gnu.org
                   ` (25 more replies)
  0 siblings, 26 replies; 27+ messages in thread
From: samuelpmish at gmail dot com @ 2023-02-28 20:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108975
           Summary: Internal compiler error on constexpr variable used as
                    nontype template
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: samuelpmish at gmail dot com
  Target Milestone: ---

Hi, 

I'm running into an internal compiler error with g++ (12.1.0):


internal compiler error: in lookup_template_class_1, at cp/pt.cc:10114
[build]   120 |     using derivative_type   =
decltype(domain_integral::get_derivative_type<index, dim, trials...>(qf,
state_type{}));
[build]       |                                                                
                   ^~~
[build] 0x662042 lookup_template_class_1
[build]         ../../src/gcc/cp/pt.cc:10114
[build] 0x81c004 lookup_template_class(tree_node*, tree_node*, tree_node*,
tree_node*, int, int)
[build]         ../../src/gcc/cp/pt.cc:10353
[build] 0x81c004 tsubst_aggr_type
[build]         ../../src/gcc/cp/pt.cc:13747
[build] 0x80e549 tsubst_aggr_type
[build]         ../../src/gcc/cp/pt.cc:17421
[build] 0x80e549 tsubst_copy
[build]         ../../src/gcc/cp/pt.cc:16928
[build] 0x80fc58 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*,
bool, bool)
[build]         ../../src/gcc/cp/pt.cc:21050
[build] 0x8200e8 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
[build]         ../../src/gcc/cp/pt.cc:19491
[build] 0x81cfb2 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
[build]         ../../src/gcc/cp/pt.cc:18462
[build] 0x81cfb2 tsubst_decl
[build]         ../../src/gcc/cp/pt.cc:15004
[build] 0x80e92b tsubst_copy
[build]         ../../src/gcc/cp/pt.cc:17000
[build] 0x80f4e1 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*,
bool, bool)
[build]         ../../src/gcc/cp/pt.cc:21265
[build] 0x80fe8d tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*,
bool, bool)
[build]         ../../src/gcc/cp/pt.cc:20117
[build] 0x8200e8 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
[build]         ../../src/gcc/cp/pt.cc:19491
[build] 0x825bad tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
[build]         ../../src/gcc/cp/pt.cc:13517
[build] 0x8108fe tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*,
bool, bool)
[build]         ../../src/gcc/cp/pt.cc:20055
[build] 0x80f865 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*,
bool, bool)
[build]         ../../src/gcc/cp/pt.cc:20676
[build] 0x818c01 tsubst(tree_node*, tree_node*, int, tree_node*)
[build]         ../../src/gcc/cp/pt.cc:16315
[build] 0x81c344 tsubst_decl
[build]         ../../src/gcc/cp/pt.cc:14952
[build] 0x8226bb tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
[build]         ../../src/gcc/cp/pt.cc:18590
[build] 0x821632 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
[build]         ../../src/gcc/cp/pt.cc:18462

g++ (11.3.0) also fails in a similar way: 

internal compiler error: in lookup_template_class_1, at cp/pt.c:10093
[build]   120 |     using derivative_type   =
decltype(domain_integral::get_derivative_type<index, dim, trials...>(qf,
state_type{}));
[build]       |                                                                
                 ^~~
[build] 0x7fc84da29d8f __libc_start_call_main
[build]         ../sysdeps/nptl/libc_start_call_main.h:58
[build] 0x7fc84da29e3f __libc_start_main_impl
[build]         ../csu/libc-start.c:392

but g++ (10.4.0) and clang (14.0.0) compile the same code without any issues.

-------------------------------------

The line of code it referred to before the backtrace is something like:

  constexpr int dim = dimension_of(geom);
  [&](auto index) {
    ...
    using derivative_type =
decltype(domain_integral::get_derivative_type<index, dim, trials...>(qf,
state_type{}));
    ...
  }

If I make `dim` static in addition to constexpr, then the internal compiler
error disappears. I've tried for a bit to come up with a smaller example that
reproduces this issue, but wasn't able to find one.

The full compilation line is (after removing some long include directory flags)

/usr/bin/g++-12 -DAXOM_DEBUG -DGTEST_HAS_DEATH_TEST=0 -Wall -Wextra  -pthread
-freport-bug     -Werror  -Wshadow -Wdouble-promotion -Wconversion -Wundef
-Wnull-dereference -Wold-style-cast -g -fPIE -fopenmp -Wno-class-memaccess
-DCONDUIT_RELAY_IO_MPI_ENABLED -DCONDUIT_BLUEPRINT_MPI_ENABLED -std=c++17 -o
file.o -c file.cpp

Following the guidance in README.Bugs, I also compiled with -save-temps to
produce a .ii file, but it is too large to attach here, so I'll include a
dropbox link to it: https://www.dropbox.com/s/slrf8r500vargd5/file.ii?dl=0 

I'm new to submitting bugs to gcc/g++, so if there's any more information I can
provide please let me know.

Sam

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2023-12-20  1:59 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-28 20:57 [Bug c++/108975] New: Internal compiler error on constexpr variable used as nontype template samuelpmish at gmail dot com
2023-02-28 20:58 ` [Bug c++/108975] " pinskia at gcc dot gnu.org
2023-02-28 21:10 ` samuelpmish at gmail dot com
2023-02-28 21:11 ` pinskia at gcc dot gnu.org
2023-02-28 21:11 ` pinskia at gcc dot gnu.org
2023-02-28 21:35 ` pinskia at gcc dot gnu.org
2023-03-01 10:54 ` pinskia at gcc dot gnu.org
2023-03-01 10:59 ` [Bug c++/108975] [10/11/12/13 Regression] " pinskia at gcc dot gnu.org
2023-03-01 11:07 ` pinskia at gcc dot gnu.org
2023-03-01 11:10 ` pinskia at gcc dot gnu.org
2023-03-01 15:26 ` samuelpmish at gmail dot com
2023-03-01 15:51 ` ppalka at gcc dot gnu.org
2023-03-02 21:35 ` [Bug c++/108975] [10/11/12/13 Regression] ICE on constexpr variable used as nontype template since r9-5473-ge32fc4499f863f ppalka at gcc dot gnu.org
2023-03-03 20:32 ` mpolacek at gcc dot gnu.org
2023-03-17 21:24 ` jason at gcc dot gnu.org
2023-03-17 23:33 ` cvs-commit at gcc dot gnu.org
2023-04-18 20:46 ` [Bug c++/108975] [10/11/12 " cvs-commit at gcc dot gnu.org
2023-04-21 20:28 ` [Bug c++/108975] [10/11 " cvs-commit at gcc dot gnu.org
2023-04-22  0:23 ` cvs-commit at gcc dot gnu.org
2023-04-25 19:59 ` cvs-commit at gcc dot gnu.org
2023-07-07 10:45 ` [Bug c++/108975] [11 " rguenth at gcc dot gnu.org
2023-12-19 20:00 ` jason at gcc dot gnu.org
2023-12-19 20:16 ` ppalka at gcc dot gnu.org
2023-12-20  1:53 ` cvs-commit at gcc dot gnu.org
2023-12-20  1:55 ` cvs-commit at gcc dot gnu.org
2023-12-20  1:56 ` cvs-commit at gcc dot gnu.org
2023-12-20  1:59 ` ppalka at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).