Bug 13728 - [3.4/4.0 regression] Duplicate parameter names not detected
Summary: [3.4/4.0 regression] Duplicate parameter names not detected
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 3.4.0
Assignee: Zack Weinberg
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2004-01-18 02:18 UTC by Joseph S. Myers
Modified: 2005-02-09 02:18 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 3.3
Known to fail:
Last reconfirmed: 2004-02-10 23:27:50


Attachments
pr13728.diff (833 bytes, patch)
2004-03-04 05:49 UTC, Zack Weinberg
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph S. Myers 2004-01-18 02:18:55 UTC
void f (int fred, int fred);
void f2 (int fred, int fred) {}

does not get any diagnostics with current 3.4 or 3.5 CVS.  3.3.2 gives
proper errors (albeit with some duplication):

t.c:1: error: redefinition of `fred'
t.c:1: error: `fred' previously declared here
t.c:2: error: redefinition of `fred'
t.c:2: error: `fred' previously declared here
t.c: In function `f2':
t.c:2: error: redeclaration of `fred'
t.c:2: error: `fred' previously declared here
Comment 1 Dara Hazeghi 2004-01-18 08:14:39 UTC
Confirmed on mainline/3.4 branch.
Comment 2 Dara Hazeghi 2004-01-18 09:21:28 UTC
Oops, I guess that's a regression.
Comment 3 Zack Weinberg 2004-03-04 05:49:00 UTC
Subject: Fix PR 13728


This is the missing diagnostic for

void f (int fred, int fred) 

and a missing diagnostic is precisely what it is.  Simply a case that
fell through the cracks when I split up duplicate_decls.

Fixed thus; bootstrapped i686-linux, applied mainline and 3.4
branch.

        PR 13728
        * c-decl.c (diagnose_mismatched_decls): Issue an error for two
        parameters with the same name, unless one is a forward decl.
        Do not issue a redundant-redeclaration warning for forward
        decls of parameters.
        * gcc.dg/decl-4.c: New testcase.

Comment 4 Zack Weinberg 2004-03-04 05:49:01 UTC
Created attachment 5858 [details]
pr13728.diff
Comment 5 GCC Commits 2004-03-04 05:49:10 UTC
Subject: Bug 13728

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	zack@gcc.gnu.org	2004-03-04 05:49:07

Modified files:
	gcc            : ChangeLog c-decl.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: decl-4.c 

Log message:
	PR 13728
	* c-decl.c (diagnose_mismatched_decls): Issue an error for two
	parameters with the same name, unless one is a forward decl.
	Do not issue a redundant-redeclaration warning for forward
	decls of parameters.
	* gcc.dg/decl-4.c: New testcase.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3030&r2=2.3031
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&r1=1.481&r2=1.482
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3565&r2=1.3566
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/decl-4.c.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 6 GCC Commits 2004-03-04 05:53:38 UTC
Subject: Bug 13728

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	zack@gcc.gnu.org	2004-03-04 05:53:35

Modified files:
	gcc            : ChangeLog c-decl.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: decl-4.c 

Log message:
	PR 13728
	* c-decl.c (diagnose_mismatched_decls): Issue an error for two
	parameters with the same name, unless one is a forward decl.
	Do not issue a redundant-redeclaration warning for forward
	decls of parameters.
	* gcc.dg/decl-4.c: New testcase.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.285&r2=2.2326.2.286
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.470.4.5&r2=1.470.4.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.119&r2=1.3389.2.120
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/decl-4.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1

Comment 7 Zack Weinberg 2004-03-04 05:55:08 UTC
there