Bug 17807 - [4.0 Regression] No warning/error for undefined local function.
Summary: [4.0 Regression] No warning/error for undefined local function.
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.4.3
: P2 normal
Target Milestone: 4.0.0
Assignee: Joseph S. Myers
URL:
Keywords: accepts-invalid, diagnostic, ice-on-invalid-code
: 19318 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-10-03 12:34 UTC by Richard Henderson
Modified: 2005-02-03 02:33 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-02-01 23:03:31


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Henderson 2004-10-03 12:34:59 UTC
int main(void)
{
    auto int bar(int);
    bar(5);
}

$ gcc z.c
/tmp/ccw5BsKp.o(.text+0x18): In function `main':
: undefined reference to `bar.0'
collect2: ld returned 1 exit status

Which isn't the best of error messages.

Mainline actually ICE's on this.
Comment 1 Andrew Pinski 2004-10-03 15:04:06 UTC
ICEs are defined as regressions even if the previous versions accepted the code.
Comment 2 Andrew Pinski 2004-10-03 19:59:40 UTC
: Search converges between 2004-05-11-trunk (#454) and 2004-05-14-trunk (#455).
: Search converges between 2003-10-26-ssa (#116) and 2003-10-27-ssa (#117).
Comment 3 Andrew Pinski 2004-10-04 17:57:16 UTC
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-10/msg00288.html>.
Comment 4 Andrew Pinski 2004-10-19 00:48:12 UTC
I will see if I can have this rejected in the front-end.
Comment 5 Andrew Pinski 2004-11-25 20:52:52 UTC
I might not get to updating this patch for a while so assigning myself for now.
Comment 6 Andrew Pinski 2005-01-07 22:26:05 UTC
*** Bug 19318 has been marked as a duplicate of this bug. ***
Comment 7 Joseph S. Myers 2005-02-01 23:03:30 UTC
Testing a patch.
Comment 8 CVS Commits 2005-02-03 02:21:38 UTC
Subject: Bug 17807

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jsm28@gcc.gnu.org	2005-02-03 02:21:11

Modified files:
	gcc            : ChangeLog c-decl.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/gcc.dg: pr18596-3.c 
Added files:
	gcc/testsuite/gcc.dg: nested-func-3.c 

Log message:
	PR c/17807
	* c-decl.c (undef_nested_function): New variable.
	(pop_scope): Diagnose undefined nested functions.
	(finish_function): Don't attempt cgraph processing or genericizing
	if current top-level function contained an undefined nested
	function.  Reset undef_nested_function at the end of a top-level
	function.
	
	testsuite:
	* gcc.dg/nested-func-3.c: New test.
	* gcc.dg/pr18596-3.c: Expect error for undefined nested function.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7380&r2=2.7381
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&r1=1.629&r2=1.630
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4988&r2=1.4989
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/nested-func-3.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr18596-3.c.diff?cvsroot=gcc&r1=1.2&r2=1.3

Comment 9 Andrew Pinski 2005-02-03 02:33:26 UTC
Fixed.