https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117167
Bug ID: 117167 Summary: ICE: ‘verify_type’ failed with attribute const and -flto during IPA pass 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: --- ******************************************************************************* OS and Platform: $ uname -a: Linux 65dac7c84719 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux ******************************************************************************* gcc version: Using built-in specs. COLLECT_GCC=/home/software/gcc-trunk-3aa004f/bin/gcc COLLECT_LTO_WRAPPER=/home/software/gcc-trunk-3aa004f/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --disable-multilib --disable-bootstrap --enable-languages=c,c++ --prefix=/home/software/gcc-trunk-3aa004f --enable-coverage Thread model: posix Supported LTO compression algorithms: zlib gcc version 15.0.0 20240630 (experimental) (GCC) ******************************************************************************* Program: $ cat mutant.c struct { } typedef *a; a __attribute__((const)) b(const a) {} void main() { a c = b(c); } It was reduced by Creduce. ******************************************************************************* Command Lines: $ gcc -flto mutant.c mutant.c:4:1: error: type variant has different 'TREE_TYPE' 4 | void main() { a c = b(c); } | ^~~~ <function_type 0x7f1529411888 type <pointer_type 0x7f1529439930 a type <record_type 0x7f1529439690 VOID align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f1529411540 pointer_to_this <pointer_type 0x7f1529439738>> unsigned DI size <integer_cst 0x7f1529262f48 constant 64> unit-size <integer_cst 0x7f1529262f60 constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f15294115e8> QI size <integer_cst 0x7f1529284048 type <integer_type 0x7f15292820a8 bitsizetype> constant 8> unit-size <integer_cst 0x7f1529284060 type <integer_type 0x7f1529282000 sizetype> constant 1> align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f1529411930 arg-types <tree_list 0x7f152940fa78 value <pointer_type 0x7f1529439930 a> chain <tree_list 0x7f152927cd98 value <void_type 0x7f1529282f18 void>>> pointer_to_this <pointer_type 0x7f15294393f0>> mutant.c:4:1: error: type variant's 'TREE_TYPE' <pointer_type 0x7f1529439930 a type <record_type 0x7f1529439690 VOID align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f1529411540 pointer_to_this <pointer_type 0x7f1529439738>> unsigned DI size <integer_cst 0x7f1529262f48 type <integer_type 0x7f15292820a8 bitsizetype> constant 64> unit-size <integer_cst 0x7f1529262f60 type <integer_type 0x7f1529282000 sizetype> constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f15294115e8> mutant.c:4:1: error: type's 'TREE_TYPE' <pointer_type 0x7f15294397e0 a type <record_type 0x7f1529439690 VOID align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f1529411540 pointer_to_this <pointer_type 0x7f1529439738>> unsigned DI size <integer_cst 0x7f1529262f48 type <integer_type 0x7f15292820a8 bitsizetype> constant 64> unit-size <integer_cst 0x7f1529262f60 type <integer_type 0x7f1529282000 sizetype> constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f15294115e8> <function_type 0x7f1529439000 type <pointer_type 0x7f15294397e0 a type <record_type 0x7f1529439690 VOID align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f1529411540 pointer_to_this <pointer_type 0x7f1529439738>> unsigned DI size <integer_cst 0x7f1529262f48 constant 64> unit-size <integer_cst 0x7f1529262f60 constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f15294115e8> readonly QI size <integer_cst 0x7f1529284048 type <integer_type 0x7f15292820a8 bitsizetype> constant 8> unit-size <integer_cst 0x7f1529284060 type <integer_type 0x7f1529282000 sizetype> constant 1> align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f15294390a8 arg-types <tree_list 0x7f152940fa78 value <pointer_type 0x7f1529439930 a type <record_type 0x7f1529439690> unsigned DI size <integer_cst 0x7f1529262f48 64> unit-size <integer_cst 0x7f1529262f60 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7f15294115e8> chain <tree_list 0x7f152927cd98 value <void_type 0x7f1529282f18 void>>> pointer_to_this <pointer_type 0x7f1529439150>> during IPA pass: *free_lang_data mutant.c:4:1: internal compiler error: 'verify_type' failed 0x5071bcf diagnostic_context::report_diagnostic(diagnostic_info*) ???:0 0x50724a1 diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, __va_list_tag (*) [1], diagnostic_t) ???:0 0x50924c7 internal_error(char const*, ...) ???:0 0x26ada95 verify_type(tree_node const*) ???: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. It can be compiled normally without const attribute or without -flto. Also ICE on trunk. Compiler Explorer: https://godbolt.org/z/chq8a9Yaj