]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR52665 do not let .ident confuse assembler scan tests
authorBernhard Reutner-Fischer <aldot@gcc.gnu.org>
Wed, 5 Sep 2018 15:31:13 +0000 (17:31 +0200)
committerBernhard Reutner-Fischer <aldot@gcc.gnu.org>
Wed, 5 Sep 2018 15:31:13 +0000 (17:31 +0200)
A branch with a name matching scan-assembler pattern triggers
inappropriate FAIL.

E.g. branch fixups-testsuite and
- gcc.target/i386/pr65871-?.c (scan-assembler-not "test")
- gcc.target/i386/pr41442.c (scan-assembler-times "test|cmp" 2)
etc.

This is a recurring problem as can be seen by some -fno-ident additions
by commits from e.g. Michael Meissner over the years: builtins-58.c,
powerpc/pr46728-?.c

The patch below adds -fno-ident if a testcase contains one of
scan-assembler, scan-assembler-not or scan-assembler-times.

Regression tested on x86_64-unknown-linux on a fixups-testsuite branch
where it fixes several false FAILs without regressions.

gcc/testsuite/ChangeLog

2016-06-18  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>

        PR testsuite/52665
        * lib/gcc-dg.exp (gcc-dg-test-1): Iterate over _required_options.
        * lib/target-supports.exp (scan-assembler_required_options,
        scan-assembler-not_required_options,
        scan-assembler-times_required_options): Add -fno-ident.
        * lib/scanasm.exp (scan-assembler-times): Fix error message.
        * c-c++-common/ident-0a.c: New test.
        * c-c++-common/ident-0b.c: New test.
        * c-c++-common/ident-1a.c: New test.
        * c-c++-common/ident-1b.c: New test.
        * c-c++-common/ident-2a.c: New test.
        * c-c++-common/ident-2b.c: New test.

From-SVN: r264128

gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/ident-0a.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/ident-0b.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/ident-1a.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/ident-1b.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/ident-2a.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/ident-2b.c [new file with mode: 0644]
gcc/testsuite/lib/gcc-dg.exp
gcc/testsuite/lib/target-supports.exp

index 74467f9ee18c8647b224bd98dee339e0bbd0b855..6936dd543f37de26b699552fa084686190499b37 100644 (file)
@@ -1,3 +1,18 @@
+2018-09-05  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
+
+       PR testsuite/52665
+       * lib/gcc-dg.exp (gcc-dg-test-1): Iterate over _required_options.
+       * lib/target-supports.exp (scan-assembler_required_options,
+       scan-assembler-not_required_options,
+       scan-assembler-times_required_options): Add -fno-ident.
+       * lib/scanasm.exp (scan-assembler-times): Fix error message.
+       * c-c++-common/ident-0a.c: New test.
+       * c-c++-common/ident-0b.c: New test.
+       * c-c++-common/ident-1a.c: New test.
+       * c-c++-common/ident-1b.c: New test.
+       * c-c++-common/ident-2a.c: New test.
+       * c-c++-common/ident-2b.c: New test.
+
 2018-09-05  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * gcc.dg/recip_sqrt_mult_1.c: New test.
