This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/13394] New: [3.3/3.4 Regression] noreturn attribute ignored on recursive invokation
- From: "carlo at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Dec 2003 15:33:38 -0000
- Subject: [Bug c/13394] New: [3.3/3.4 Regression] noreturn attribute ignored on recursive invokation
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
A real-life program gave me an erroneous warning
'`noreturn' function does return', while it is
impossible that it returns and more importantly:
it indeed doesn't return: it is a logical error
to ignore a recursively invokated functions
noreturn attribute when determining the validness
of that noreturn attribute.
Now, a possible warning would be: '`noreturn' function
might caught stack overflow due to self-invokation',
but the keyword there is MIGHT. And I think that
the explicit existance of the `noreturn' attribute
should give us the favour of gcc's doubt: this function
will exit somehow. It CERTAINLY doesn't return.
Example snippet:
int f(void) __attribute__ ((__noreturn__));
void _exit(int status) __attribute__ ((__noreturn__));
int z = 0;
int f()
{
if (++z > 10)
_exit(0);
f();
}
>gcc-cvs-3.4 -Wall -O2 -c noreturn.c
noreturn.cc: In function `int f()':
noreturn.cc:11: warning: `noreturn' function does return
This is a regression: gcc 3.2.3 and all previous versions
of gcc (tried 2.95.3, 2.96, 3.0.4, 3.1.1 and 3.2.x) do not
give the warning.
--
Summary: [3.3/3.4 Regression] noreturn attribute ignored on
recursive invokation
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: carlo at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13394