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  <ja...@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.

--- 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 } */

        Jakub

Reply via email to