c-common.c (handle_mode_attribute): For ENUMERAL_TYPE, also copy TYPE_MODE.

* c-common.c (handle_mode_attribute): For ENUMERAL_TYPE, also copy
	TYPE_MODE.

	* gcc.c-torture/execute/20050107-1.c: New test.

From-SVN: r93066
This commit is contained in:
Jakub Jelinek 2005-01-07 21:05:14 +01:00 committed by Jakub Jelinek
parent 825bd0e1e8
commit b827788f57
4 changed files with 35 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2005-01-07 Jakub Jelinek <jakub@redhat.com>
* c-common.c (handle_mode_attribute): For ENUMERAL_TYPE, also copy
TYPE_MODE.
2005-01-07 David Edelsohn <edelsohn@gnu.org>
PR target/13674

View File

@ -4341,6 +4341,7 @@ handle_mode_attribute (tree *node, tree name, tree args,
TYPE_MAX_VALUE (type) = TYPE_MAX_VALUE (typefm);
TYPE_SIZE (type) = TYPE_SIZE (typefm);
TYPE_SIZE_UNIT (type) = TYPE_SIZE_UNIT (typefm);
TYPE_MODE (type) = TYPE_MODE (typefm);
if (!TYPE_USER_ALIGN (type))
TYPE_ALIGN (type) = TYPE_ALIGN (typefm);

View File

@ -1,3 +1,7 @@
2005-01-07 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/execute/20050107-1.c: New test.
2005-01-07 Nathan Sidwell <nathan@codesourcery.com>
PR c++/19298

View File

@ -0,0 +1,25 @@
typedef enum { C = 1, D = 2 } B;
extern void abort (void);
struct S
{
B __attribute__ ((mode (byte))) a;
B __attribute__ ((mode (byte))) b;
};
void
foo (struct S *x)
{
if (x->a != C || x->b != D)
abort ();
}
int
main (void)
{
struct S s;
s.a = C;
s.b = D;
foo (&s);
return 0;
}