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

            Bug ID: 115848
           Summary: ICE: 'verify_type' failed with -flto and custom
                    attribute
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          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
typedef void __attribute__((__strub__)) a(int, int);
a(b);
void c() { b(0, 0); }

*******************************************************************************
Command Lines:
$ gcc -flto mutant.c
lto1: error: type variant differs by TYPE_ARG_TYPES
 <function_type 0x7f931a1e4b28
    type <void_type 0x7f931a3a0f18 void VOID
        align:8 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality
        pointer_to_this <pointer_type 0x7f931a3a8000>>
    QI
    size <integer_cst 0x7f931a386eb8 type <integer_type 0x7f931a3a00a8
bitsizetype> constant 8>
    unit-size <integer_cst 0x7f931a386ed0 type <integer_type 0x7f931a3a0000
sizetype> constant 1>
    align:8 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality
    attributes <tree_list 0x7f931a1e72d0
        purpose <identifier_node 0x7f931a1e7078 strub>>
    arg-types <tree_list 0x7f931a1e72a8
        value <integer_type 0x7f931a3a05e8 int public SI
            size <integer_cst 0x7f931a3a4018 constant 32>
            unit-size <integer_cst 0x7f931a3a4030 constant 4>
            align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7f931a3a05e8 precision:32 min <integer_cst 0x7f931a386fc0 -2147483648> max
<integer_cst 0x7f931a386fd8 2147483647>
            pointer_to_this <pointer_type 0x7f931a3a8b28>>
        chain <tree_list 0x7f931a1e7280 value <integer_type 0x7f931a3a05e8 int>
            chain <tree_list 0x7f931a39fde8 value <void_type 0x7f931a3a0f18
void>>>>>
 <function_type 0x7f931a1e4bd0 a
    type <void_type 0x7f931a3a0f18 void VOID
        align:8 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality
        pointer_to_this <pointer_type 0x7f931a3a8000>>
    QI
    size <integer_cst 0x7f931a386eb8 type <integer_type 0x7f931a3a00a8
bitsizetype> constant 8>
    unit-size <integer_cst 0x7f931a386ed0 type <integer_type 0x7f931a3a0000
sizetype> constant 1>
    align:8 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality
    attributes <tree_list 0x7f931a1e72d0
        purpose <identifier_node 0x7f931a1e7078 strub>>
    arg-types <tree_list 0x7f931a1e7258
        value <integer_type 0x7f931a3a05e8 int public SI
            size <integer_cst 0x7f931a3a4018 constant 32>
            unit-size <integer_cst 0x7f931a3a4030 constant 4>
            align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7f931a3a05e8 precision:32 min <integer_cst 0x7f931a386fc0 -2147483648> max
<integer_cst 0x7f931a386fd8 2147483647>
            pointer_to_this <pointer_type 0x7f931a3a8b28>>
        chain <tree_list 0x7f931a1e7230 value <integer_type 0x7f931a3a05e8 int>
            chain <tree_list 0x7f931a1e7168 value <reference_type
0x7f931a1e49d8>
                chain <tree_list 0x7f931a39fde8 value <void_type 0x7f931a3a0f18
void>>>>>
    pointer_to_this <pointer_type 0x7f931a1e4dc8>>
lto1: internal compiler error: 'verify_type' failed
0x4ddb72b diagnostic_context::report_diagnostic(diagnostic_info*)
        ???:0
0x4ddbffd diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, int, char const*, __va_list_tag (*) [1],
diagnostic_t)
        ???:0
0x4dfc327 internal_error(char const*, ...)
        ???:0
0x23e928b verify_type(tree_node const*)
        ???:0
0xdef502 read_cgraph_and_symbols(unsigned int, char const**)
        ???:0
0xd8f963 lto_main()
        ???: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.
lto-wrapper: fatal error: /home/software/gcc-trunk-3aa004f/bin/gcc returned 1
exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

It can be compiled normally without -flto.
Also ICE on trunk.
Compiler Explorer: https://godbolt.org/z/nKac3vG47

Reply via email to