public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/52554] New: Variable called $1 causes invalid asm to be generated
@ 2012-03-10 21:29 rwxr-xr-x at gmx dot de
  2012-03-12 13:28 ` [Bug c/52554] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: rwxr-xr-x at gmx dot de @ 2012-03-10 21:29 UTC (permalink / raw)
  To: gcc-bugs

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)


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-07-29 23:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
2012-04-04  3:38 ` rwxr-xr-x at gmx dot de
2021-07-29 23:46 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).