re PR middle-end/56977 (gcc -Og incorrectly warns about 'constant zero length parameter')
authorRichard Biener <rguenther@suse.de>
Tue, 25 Jun 2013 08:21:31 +0000 (08:21 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 25 Jun 2013 08:21:31 +0000 (08:21 +0000)
2013-06-25  Richard Biener  <rguenther@suse.de>

PR middle-end/56977
* passes.c (init_optimization_passes): Move pass_fold_builtins
and pass_dce earlier with -Og.

* gcc.dg/pr56977.c: New testcase.

From-SVN: r200391

gcc/ChangeLog
gcc/passes.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr56977.c [new file with mode: 0644]

index f21e60b75c383a8de4103385eeda36b84f275b27..f0af61e8f996e06064ece548e35dad9eb6826255 100644 (file)
@@ -1,3 +1,9 @@
+2013-06-25  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/56977
+       * passes.c (init_optimization_passes): Move pass_fold_builtins
+       and pass_dce earlier with -Og.
+
 2013-06-25  Eric Botcazou  <ebotcazou@adacore.com>
 
        * expr.c (expand_expr_real_1) <ARRAY_REF>: Fix formatting glitches.
index c8b03eef133532246afc2f0d4cd9bff6e0f0e811..761f0307dff00ff2a278c1ca3452e137c777be3f 100644 (file)
@@ -1536,15 +1536,15 @@ init_optimization_passes (void)
       /* Perform simple scalar cleanup which is constant/copy propagation.  */
       NEXT_PASS (pass_ccp);
       NEXT_PASS (pass_object_sizes);
+      /* Fold remaining builtins.  */
+      NEXT_PASS (pass_fold_builtins);
       /* Copy propagation also copy-propagates constants, this is necessary
-         to forward object-size results properly.  */
+         to forward object-size and builtin folding results properly.  */
       NEXT_PASS (pass_copy_prop);
+      NEXT_PASS (pass_dce);
       NEXT_PASS (pass_asan);
       NEXT_PASS (pass_tsan);
       NEXT_PASS (pass_rename_ssa_copies);
-      NEXT_PASS (pass_dce);
-      /* Fold remaining builtins.  */
-      NEXT_PASS (pass_fold_builtins);
       /* ???  We do want some kind of loop invariant motion, but we possibly
          need to adjust LIM to be more friendly towards preserving accurate
         debug information here.  */
index 9940868d34503047cf37cbb844af330c56673c36..8c9f01af686f0a71b0bf928b2c74b0062ba29ecf 100644 (file)
@@ -1,3 +1,8 @@
+2013-06-25  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/56977
+       * gcc.dg/pr56977.c: New testcase.
+
 2013-06-24  Martin Jambor  <mjambor@suse.cz>
 
        PR tree-optimization/57358
diff --git a/gcc/testsuite/gcc.dg/pr56977.c b/gcc/testsuite/gcc.dg/pr56977.c
new file mode 100644 (file)
index 0000000..fde88af
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-Og" } */
+
+__attribute__((__error__("error"))) void error ();
+
+void f (int i) {
+    if (__builtin_constant_p (i)) {
+       error ();
+    }
+}