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

Torbjorn SVENSSON <azoff at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |azoff at gcc dot gnu.org

--- Comment #24 from Torbjorn SVENSSON <azoff at gcc dot gnu.org> ---
The test case gcc.target/arm/pr98636.c fails for Cortex-M55 as the error is
emitted during the process_options step in toplev.c rather than do_compile
step.

In arm_option_reconfigure_globals, the following line can be found:
arm_fp16_inst = bitmap_bit_p (arm_active_target.isa, isa_bit_fp16);

For Cortex-A7 (just an example where the test case passes), the above statement
results in arm_fp16_inst=0 when the call tree contains process_options. When
the call tree contains do_compile, it's instead arm_fp16_inst=1 and the
expected error is emitted.

For Cortex-M55, the above statement results in arm_fp16_inst=1 when the call
tree contains process_options. As a result, the expected error is emitted, but
at this point, input_location is 0, so there is no context and the test case
fail.


I've debugged the above using the following command:
cc1 -quiet -D__USES_INITFINI__ gcc/testsuite/gcc.target/arm/pr98636.c -quiet
-mthumb -mcpu=cortex-m55 -mfloat-abi=hard -mfpu=auto -mfp16-format=alternative
-o /dev/null

Output with -mcpu=cortex-a7:
gcc/testsuite/gcc.target/arm/pr98636.c:6:10: error: selected fp16 options are
incompatible
    6 | # pragma GCC target ("arch=armv8.2-a+fp16") /* { dg-error "selected
fp16 options are incompatible" } */
      |          ^~~

Output with -mcpu=cortex-m55:
cc1: error: selected fp16 options are incompatible


Should the test case be updated to be this instead as it would allow both cases
to pass?
# pragma GCC target ("arch=armv8.2-a+fp16") /* { dg-error "selected fp16
options are incompatible" "" { target *-*-* } 0 } */

Reply via email to