From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27917 invoked by alias); 10 Mar 2012 21:29:22 -0000 Received: (qmail 27909 invoked by uid 22791); 10 Mar 2012 21:29:21 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_CX,TW_RW,TW_WX X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 10 Mar 2012 21:29:09 +0000 From: "rwxr-xr-x at gmx dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/52554] New: Variable called $1 causes invalid asm to be generated Date: Sat, 10 Mar 2012 21:29:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: rwxr-xr-x at gmx dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-03/txt/msg00794.txt.bz2 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: unassigned@gcc.gnu.org ReportedBy: rwxr-xr-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)