aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2016-11-23 12:18:23 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2016-11-23 12:18:23 +0000
commit3615816da830d41f67a5d8955ae588eba7f0b6fb (patch)
tree12a174bfebb96c4c8be937abf2ea4244fc565eda
parent0eb078fe20d443e2981a7b69067547e7ab80565c (diff)
downloadgcc-3615816da830d41f67a5d8955ae588eba7f0b6fb.zip
gcc-3615816da830d41f67a5d8955ae588eba7f0b6fb.tar.gz
gcc-3615816da830d41f67a5d8955ae588eba7f0b6fb.tar.bz2
re PR target/78213 (-fself-test fails on aarch64)
PR target/78213 * opts.c (finish_options): Set -fsyntax-only if running self tests. From-SVN: r242748
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/opts.c8
-rw-r--r--gcc/testsuite/gcc.dg/pr78213.c11
3 files changed, 25 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 192d6e4..ec1fe96 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2016-11-23 Aldy Hernandez <aldyh@redhat.com>
+
+ PR target/78213
+ * opts.c (finish_options): Set -fsyntax-only if running self
+ tests.
+
2016-11-23 Richard Biener <rguenther@suse.de>
PR middle-end/71762
diff --git a/gcc/opts.c b/gcc/opts.c
index d2d6100..cb20154 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -744,6 +744,14 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
opts->x_flag_toplevel_reorder = 0;
}
+ /* -fself-test depends on the state of the compiler prior to
+ compiling anything. Ideally it should be run on an empty source
+ file. However, in case we get run with actual source, assume
+ -fsyntax-only which will inhibit any compiler initialization
+ which may confuse the self tests. */
+ if (opts->x_flag_self_test)
+ opts->x_flag_syntax_only = 1;
+
if (opts->x_flag_tm && opts->x_flag_non_call_exceptions)
sorry ("transactional memory is not supported with non-call exceptions");
diff --git a/gcc/testsuite/gcc.dg/pr78213.c b/gcc/testsuite/gcc.dg/pr78213.c
new file mode 100644
index 0000000..e43c83c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr78213.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-fself-test" } */
+
+/* Verify that -fself-test does not fail on a non empty source. */
+
+int i; void bar(); void foo()
+{
+ while (i--)
+ bar();
+}
+/* { dg-message "fself\-test: " "-fself-test" { target *-*-* } 0 } */