From 66189108d3785a463d2d1d0341fa6198582d9fd2 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Mon, 7 Dec 2015 17:52:23 +0000 Subject: re PR c/68668 (bogus error: invalid use of array with unspecified bounds) PR c/68668 * c-decl.c (grokdeclarator): If ORIG_QUAL_INDIRECT is indirect, use TREE_TYPE of ORIG_QUAL_TYPE, otherwise decrement ORIG_QUAL_INDIRECT. * gcc.dg/pr68668.c: New test. From-SVN: r231374 --- gcc/c/c-decl.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc/c/c-decl.c') diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 9ad8219..2da84f2 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -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); -- cgit v1.1