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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-09-04
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Maybe the problem isn't that arm_option_reconfigure_globals isn't called, it
is, but nothing has updated arm_active_target.
E.g. put a breakpoint on arm_option_reconfigure_globals and
arm_set_current_function and see what global_options.x_arm_arch_string and
arm_active_target and arm_arch_crc is at the end of each
arm_option_reconfigure_globals.

Breakpoint 8, arm_option_reconfigure_globals () at
../../gcc/config/arm/arm.c:3772
3772      arm_arch6kz = arm_arch6k && bitmap_bit_p (arm_active_target.isa,
1: arm_arch_crc = 0
2: arm_active_target = {core_name = 0x0, arch_name = 0x24fb770 "armv7-a",
arch_pp_name = 0x24fb778 "7A", base_arch = BASE_ARCH_7, 
  profile = 65 'A', isa = 0x2a6aaf0, tune_flags = 1, tune = 0x2213260
<arm_cortex_tune>, tune_core = TARGET_CPU_genericv7a}
3: global_options.x_arm_arch_string = 0x2a6ba40 "armv7-a+fp"
(gdb) c
Continuing.

Breakpoint 5, arm_set_current_function (fndecl=<function_decl 0x7fffea66b600
crc>) at ../../gcc/config/arm/arm.c:32315
32315     if (!fndecl || fndecl == arm_previous_fndecl)
1: arm_arch_crc = 0
2: arm_active_target = {core_name = 0x0, arch_name = 0x24fb770 "armv7-a",
arch_pp_name = 0x24fb778 "7A", base_arch = BASE_ARCH_7, 
  profile = 65 'A', isa = 0x2a6aaf0, tune_flags = 1, tune = 0x2213260
<arm_cortex_tune>, tune_core = TARGET_CPU_genericv7a}
3: global_options.x_arm_arch_string = 0x2a6ba40 "armv7-a+fp"
(gdb) c
Continuing.

Breakpoint 8, arm_option_reconfigure_globals () at
../../gcc/config/arm/arm.c:3772
3772      arm_arch6kz = arm_arch6k && bitmap_bit_p (arm_active_target.isa,
1: arm_arch_crc = 1
2: arm_active_target = {core_name = 0x0, arch_name = 0x24fb7a6 "armv8-a",
arch_pp_name = 0x24fb7ae "8A", base_arch = BASE_ARCH_8A, 
  profile = 65 'A', isa = 0x2a6aaf0, tune_flags = 1, tune = 0x2213260
<arm_cortex_tune>, tune_core = TARGET_CPU_genericv7a}
3: global_options.x_arm_arch_string = 0x2a38d50 "armv8-a+crc+simd"
(gdb) c
Continuing.

Breakpoint 8, arm_option_reconfigure_globals () at
../../gcc/config/arm/arm.c:3772
3772      arm_arch6kz = arm_arch6k && bitmap_bit_p (arm_active_target.isa,
1: arm_arch_crc = 0
2: arm_active_target = {core_name = 0x0, arch_name = 0x24fb770 "armv7-a",
arch_pp_name = 0x24fb778 "7A", base_arch = BASE_ARCH_7, 
  profile = 65 'A', isa = 0x2a6aaf0, tune_flags = 1, tune = 0x2213260
<arm_cortex_tune>, tune_core = TARGET_CPU_genericv7a}
3: global_options.x_arm_arch_string = 0x2a38d50 "armv8-a+crc+simd"
(gdb) c
Continuing.

Breakpoint 8, arm_option_reconfigure_globals () at
../../gcc/config/arm/arm.c:3772
3772      arm_arch6kz = arm_arch6k && bitmap_bit_p (arm_active_target.isa,
1: arm_arch_crc = 0
2: arm_active_target = {core_name = 0x0, arch_name = 0x24fb770 "armv7-a",
arch_pp_name = 0x24fb778 "7A", base_arch = BASE_ARCH_7, 
  profile = 65 'A', isa = 0x2a6aaf0, tune_flags = 1, tune = 0x2213260
<arm_cortex_tune>, tune_core = TARGET_CPU_genericv7a}
3: global_options.x_arm_arch_string = 0x2a38d50 "armv8-a+crc+simd"
(gdb) 
Continuing.

Breakpoint 8, arm_option_reconfigure_globals () at
../../gcc/config/arm/arm.c:3772
3772      arm_arch6kz = arm_arch6k && bitmap_bit_p (arm_active_target.isa,
1: arm_arch_crc = 0
2: arm_active_target = {core_name = 0x0, arch_name = 0x24fb770 "armv7-a",
arch_pp_name = 0x24fb778 "7A", base_arch = BASE_ARCH_7, 
  profile = 65 'A', isa = 0x2a6aaf0, tune_flags = 1, tune = 0x2213260
<arm_cortex_tune>, tune_core = TARGET_CPU_genericv7a}
3: global_options.x_arm_arch_string = 0x2a38d50 "armv8-a+crc+simd"
(gdb) 
Continuing.

Breakpoint 5, arm_set_current_function (fndecl=<tree 0x0>) at
../../gcc/config/arm/arm.c:32315
32315     if (!fndecl || fndecl == arm_previous_fndecl)
1: arm_arch_crc = 0
2: arm_active_target = {core_name = 0x0, arch_name = 0x24fb770 "armv7-a",
arch_pp_name = 0x24fb778 "7A", base_arch = BASE_ARCH_7, 
  profile = 65 'A', isa = 0x2a6aaf0, tune_flags = 1, tune = 0x2213260
<arm_cortex_tune>, tune_core = TARGET_CPU_genericv7a}
3: global_options.x_arm_arch_string = 0x2a38d50 "armv8-a+crc+simd"
(gdb) 
Continuing.

Breakpoint 8, arm_option_reconfigure_globals () at
../../gcc/config/arm/arm.c:3772
3772      arm_arch6kz = arm_arch6k && bitmap_bit_p (arm_active_target.isa,
1: arm_arch_crc = 0
2: arm_active_target = {core_name = 0x0, arch_name = 0x24fb770 "armv7-a",
arch_pp_name = 0x24fb778 "7A", base_arch = BASE_ARCH_7, 
  profile = 65 'A', isa = 0x2a6aaf0, tune_flags = 1, tune = 0x2213260
<arm_cortex_tune>, tune_core = TARGET_CPU_genericv7a}
3: global_options.x_arm_arch_string = 0x2a38d50 "armv8-a+crc+simd"
(gdb) 
Continuing.

Breakpoint 5, arm_set_current_function (fndecl=<function_decl 0x7fffea66b600
crc>) at ../../gcc/config/arm/arm.c:32315
32315     if (!fndecl || fndecl == arm_previous_fndecl)
1: arm_arch_crc = 0
2: arm_active_target = {core_name = 0x0, arch_name = 0x24fb770 "armv7-a",
arch_pp_name = 0x24fb778 "7A", base_arch = BASE_ARCH_7, 
  profile = 65 'A', isa = 0x2a6aaf0, tune_flags = 1, tune = 0x2213260
<arm_cortex_tune>, tune_core = TARGET_CPU_genericv7a}
3: global_options.x_arm_arch_string = 0x2a38d50 "armv8-a+crc+simd"
(gdb) 
Continuing.
a2.c: In function ‘crc’:
a2.c:7:10: error: this builtin is not supported for this target
    7 |   return __crc32cw (x, *(unsigned *) y);
      |          ^

is what I'm seeing, i.e. arm_arch_crc is set to the correct value only once,
during allocate_struct_function:
#0  arm_option_reconfigure_globals () at ../../gcc/config/arm/arm.c:3772
#1  0x0000000001527ebc in arm_configure_build_target (target=0x29fb3c0
<arm_active_target>, opts=0x7fffea663dc0, 
    opts_set=0x2a080c0 <global_options_set>, warn_compatible=false) at
../../gcc/config/arm/arm.c:3428
#2  0x0000000001526fff in arm_option_restore (opts=0x2a06ca0 <global_options>,
ptr=0x7fffea663dc0) at ../../gcc/config/arm/arm.c:3063
#3  0x0000000000f1662b in cl_target_option_restore (opts=0x2a06ca0
<global_options>, ptr=0x7fffea663dc0) at options-save.c:7105
#4  0x000000000157cd98 in arm_set_current_function (fndecl=<function_decl
0x7fffea66b600 crc>) at ../../gcc/config/arm/arm.c:32338
#5  0x0000000000c4acb7 in invoke_set_current_function_hook
(fndecl=<function_decl 0x7fffea66b600 crc>) at ../../gcc/function.c:4670
#6  0x0000000000c4b01f in allocate_struct_function (fndecl=<function_decl
0x7fffea66b600 crc>, abstract_p=false) at ../../gcc/function.c:4793
#7  0x0000000000c4b326 in push_struct_function (fndecl=<function_decl
0x7fffea66b600 crc>) at ../../gcc/function.c:4859
#8  0x0000000000e6adb8 in input_function (fn_decl=<function_decl 0x7fffea66b600
crc>, data_in=0x2a9b780, ib=0x7fffffffd000, 
    ib_cfg=0x7fffffffcfe0, node=<cgraph_node * 0x7fffea66f168 "crc"/95>) at
