diff options
author | Martin Sebor <msebor@redhat.com> | 2020-10-23 12:37:38 -0600 |
---|---|---|
committer | Martin Sebor <msebor@redhat.com> | 2020-10-23 12:37:38 -0600 |
commit | 757ba6653c2699761c2243e0194749a6695112d8 (patch) | |
tree | 9cbfe237f74cbb0fe21cf7631916f1273eb9e384 /gcc/c/c-decl.c | |
parent | 7991e963239160624b22a12caaacce95d3667e49 (diff) | |
download | gcc-757ba6653c2699761c2243e0194749a6695112d8.zip gcc-757ba6653c2699761c2243e0194749a6695112d8.tar.gz gcc-757ba6653c2699761c2243e0194749a6695112d8.tar.bz2 |
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.
Diffstat (limited to 'gcc/c/c-decl.c')
-rw-r--r-- | gcc/c/c-decl.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 81b9adb..1673b95 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -5784,6 +5784,9 @@ get_parm_array_spec (const struct c_parm *parm, tree attrs) continue; } + if (pd->u.array.static_p) + spec += 's'; + if (TREE_CODE (nelts) == INTEGER_CST) { /* Skip all constant bounds except the most significant one. @@ -5796,9 +5799,8 @@ get_parm_array_spec (const struct c_parm *parm, tree attrs) return attrs; char buf[40]; - const char *code = pd->u.array.static_p ? "s" : ""; unsigned HOST_WIDE_INT n = tree_to_uhwi (nelts); - sprintf (buf, "%s%llu", code, (unsigned long long)n); + sprintf (buf, "%llu", (unsigned long long)n); spec += buf; break; } |