public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sergio dot pokrovskij at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/38539]  New: inline-asm with labels does not compile at -O3
Date: Tue, 16 Dec 2008 05:11:00 -0000	[thread overview]
Message-ID: <bug-38539-17086@http.gcc.gnu.org/bugzilla/> (raw)

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 "<built-in>"
# 1 "<command line>"
# 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


             reply	other threads:[~2008-12-16  5:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-16  5:11 sergio dot pokrovskij at gmail dot com [this message]
2008-12-16  6:24 ` [Bug c/38539] " steven at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-38539-17086@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).