re PR target/30406 ([4.1 only] ICE in LOGICAL(8) functions)
authorFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Sun, 4 Mar 2007 08:10:25 +0000 (08:10 +0000)
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Sun, 4 Mar 2007 08:10:25 +0000 (08:10 +0000)
PR target/30406

* config/rs6000/rs6000.c (rs6000_function_value): Look at bit size
instead of precision.

* gfortran.dg/logical_3.f90: New test.

From-SVN: r122523

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/logical_3.f90 [new file with mode: 0644]

index 2c9edd2c77c11fcdb923656203b79d45006957bd..67eb439ada9b428257877dc86f305825c35ca00d 100644 (file)
@@ -1,3 +1,9 @@
+2007-03-04 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+       PR target/30406
+       * config/rs6000/rs6000.c (rs6000_function_value): Look at bit size
+       instead of precision.
+
 2007-03-04  Roman Zippel <zippel@linux-m68k.org>
             Nathan Sidwell  <nathan@codesourcery.com>
 
index f21d5f1d7c3741f4ba36ad72a35f8398ea3e4e89..fd1b8358a9b47931a01affa913769e6d3f8c9660 100644 (file)
@@ -20562,12 +20562,10 @@ rs6000_function_value (tree valtype, tree func ATTRIBUTE_UNUSED)
                                      GEN_INT (12))));
     }
 
-  if ((INTEGRAL_TYPE_P (valtype)
-       && TYPE_PRECISION (valtype) < BITS_PER_WORD)
+  mode = TYPE_MODE (valtype);
+  if ((INTEGRAL_TYPE_P (valtype) && GET_MODE_BITSIZE (mode) < BITS_PER_WORD)
       || POINTER_TYPE_P (valtype))
     mode = TARGET_32BIT ? SImode : DImode;
-  else
-    mode = TYPE_MODE (valtype);
 
   if (DECIMAL_FLOAT_MODE_P (mode))
     {
index 309ea4ac6e9d22ce26543f6679a5eac641a3fe31..5b717af41db1611cab0adf368e13869c085332a4 100644 (file)
@@ -1,3 +1,8 @@
+2007-03-04 Francois-Xavier Coudert <coudert@clipper.ens.fr>
+
+       PR target/30406
+       * gfortran.dg/logical_3.f90: New test.
+
 2007-03-04  Thomas Koenig  <Thomas.Koenig@online.de>
 
        PR libfortran/30981
diff --git a/gcc/testsuite/gfortran.dg/logical_3.f90 b/gcc/testsuite/gfortran.dg/logical_3.f90
new file mode 100644 (file)
index 0000000..f4d069e
--- /dev/null
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! This checks the fix for PR30406.
+!
+! Contributed by Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+!===============================================================
+
+function f()
+  logical(8) :: f
+  f = .false._8
+end function f