diff options
author | Martin Sebor <msebor@redhat.com> | 2020-11-24 15:23:57 -0700 |
---|---|---|
committer | Martin Sebor <msebor@redhat.com> | 2020-11-24 15:23:57 -0700 |
commit | 211d68dda14d6b773ad648909ef9dd0d65ec2053 (patch) | |
tree | 85f5ed7c240731dceefdab3383ddcb796d22ea8e /gcc/c-family/c-warn.c | |
parent | f2a5cdff0457077cc0ef44a7c52c7dcf3fcaeadb (diff) | |
download | gcc-211d68dda14d6b773ad648909ef9dd0d65ec2053.zip gcc-211d68dda14d6b773ad648909ef9dd0d65ec2053.tar.gz gcc-211d68dda14d6b773ad648909ef9dd0d65ec2053.tar.bz2 |
PR c/97955 - ICE in build_array_type_1 on invalid redeclaration of function with VLA parameter
gcc/c-family/ChangeLog:
* c-warn.c (warn_parm_array_mismatch): Avoid invalid redeclarations.
gcc/testsuite/ChangeLog:
* gcc.dg/pr97955.c: New test.
Diffstat (limited to 'gcc/c-family/c-warn.c')
-rw-r--r-- | gcc/c-family/c-warn.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c index 6d22a11..91abafe 100644 --- a/gcc/c-family/c-warn.c +++ b/gcc/c-family/c-warn.c @@ -3379,8 +3379,9 @@ warn_parm_array_mismatch (location_t origloc, tree fndecl, tree newparms) return; /* Only check pointers and C++ references. */ + tree curptype = TREE_TYPE (curp); tree newptype = TREE_TYPE (newp); - if (!POINTER_TYPE_P (newptype)) + if (!POINTER_TYPE_P (curptype) || !POINTER_TYPE_P (newptype)) continue; /* Skip mismatches in __builtin_va_list that is commonly @@ -3430,7 +3431,6 @@ warn_parm_array_mismatch (location_t origloc, tree fndecl, tree newparms) if (origloc == UNKNOWN_LOCATION) origloc = newloc; - tree curptype = TREE_TYPE (curp); const std::string newparmstr = newa->array_as_string (newptype); const std::string curparmstr = cura->array_as_string (curptype); if (new_vla_p && !cur_vla_p) |