public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/3764: Gcc incorrectly complains that a noreturn function returns
@ 2001-07-22 14:06 J.A.K.Mouw
  0 siblings, 0 replies; 2+ messages in thread
From: J.A.K.Mouw @ 2001-07-22 14:06 UTC (permalink / raw)
  To: gcc-gnats

>Number:         3764
>Category:       c
>Synopsis:       Gcc incorrectly complains that a noreturn function returns
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 22 14:06:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Erik Mouw
>Release:        3.0
>Organization:
Delft University of Technology, Ubicom project
>Environment:
System: Linux arthur 2.4.7-pre8 #1 Fri Jul 20 10:02:46 CEST 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: arm-unknown-linux-gnu
configured with: ../../src/gcc-3.0/configure --target=arm-linux --prefix=/usr/local/arm/3.0 --enable-languages=c,c++ --enable-threads --enable-shared
>Description:
GCC warns about the fact that a noreturn function does return. I made a
Reboot() function in the blob bootloader (see
http://www.sourceforge.net/projects/blob ) that reboots the machine so the
function certainly doesn't return. Because it doesn't, I marked the function
as __attribute__ ((noreturn)). Gcc now complains about the fact that the
noreturn function returns while it shouldn't according to the manual.
>How-To-Repeat:
Here is some sample code:

void Reboot(void) __attribute__ ((noreturn)) ;

void Reboot(void)
{
	volatile unsigned int *RSRR = (unsigned int *)0x90030000;

	/* reset CPU */
	*RSRR = 1;
}	

Compiling it:
  erik@arthur:/tmp >arm-linux-gcc -Wall -O2 -c test.c 
  test.c: In function `Reboot':
  test.c:9: warning: `noreturn' function does return
>Fix:
Don't mark functions as noreturn.
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c/3764: Gcc incorrectly complains that a noreturn function returns
@ 2001-07-22 21:58 rth
  0 siblings, 0 replies; 2+ messages in thread
From: rth @ 2001-07-22 21:58 UTC (permalink / raw)
  To: J.A.K.Mouw, gcc-bugs, gcc-prs, nobody, rth

Synopsis: Gcc incorrectly complains that a noreturn function returns

Responsible-Changed-From-To: unassigned->rth
Responsible-Changed-By: rth
Responsible-Changed-When: Sun Jul 22 21:58:17 2001
Responsible-Changed-Why:
    Mine.
State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Sun Jul 22 21:58:17 2001
State-Changed-Why:
    Not a bug.  How can gcc possibly know that a write to a particular
    memory location resets the computer?  Either live with the
    warning, or fool the compiler by placing an infinite loop
    at the end of the function.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3764&database=gcc


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

end of thread, other threads:[~2001-07-22 21:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-22 14:06 c/3764: Gcc incorrectly complains that a noreturn function returns J.A.K.Mouw
2001-07-22 21:58 rth

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).