This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/52554] Variable called $1 causes invalid asm to be generated
- From: "rwxr-xr-x at gmx dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 13 Mar 2012 16:57:38 +0000
- Subject: [Bug c/52554] Variable called $1 causes invalid asm to be generated
- Auto-submitted: auto-generated
- References: <bug-52554-4@http.gcc.gnu.org/bugzilla/>
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.