aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2007-04-03 08:50:42 -0700
committerRichard Henderson <rth@gcc.gnu.org>2007-04-03 08:50:42 -0700
commitfdd84500aecd4edcab10770d77f28c602b618359 (patch)
tree4747d3f159f5acd4eb140b04448e4887f12b654e /gcc/expr.c
parent696fbee71016c152278c38048421cf291e1566a4 (diff)
downloadgcc-fdd84500aecd4edcab10770d77f28c602b618359.zip
gcc-fdd84500aecd4edcab10770d77f28c602b618359.tar.gz
gcc-fdd84500aecd4edcab10770d77f28c602b618359.tar.bz2
expr.c (store_expr): If get_signed_or_unsigned_type doesn't yield an appropriate type...
* expr.c (store_expr): If get_signed_or_unsigned_type doesn't yield an appropriate type, use the mode instead. From-SVN: r123477
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 653eb56..77cc44a 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -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)),