This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/52554] Variable called $1 causes invalid asm to be generated


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]