* [Bug c/52554] Variable called $1 causes invalid asm to be generated
2012-03-10 21:29 [Bug c/52554] New: Variable called $1 causes invalid asm to be generated rwxr-xr-x at gmx dot de
@ 2012-03-12 13:28 ` rguenth at gcc dot gnu.org
2012-03-12 14:22 ` schwab@linux-m68k.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-03-12 13:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52554
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |accepts-invalid
CC| |jsm28 at gcc dot gnu.org
Component|target |c
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-03-12 13:28:05 UTC ---
C does not allow an identifier to start with a dollar. But we even accept
the program with -std=c99 -pedantic-errors.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/52554] Variable called $1 causes invalid asm to be generated
2012-03-10 21:29 [Bug c/52554] New: Variable called $1 causes invalid asm to be generated rwxr-xr-x at gmx dot de
2012-03-12 13:28 ` [Bug c/52554] " rguenth at gcc dot gnu.org
@ 2012-03-12 14:22 ` schwab@linux-m68k.org
2012-03-13 17:20 ` rwxr-xr-x at gmx dot de
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: schwab@linux-m68k.org @ 2012-03-12 14:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52554
--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> 2012-03-12 14:22:00 UTC ---
6.4.2.1 says that an identifier may contain "other implementation-defined
characters".
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/52554] Variable called $1 causes invalid asm to be generated
2012-03-10 21:29 [Bug c/52554] New: Variable called $1 causes invalid asm to be generated rwxr-xr-x at gmx dot de
2012-03-12 13:28 ` [Bug c/52554] " rguenth at gcc dot gnu.org
2012-03-12 14:22 ` schwab@linux-m68k.org
@ 2012-03-13 17:20 ` rwxr-xr-x at gmx dot de
2012-03-28 6:09 ` [Bug target/52554] " fw at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rwxr-xr-x at gmx dot de @ 2012-03-13 17:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52554
Lukas Mai <rwxr-xr-x at gmx dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
--- Comment #3 from Lukas Mai <rwxr-xr-x at gmx dot de> 2012-03-13 16:57:38 UTC ---
It gets better:
int $42 = 0;
int main(void) {
return $42;
}
% gcc try.c; ./a.out; echo $?
42
% gcc -O2 try.c; ./a.out; echo $?
42
% gcc -flto try.c; ./a.out; echo $?
/tmp/cc5Gwdzb.s: Assembler messages:
/tmp/cc5Gwdzb.s:13: Error: junk `.1988' after expression
lto-wrapper: gcc returned 1 exit status
/usr/bin/ld: lto-wrapper failed
collect2: ld returned 1 exit status
zsh: no such file or directory: ./a.out
127
% gcc -O -flto try.c; ./a.out; echo $?
0
So compiling this program either
1) generates bogus code,
2) causes assembler syntax errors, or
3) compiles correctly,
depending on which compiler flags are used.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/52554] Variable called $1 causes invalid asm to be generated
2012-03-10 21:29 [Bug c/52554] New: Variable called $1 causes invalid asm to be generated rwxr-xr-x at gmx dot de
` (2 preceding siblings ...)
2012-03-13 17:20 ` rwxr-xr-x at gmx dot de
@ 2012-03-28 6:09 ` fw at gcc dot gnu.org
2012-03-28 9:45 ` webmaster at openhardware dot de
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: fw at gcc dot gnu.org @ 2012-03-28 6:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52554
Florian Weimer <fw at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|accepts-invalid, wrong-code |
Status|UNCONFIRMED |RESOLVED
CC| |fw at gcc dot gnu.org
Resolution| |INVALID
--- Comment #4 from Florian Weimer <fw at gcc dot gnu.org> 2012-03-28 05:38:56 UTC ---
Some platforms (such as VMS) support $ in identifiers, similar to _. It seems
that your assembler doesn't:
http://gcc.gnu.org/onlinedocs/gcc/Dollar-Signs.html
(If you compile with -pedantic, you'll get a warning.)
This is not much different from platforms where global symbols are
case-insensitive or severely limited in length.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/52554] Variable called $1 causes invalid asm to be generated
2012-03-10 21:29 [Bug c/52554] New: Variable called $1 causes invalid asm to be generated rwxr-xr-x at gmx dot de
` (3 preceding siblings ...)
2012-03-28 6:09 ` [Bug target/52554] " fw at gcc dot gnu.org
@ 2012-03-28 9:45 ` webmaster at openhardware dot de
2012-03-29 11:44 ` rwxr-xr-x at gmx dot de
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: webmaster at openhardware dot de @ 2012-03-28 9:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52554
webmaster at openhardware dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |webmaster at openhardware
| |dot de
--- Comment #5 from webmaster at openhardware dot de 2012-03-28 09:36:47 UTC ---
Hi, I tested the 42 it mit older gcc, and it behaved better:
gcc --version
gcc (GCC) 4.2.4 (Gentoo 4.2.4 p1.0)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
cat >try.c
int $42 = 0;
int main(void) {
return $42;
}
gcc try.c; ./a.out; echo $?
/tmp/ccY61UFa.s: Assembler messages:
/tmp/ccY61UFa.s:18: Error: junk `(%rip)' after expression
bash: ./a.out: No such file or directory
127
gcc -O2 try.c; ./a.out; echo $?
/tmp/ccXk0zWe.s: Assembler messages:
/tmp/ccXk0zWe.s:8: Error: junk `(%rip)' after expression
bash: ./a.out: No such file or directory
127
But I would expect an syntax error thrown by gcc here.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/52554] Variable called $1 causes invalid asm to be generated
2012-03-10 21:29 [Bug c/52554] New: Variable called $1 causes invalid asm to be generated rwxr-xr-x at gmx dot de
` (4 preceding siblings ...)
2012-03-28 9:45 ` webmaster at openhardware dot de
@ 2012-03-29 11:44 ` rwxr-xr-x at gmx dot de
2012-03-29 13:42 ` webmaster at openhardware dot de
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rwxr-xr-x at gmx dot de @ 2012-03-29 11:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52554
--- Comment #6 from Lukas Mai <rwxr-xr-x at gmx dot de> 2012-03-29 11:26:12 UTC ---
>From the gcc documentation:
| However, dollar signs in identifiers are not supported on a few target
| machines, typically because the target assembler does not allow them.
That's nice, but:
| * If the compiler produces invalid assembly code, for any input
| whatever (except an `asm' statement), that is a compiler bug,
| unless the compiler reports errors (not just warnings) which would
| ordinarily prevent the assembler from being run.
| * If the compiler produces valid assembly code that does not
| correctly execute the input source code, that is a compiler bug.
If my target assembler (gas) doesn't allow them, you must produce an error.
Making up asm syntax and handing it to the assembler is not an option.
Alternatively, change the documentation to the effect that invalid assembly
code and valid (but semantically wrong) assembly code aren't necessarily
compiler bugs.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/52554] Variable called $1 causes invalid asm to be generated
2012-03-10 21:29 [Bug c/52554] New: Variable called $1 causes invalid asm to be generated rwxr-xr-x at gmx dot de
` (5 preceding siblings ...)
2012-03-29 11:44 ` rwxr-xr-x at gmx dot de
@ 2012-03-29 13:42 ` webmaster at openhardware dot de
2012-04-04 3:38 ` rwxr-xr-x at gmx dot de
2021-07-29 23:46 ` pinskia at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: webmaster at openhardware dot de @ 2012-03-29 13:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52554
--- Comment #7 from openhardware <webmaster at openhardware dot de> 2012-03-29 13:40:14 UTC ---
"Alternatively, change the documentation to the effect that invalid assembly
code and valid (but semantically wrong) assembly code aren't necessarily
compiler bugs."
Its a "windows-approach"
Not a bug but a feature.
Intel calls their errata sheets for silicon bugs "specification update"
That's really sweet, so whats a spec for?
Please fix it in gcc to be a syntax error, or at least throw a warning like
"Illegal variable name found in line # might cause illegal assembly code and
thus unpredictable results!".
This would be the best, so if one has a special "geeks-assembler",
that allows a $ to be send to the assembler, so one could use it, for what
special geeks-reason ever (may be, to have a hack to illegally allign a
variable in memory between the rails of the processors word length in order to
smear it into two registers [highbyte of lower register and lowbyte of upper
register] of some IO or to do some other dirty stuff directly from hell)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/52554] Variable called $1 causes invalid asm to be generated
2012-03-10 21:29 [Bug c/52554] New: Variable called $1 causes invalid asm to be generated rwxr-xr-x at gmx dot de
` (6 preceding siblings ...)
2012-03-29 13:42 ` webmaster at openhardware dot de
@ 2012-04-04 3:38 ` rwxr-xr-x at gmx dot de
2021-07-29 23:46 ` pinskia at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: rwxr-xr-x at gmx dot de @ 2012-04-04 3:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52554
Lukas Mai <rwxr-xr-x at gmx dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
--- Comment #8 from Lukas Mai <rwxr-xr-x at gmx dot de> 2012-04-04 03:37:48 UTC ---
According to the documentation this is a valid bug. See
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52554#c6.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/52554] Variable called $1 causes invalid asm to be generated
2012-03-10 21:29 [Bug c/52554] New: Variable called $1 causes invalid asm to be generated rwxr-xr-x at gmx dot de
` (7 preceding siblings ...)
2012-04-04 3:38 ` rwxr-xr-x at gmx dot de
@ 2021-07-29 23:46 ` pinskia at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-29 23:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52554
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 31782.
*** This bug has been marked as a duplicate of bug 31782 ***
^ permalink raw reply [flat|nested] 10+ messages in thread