]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/43123 (wrong value for march or mtune produces confusing output)
authorManuel López-Ibáñez <manu@gcc.gnu.org>
Tue, 23 Feb 2010 15:51:42 +0000 (15:51 +0000)
committerManuel López-Ibáñez <manu@gcc.gnu.org>
Tue, 23 Feb 2010 15:51:42 +0000 (15:51 +0000)
2010-02-23  Manuel López-Ibáñez  <manu@gcc.gnu.org>

PR 43123
* config/i386/i386.c (override_options): Reorganise to provide
better error messages.
testsuite/
* gcc.dg/march.c: New.
* gcc.dg/march-generic.c: New.
* gcc.dg/mtune.c: New.

From-SVN: r157007

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/march-generic.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/march.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/mtune.c [new file with mode: 0644]

index d500d8e87c80cffee0b11c948908039153577876..7d6c3068af102a72396f2816b5dccac20a8db25e 100644 (file)
@@ -1,3 +1,9 @@
+2010-02-23  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+
+       PR 43123
+       * config/i386/i386.c (override_options): Reorganise to provide
+       better error messages.
+
 2010-02-22  Sebastian Pop  <sebastian.pop@amd.com>
 
        PR middle-end/43083
index f87eefc10734875ab601edecefe03c039c382330..27593d761ade4336046cb4b47868eb39d83a421e 100644 (file)
@@ -2621,6 +2621,7 @@ override_options (bool main_args_p)
 {
   int i;
   unsigned int ix86_arch_mask, ix86_tune_mask;
+  const bool ix86_tune_specified = (ix86_tune_string != NULL); 
   const char *prefix;
   const char *suffix;
   const char *sw;
@@ -2821,8 +2822,12 @@ override_options (bool main_args_p)
                   || !strcmp (ix86_tune_string, "generic64")))
        ;
       else if (!strncmp (ix86_tune_string, "generic", 7))
-       error ("bad value (%s) for %stune=%s %s",
+        error ("bad value (%s) for %stune=%s %s",
               ix86_tune_string, prefix, suffix, sw);
+      else if (!strcmp (ix86_tune_string, "x86-64"))
+        warning (OPT_Wdeprecated, "%stune=x86-64%s is deprecated.  Use "
+                 "%stune=k8%s or %stune=generic%s instead as appropriate.",
+                 prefix, suffix, prefix, suffix, prefix, suffix);
     }
   else
     {
@@ -2846,6 +2851,7 @@ override_options (bool main_args_p)
            ix86_tune_string = "generic32";
        }
     }
+
   if (ix86_stringop_string)
     {
       if (!strcmp (ix86_stringop_string, "rep_byte"))
@@ -2868,23 +2874,12 @@ override_options (bool main_args_p)
        error ("bad value (%s) for %sstringop-strategy=%s %s",
               ix86_stringop_string, prefix, suffix, sw);
     }
-  if (!strcmp (ix86_tune_string, "x86-64"))
-    warning (OPT_Wdeprecated, "%stune=x86-64%s is deprecated.  Use "
-            "%stune=k8%s or %stune=generic%s instead as appropriate.",
-            prefix, suffix, prefix, suffix, prefix, suffix);
 
   if (!ix86_arch_string)
     ix86_arch_string = TARGET_64BIT ? "x86-64" : "i386";
   else
     ix86_arch_specified = 1;
 
-  if (!strcmp (ix86_arch_string, "generic"))
-    error ("generic CPU can be used only for %stune=%s %s",
-          prefix, suffix, sw);
-  if (!strncmp (ix86_arch_string, "generic", 7))
-    error ("bad value (%s) for %sarch=%s %s",
-          ix86_arch_string, prefix, suffix, sw);
-
   /* Validate -mabi= value.  */
   if (ix86_abi_string)
     {
@@ -3032,7 +3027,10 @@ override_options (bool main_args_p)
        break;
       }
 
-  if (i == pta_size)
+  if (!strcmp (ix86_arch_string, "generic"))
+    error ("generic CPU can be used only for %stune=%s %s",
+          prefix, suffix, sw);
+  else if (!strncmp (ix86_arch_string, "generic", 7) || i == pta_size)
     error ("bad value (%s) for %sarch=%s %s",
           ix86_arch_string, prefix, suffix, sw);
 
@@ -3071,7 +3069,8 @@ override_options (bool main_args_p)
          x86_prefetch_sse = true;
        break;
       }
-  if (i == pta_size)
+
+  if (ix86_tune_specified && i == pta_size)
     error ("bad value (%s) for %stune=%s %s",
           ix86_tune_string, prefix, suffix, sw);
 
index d8bcce57ae1e98da245e633a1cfb04f175e2a619..bc1ff1f15ba4f29b870d7a6547b313ca2cd57549 100644 (file)
@@ -1,3 +1,10 @@
+2010-02-23  Manuel López-Ibáñez  <manu@gcc.gnu.org>
+
+       PR 43123
+       * gcc.dg/march.c: New.
+       * gcc.dg/march-generic.c: New.
+       * gcc.dg/mtune.c: New.
+       
 2010-02-22  Sebastian Pop  <sebastian.pop@amd.com>
 
        PR middle-end/43083
diff --git a/gcc/testsuite/gcc.dg/march-generic.c b/gcc/testsuite/gcc.dg/march-generic.c
new file mode 100644 (file)
index 0000000..2cebd36
--- /dev/null
@@ -0,0 +1,5 @@
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-march=generic" } */
+/* { dg-error "generic CPU can be used only for -mtune" "" { target *-*-* } 0 } */
+/* { dg-bogus "march" "" { target *-*-* } 0 } */
+int i;
diff --git a/gcc/testsuite/gcc.dg/march.c b/gcc/testsuite/gcc.dg/march.c
new file mode 100644 (file)
index 0000000..f0a0852
--- /dev/null
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-march=foo" } */
+/* { dg-error "march" "" { target *-*-* } 0 } */
+/* { dg-bogus "mtune" "" { target *-*-* } 0 } */
+int i;
diff --git a/gcc/testsuite/gcc.dg/mtune.c b/gcc/testsuite/gcc.dg/mtune.c
new file mode 100644 (file)
index 0000000..1b0c76d
--- /dev/null
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-mtune=foo" } */
+/* { dg-error "mtune" "" { target *-*-* } 0 } */
+/* { dg-bogus "march" "" { target *-*-* } 0 } */
+int i;