From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C4E5B3858D33; Tue, 28 Feb 2023 20:57:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C4E5B3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677617835; bh=58DcK/9DFdIv0rbBwXvubH6EZ6r5HBMFWOoFILoYbcI=; h=From:To:Subject:Date:From; b=QOXOp+lKLwlqJx8GcIhvqFnDZGhFFg6hTzbjA4d01QZlzpXXCEJG5da04S0p820dy BGo7hFj6BwarJ4iE2een+ASIpaD7GopoNzo+ADb0VvwF+8RRygLGSZYaC0Q+gEBwcc NmQdFCPtvfKK5QSj+ciEcIvYvL+RcBx0arqUN63U= From: "samuelpmish at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108975] New: Internal compiler error on constexpr variable used as nontype template Date: Tue, 28 Feb 2023 20:57:15 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: samuelpmish at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108975 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,=20 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 =3D decltype(domain_integral::get_derivative_type(qf, state_type{})); [build] |=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 ^~~ [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_no= de*, 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_no= de*, bool, bool) [build] ../../src/gcc/cp/pt.cc:21265 [build] 0x80fe8d tsubst_copy_and_build(tree_node*, tree_node*, int, tree_no= de*, 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_nod= e*) [build] ../../src/gcc/cp/pt.cc:13517 [build] 0x8108fe tsubst_copy_and_build(tree_node*, tree_node*, int, tree_no= de*, bool, bool) [build] ../../src/gcc/cp/pt.cc:20055 [build] 0x80f865 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_no= de*, 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:=20 internal compiler error: in lookup_template_class_1, at cp/pt.c:10093 [build] 120 | using derivative_type =3D decltype(domain_integral::get_derivative_type(qf, state_type{})); [build] |=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 ^~~ [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 issue= s. ------------------------------------- The line of code it referred to before the backtrace is something like: constexpr int dim =3D dimension_of(geom); [&](auto index) { ... using derivative_type =3D decltype(domain_integral::get_derivative_type(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 th= at reproduces this issue, but wasn't able to find one. The full compilation line is (after removing some long include directory fl= ags) /usr/bin/g++-12 -DAXOM_DEBUG -DGTEST_HAS_DEATH_TEST=3D0 -Wall -Wextra -pth= read -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=3Dc++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=3D= 0=20 I'm new to submitting bugs to gcc/g++, so if there's any more information I= can provide please let me know. Sam=