http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52253
Bug #: 52253
Summary: wrong code generation
Classification: Unclassified
Product: gcc
Version: 4.6.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: gow...@gmail.com
If the x_wait() function is inlined, the block which contains memcpy() is
removed.
$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (GCC) 4.6.2
$ uname -a
CYGWIN_NT-6.1-WOW64 namsh 1.7.10(0.259/5/3) 2012-02-05 12:36 i686 Cygwin
gcc configure option:
==
$ /s/crosstool/gcc/configure --target=arm-none-eabi
--prefix=/s/crosstool/build/base --disable-nls --disable-werror
--enable-interwork --enable-multilib --disable-libssp --enable-languages=c,c++
--with-newlib --with-headers=/s/crosstool/newlib/newlib/libc/include
--with-system-zlib
command line option:
==
$ arm-none-eabi-gcc -c -mcpu=cortex-m3 -mthumb -fomit-frame-pointer
-fverbose-asm -Wa,-ahlms=ex.lst -Os -fno-strength-reduce -o ex.o ex.c
The attached ex.c includes lines below:
#if 0
#define ATTR_NOINLINE __attribute__((__noinline__)) /* good result */
#else
#define ATTR_NOINLINE /* bad result */
#endif
And comment says all.
Generated list file with '#if 0' (bad). There's no 'memcpy()' call.
==
ARM GAS /z/tmp/cc6WJdhu.s page 1
1 .syntax unified
2 .cpu cortex-m3
3 .fpu softvfp
4 .eabi_attribute 20, 1
5 .eabi_attribute 21, 1
6 .eabi_attribute 23, 3
7 .eabi_attribute 24, 1
8 .eabi_attribute 25, 1
9 .eabi_attribute 26, 1
10 .eabi_attribute 30, 4
11 .eabi_attribute 18, 4
12 .file"ex.c"
13 @ GNU C (GCC) version 4.6.2 (arm-none-eabi)
14 @compiled by GNU C version 4.5.3, GMP version 4.3.2,
MPFR version 3.0.1-p4, MPC version 0.8
15 @ GGC heuristics: --param ggc-min-expand=100 --param
ggc-min-heapsize=131072
16 @ options passed: -imultilib thumb -D__USES_INITFINI__
/d/ex.c
17 @ -mcpu=cortex-m3 -mthumb -auxbase-strip
.obj/oidd/src/ex.o -Os
18 @ -fomit-frame-pointer -fverbose-asm
19 @ options enabled: -fauto-inc-dec -fbranch-count-reg
-fcaller-saves
20 @ -fcombine-stack-adjustments -fcommon -fcompare-elim
-fcprop-registers
21 @ -fcrossjumping -fcse-follow-jumps -fdefer-pop
22 @ -fdelete-null-pointer-checks -fdevirtualize
-fdwarf2-cfi-asm
23 @ -fearly-inlining -feliminate-unused-debug-types
-fexpensive-optimizations
24 @ -fforward-propagate -ffunction-cse -fgcse -fgcse-lm
25 @ -fguess-branch-probability -fident -fif-conversion
-fif-conversion2
26 @ -findirect-inlining -finline -finline-functions
27 @ -finline-functions-called-once -finline-small-functions
-fipa-cp
28 @ -fipa-profile -fipa-pure-const -fipa-reference
-fipa-sra
29 @ -fira-share-save-slots -fira-share-spill-slots -fivopts
30 @ -fkeep-static-consts -fleading-underscore -fmath-errno
-fmerge-constants
31 @ -fmerge-debug-strings -fmove-loop-invariants
-fomit-frame-pointer
32 @ -foptimize-register-move -foptimize-sibling-calls
-fpartial-inlining
33 @ -fpeephole -fpeephole2 -fprefetch-loop-arrays
-freg-struct-return
34 @ -fregmove -freorder-blocks -freorder-functions
-frerun-cse-after-loop
35 @ -fsched-critical-path-heuristic
-fsched-dep-count-heuristic
36 @ -fsched-group-heuristic -fsched-interblock
-fsched-last-insn-heuristic
37 @ -fsched-rank-heuristic -fsched-spec
-fsched-spec-insn-heuristic
38 @ -fsched-stalled-insns-dep -fschedule-insns2
-fsection-anchors
39 @ -fshow-column -fsigned-zeros -fsplit-ivs-in-unroller
-fsplit-wide-types
40 @ -fstrict-aliasing -fstrict-overflow
-fstrict-volatile-bitfields
41 @ -fthread-jumps -ftoplevel-reorder -ftrapping-math
-ftree-bit-ccp
42 @ -ftree-builtin-call-dce -ftree-ccp -ftree-ch
-ftree-copy-prop
43 @ -ftree-copyrename -ftree-cselim -ftree-dce
-ftree-dominator-opts
44 @ -ftree-dse -ftree-forwprop -ftree-fre
-ftree-loop-if-convert
45 @ -ftree-loop-im -ftree-loop-ivcanon -ftree-loop-optimize
46 @ -ftree-parallelize-loops= -ftree-phiprop -ftree-pre
-ftree-pta
47 @