From: Jakub Jelinek Date: Fri, 7 Jan 2005 19:59:05 +0000 (+0100) Subject: c-common.c (handle_mode_attribute): For ENUMERAL_TYPE, also copy TYPE_MODE. X-Git-Tag: releases/gcc-3.4.4~331 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6229582702b1d26c630032823b1a74cbd005dce;p=thirdparty%2Fgcc.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: r93064 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 021cdc0d12c4..07287b16d4ae 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-06 Richard Sandiford PR rtl-opt/13299 diff --git a/gcc/c-common.c b/gcc/c-common.c index 29dc28ec6fba..d79f2000250f 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -4699,6 +4699,7 @@ handle_mode_attribute (tree *node, tree name, tree args ATTRIBUTE_UNUSED, 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 bbdfbc696aa5..382711907d34 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-06 Laurent GUERBY Backport from mainline: 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 000000000000..903c54a25e6a --- /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; +}