[PATCH] Fix up preprocessing of #pragma GCC ivdep (PR c++/60267)

Jakub Jelinek jakub@redhat.com
Wed Feb 19 14:53:00 GMT 2014


Hi!

In #pragma GCC ivdep there is nothing the preprocessor should care about,
thus there is no reason to register it when doing just -E (and, otherwise
we'd have to handle PRAGMA_IVDEP in pragma lookups).

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2014-02-19  Jakub Jelinek  <jakub@redhat.com>

	PR c++/60267
	* c-pragma.c (init_pragma): Don't call cpp_register_deferred_pragma
	for PRAGMA_IVDEP if flag_preprocess_only.

	* gcc.dg/pr60267.c: New test.

--- gcc/c-family/c-pragma.c.jj	2014-02-12 17:46:22.000000000 +0100
+++ gcc/c-family/c-pragma.c	2014-02-19 09:49:08.410079037 +0100
@@ -1392,8 +1392,9 @@ init_pragma (void)
     cpp_register_deferred_pragma (parse_in, "GCC", "pch_preprocess",
 				  PRAGMA_GCC_PCH_PREPROCESS, false, false);
 
-  cpp_register_deferred_pragma (parse_in, "GCC", "ivdep", PRAGMA_IVDEP, false,
-				false);
+  if (!flag_preprocess_only)
+    cpp_register_deferred_pragma (parse_in, "GCC", "ivdep", PRAGMA_IVDEP, false,
+				  false);
 #ifdef HANDLE_PRAGMA_PACK_WITH_EXPANSION
   c_register_pragma_with_expansion (0, "pack", handle_pragma_pack);
 #else
--- gcc/testsuite/gcc.dg/pr60267.c.jj	2014-02-19 09:57:15.083327458 +0100
+++ gcc/testsuite/gcc.dg/pr60267.c	2014-02-19 09:57:51.383122054 +0100
@@ -0,0 +1,14 @@
+/* PR c++/60267 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -save-temps" } */
+
+void
+foo (int *a, int *b, int *c)
+{
+  int i;
+#pragma GCC ivdep
+  for (i = 0; i < 64; i++)
+    a[i] = b[i] * c[i];
+}
+
+/* { dg-final { cleanup-saved-temps } } */

	Jakub



More information about the Gcc-patches mailing list