public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/13394] New: [3.3/3.4 Regression] noreturn attribute ignored on recursive invokation
@ 2003-12-13 15:33 carlo at gcc dot gnu dot org
  2003-12-15  9:27 ` [Bug c/13394] " bangerth at dealii dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: carlo at gcc dot gnu dot org @ 2003-12-13 15:33 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-12-23  6:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-13 15:33 [Bug c/13394] New: [3.3/3.4 Regression] noreturn attribute ignored on recursive invokation carlo at gcc dot gnu dot org
2003-12-15  9:27 ` [Bug c/13394] " bangerth at dealii dot org
2003-12-15 17:28 ` carlo at gcc dot gnu dot org
2003-12-16 16:35 ` pinskia at gcc dot gnu dot org
2003-12-20 11:21 ` [Bug optimization/13394] " ebotcazou at gcc dot gnu dot org
2003-12-20 11:23 ` ebotcazou at gcc dot gnu dot org
2003-12-23  5:54 ` cvs-commit at gcc dot gnu dot org
2003-12-23  8:42 ` cvs-commit at gcc dot gnu dot org
2003-12-23  8:47 ` ebotcazou at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).