PR c/97882 - Segmentation Fault on improper redeclaration of function
authorMartin Sebor <msebor@redhat.com>
Thu, 4 Feb 2021 21:50:23 +0000 (14:50 -0700)
committerMartin Sebor <msebor@redhat.com>
Thu, 4 Feb 2021 21:53:38 +0000 (14:53 -0700)
commitce5720447c69286599b96bae53ae854b1bbe41fa
treeb7f6a4fb020f9b00c93319630e674f9aea57b92b
parent4e7c24d97dd65083a770252ce942f43d408fe11d
PR c/97882 - Segmentation Fault on improper redeclaration of function

gcc/c/ChangeLog:

PR c/97882
* c-decl.c (locate_old_decl): Add type to diagnostic output.
(diagnose_mismatched_decls): Same.
(start_function): Introduce temporaries for better readability.
* c-typeck.c (comptypes_internal): Only consider complete enum
types in comparisons with integers.

gcc/testsuite/ChangeLog:

PR c/97882
* gcc.dg/decl-8.c: Adjust text of expected diagnostic.
* gcc.dg/label-decl-4.c: Same.
* gcc.dg/mismatch-decl-1.c: Same.
* gcc.dg/old-style-then-proto-1.c: Same.
* gcc.dg/parm-mismatch-1.c: Same.
* gcc.dg/pr35445.c: Same.
* gcc.dg/redecl-11.c: Same.
* gcc.dg/redecl-12.c: Same.
* gcc.dg/redecl-13.c: Same.
* gcc.dg/redecl-15.c: Same.
* gcc.dg/tls/thr-init-1.c: Same.
* objc.dg/id-1.m: Same.
* objc.dg/tls/diag-3.m: Same.
* gcc.dg/pr97882.c: New test.
* gcc.dg/qual-return-7.c: New test.
* gcc.dg/qual-return-8.c: New test.
18 files changed:
gcc/c/c-decl.c
gcc/c/c-typeck.c
gcc/testsuite/gcc.dg/decl-8.c
gcc/testsuite/gcc.dg/label-decl-4.c
gcc/testsuite/gcc.dg/mismatch-decl-1.c
gcc/testsuite/gcc.dg/old-style-then-proto-1.c
gcc/testsuite/gcc.dg/parm-mismatch-1.c
gcc/testsuite/gcc.dg/pr35445.c
gcc/testsuite/gcc.dg/pr97882.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/qual-return-7.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/qual-return-8.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/redecl-11.c
gcc/testsuite/gcc.dg/redecl-12.c
gcc/testsuite/gcc.dg/redecl-13.c
gcc/testsuite/gcc.dg/redecl-15.c
gcc/testsuite/gcc.dg/tls/thr-init-1.c
gcc/testsuite/objc.dg/id-1.m
gcc/testsuite/objc.dg/tls/diag-3.m