]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-common.c (handle_mode_attribute): For ENUMERAL_TYPE, also copy TYPE_MODE.
authorJakub Jelinek <jakub@redhat.com>
Fri, 7 Jan 2005 19:59:05 +0000 (20:59 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 7 Jan 2005 19:59:05 +0000 (20:59 +0100)
* 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

gcc/ChangeLog
gcc/c-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/20050107-1.c [new file with mode: 0644]

index 021cdc0d12c41c686a7698ee8b72cab0290d6f35..07287b16d4ae8ab784e507d2ef831f4c7c8dfe8e 100644 (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-06  Richard Sandiford  <rsandifo@redhat.com>
 
         PR rtl-opt/13299
index 29dc28ec6fba53465da07462497a708ef7036d0c..d79f2000250facd622a4f28108b32a69e522fa45 100644 (file)
@@ -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);
 
index bbdfbc696aa52fdbf3c484fc2bbab2dd56657dc3..382711907d34999d712c7e1311bdb956d03ddac8 100644 (file)
@@ -1,3 +1,7 @@
+2005-01-07  Jakub Jelinek  <jakub@redhat.com>
+
+       * gcc.c-torture/execute/20050107-1.c: New test.
+
 2005-01-06  Laurent GUERBY <laurent@guerby.net>
 
        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 (file)
index 0000000..903c54a
--- /dev/null
@@ -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;
+}