From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26215 invoked by alias); 16 Dec 2008 05:11:50 -0000 Received: (qmail 24459 invoked by uid 48); 16 Dec 2008 05:10:23 -0000 Date: Tue, 16 Dec 2008 05:11:00 -0000 Subject: [Bug c/38539] New: inline-asm with labels does not compile at -O3 X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "sergio dot pokrovskij at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-12/txt/msg01589.txt.bz2 When -O3 key is specified, gcc inlines functions with inline asm without dismangling the labels in these asm fragments. This occurs in all flavours of the asm pieces: CONSTRAIN, MASM and plain string: % cat gas-label.c f() { #ifdef CONSTRAIN asm volatile ("lab:mov %0, %0"::"r"(1.5F)); #elif defined(MASM) asm{mov eax, 0x3fc00; lab: mov eax, eax} #else asm(" movl $0x3fc, %eax \n" "lab: mov %eax, %eax"); #endif } main() { f(); f(); } % % gcc -pedantic gas-label.c % gcc -DCONSTRAIN gas-label.c -finline-functions % gcc -DCONSTRAIN gas-label.c -O3 /tmp/ccd4XxX8.s: Assembler messages: /tmp/ccd4XxX8.s:28: Error: symbol `lab' is already defined /tmp/ccd4XxX8.s:29: Error: symbol `lab' is already defined % % gcc -v -save-temps -DCONSTRAIN gas-label.c -O3 Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc-4.1.0/configure --prefix=/nfs/ins/proj/icl/qa/QA_verification/gnu/local --disable-nls --enable-languages=c,c++,fortran Thread model: posix gcc version 4.1.0 /nfs/ins/proj/icl/qa/QA_verification/gnu/local/libexec/gcc/i686-pc-linux-gnu/4.1.0/cc1 -E -quiet -v -DCONSTRAIN gas-label.c -mtune=pentiumpro -O3 -fpch-preprocess -o gas-label.i ignoring nonexistent directory "/nfs/ins/proj/icl/qa/QA_verification/gnu/local/lib/gcc/i686-pc-linux-gnu/4.1.0/../../../../i686-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /nfs/ins/proj/icl/qa/QA_verification/gnu/local/include /nfs/ins/proj/icl/qa/QA_verification/gnu/local/lib/gcc/i686-pc-linux-gnu/4.1.0/include /usr/include End of search list. /nfs/ins/proj/icl/qa/QA_verification/gnu/local/libexec/gcc/i686-pc-linux-gnu/4.1.0/cc1 -fpreprocessed gas-label.i -quiet -dumpbase gas-label.c -mtune=pentiumpro -auxbase gas-label -O3 -version -o gas-label.s GNU C version 4.1.0 (i686-pc-linux-gnu) compiled by GNU C version 4.1.0. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 9c14cefcbb08ee412959d25f87b03831 /nfs/ins/proj/icl/qa/QA_verification/gnu/local/lib/gcc/i686-pc-linux-gnu/4.1.0/../../../../i686-pc-linux-gnu/bin/as -V -Qy -o gas-label.o gas-label.s GNU assembler version 2.16 (i686-pc-linux-gnu) using BFD version 2.16 gas-label.s: Assembler messages: gas-label.s:28: Error: symbol `lab' is already defined gas-label.s:29: Error: symbol `lab' is already defined % % % cat gas-label.i # 1 "gas-label.c" # 1 "" # 1 "" # 1 "gas-label.c" f() { asm volatile ("lab:mov %0, %0"::"r"(1.5F)); } main() { f(); f(); } % -- Summary: inline-asm with labels does not compile at -O3 Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sergio dot pokrovskij at gmail dot com GCC host triplet: i386 GNU/Linux GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38539