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
This commit is contained in:
Jakub Jelinek 2001-12-05 15:15:37 +01:00 committed by Jakub Jelinek
parent 822baa84c8
commit 7254c5fa73
4 changed files with 30 additions and 1 deletions

View File

@ -1,3 +1,8 @@
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

View File

@ -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. */

View File

@ -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,

View File

@ -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;
}