You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With GCC trunk (which will become GCC 15), the randomize layout plugin hits a GCC assert in comptypes_check_enum_int() which was introduced by GCC commit d2cfe8a73b3c ("C23: allow aliasing for types derived from structs with variable size"):
#0 fancy_abort (file=file@entry=0x266d678 "/path/to/gcc.git/gcc/c/c-typeck.cc", line=line@entry=1496, function=function@entry=0x256de5a "comptypes_check_enum_int") at /path/to/gcc.git/gcc/diagnostic.cc:1671
#1 0x000000000077ac59 in comptypes_check_enum_int (type1=0x7ffff063f540, type2=0x7ffff0670348, enum_and_int_p=0x7fffffffad0d) at /path/to/gcc.git/gcc/c/c-typeck.cc:1490
#2 comptypes_check_enum_int (type1=type1@entry=0x7ffff063f540, type2=type2@entry=0x7ffff0670348, enum_and_int_p=enum_and_int_p@entry=0x7fffffffad0d) at /path/to/gcc.git/gcc/c/c-typeck.cc:1490
#3 0x00000000009d3975 in diagnose_mismatched_decls (newdecl=newdecl@entry=0x7ffff06a6720, olddecl=olddecl@entry=0x7ffff0665130, newtypep=newtypep@entry=0x7fffffffae48, oldtypep=oldtypep@entry=0x7fffffffae50) at /path/to/gcc.git/gcc/c/c-decl.cc:2169
#4 0x00000000009d5d63 in duplicate_decls (newdecl=newdecl@entry=0x7ffff06a6720, olddecl=0x7ffff0665130) at /path/to/gcc.git/gcc/c/c-decl.cc:3165
#5 0x00000000009d8e0a in pushdecl (x=0x7ffff06a6720) at /path/to/gcc.git/gcc/c/c-decl.cc:3372
#6 0x00000000009ee479 in start_decl (declarator=declarator@entry=0x330d8c0, declspecs=declspecs@entry=0x330d7a0, initialized=<optimised out>, initialized@entry=true, attributes=<optimised out>, do_push=true, lastloc=lastloc@entry=0x0) at /path/to/gcc.git/gcc/c/c-decl.cc:5773
#7 0x0000000000a3ce1a in c_parser_declaration_or_fndef (parser=parser@entry=0x7ffff7fbaea0, fndef_ok=false, fndef_ok@entry=true, static_assert_ok=static_assert_ok@entry=true, empty_ok=empty_ok@entry=true, nested=nested@entry=false, start_attr_ok=start_attr_ok@entry=true, simple_ok=<optimised out>, objc_foreach_object_declaration=<optimised out>, omp_declare_simd_clauses=<optimised out>, have_attrs=<optimised out>, attrs=<optimised out>, oacc_routine_data=<optimised out>, fallthru_attr_p=<optimised out>) at /path/to/gcc.git/gcc/c/c-parser.cc:2784
#8 0x0000000000a7a9c8 in c_parser_external_declaration (parser=0x7ffff7fbaea0) at /path/to/gcc.git/gcc/c/c-parser.cc:2069
#9 0x0000000000a7b951 in c_parser_translation_unit (parser=<optimised out>) at /path/to/gcc.git/gcc/c/c-parser.cc:1923
#10 c_parse_file () at /path/to/gcc.git/gcc/c/c-parser.cc:29055
#11 0x0000000000afc26a in c_common_parse_file () at /path/to/gcc.git/gcc/c-family/c-opts.cc:1389
#12 0x000000000113d69f in compile_file () at /path/to/gcc.git/gcc/toplev.cc:452
#13 0x00000000009c51e0 in do_compile () at /path/to/gcc.git/gcc/toplev.cc:2208
#14 toplev::main (this=this@entry=0x7fffffffb4a6, argc=<optimised out>, argc@entry=160, argv=<optimised out>, argv@entry=0x7fffffffb5e8) at /path/to/gcc.git/gcc/toplev.cc:2368
#15 0x00000000009c6b50 in main (argc=160, argv=0x7fffffffb5e8) at /path/to/gcc.git/gcc/main.cc:39
The comptypes_check_enum_int() function is called with type1 and type2 both having code == RECORD_TYPE. From the function name, it looks like it's only meant to be called for enums and ints?
These are the GCC_PLUGIN config options that are enabled:
$ grep GCC_PLUGIN ~/.cache/builds/linux-cross-arm64/.config
CONFIG_HAVE_GCC_PLUGINS=y
CONFIG_GCC_PLUGINS=y
# CONFIG_GCC_PLUGIN_LATENT_ENTROPY is not set
# CONFIG_GCC_PLUGIN_STACKLEAK is not set
CONFIG_GCC_PLUGIN_RANDSTRUCT=y
And this is the GCC version tested:
$ aarch64-linux-gnu-gcc --version
aarch64-linux-gnu-gcc (GCC) 15.0.0 20241212 (experimental) [master revision gcc-15-6176-gb563a3a00db0]
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Tested with Linux commit 231825b ("Revert "unicode: Don't special case ignorable code points"").
When disabling CONFIG_RANDSTRUCT, the problem goes away.
I also tested a native build in x86_64 and the same issue happens there.
The text was updated successfully, but these errors were encountered:
With GCC trunk (which will become GCC 15), the randomize layout plugin hits a GCC assert in
comptypes_check_enum_int()
which was introduced by GCC commit d2cfe8a73b3c ("C23: allow aliasing for types derived from structs with variable size"):This is the backtrace of
cc1
obtained with GDB:The
comptypes_check_enum_int()
function is called withtype1
andtype2
both havingcode == RECORD_TYPE
. From the function name, it looks like it's only meant to be called for enums and ints?These are the GCC_PLUGIN config options that are enabled:
And this is the GCC version tested:
Tested with Linux commit 231825b ("Revert "unicode: Don't special case ignorable code points"").
When disabling
CONFIG_RANDSTRUCT
, the problem goes away.I also tested a native build in x86_64 and the same issue happens there.
The text was updated successfully, but these errors were encountered: