gcc-4.3.2 unrolls loop despite -Os -fno-unroll-loops (dito -fno-unroll-all-loops)

Georg-Johann Lay avr@gjlay.de
Sat Jan 24 16:36:00 GMT 2009


Hi, I attached a source and the respective assembler output of a small 
program.

Despite -Os and -fno-unroll-loops a loop is unrolled.

Is there a way to stop gcc from doing the unroll?

Regards,

Georg-Johann



This are the command lines:

e:/WinAVR-20081205/bin/avr-gcc -mmcu=atmega8 -S countdown.c -v -Os 
-fno-unroll-loops -fno-unroll-all-loops -std=gnu99  -fno-common -W -Wall 
-Wstrict-prototypes -DF_CPU=1000000 -save-temps -fverbose-asm
Using built-in specs.
Target: avr
Configured with: ../gcc-4.3.2/configure 
--enable-win32-registry=WinAVR-20081205 --with-gmp=/usr/local 
--with-mpfr=/usr/local --prefix=/c/WinAVR --target=avr 
--enable-languages=c,c++,objc --with-dwarf2 --enable-doc 
--disable-shared --disable-libada --disable-libssp --disable-nls 
--with-pkgversion='WinAVR 20081205' 
--with-bugurl='URL:http://sourceforge.net/tracker/?atid=520074&group_id=68108&func=browse'
Thread model: single
gcc version 4.3.2 (WinAVR 20081205)
COLLECT_GCC_OPTIONS='-mmcu=atmega8' '-S' '-v' '-Os' '-fno-unroll-loops' 
'-fno-unroll-all-loops' '-std=gnu99' '-fno-common' '-W' '-Wall' 
'-Wstrict-prototypes' '-DF_CPU=1000000' '-save-temps' '-fverbose-asm'
  e:/winavr-20081205/bin/../libexec/gcc/avr/4.3.2/cc1.exe -E -quiet -v 
-imultilib avr4 -iprefix e:\winavr-20081205\bin\../lib/gcc/avr/4.3.2/ 
-DF_CPU=1000000 countdown.c -mmcu=atmega8 -std=gnu99 -W -Wall 
-Wstrict-prototypes -fno-unroll-loops -fno-unroll-all-loops -fno-common 
-fverbose-asm -Os -fpch-preprocess -o countdown.i
ignoring nonexistent directory 
"e:/winavr-20081205/lib/gcc/../../avr/sys-include"
#include "..." search starts here:
#include <...> search starts here:
  e:\winavr-20081205\bin\../lib/gcc/avr/4.3.2/include
  e:\winavr-20081205\bin\../lib/gcc/avr/4.3.2/include-fixed
  e:/winavr-20081205/lib/gcc/../../lib/gcc/avr/4.3.2/include
  e:/winavr-20081205/lib/gcc/../../lib/gcc/avr/4.3.2/include-fixed
  e:/winavr-20081205/lib/gcc/../../avr/include
End of search list.
COLLECT_GCC_OPTIONS='-mmcu=atmega8' '-S' '-v' '-Os' '-fno-unroll-loops' 
'-fno-unroll-all-loops' '-std=gnu99' '-fno-common' '-W' '-Wall' 
'-Wstrict-prototypes' '-DF_CPU=1000000' '-save-temps' '-fverbose-asm'
  e:/winavr-20081205/bin/../libexec/gcc/avr/4.3.2/cc1.exe -fpreprocessed 
countdown.i -quiet -dumpbase countdown.c -mmcu=atmega8 -auxbase 
countdown -Os -W -Wall -Wstrict-prototypes -std=gnu99 -version 
-fno-unroll-loops -fno-unroll-all-loops -fno-common -fverbose-asm -o 
countdown.s
GNU C (WinAVR 20081205) version 4.3.2 (avr)
	compiled by GNU C version 3.4.5 (mingw-vista special r3), GMP version 
4.2.3, MPFR version 2.3.2.
GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=32702
Compiler executable checksum: 67867e0bb6a39ca5af7615e31f09b8c9
COMPILER_PATH=e:/winavr-20081205/bin/../libexec/gcc/avr/4.3.2/;e:/winavr-20081205/bin/../libexec/gcc/;e:/winavr-20081205/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/
LIBRARY_PATH=e:/winavr-20081205/bin/../lib/gcc/avr/4.3.2/avr4/;e:/winavr-20081205/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr4/;e:/winavr-20081205/bin/../lib/gcc/avr/4.3.2/;e:/winavr-20081205/bin/../lib/gcc/;e:/winavr-20081205/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/
COLLECT_GCC_OPTIONS='-mmcu=atmega8' '-S' '-v' '-Os' '-fno-unroll-loops' 
'-fno-unroll-all-loops' '-std=gnu99' '-fno-common' '-W' '-Wall' 
'-Wstrict-prototypes' '-DF_CPU=1000000' '-save-temps' '-fverbose-asm'
e:/WinAVR-20081205/bin/avr-gcc -mmcu=atmega8 -x assembler -c countdown.s

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: countdown.i
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20090124/87220d81/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: countdown.s
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20090124/87220d81/attachment-0001.ksh>


More information about the Gcc-help mailing list