This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/50997] New: ARM: No warnings for unreachable code for ARM cross compiler
- From: "fredrik dot hederstierna at securitas-direct dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 06 Nov 2011 10:11:46 +0000
- Subject: [Bug c/50997] New: ARM: No warnings for unreachable code for ARM cross compiler
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: fredrik.hederstierna@securitas-direct.com
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