c-common.c (handle_mode_attribute): For ENUMERAL_TYPE, also copy TYPE_MODE.
authorJakub Jelinek <jakub@redhat.com>
Fri, 7 Jan 2005 20:05:14 +0000 (21:05 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 7 Jan 2005 20:05:14 +0000 (21:05 +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: r93066

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

index aa0bbffcc3fabb2f274749a77d29355d4348b4e1..2979ebe0d60021b314b77955fd9ce383a2c576bd 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-07  David Edelsohn  <edelsohn@gnu.org>
 
        PR target/13674
index bb81a6f281baf0b20e022c63ed2818c7961287a7..a699cbcdc63432b03487812be2d168bc92274f22 100644 (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);
 
index 46a2093794e54f1824c9e307a4ba89aacb3d5912..9d460080ac7c3ea686b9fda6e099328b2979a6ac 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-07  Nathan Sidwell  <nathan@codesourcery.com>
 
        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 (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;
+}