Patchwork [committed] PR 58271: Upgrade a warning to an error

login
register
mail settings
Submitter Richard Sandiford
Date March 8, 2014, 9:28 a.m.
Message ID <87y50l82fy.fsf@talisman.default>
Download mbox | patch
Permalink /patch/328170/
State New
Headers show

Comments

Richard Sandiford - March 8, 2014, 9:28 a.m.
PR 58271 shows a case where using -mips3 -mpaired-single will print:

  warning: the 'mips3' architecture does not support paired-single instructions [enabled by default]

and then ICE because the -mpaired-single support implicitly assumes
that MIPS IV features are available.  The ICE in this case is a regression 
from 4.7, although 4.7 would probably ICE in other situations.

This patch upgrades the warning to an error and disables -mips3d and
-mpaired-single when they are not available.

Tested on mips64-linux-gnu and applied.

Thanks,
Richard


gcc/
	PR target/58271
	* config/mips/mips.c (mips_option_override): Promote -mpaired-single
	warning to an error.  Disable TARGET_PAIRED_SINGLE and TARGET_MIPS3D
	if they can't be used.

Patch

Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	2014-02-02 16:10:04.116587339 +0000
+++ gcc/config/mips/mips.c	2014-03-05 20:44:40.651657638 +0000
@@ -17206,15 +17206,24 @@  mips_option_override (void)
   /* Make sure that when TARGET_PAIRED_SINGLE_FLOAT is true, TARGET_FLOAT64
      and TARGET_HARD_FLOAT_ABI are both true.  */
   if (TARGET_PAIRED_SINGLE_FLOAT && !(TARGET_FLOAT64 && TARGET_HARD_FLOAT_ABI))
-    error ("%qs must be used with %qs",
-	   TARGET_MIPS3D ? "-mips3d" : "-mpaired-single",
-	   TARGET_HARD_FLOAT_ABI ? "-mfp64" : "-mhard-float");
+    {
+      error ("%qs must be used with %qs",
+	     TARGET_MIPS3D ? "-mips3d" : "-mpaired-single",
+	     TARGET_HARD_FLOAT_ABI ? "-mfp64" : "-mhard-float");
+      target_flags &= ~MASK_PAIRED_SINGLE_FLOAT;
+      TARGET_MIPS3D = 0;
+    }
 
-  /* Make sure that the ISA supports TARGET_PAIRED_SINGLE_FLOAT when it is
-     enabled.  */
+  /* Make sure that -mpaired-single is only used on ISAs that support it.
+     We must disable it otherwise since it relies on other ISA properties
+     like ISA_HAS_8CC having their normal values.  */
   if (TARGET_PAIRED_SINGLE_FLOAT && !ISA_HAS_PAIRED_SINGLE)
-    warning (0, "the %qs architecture does not support paired-single"
+    {
+      error ("the %qs architecture does not support paired-single"
 	     " instructions", mips_arch_info->name);
+      target_flags &= ~MASK_PAIRED_SINGLE_FLOAT;
+      TARGET_MIPS3D = 0;
+    }
 
   if (mips_r10k_cache_barrier != R10K_CACHE_BARRIER_NONE
       && !TARGET_CACHE_BUILTIN)