From: Jakub Jelinek Date: Fri, 7 Jan 2005 20:05:14 +0000 (+0100) Subject: c-common.c (handle_mode_attribute): For ENUMERAL_TYPE, also copy TYPE_MODE. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b827788f5768220700c66beaee6a66586014f07f;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index aa0bbffcc3f..2979ebe0d60 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-01-07 Jakub Jelinek + + * c-common.c (handle_mode_attribute): For ENUMERAL_TYPE, also copy + TYPE_MODE. + 2005-01-07 David Edelsohn PR target/13674 diff --git a/gcc/c-common.c b/gcc/c-common.c index bb81a6f281b..a699cbcdc63 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 46a2093794e..9d460080ac7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-01-07 Jakub Jelinek + + * gcc.c-torture/execute/20050107-1.c: New test. + 2005-01-07 Nathan Sidwell PR c++/19298 diff --git a/gcc/testsuite/gcc.c-torture/execute/20050107-1.c b/gcc/testsuite/gcc.c-torture/execute/20050107-1.c new file mode 100644 index 00000000000..903c54a25e6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050107-1.c @@ -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; +}