re PR c/82679 (Uses of typedefs of arrays of _Atomic-qualified types are rejected)
authorMarek Polacek <polacek@redhat.com>
Tue, 12 Dec 2017 10:38:09 +0000 (10:38 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Tue, 12 Dec 2017 10:38:09 +0000 (10:38 +0000)
PR c/82679
* c-decl.c (grokdeclarator): Check declspecs insted of atomicp.

* gcc.dg/c11-atomic-5.c: New test.

From-SVN: r255577

gcc/c/ChangeLog
gcc/c/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/c11-atomic-5.c [new file with mode: 0644]

index f9812665069712d842d812d01da23b169cabf20a..6516e5d598251db2bfb4dfefc6504bd192c9129e 100644 (file)
@@ -1,3 +1,8 @@
+2017-12-12  Marek Polacek  <polacek@redhat.com>
+
+       PR c/82679
+       * c-decl.c (grokdeclarator): Check declspecs insted of atomicp.
+
 2017-12-12  Alexandre Oliva <aoliva@redhat.com>
 
        * c-objc-common.h (LANG_HOOKS_EMITS_BEGIN_STMT): Redefine as true.
index 4a36c54d21e91440f2b324b1167872d52de0b28c..7ade2d6436e8d58180f4f5ccb887f7046be20a0d 100644 (file)
@@ -5813,7 +5813,7 @@ grokdeclarator (const struct c_declarator *declarator,
      of typedefs or typeof) must be detected here.  If the qualifier
      is introduced later, any appearance of applying it to an array is
      actually applying it to an element of that array.  */
-  if (atomicp && TREE_CODE (type) == ARRAY_TYPE)
+  if (declspecs->atomic_p && TREE_CODE (type) == ARRAY_TYPE)
     error_at (loc, "%<_Atomic%>-qualified array type");
 
   /* Warn about storage classes that are invalid for certain
index 079fd96fee50a5f21df382b89cdf0ed43c2ea759..6f0ea7c5727b86f73760275ff82731923557d554 100644 (file)
@@ -1,3 +1,8 @@
+2017-12-12  Marek Polacek  <polacek@redhat.com>
+
+       PR c/82679
+       * gcc.dg/c11-atomic-5.c: New test.
+
 2017-12-12  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/83363
diff --git a/gcc/testsuite/gcc.dg/c11-atomic-5.c b/gcc/testsuite/gcc.dg/c11-atomic-5.c
new file mode 100644 (file)
index 0000000..090ffdf
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR c/82679 */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu11" } */
+
+typedef _Atomic int A[10];
+A a;
+
+typedef _Atomic int I;
+typedef I T[10];
+T t;