This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, rs6000] Fix PR87496: ICE in aggregate_value_p at gcc/function.c:2046


PR87496 shows a bug where we ICE if we attempt to use -mabi=ieeelongdouble
and -mno-popcntd.  The IEEE128 support requires full ISA 2.06 (aka POWER7)
support, so we really should throw an error when using those options
together.  Ditto for -mabi=ieeelongdouble and -mno-vsx.  The patch below
does that.

Ok for mainline once bootstrap and regtesting are complete and clean?

Peter


gcc/
	PR target/87496
	* config/rs6000/rs6000.c (rs6000_option_override_internal): Disallow
	-mabi=ieeelongdouble without both -mpopcntd and -mvsx.

gcc/testsuite/
	PR target/87496
	* gcc.target/powerpc/pr87496.c: New test.

Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 266566)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -4291,16 +4291,22 @@ rs6000_option_override_internal (bool gl
   if (!global_options_set.x_rs6000_ieeequad)
     rs6000_ieeequad = TARGET_IEEEQUAD_DEFAULT;
 
-  else if (rs6000_ieeequad != TARGET_IEEEQUAD_DEFAULT && TARGET_LONG_DOUBLE_128)
+  else
     {
-      static bool warned_change_long_double;
-      if (!warned_change_long_double)
+      if (!TARGET_POPCNTD || !TARGET_VSX)
+	error ("%qs requires full ISA 2.06 support", "-mabi=ieeelongdouble");
+
+      if (rs6000_ieeequad != TARGET_IEEEQUAD_DEFAULT && TARGET_LONG_DOUBLE_128)
 	{
-	  warned_change_long_double = true;
-	  if (TARGET_IEEEQUAD)
-	    warning (OPT_Wpsabi, "Using IEEE extended precision long double");
-	  else
-	    warning (OPT_Wpsabi, "Using IBM extended precision long double");
+	  static bool warned_change_long_double;
+	  if (!warned_change_long_double)
+	    {
+	      warned_change_long_double = true;
+	      if (TARGET_IEEEQUAD)
+		warning (OPT_Wpsabi, "Using IEEE extended precision long double");
+	      else
+		warning (OPT_Wpsabi, "Using IBM extended precision long double");
+	    }
 	}
     }
 
Index: gcc/testsuite/gcc.target/powerpc/pr87496.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/pr87496.c	(nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/pr87496.c	(working copy)
@@ -0,0 +1,10 @@
+/* PR target/87496.c */
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */
+/* { dg-require-effective-target longdouble128 } */
+/* { dg-options "-O2 -mcpu=power7 -mabi=ieeelongdouble -mno-popcntd -Wno-psabi" } */
+
+int i;
+
+/* { dg-error "'-mabi=ieeelongdouble' requires full ISA 2.06 support" "PR87496" { target *-*-* } 0 } */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]