https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115940
Bug ID: 115940 Summary: ICE: tree check: expected record_type or union_type or qual_union_type, have translation_unit_decl in maybe_dummy_object, at cp/tree.cc:4379 Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: iamanonymous.cs at gmail dot com Target Milestone: --- Target: x86_64 ******************************************************************************* The compiler produces a segfault during tree_check_failed when compiling the provided code with the specified options. The issue can also be reproduced on Compiler Explorer. ******************************************************************************* OS and Platform: # uname -a Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux ******************************************************************************* # g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/root/gdbtest/gcc/gcc-15/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /root/gdbtest/gcc/obj/../gcc/configure --prefix=/root/gdbtest/gcc/gcc-15 --enable-languages=c,c++,fortran,go --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 15.0.0 20240509 (experimental) (GCC) ******************************************************************************* Program:Please refer to the attachment. ******************************************************************************* Command Lines: # g++ BlockRegion.i -O3 -march=native -flto -fsanitize=address,undefined -fno-omit-frame-pointer -Wall -Wextra -Wpedantic -Wshadow -Wconversion -Wdouble-promotion -fstack-protector-all -fno-strict-aliasing -Wstrict-overflow -Wnull-dereference -Wformat=2 -Wformat-signedness -c -o BlockRegion.o <source>:1:3: warning: style of line directive is a GCC extension 1 | # 1 "PFA/BlockRegion.c" | ^ PFA/BlockRegion.c:1:3: warning: style of line directive is a GCC extension <built-in>: warning: style of line directive is a GCC extension <command line>:1:3: warning: style of line directive is a GCC extension PFA/BlockRegion.c:1:3: warning: style of line directive is a GCC extension /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/lao/PFA/BlockRegion.xcc:16:3: warning: style of line directive is a GCC extension In file included from /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/lao/PFA/BlockRegion.xcc:16: PFA/PFA._h:1:3: warning: style of line directive is a GCC extension /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/lao/PFA/PFA.xcc:19:3: warning: style of line directive is a GCC extension In file included from /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/lao/PFA/PFA.xcc:19: PFA/PFA.h:1:3: warning: style of line directive is a GCC extension /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/lao/PFA/PFA.xcc:1:3: warning: style of line directive is a GCC extension /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/lao/PFA/PFA.xcc:22:3: warning: style of line directive is a GCC extension In file included from /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/lao/PFA/PFA.xcc:22: /work1/monat/tmp/include/CCL.h:1:3: warning: style of line directive is a GCC extension /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/CDT/CCL/CCL.xcc:1:3: warning: style of line directive is a GCC extension /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/CDT/CCL/CCL.xcc:20:3: warning: style of line directive is a GCC extension In file included from /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/CDT/CCL/CCL.xcc:20: /work1/monat/tmp/include/BSL.h:1:3: warning: style of line directive is a GCC extension /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/CDT/BSL/BSL.xcc:1:3: warning: style of line directive is a GCC extension /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/CDT/BSL/BSL.xcc:19:3: warning: style of line directive is a GCC extension In file included from /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/CDT/BSL/BSL.xcc:19: /work1/monat/tmp/include/CDT.h:4:3: warning: style of line directive is a GCC extension /work1/monat/tmp/include/CDT.h:5:3: warning: style of line directive is a GCC extension /work1/monat/tmp/include/CDT.h:6:3: warning: style of line directive is a GCC extension /work1/monat/tmp/include/CDT.h:7:3: warning: style of line directive is a GCC extension /work1/monat/tmp/include/CDT.h:8:3: warning: style of line directive is a GCC extension /work1/monat/tmp/include/CDT.h:9:3: warning: style of line directive is a GCC extension /work1/monat/tmp/include/CDT.h:10:3: warning: style of line directive is a GCC extension /work1/monat/tmp/include/CDT.h:12:3: warning: style of line directive is a GCC extension .... .... .... .... .... .... /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/CDT/BSL/Memory.xcc:294:15: error: a non-member function cannot have an explicit object parameter /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/CDT/BSL/Memory.xcc: In explicit object member function 'MemoryItemList_* Memory_blocks(this Memory)': /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/CDT/BSL/Memory.xcc:296:14: error: 'this' is unavailable for explicit object member functions /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/CDT/BSL/Memory.xcc:294:15: note: name the explicit object parameter /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/CDT/BSL/Memory.xcc: At global scope: /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/CDT/BSL/Memory.xcc:314:21: error: 'this' must be the first specifier in a parameter declaration /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/CDT/BSL/Memory.xcc:314:14: warning: explicit object member function only available with '-std=c++23' or '-std=gnu++23' [-Wc++23-extensions] /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/CDT/BSL/Memory.xcc:314:14: error: a non-member function cannot have an explicit object parameter /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/CDT/BSL/Memory.xcc: In explicit object member function 'void* Memory_alloc(this Memory, size_t)': /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/CDT/BSL/Memory.xcc:316:7: error: 'this' is unavailable for explicit object member functions /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/CDT/BSL/Memory.xcc:314:14: note: name the explicit object parameter /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/CDT/BSL/Memory.xcc:318:31: error: invalid conversion from 'void*' to 'MemoryBlock' {aka 'MemoryBlock_*'} [-fpermissive] /home/compwork/monat/Open64-1-7-0-B-Linux/CVSTop-LAO2/LAO_PRO/CDT/BSL/Memory.xcc:320:5: internal compiler error: tree check: expected record_type or union_type or qual_union_type, have translation_unit_decl in maybe_dummy_object, at cp/tree.cc:4379 0x26e6df5 diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, __va_list_tag (*) [1], diagnostic_t) ???:0 0x26f4a05 internal_error(char const*, ...) ???:0 0x97be1c tree_check_failed(tree_node const*, char const*, int, char const*, ...) ???:0 0xcfdeeb finish_id_expression(tree_node*, tree_node*, tree_node*, cp_id_kind*, bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int) ???:0 0xc71e3a c_parse_file() ???:0 0xdc7a79 c_common_parse_file() ???:0 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. Compiler returned: 1 ******************************************************************************* Also ICE on trunk, compiler explorer:https://godbolt.org/z/9KaPjx5EP *******************************************************************************