diff mbox

Don't run -fself-test with -E (PR rtl-optimization/71591)

Message ID 20160620183802.GI7387@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek June 20, 2016, 6:38 p.m. UTC
Hi!

As mentioned in the PR, with -E (C family and Fortran FEs, others don't
preprocess) ask the middle-end not to initialize the backends, so running
e.g. RTL tests leads to ICEs, e.g. pc_rtx and many other things just aren't
initialized.

2016-06-20  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/71591
	* toplev.c (toplev::run_self_tests): If no_backend, complain and
	don't run any tests.

	* gcc.dg/cpp/pr71591.c: New test.


	Jakub

Comments

Jeff Law June 20, 2016, 9:36 p.m. UTC | #1
On 06/20/2016 12:38 PM, Jakub Jelinek wrote:
> Hi!
>
> As mentioned in the PR, with -E (C family and Fortran FEs, others don't
> preprocess) ask the middle-end not to initialize the backends, so running
> e.g. RTL tests leads to ICEs, e.g. pc_rtx and many other things just aren't
> initialized.
>
> 2016-06-20  Jakub Jelinek  <jakub@redhat.com>
>
> 	PR rtl-optimization/71591
> 	* toplev.c (toplev::run_self_tests): If no_backend, complain and
> 	don't run any tests.
>
> 	* gcc.dg/cpp/pr71591.c: New test.
OK.
jeff
diff mbox

Patch

--- gcc/toplev.c.jj	2016-06-13 20:45:11.000000000 +0200
+++ gcc/toplev.c	2016-06-20 14:54:07.931667136 +0200
@@ -2047,6 +2047,11 @@  toplev::start_timevars ()
 void
 toplev::run_self_tests ()
 {
+  if (no_backend)
+    {
+      error_at (UNKNOWN_LOCATION, "self-tests incompatible with -E");
+      return;
+    }
 #if CHECKING_P
   /* Reset some state.  */
   input_location = UNKNOWN_LOCATION;
--- gcc/testsuite/gcc.dg/cpp/pr71591.c.jj	2016-06-20 14:57:19.713187492 +0200
+++ gcc/testsuite/gcc.dg/cpp/pr71591.c	2016-06-20 14:58:46.014071662 +0200
@@ -0,0 +1,5 @@ 
+/* PR rtl-optimization/71591 */
+/* { dg-do preprocess } */
+/* { dg-options "-fself-test" } */
+
+/* { dg-message "self-tests incompatible with -E" "" { target *-*-* } 0 } */