diff options
author | Jakub Jelinek <jakub@redhat.com> | 2002-01-08 21:10:39 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2002-01-08 21:10:39 +0100 |
commit | b3ca30df78d4c4a33cc268f12301b3f8493824c6 (patch) | |
tree | bf54c07842103da5e917c623c1710747425f3ef1 | |
parent | 66839ef65ef900d409a19b269f60731224f55275 (diff) | |
download | gcc-b3ca30df78d4c4a33cc268f12301b3f8493824c6.zip gcc-b3ca30df78d4c4a33cc268f12301b3f8493824c6.tar.gz gcc-b3ca30df78d4c4a33cc268f12301b3f8493824c6.tar.bz2 |
expr.c (store_expr): Convert VOIDmode constants back to target's mode.
* expr.c (store_expr): Convert VOIDmode constants back to target's
mode.
* gcc.dg/20020108-1.c: New test.
From-SVN: r48658
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/expr.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/20020108-1.c | 16 |
4 files changed, 37 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1151544..1b95cfe 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-01-08 Jakub Jelinek <jakub@redhat.com> + + * expr.c (store_expr): Convert VOIDmode constants back to target's + mode. + 2002-01-08 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> * doc/invoke.texi: Markup gcc as @command. Refer to @@ -4041,13 +4041,19 @@ store_expr (exp, target, want_value) target. Otherwise, the caller might get confused by a result whose mode is larger than expected. */ - if (want_value && GET_MODE (temp) != GET_MODE (target) - && GET_MODE (temp) != VOIDmode) + if (want_value && GET_MODE (temp) != GET_MODE (target)) { - temp = gen_lowpart_SUBREG (GET_MODE (target), temp); - SUBREG_PROMOTED_VAR_P (temp) = 1; - SUBREG_PROMOTED_UNSIGNED_P (temp) - = SUBREG_PROMOTED_UNSIGNED_P (target); + if (GET_MODE (temp) != VOIDmode) + { + temp = gen_lowpart_SUBREG (GET_MODE (target), temp); + SUBREG_PROMOTED_VAR_P (temp) = 1; + SUBREG_PROMOTED_UNSIGNED_P (temp) + = SUBREG_PROMOTED_UNSIGNED_P (target); + } + else + temp = convert_modes (GET_MODE (target), + GET_MODE (SUBREG_REG (target)), + temp, SUBREG_PROMOTED_UNSIGNED_P (target)); } return want_value ? temp : NULL_RTX; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4b432d8..d4f4a3e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2002-01-08 Jakub Jelinek <jakub@redhat.com> + + * gcc.dg/20020108-1.c: New test. + 2002-01-08 H.J. Lu <hjl@gnu.org> * objc.dg/special/special.exp: Add -I${srcdir}/../../libobjc diff --git a/gcc/testsuite/gcc.dg/20020108-1.c b/gcc/testsuite/gcc.dg/20020108-1.c new file mode 100644 index 0000000..b91022d --- /dev/null +++ b/gcc/testsuite/gcc.dg/20020108-1.c @@ -0,0 +1,16 @@ +/* This testcase failed on i686 because (const_int -1) was changed into + (const_int 0xffff) when storing it into SImode pseudo, but was not + converted back to (const_int -1) when returning from store_expr, + eventhough target was (subreg:HI (reg/v:SI indx)). But (const_int 0xffff) + is not valid general_operand in HImode. */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-options "-O2 -mcpu=i686" { target i?86-*-* } } */ + +void +foo (unsigned short *cp) +{ + unsigned short indx; + + *cp = indx = 0xFFFF; +} |