[Bug c/22599] New: Segfault with invalid asm usage

schodet at efrei dot fr gcc-bugzilla@gcc.gnu.org
Thu Jul 21 20:14:00 GMT 2005


I triggered a segfault on a i386 target with a piece of code intented to be
compiled for avr target. I get a more descriptive message by modifiying the code
a little bit. Here is the source, messages and versions :

typedef unsigned long uint32_t;
typedef unsigned char uint8_t;

int
main (void)
{
    volatile uint32_t d = 0;
    volatile uint8_t b0 = 1, b1 = 2, b2 = 3, b3 = 4;
    asm ("mov %C0, %3"  "\r\n"
         "mov %D0, %4"  "\r\n"
         : "=d" (d) : "r" (b0), "r" (b1), "r" (b2), "r" (b3));
    return 0;
}

/*
cc -g -Wall -W -Wundef -O2  -I../../.. -I../../../common -MMD -include
avrconfig.h   t.c   -o t
t.c: In function `main':
t.c:13: internal compiler error: Segmentation fault
*/

/* Or with a modified version :

typedef unsigned long uint32_t;
typedef unsigned char uint8_t;

int
main (void)
{
    volatile uint32_t d = 0;
    volatile uint8_t b0 = 1, b1 = 2, b2 = 3, b3 = 4;
    asm ("mov %D0, %4"  "\r\n"
         : "=d" (d) : "r" (b0), "r" (b1), "r" (b2), "r" (b3));
    return 0;
}
*/

/*
t.c:15: internal compiler error: in print_operand, at config/i386/i386.c:7003
*/

/* gcc -v
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.5/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared
--enable-__cxa_atexit --with-system-zlib --enable-nls --without-included-gettext
--enable-clocale=gnu --enable-debug --enable-java-gc=boehm
--enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.5 (Debian 1:3.3.5-13)
*/

-- 
           Summary: Segfault with invalid asm usage
           Product: gcc
           Version: 3.3.5
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schodet at efrei dot fr
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i486-linux
  GCC host triplet: i486-linux
GCC target triplet: i486-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22599



More information about the Gcc-bugs mailing list