public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/53896] New: nonreturning function suggested as 'pure' candidate
@ 2012-07-09 7:11 eggert at gnu dot org
0 siblings, 0 replies; only message in thread
From: eggert at gnu dot org @ 2012-07-09 7:11 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53896
Bug #: 53896
Summary: nonreturning function suggested as 'pure' candidate
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: eggert@gnu.org
I ran into this problem when building a test version of Emacs
with GCC 4.7.1 (x86-64). I simplified it to a small test case.
Take this program:
void lose (const char *msg) __attribute__((__noreturn__));
const char *
get_prefix (int running_suid)
{
if (!running_suid)
lose ("Not using a shared game directory, and no prefix given.");
return "foo";
}
Compile it with:
gcc -c -O2 -Wsuggest-attribute=pure t.c
The output will be:
t.c:4:1: warning: function might be candidate for attribute 'pure' if it is
known to return normally [-Wsuggest-attribute=pure]
But the get_prefix function is obviously not a candidate for attribute
'pure', since it might not return.
This bug may be related to Bug#50021 (currently apparently fixed in
GCC 4.7.0) and to Bug#51971 (documentation unclear for 'pure').
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-07-09 7:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-09 7:11 [Bug c/53896] New: nonreturning function suggested as 'pure' candidate eggert at 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).