https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121923
Bug ID: 121923 Summary: ICF doesn't pass function decl to sanitize_flags_p Product: gcc Version: 16.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: hjl.tools at gmail dot com Target Milestone: --- ipa_icf::sem_variable::merge has if (DECL_ALIGN (original->decl) != DECL_ALIGN (alias->decl) && (sanitize_flags_p (SANITIZE_ADDRESS, original->decl) || sanitize_flags_p (SANITIZE_ADDRESS, alias->decl))) { if (dump_enabled_p ()) dump_printf (MSG_MISSED_OPTIMIZATION, "Not unifying; " "ASAN requires equal alignments for original and alias\n"); return false; } when compiling c-c++-common/asan/pr99168.c. But original->decl isn't a function decl: 2045 && (sanitize_flags_p (SANITIZE_ADDRESS, original->decl) (gdb) call debug (original->decl) <var_decl 0x7fffe9610ed8 variables1 type <record_type 0x7fffe99ff150 my_struct asm_written tree_2 tree_4 BLK size <integer_cst 0x7fffe99f8348 constant 1024> unit-size <integer_cst 0x7fffe9611db0 constant 128> user align:1024 warn_if_not_align:0 symtab:-379480512 alias-set 3 canonical-type 0x7fffe99ff150 attributes <tree_list 0x7fffe9601b40 purpose <identifier_node 0x7fffe96195f0 aligned> value <tree_list 0x7fffe9601ac8 value <integer_cst 0x7fffe9611d80 constant 128>>> fields <field_decl 0x7fffe982c8c0 x type <integer_type 0x7fffe99ff2a0 long unsigned int> side-effects volatile unsigned DI pr99168.c:6:26 size <integer_cst 0x7fffe9802f60 constant 64> unit-size <integer_cst 0x7fffe9802f78 constant 8> align:64 warn_if_not_align:0 offset_align 1024 decl_not_flexarray: 1 offset <integer_cst 0x7fffe9802f90 constant 0> bit-offset <integer_cst 0x7fffe9802fd8 constant 0> context <record_type 0x7fffe99ff150 my_struct>> chain <type_decl 0x7fffe982c820 D.3395>> readonly used static read BLK pr99168.c:10:25 size <integer_cst 0x7fffe99f8348 1024> unit-size <integer_cst 0x7fffe9611db0 128> align:1024 warn_if_not_align:0 context <translation_unit_decl 0x7fffe963b200 pr99168.c> initial <constructor 0x7fffe9611f00> chain <var_decl 0x7fffe963c000 variables2>> (gdb)