diff --git a/gcc/testsuite/c-c++-common/ident-0a.c b/gcc/testsuite/c-c++-common/ident-0a.c
new file mode 100644 (file)
index 0000000..900d206
--- /dev/null
@@ -0,0 +1,6 @@
+/* PR testsuite/52665
+ * Make sure scan-assembler-not turns off .ident  */
+/* { dg-do compile } */
+int i;
+
+/* { dg-final { scan-assembler-not "GCC: " } } */
diff --git a/gcc/testsuite/c-c++-common/ident-0b.c b/gcc/testsuite/c-c++-common/ident-0b.c
new file mode 100644 (file)
index 0000000..e08126d
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR testsuite/52665
+ * Make sure scan-assembler-not turns off .ident unless -fident in testcase */
+/* { dg-do compile } */
+/* { dg-options "-fident" } */
+int i;
+
+/* { dg-final { scan-assembler-not "GCC: " { xfail *-*-* } } } */
+/* The testsuite saw scan-assembler-not and turned off .ident so the above
+ * has to fail for proper operation since the testsuite itself forced
+ * -fident on again.  */
diff --git a/gcc/testsuite/c-c++-common/ident-1a.c b/gcc/testsuite/c-c++-common/ident-1a.c
new file mode 100644 (file)
index 0000000..867ee43
--- /dev/null
@@ -0,0 +1,8 @@
+/* PR testsuite/52665
+ * Make sure scan-assembler turns off .ident  */
+/* { dg-do compile } */
+int i;
+
+/* { dg-final { scan-assembler "GCC: " { xfail *-*-* } } } */
+/* The testsuite saw scan-assembler and turned off .ident so the above
+ * has to fail for proper operation.  */
diff --git a/gcc/testsuite/c-c++-common/ident-1b.c b/gcc/testsuite/c-c++-common/ident-1b.c
new file mode 100644 (file)
index 0000000..2431086
--- /dev/null
@@ -0,0 +1,7 @@
+/* PR testsuite/52665
+ * Make sure scan-assembler turns off .ident unless -fident in testcase */
+/* { dg-do compile } */
+/* { dg-options "-fident" } */
+int i;
+
+/* { dg-final { scan-assembler "GCC: " } } */
diff --git a/gcc/testsuite/c-c++-common/ident-2a.c b/gcc/testsuite/c-c++-common/ident-2a.c
new file mode 100644 (file)
index 0000000..131b867
--- /dev/null
@@ -0,0 +1,6 @@
+/* PR testsuite/52665
+ * Make sure scan-assembler-times turns off .ident  */
+/* { dg-do compile } */
+int i;
+
+/* { dg-final { scan-assembler-times "GCC: " 0 } } */ /* internal test, keep -times 0 ! */
diff --git a/gcc/testsuite/c-c++-common/ident-2b.c b/gcc/testsuite/c-c++-common/ident-2b.c
new file mode 100644 (file)
index 0000000..a21e25f
--- /dev/null
@@ -0,0 +1,7 @@
+/* PR testsuite/52665
+ * Make sure scan-assembler-times turns off .ident unless -fident in testcase */
+/* { dg-do compile } */
+/* { dg-options "-fident" } */
+int ident;
+
+/* { dg-final { scan-assembler-times "GCC: " 1 } } */
index f5e6bef5dd97ad2e0ea7683577eb8894564593ba..24d0b00d25d21c070d6c8aee0fecac5edafcb720 100644 (file)
@@ -299,9 +299,11 @@ proc gcc-dg-test-1 { target_compile prog do_what extra_tool_flags } {
     foreach x [split $finalcode "\n"] {
        set finalcmd [lindex $x 0]
        if { [info procs ${finalcmd}_required_options] != "" } {
-           set req [${finalcmd}_required_options]
-           if { $req != "" && [lsearch -exact $extra_tool_flags $req] == -1 } {
-               lappend extra_tool_flags $req
+           foreach req [${finalcmd}_required_options] {
+               if { $req != ""
+                    && [lsearch -exact $extra_tool_flags $req] == -1 } {
+                   lappend extra_tool_flags $req
+               }
            }
        }
     }
index b51e8f0a5e9e24c79aeddda96da7952086a3511e..94f61c58df9ba09fdbef26201a92754b4702786c 100644 (file)
@@ -8895,6 +8895,12 @@ proc force_conventional_output_for { test } {
     }
     proc ${test}_required_options {} {
        global gcc_force_conventional_output
+       upvar 1 extra_tool_flags extra_tool_flags
+       if {[regexp -- "^scan-assembler" [info level 0]]
+           && ![string match "*-fident*" $extra_tool_flags]} {
+           # Do not let .ident confuse assembler scan tests
+           return [list $gcc_force_conventional_output "-fno-ident"]
+       }
        return $gcc_force_conventional_output
     }
 }