http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52554
Bug #: 52554 Summary: Variable called $1 causes invalid asm to be generated Classification: Unclassified Product: gcc Version: 4.6.3 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: rwxr-x...@gmx.de The following code is somewhat silly, but gcc should either compile it correctly or print an error message, not generate invalid asm. Here's my code: int $1 = -1; int main(void) { $1++; return $1; } Here's my command: % gcc try.c /tmp/ccVyjhob.s: Assembler messages: /tmp/ccVyjhob.s:22: Error: operand type mismatch for `mov' Here's my asm: .file "try.c" .globl $1 .data .align 4 .type $1, @object .size $1, 4 $1: .long -1 .text .globl main .type main, @function main: .LFB0: .cfi_startproc pushl %ebp .cfi_def_cfa_offset 8 .cfi_offset 5, -8 movl %esp, %ebp .cfi_def_cfa_register 5 movl $1, %eax incl %eax movl %eax, $1 movl $1, %eax popl %ebp .cfi_def_cfa 4, 4 .cfi_restore 5 ret .cfi_endproc .LFE0: .size main, .-main .ident "GCC: (GNU) 4.6.3" .section .note.GNU-stack,"",@progbits Here's my specs: % gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/home/mauke/usr/local/libexec/gcc/i686-pc-linux-gnu/4.6.3/lto-wrapper Target: i686-pc-linux-gnu Configured with: ../gcc-4.6.3/configure --prefix=/home/mauke/usr/local --with-arch=native --with-tune=native --enable-__cxa_atexit --disable-nls --enable-languages=c,c++,go Thread model: posix gcc version 4.6.3 (GCC)