c/3764: Gcc incorrectly complains that a noreturn function returns
J.A.K.Mouw@ITS.TUDelft.NL
J.A.K.Mouw@ITS.TUDelft.NL
Sun Jul 22 14:06:00 GMT 2001
>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:
More information about the Gcc-prs
mailing list