public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112427] New: [14 regression] ICE when buliding Minetest (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931)
@ 2023-11-07 19:37 sjames at gcc dot gnu.org
  2023-11-07 19:38 ` [Bug c++/112427] " sjames at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-11-07 19:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112427
           Summary: [14 regression] ICE when buliding Minetest (internal
                    compiler error: tree check: expected tree that
                    contains ‘decl common’ structure, have
                    ‘identifier_node’ in get_inner_reference, at
                    expr.cc:7931)
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

Created attachment 56525
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56525&action=edit
mesh.cpp.ii.xz

Initially reported downstream by Toralf Förster in Gentoo at
https://bugs.gentoo.org/916997.

```
/var/tmp/portage/games-action/minetest-5.7.0-r2/work/minetest-5.7.0/src/client/mesh.cpp:
In lambda function:
/var/tmp/portage/games-action/minetest-5.7.0-r2/work/minetest-5.7.0/src/client/mesh.cpp:275:40:
internal compiler error: tree check: expected tree that contains ‘decl common’
structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931
  275 |                 float u = vertex->Pos.*U;
      |                                        ^
0x5580b4a13090 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/tree.cc:9123
0x5580b393af18 contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/tree.h:3744
0x5580b393af18 get_inner_reference(tree_node*, poly_int<1u, long>*,
poly_int<1u, long>*, tree_node**, machine_mode*, int*, int*, int*)
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/expr.cc:7931
0x5580b52b06c4 fold_unary_loc(unsigned int, tree_code, tree_node*, tree_node*)
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/fold-const.cc:9498
0x5580b51ea660 fold_build1_loc(unsigned int, tree_code, tree_node*, tree_node*)
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/fold-const.cc:14022
0x5580b51ea660 fold_convert_loc(unsigned int, tree_node*, tree_node*)
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/fold-const.cc:2597
0x5580b42fb5f2 build_m_component_ref(tree_node*, tree_node*, int)
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/cp/typeck2.cc:2381
0x5580b3c253f8 build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node*, tree_node**, int)
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/cp/typeck.cc:4716
0x5580b539821c cp_parser_binary_expression
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/cp/parser.cc:10434
0x5580b5396f18 cp_parser_assignment_expression
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/cp/parser.cc:10595
0x5580b53beb63 cp_parser_constant_expression
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/cp/parser.cc:10885
0x5580b53beb63 cp_parser_initializer_clause
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/cp/parser.cc:25746
0x5580b53beb63 cp_parser_initializer
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/cp/parser.cc:25685
0x5580b52f0e70 cp_parser_init_declarator
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/cp/parser.cc:23255
0x5580b52dfe4d cp_parser_simple_declaration
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/cp/parser.cc:15649
0x5580b5453e0f cp_parser_declaration_statement
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/cp/parser.cc:14730
0x5580b538bd4a cp_parser_statement
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/cp/parser.cc:12686
0x5580b5387af5 cp_parser_statement_seq_opt
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/cp/parser.cc:13210
0x5580b5387af5 cp_parser_compound_statement
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/cp/parser.cc:13064
0x5580b539e9bf cp_parser_function_body
       
/usr/src/debug/sys-devel/gcc-14.0.0_pre20231105/gcc-14-20231105/gcc/cp/parser.cc:25589
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
```

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

* [Bug c++/112427] [14 regression] ICE when buliding Minetest (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931)
  2023-11-07 19:37 [Bug c++/112427] New: [14 regression] ICE when buliding Minetest (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931) sjames at gcc dot gnu.org
@ 2023-11-07 19:38 ` sjames at gcc dot gnu.org
  2023-11-07 19:41 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-11-07 19:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Sam James <sjames at gcc dot gnu.org> ---
This reproduces with just 'g++ -c mesh.cpp.ii' for me.

```
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-14.0.0_pre20231105/work/gcc-14-20231105/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/14
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14
--disable-silent-rules --disable-dependency-tracking
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/14/python
--enable-languages=c,c++,fortran,rust --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--disable-libunwind-exceptions --enable-checking=yes,extra,rtl
--with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened
14.0.0_pre20231105 p8' --with-gcc-major-version-only --enable-libstdcxx-time
--enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --enable-multilib
--with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all
--enable-libgomp --disable-libssp --disable-libada --enable-cet
--disable-systemtap --enable-valgrind-annotations --disable-vtable-verify
--disable-libvtv --with-zstd --with-isl --disable-isl-version-check
--enable-default-pie --enable-host-pie --enable-host-bind-now
--enable-default-ssp --with-build-config='bootstrap-O3 bootstrap-lto
bootstrap-cet'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.0 20231105 (experimental) (Gentoo Hardened 14.0.0_pre20231105
p8)
```

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

