diff options
author | Jakub Jelinek <jakub@redhat.com> | 2001-12-05 15:15:37 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2001-12-05 15:15:37 +0100 |
commit | 7254c5fa7355f071477c329a9495a726810a5d63 (patch) | |
tree | 09544232bf9869e15d37e4b95921998c6b9431b3 | |
parent | 822baa84c86a39c89b6f066210d645f36f4f3eee (diff) | |
download | gcc-7254c5fa7355f071477c329a9495a726810a5d63.zip gcc-7254c5fa7355f071477c329a9495a726810a5d63.tar.gz gcc-7254c5fa7355f071477c329a9495a726810a5d63.tar.bz2 |
expr.c (expand_expr): When checking promoted value, use DECL_MODE (exp) and not mode.
* expr.c (expand_expr): When checking promoted value, use
DECL_MODE (exp) and not mode.
* g++.dg/other/anon-union.C: New test.
From-SVN: r47674
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/expr.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/anon-union.C | 22 |
4 files changed, 30 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e2485c5..c3d9d38 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2001-12-05 Jakub Jelinek <jakub@redhat.com> + * expr.c (expand_expr): When checking promoted value, use + DECL_MODE (exp) and not mode. + +2001-12-05 Jakub Jelinek <jakub@redhat.com> + * c-typeck.c (output_init_element): Call digest_init just once, not in each if branch and check its return value for error_mark_node. @@ -6452,7 +6452,7 @@ expand_expr (exp, target, tmode, modifier) but mark it so that we know that it was already extended. */ if (GET_CODE (DECL_RTL (exp)) == REG - && GET_MODE (DECL_RTL (exp)) != mode) + && GET_MODE (DECL_RTL (exp)) != DECL_MODE (exp)) { /* Get the signedness used for this variable. Ensure we get the same mode we got when the variable was declared. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 56b2f08..5dace7b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -4,6 +4,8 @@ * gcc.dg/noncompile/20011025-1.c: New test. + * g++.dg/other/anon-union.C: New test. + 2001-12-04 Joseph S. Myers <jsm28@cam.ac.uk> * gcc.c-torture/execute/20000722-1.x, diff --git a/gcc/testsuite/g++.dg/other/anon-union.C b/gcc/testsuite/g++.dg/other/anon-union.C new file mode 100644 index 0000000..51598bf --- /dev/null +++ b/gcc/testsuite/g++.dg/other/anon-union.C @@ -0,0 +1,22 @@ +// { dg-do compile } +// { dg-options -O2 } + +int foo (); +double bar (void) +{ + union + { + char a[8]; + double b; + }; + + a[0] = foo (); + a[1] = foo (); + a[2] = foo (); + a[3] = foo (); + a[4] = foo (); + a[5] = foo (); + a[6] = foo (); + a[7] = foo (); + return b; +} |