expr.c (store_expr): If get_signed_or_unsigned_type doesn't yield an appropriate...
authorRichard Henderson <rth@redhat.com>
Tue, 3 Apr 2007 15:50:42 +0000 (08:50 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Tue, 3 Apr 2007 15:50:42 +0000 (08:50 -0700)
        * expr.c (store_expr): If get_signed_or_unsigned_type doesn't yield
        an appropriate type, use the mode instead.

From-SVN: r123477

gcc/ChangeLog
gcc/expr.c

index 0a56ebc63e23dfb25997d4160cab6472e51cdb75..e3b491aea99ec71680b02624d8ad47192e410ed6 100644 (file)
@@ -1,3 +1,8 @@
+2007-04-03  Richard Henderson  <rth@redhat.com>
+
+       * expr.c (store_expr): If get_signed_or_unsigned_type doesn't yield
+       an appropriate type, use the mode instead.
+
 2007-04-03  Richard Sandiford  <richard@codesourcery.com>
 
        * config.gcc (mips-wrs-vxworks): Add vx-common.h to tm_file.
index 653eb56ce961f8ef241f988e8a2aef8712353598..77cc44a83d3ba637d7cf6eb81a69be52360ec64e 100644 (file)
@@ -4383,9 +4383,19 @@ store_expr (tree exp, rtx target, int call_param_p)
        {
          if (TYPE_UNSIGNED (TREE_TYPE (exp))
              != SUBREG_PROMOTED_UNSIGNED_P (target))
-           exp = fold_convert
-             (get_signed_or_unsigned_type
-              (SUBREG_PROMOTED_UNSIGNED_P (target), TREE_TYPE (exp)), exp);
+           {
+             /* Some types, e.g. Fortran's logical*4, won't have a signed
+                version, so use the mode instead.  */
+             tree ntype
+               = (get_signed_or_unsigned_type
+                  (SUBREG_PROMOTED_UNSIGNED_P (target), TREE_TYPE (exp)));
+             if (ntype == NULL)
+               ntype = lang_hooks.types.type_for_mode
+                 (TYPE_MODE (TREE_TYPE (exp)),
+                  SUBREG_PROMOTED_UNSIGNED_P (target));
+
+             exp = fold_convert (ntype, exp);
+           }
 
          exp = fold_convert (lang_hooks.types.type_for_mode
                                (GET_MODE (SUBREG_REG (target)),