From: Manuel López-Ibáñez Date: Tue, 23 Feb 2010 15:51:42 +0000 (+0000) Subject: re PR target/43123 (wrong value for march or mtune produces confusing output) X-Git-Tag: releases/gcc-4.5.0~644 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=38170f34f370a7e429e39a74401218323dc77eeb;p=thirdparty%2Fgcc.git re PR target/43123 (wrong value for march or mtune produces confusing output) 2010-02-23 Manuel López-Ibáñez 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d500d8e87c80..7d6c3068af10 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-02-23 Manuel López-Ibáñez + + PR 43123 + * config/i386/i386.c (override_options): Reorganise to provide + better error messages. + 2010-02-22 Sebastian Pop PR middle-end/43083 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index f87eefc10734..27593d761ade 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d8bcce57ae1e..bc1ff1f15ba4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2010-02-23 Manuel López-Ibáñez + + PR 43123 + * gcc.dg/march.c: New. + * gcc.dg/march-generic.c: New. + * gcc.dg/mtune.c: New. + 2010-02-22 Sebastian Pop 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 index 000000000000..2cebd369de2b --- /dev/null +++ b/gcc/testsuite/gcc.dg/march-generic.c @@ -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 index 000000000000..f0a08526ec10 --- /dev/null +++ b/gcc/testsuite/gcc.dg/march.c @@ -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 index 000000000000..1b0c76db47e3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/mtune.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-mtune=foo" } */ +/* { dg-error "mtune" "" { target *-*-* } 0 } */ +/* { dg-bogus "march" "" { target *-*-* } 0 } */ +int i;