Hi,

While making experiments with -mpure-code, I ran the testsuite with
that flag, and noticed that several tests failed because they were
forcing an architecture version incompatible with this option.

I've just realized that I've come up with 2 different types of fixes:
(1) add a dg-skip-if (like eg. in gcc.target/arm/pr40657-1.c):
/* { dg-skip-if "-mpure-code supports M-profile only" { *-*-* } {
"-mpure-code" } } */
or in gcc.target/arm/pr52006.c:
/* { dg-skip-if "-mpure-code and -fPIC incompatible" { *-*-* } {
"-mpure-code" } } */

(2) in other cases I added:
/* { dg-require-effective-target arm_arch_v8a_ok } */
in gcc.target/arm/attr-crypto.c and ftest-armv7a-arm.c (and similar)

I have a patch that mixes both ways, but I'm wondering whether there's
a preferred approach?

(1) means we should in theory do this for every option that is not
supported by all cpu/arch/... version, and that we'd potentially want
to run the tests with

(2) means that the tests are skipped if one uses a runtestflag like
-mcpu=cortex-XX that is incompatible with arm_arch_YY_ok, even if one
doesn't for -mpure-code, but where the -march option safely overrides
the -mcpu.

For instance, if one forces -mcpu=cortex-m4, attr-crypto.c is compiled with
-mcpu=cortex-m4 -march=armv8-a which generates a warning, but compiles OK.
With my patch, it would be UNSUPPORTED because the effective-target
would fail on the warning.

If one foces -mcpu=cortex-m4 -mpure-code, that attr-crypto.c is
compiled with -mcpu=cortex-m4 -mpure-code -march=armv8-a, resulting in
a failure without my patch because -mpure-code conflicts with
-march=armv8-a. With my patch, the test is UNSUPPORTED.

Thoughts?

Christophe

Reply via email to