* [Bug c++/112427] [14 regression] ICE when buliding Minetest (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931)
  2023-11-07 19:37 [Bug c++/112427] New: [14 regression] ICE when buliding Minetest (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931) sjames at gcc dot gnu.org
  2023-11-07 19:38 ` [Bug c++/112427] " sjames at gcc dot gnu.org
@ 2023-11-07 19:41 ` pinskia at gcc dot gnu.org
  2023-11-07 20:02 ` [Bug c++/112427] [14 regression] ICE when building Minetest (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931) since r14-4793-gdad311874ac3b3 ppalka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-07 19:41 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0

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

* [Bug c++/112427] [14 regression] ICE when building Minetest (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931) since r14-4793-gdad311874ac3b3
  2023-11-07 19:37 [Bug c++/112427] New: [14 regression] ICE when buliding Minetest (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931) sjames at gcc dot gnu.org
  2023-11-07 19:38 ` [Bug c++/112427] " sjames at gcc dot gnu.org
  2023-11-07 19:41 ` pinskia at gcc dot gnu.org
@ 2023-11-07 20:02 ` ppalka at gcc dot gnu.org
  2023-11-08  8:04 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-11-07 20:02 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
   Last reconfirmed|                            |2023-11-07
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
            Summary|[14 regression] ICE when    |[14 regression] ICE when
                   |buliding Minetest (internal |building Minetest (internal
                   |compiler error: tree check: |compiler error: tree check:
                   |expected tree that contains |expected tree that contains
                   |‘decl common’ structure,    |‘decl common’ structure,
                   |have ‘identifier_node’ in   |have ‘identifier_node’ in
                   |get_inner_reference, at     |get_inner_reference, at
                   |expr.cc:7931)               |expr.cc:7931) since
                   |                            |r14-4793-gdad311874ac3b3
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
struct A { int m; };
struct B { A a; };

template<int A::*P>
void f(B* b) {
  b->a.*P;
}

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

* [Bug c++/112427] [14 regression] ICE when building Minetest (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931) since r14-4793-gdad311874ac3b3
  2023-11-07 19:37 [Bug c++/112427] New: [14 regression] ICE when buliding Minetest (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931) sjames at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-11-07 20:02 ` [Bug c++/112427] [14 regression] ICE when building Minetest (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931) since r14-4793-gdad311874ac3b3 ppalka at gcc dot gnu.org
@ 2023-11-08  8:04 ` rguenth at gcc dot gnu.org
  2023-11-13 18:14 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-11-08  8:04 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

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

* [Bug c++/112427] [14 regression] ICE when building Minetest (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931) since r14-4793-gdad311874ac3b3
  2023-11-07 19:37 [Bug c++/112427] New: [14 regression] ICE when buliding Minetest (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931) sjames at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-11-08  8:04 ` rguenth at gcc dot gnu.org
@ 2023-11-13 18:14 ` mpolacek at gcc dot gnu.org
  2023-11-15 17:10 ` cvs-commit at gcc dot gnu.org
  2023-11-15 17:11 ` ppalka at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-11-13 18:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 112516 has been marked as a duplicate of this bug. ***

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

* [Bug c++/112427] [14 regression] ICE when building Minetest (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931) since r14-4793-gdad311874ac3b3
  2023-11-07 19:37 [Bug c++/112427] New: [14 regression] ICE when buliding Minetest (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931) sjames at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-11-13 18:14 ` mpolacek at gcc dot gnu.org
@ 2023-11-15 17:10 ` cvs-commit at gcc dot gnu.org
  2023-11-15 17:11 ` ppalka at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-15 17:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:d3f48f682271ed94ab6e9f6bc62418a62bd8ff26

commit r14-5503-gd3f48f682271ed94ab6e9f6bc62418a62bd8ff26
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Nov 15 12:10:16 2023 -0500

    c++: non-dependent .* operand folding [PR112427]

    Here when building up the non-dependent .* expression, we crash from
    fold_convert on 'b.a' due to this (templated) COMPONENT_REF having an
    IDENTIFIER_NODE instead of FIELD_DECL operand that middle-end routines
    expect.  Like in r14-4899-gd80a26cca02587, this patch fixes this by
    replacing the problematic piecemeal folding with a single call to
    cp_fully_fold.  Also, don't bother building the POINTER_PLUS_EXPR in a
    template context.  This means the returned non-dependent tree might not
    have TREE_SIDE_EFFECTS set when it used to, so we need to compensate
    by making build_min_non_dep propagate TREE_SIDE_EFFECTS from the original
    arguments like buildN and build_min do.

            PR c++/112427

    gcc/cp/ChangeLog:

            * tree.cc (build_min_non_dep): Propagate TREE_SIDE_EFFECTS from
            the original arguments.
            (build_min_non_dep_call_vec): Likewise.
            * typeck2.cc (build_m_component_ref): Use cp_convert, build2 and
            cp_fully_fold instead of fold_build_pointer_plus and fold_convert.
            Don't build the POINTER_PLUS_EXPR in a template context.

    gcc/testsuite/ChangeLog:

            * g++.dg/template/non-dependent29.C: New test.

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

* [Bug c++/112427] [14 regression] ICE when building Minetest (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931) since r14-4793-gdad311874ac3b3
  2023-11-07 19:37 [Bug c++/112427] New: [14 regression] ICE when buliding Minetest (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931) sjames at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-11-15 17:10 ` cvs-commit at gcc dot gnu.org
@ 2023-11-15 17:11 ` ppalka at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-11-15 17:11 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2023-11-15 17:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-07 19:37 [Bug c++/112427] New: [14 regression] ICE when buliding Minetest (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931) sjames at gcc dot gnu.org
2023-11-07 19:38 ` [Bug c++/112427] " sjames at gcc dot gnu.org
2023-11-07 19:41 ` pinskia at gcc dot gnu.org
2023-11-07 20:02 ` [Bug c++/112427] [14 regression] ICE when building Minetest (internal compiler error: tree check: expected tree that contains ‘decl common’ structure, have ‘identifier_node’ in get_inner_reference, at expr.cc:7931) since r14-4793-gdad311874ac3b3 ppalka at gcc dot gnu.org
2023-11-08  8:04 ` rguenth at gcc dot gnu.org
2023-11-13 18:14 ` mpolacek at gcc dot gnu.org
2023-11-15 17:10 ` cvs-commit at gcc dot gnu.org
2023-11-15 17:11 ` 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).