testsuite:
        * lib/target-supports.exp (effective_target_march_option): New.

I see no (other) way to, depending on the absence of an option,
add an option for a specific target.  Specifically, I don't see
how to do this with dg-skip-if and its friends.

For gcc.dg/torture/pr26515.c and cris-elf, you get an error for
supplying multiple (different) -march=... options (and that
error is desirable), like testing cris-elf with
RUNTESTFLAGS=--target_board=cris-sim/arch=v8, where otherwise
-march=v10 and -march=v8 will both be given, and the test would
fail.

See example last.

Ok to commit the below?

---
 gcc/testsuite/lib/target-supports.exp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index 629b454..565cb62 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2463,6 +2463,10 @@ proc check_effective_target_ti_c64xp { } {
     }]
 }
 
+# Check if a -march=... option is given, as part of (earlier) options.
+proc check_effective_target_march_option { } {
+    return [check-flags [list "" { *-*-* } { "-march=*" } { "" } ]]
+}
 
 proc check_alpha_max_hw_available { } {
     return [check_runtime alpha_max_hw_available {
-- 
2.11.0

Example usage (one of several similar, which will be committed
together with the above, if approved):

diff --git a/gcc/testsuite/gcc.dg/torture/pr26515.c 
b/gcc/testsuite/gcc.dg/torture/pr26515.c
index a051e2e..ff765ba 100644
--- a/gcc/testsuite/gcc.dg/torture/pr26515.c
+++ b/gcc/testsuite/gcc.dg/torture/pr26515.c
@@ -1,4 +1,4 @@
-/* { dg-options "-march=v10" { target cris*-*-* } } */
+/* { dg-options "-march=v10" { target { cris*-*-* && { ! march_option } } } } 
*/
 struct i
 {
   long long i_size;

brgds, H-P

Reply via email to