../../gcc/lto-streamer-in.c:1120
but then reset back to unwanted state in:
#0  arm_option_reconfigure_globals () at ../../gcc/config/arm/arm.c:3772
#1  0x0000000001527ebc in arm_configure_build_target (target=0x29fb3c0
<arm_active_target>, opts=0x7fffea7f8000, 
    opts_set=0x2a080c0 <global_options_set>, warn_compatible=false) at
../../gcc/config/arm/arm.c:3428
#2  0x0000000001526f48 in arm_override_options_after_change () at
../../gcc/config/arm/arm.c:3040
#3  0x0000000000f045e7 in cl_optimization_restore (opts=0x2a06ca0
<global_options>, ptr=0x7fffea7f7800) at options-save.c:1179
#4  0x0000000001ef197c in save_target_globals_default_opts () at
../../gcc/target-globals.c:111
#5  0x000000000157cc78 in save_restore_target_globals
(new_tree=<target_option_node 0x7fffea669d08>) at
../../gcc/config/arm/arm.c:32294
#6  0x000000000157cda4 in arm_set_current_function (fndecl=<function_decl
0x7fffea66b600 crc>) at ../../gcc/config/arm/arm.c:32340
and kept in that state until the error is emitted.  Later set_cfun is called
for main and all 3 are in that case at the end of the
arm_option_reconfigure_globals back correct for the main function.

Reply via email to