public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/31782] New: Invalid assembly code on initial dollar signs
@ 2007-05-02 2:20 truedfx at gentoo dot org
2007-05-02 2:22 ` [Bug c/31782] " truedfx at gentoo dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: truedfx at gentoo dot org @ 2007-05-02 2:20 UTC (permalink / raw)
To: gcc-bugs
Hi,
This code compiles fine with gcc:
void a$() {}
int main() { a$(); }
This generates invalid assembly code:
void $() {}
int main() { $(); }
To gas, an initial $ is not allowed in an identifier, but to gcc, it is, so gcc
can't simply copy the function name to the assembly output, unless $ also
becomes an invalid identifier in C.
The code can, of course, compile successfully with -fleading-underscore.
--
Summary: Invalid assembly code on initial dollar signs
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: truedfx at gentoo dot org
GCC host triplet: x86_64-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31782
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/31782] Invalid assembly code on initial dollar signs
2007-05-02 2:20 [Bug c/31782] New: Invalid assembly code on initial dollar signs truedfx at gentoo dot org
@ 2007-05-02 2:22 ` truedfx at gentoo dot org
2007-05-02 2:33 ` [Bug target/31782] " pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: truedfx at gentoo dot org @ 2007-05-02 2:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from truedfx at gentoo dot org 2007-05-02 03:21 -------
Sorry, forgot to mention, I'm using gcc 4.1.2 with binutils 2.17, and I also
tried gcc 3.3.6 with binutils 2.16.1, which behaves the same for me.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31782
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/31782] Invalid assembly code on initial dollar signs
2007-05-02 2:20 [Bug c/31782] New: Invalid assembly code on initial dollar signs truedfx at gentoo dot org
2007-05-02 2:22 ` [Bug c/31782] " truedfx at gentoo dot org
@ 2007-05-02 2:33 ` pinskia at gcc dot gnu dot org
2007-05-02 4:58 ` truedfx at gentoo dot org
2007-05-02 11:58 ` joseph at codesourcery dot com
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-05-02 2:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2007-05-02 03:33 -------
> unless $ also becomes an invalid identifier in C.
Well read:
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Dollar-Signs.html
it is can be but does not have to be.
This works for me targetting spu-elf and powerpc64-linux-gnu (with -m32 and
-m64) so this is a target issue. Really I think this is a bug in binutils for
i386/x86_64 (I can reproduce it there).
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c |target
GCC host triplet|x86_64-pc-linux-gnu |
GCC target triplet| |x86_64-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31782
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/31782] Invalid assembly code on initial dollar signs
2007-05-02 2:20 [Bug c/31782] New: Invalid assembly code on initial dollar signs truedfx at gentoo dot org
2007-05-02 2:22 ` [Bug c/31782] " truedfx at gentoo dot org
2007-05-02 2:33 ` [Bug target/31782] " pinskia at gcc dot gnu dot org
@ 2007-05-02 4:58 ` truedfx at gentoo dot org
2007-05-02 11:58 ` joseph at codesourcery dot com
3 siblings, 0 replies; 5+ messages in thread
From: truedfx at gentoo dot org @ 2007-05-02 4:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from truedfx at gentoo dot org 2007-05-02 05:58 -------
Thanks for the link. I don't see how GAS could be fixed, though. How would the
assembler tell the difference between $0 the constant and $0 the identifier?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31782
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/31782] Invalid assembly code on initial dollar signs
2007-05-02 2:20 [Bug c/31782] New: Invalid assembly code on initial dollar signs truedfx at gentoo dot org
` (2 preceding siblings ...)
2007-05-02 4:58 ` truedfx at gentoo dot org
@ 2007-05-02 11:58 ` joseph at codesourcery dot com
3 siblings, 0 replies; 5+ messages in thread
From: joseph at codesourcery dot com @ 2007-05-02 11:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from joseph at codesourcery dot com 2007-05-02 12:58 -------
Subject: Re: Invalid assembly code on initial dollar signs
On Wed, 2 May 2007, truedfx at gentoo dot org wrote:
> Thanks for the link. I don't see how GAS could be fixed, though. How would the
> assembler tell the difference between $0 the constant and $0 the identifier?
ELF supports arbitrary (possibly empty) sequences of non-NUL bytes as
symbol names. GAS should, in principle, provide an escaping mechanism for
assembly files to represent all such names. GCC should use that escaping
mechanism as required. (It's arguable whether such escaping should be
applied to asm names given to variables or whether it's the user's
responsibility to include the escaping in the string passed to asm in that
case.)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31782
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-05-02 11:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-02 2:20 [Bug c/31782] New: Invalid assembly code on initial dollar signs truedfx at gentoo dot org
2007-05-02 2:22 ` [Bug c/31782] " truedfx at gentoo dot org
2007-05-02 2:33 ` [Bug target/31782] " pinskia at gcc dot gnu dot org
2007-05-02 4:58 ` truedfx at gentoo dot org
2007-05-02 11:58 ` joseph at codesourcery dot com
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).