http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50997
Bug #: 50997
Summary: ARM: No warnings for unreachable code for ARM cross
compiler
Classification: Unclassified
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
AssignedTo: [email protected]
ReportedBy: [email protected]
Created attachment 25729
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25729
Example file with warnings for unreachable code
When I compile for x86 the -Wunreachable-code works as intended, but when using
ARM cross compiler I do not get any warnings.
Attached is example C-file, compiled with (tested -O0,-O1,-O2,-O3):
gcc -c -O2 unreachable.c -W -Wall -Wextra -Wunreachable-code
For x86 GCC I get output:
unreachable.c: In function ‘unreachable’:
unreachable.c:7: warning: ignoring return value of ‘scanf’, declared with
attribute warn_unused_result
unreachable.c:41: warning: will never be executed
unreachable.c:46: warning: will never be executed
unreachable.c: In function ‘main’:
unreachable.c:22: warning: will never be executed
unreachable.c:33: warning: will never be executed
unreachable.c:37: warning: will never be executed
Which is correct
For ARM-cross compiler (4.5.1 and 4.6.0 tested) I do not get any warnings at
all.
ARM-cross compiler was compiled with
configure --enable-languages=c,c++ --target="$TARGET" --prefix="$DEST"
--with-gnu-as --with-gnu-ld --disable-nls --with-newlib --disable-__cxa_atexit
--with-ecos
make LDFLAGS=-s all all-gcc all-target-libstdc++-v3 install install-gcc
install-target-libstdc++-v3
Fredrik Hederstierna
Securitas Direct AB
Malmoe Sweden