From 34efa5c2a84a8c7c7beb855dec24a321eebcbd6b Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Wed, 14 Oct 2020 15:18:19 -0600 Subject: PR c/97413 - bogus error on function declaration with many VLA arguments gcc/ChangeLog: PR c/97413 * attribs.c (init_attr_rdwr_indices): Unwrap extra list layer. gcc/c-family/ChangeLog: PR c/97413 * c-attribs.c (build_attr_access_from_parms): Wrap chain of VLA bounds in an extra list. gcc/testsuite/ChangeLog: PR c/97413 * gcc.dg/Wvla-parameter-8.c: New test. --- gcc/attribs.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/attribs.c') diff --git a/gcc/attribs.c b/gcc/attribs.c index 94b9e02..3bdb2ff 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -2049,6 +2049,8 @@ init_attr_rdwr_indices (rdwr_map *rwm, tree attrs) /* The (optional) list of VLA bounds. */ tree vblist = TREE_CHAIN (mode); + if (vblist) + vblist = TREE_VALUE (vblist); mode = TREE_VALUE (mode); if (TREE_CODE (mode) != STRING_CST) -- cgit v1.1 From 757ba6653c2699761c2243e0194749a6695112d8 Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Fri, 23 Oct 2020 12:37:38 -0600 Subject: PR middle-end/97552 - missing waning passing null to a VLA argument declared [static] gcc/ChangeLog: PR middle-end/97552 * attribs.c (init_attr_rdwr_indices): Handle static VLA parameters. gcc/c/ChangeLog: PR middle-end/97552 * c-decl.c (get_parm_array_spec): Handle static VLA parameters. gcc/testsuite/ChangeLog: PR middle-end/97552 * gcc.dg/Wvla-parameter-2.c: Adjust text of expected warning. * gcc.dg/Wnonnull-5.c: New test. --- gcc/attribs.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/attribs.c') diff --git a/gcc/attribs.c b/gcc/attribs.c index 3bdb2ff..a6f6b70 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -2109,6 +2109,7 @@ init_attr_rdwr_indices (rdwr_map *rwm, tree attrs) is followed by a comma and a dollar sign its bound is on the list. Otherwise it's a VLA with an unspecified bound. */ + acc.static_p = p[-2] == 's'; acc.minsize = HOST_WIDE_INT_M1U; } -- cgit v1.1