https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128352
Bug ID: 128352
Summary: internal compiler error: in fold_convert_loc, at
fold-const.cc:2620
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: haoxintu at gmail dot com
Target Milestone: ---
Hi,
$cat case.c
typedef int A;
typedef int __attribute__ (( hardbool(0,.1) )) B;
_Static_assert(_Generic((A*){ 0 }, B*: 1), "");
void* foo(void* a, void *b, A *c, B *d)
{
*(A**)a = c;
*(B**)b = d;
return *(A**)a;
}
int main()
{
A *a, b, c;
if (&c != (A*)foo(&a, &a, &b, &c))
__builtin_abort();
}
$gcc-trunk -c case.c
case.c:5:1: internal compiler error: in fold_convert_loc, at fold-const.cc:2620
5 | typedef int __attribute__ (( hardbool(0,.1) )) B;
| ^~~~~~~
0x25e0b3f internal_error(char const*, ...)
../../gcc/diagnostic-global-context.cc:787
0x8559e1 fancy_abort(char const*, int, char const*)
../../gcc/diagnostics/context.cc:1813
0x7f1899 fold_convert_loc(unsigned long, tree_node*, tree_node*)
../../gcc/fold-const.cc:2620
0x99fe88 handle_hardbool_attribute
../../gcc/c-family/c-attribs.cc:974
0x870dd3 decl_attributes(tree_node**, tree_node*, int, tree_node*)
../../gcc/attribs.cc:905
0x87bb7c c_decl_attributes
../../gcc/c/c-decl.cc:5747
0x88dfed start_decl(c_declarator*, c_declspecs*, bool, tree_node*, bool,
unsigned long*)
../../gcc/c/c-decl.cc:5902
0x901247 c_parser_declaration_or_fndef
../../gcc/c/c-parser.cc:3083
0x911614 c_parser_external_declaration
../../gcc/c/c-parser.cc:2276
0x912580 c_parser_translation_unit
../../gcc/c/c-parser.cc:2115
0x912580 c_parse_file()
../../gcc/c/c-parser.cc:31603
0x983d51 c_common_parse_file()
../../gcc/c-family/c-opts.cc:1442
/research/gcc/build/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1 -quiet
-imultiarch x86_64-linux-gnu case.c -quiet -dumpbase case.c -dumpbase-ext .c
-mtune=generic -march=x86-64 -o /tmp/ccyQYadU.s
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.
Reproduced in Goldbolt: https://godbolt.org/z/achs6sb8E
Seems to be a regression since GCC-14.1.
Thanks.