@@ -6417,6 +6417,13 @@ grokdeclarator (const struct c_declarator *declarator,
{
/* Transfer const-ness of array into that of type pointed to. */
type = TREE_TYPE (type);
+ if (orig_qual_type != NULL_TREE)
+ {
+ if (orig_qual_indirect == 0)
+ orig_qual_type = TREE_TYPE (orig_qual_type);
+ else
+ orig_qual_indirect--;
+ }
if (type_quals)
type = c_build_qualified_type (type, type_quals, orig_qual_type,
orig_qual_indirect);
@@ -0,0 +1,53 @@
+/* PR c/68668 */
+/* { dg-do compile } */
+
+typedef const int T[];
+typedef const int U[1];
+
+int
+fn1 (T p)
+{
+ return p[0];
+}
+
+int
+fn2 (U p[2])
+{
+ return p[0][0];
+}
+
+int
+fn3 (U p[2][3])
+{
+ return p[0][0][0];
+}
+
+int
+fn4 (U *p)
+{
+ return p[0][0];
+}
+
+int
+fn5 (U (*p)[1])
+{
+ return (*p)[0][0];
+}
+
+int
+fn6 (U (*p)[1][2])
+{
+ return (*p)[0][0][0];
+}
+
+int
+fn7 (U **p)
+{
+ return p[0][0][0];
+}
+
+int
+fn8 (U (**p)[1])
+{
+ return (*p)[0][0][0];
+}