http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47071
Summary: Using -ffunction-sections produces bad assembler on my testcase Product: gcc Version: 4.5.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: inline-asm AssignedTo: unassig...@gcc.gnu.org ReportedBy: alex.wa...@gmail.com Host: x86_64-unknown-linux-gnu Target: x86_64-unknown-linux-gnu Build: x86_64-unknown-linux-gnu Created attachment 22854 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22854 (almost) minimal testcase This bug was found when trying to compile qt 4.7.1 for i386 target. The compiler produces assembler file, but the assembler does not process it, so something about code generator is broken... So, the details: 1) the exact version of GCC: $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-unknown-linux-gnu/4.5.2/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-4.5.2/configure --enable-lto --prefix=/usr --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-c99 --enable-long-long --enable-clocale=gnu --disable-libstdcxx-pch --enable-multilib --enable-languages=c,c++ --enable-gold Thread model: posix gcc version 4.5.2 (GCC) 2) the system type: 64/32bit linux, cross-linuxfromscratch 3) the options given when GCC was configured/built - see 1) 4) the complete command line that triggers the bug: $ gcc -m32 -ffunction-sections -c testcase.cpp 5) the compiler output (error messages, warnings, etc.); /tmp/ccEuz6j3.s: Assembler messages: /tmp/ccEuz6j3.s:37: Error: CFI instruction used without previous .cfi_startproc /tmp/ccEuz6j3.s:38: Error: CFI instruction used without previous .cfi_startproc /tmp/ccEuz6j3.s:40: Error: .cfi_endproc without corresponding .cfi_startproc /tmp/ccEuz6j3.s:44: Error: open CFI at the end of file; missing .cfi_endproc directive 6) the preprocessed file (*.i*) that triggers the bug: attached non-preprocessed file, but it has absolutely no dependencies. Additional information: - if you omit -ffunction-sections parameter, it compiles fine - if you comment the ".text\n" line in the testcase, it compiles fine even with -ffunction-sections - if you comment first, second and the last line in the testcase, it compiles fine (the asm directive is then not put inside a function, but it's outside of the function). - since there's no COMPILER error, but the assembler error, just in case that the generated assembly is proper and it's my binutils problem: $ as -V GNU assembler version 2.21 (x86_64-unknown-linux-gnu) using BFD version (GNU Binutils) 2.21 This is my first bug report, I hope that I'm doing it right (the host/target/build triplet that I've filled above is for the options with which the compiler was built, right?)