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/13473] New: cc1 segfault w/-march=pentium4


the code below (which i've reduced to a self-contained program with no 
#includes) results in a cc1 segfault when compiled with -march=pentium4, but 
there's no segfault when compiled -march=pentium3 (or without -march).

-dean

% cat xx.c
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;

#define CF (1<<0)
#define PF (1<<2)
#define AF (1<<4)
#define ZF (1<<6)
#define SF (1<<7)
#define OF (1<<11)

#define EFLAGS_BITS (CF|PF|AF|ZF|SF|OF)

void test16(uint16_t x, uint32_t eflags)
{
        uint16_t bsr_result;
        uint32_t bsr_eflags;
        uint16_t bsf_result;
        uint32_t bsf_eflags;

        __asm volatile(
                "\n     mov $0xa5a5,%0"
                "\n     pushf"
                "\n     pop %1"
                "\n     and %3,%1"
                "\n     or %4,%1"
                "\n     push %1"
                "\n     popf"
                "\n     bsrw %2,%0"
                "\n     pushf"
                "\n     pop %1"
                : "=&r" (bsr_result), "=&r" (bsr_eflags)
                : "r" (x), "i" (~EFLAGS_BITS), "r" (eflags));
        __asm volatile(
                "\n     mov $0xa5a5,%0"
                "\n     pushf"
                "\n     pop %1"
                "\n     and %3,%1"
                "\n     or %4,%1"
                "\n     push %1"
                "\n     popf"
                "\n     bsfw %2,%0"
                "\n     pushf"
                "\n     pop %1"
                : "=&r" (bsf_result), "=&r" (bsf_eflags)
                : "r" (x), "i" (~EFLAGS_BITS), "r" (eflags));
        printf("%08x %04x bsrw %02x %08x bsfw %02x %08x\n",
                x, eflags, bsr_result, bsr_eflags, bsf_result, bsf_eflags);
}
% gcc -v -std=c99 -g -Wall -O2 -march=pentium4 -c xx.c
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.3/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 --with-system-zlib --enable-nls --
without-included-gettext --enable-__cxa_atexit --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.3 20031206 (prerelease) (Debian)
 /usr/lib/gcc-lib/i486-linux/3.3.3/cc1 -quiet -v -D__GNUC__=3 -
D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3 xx.c -quiet -dumpbase xx.c -
march=pentium4 -auxbase xx -g -O2 -Wall -std=c99 -version -
o /home/dean/tmp/ccvkOl9w.s
GNU C version 3.3.3 20031206 (prerelease) (Debian) (i486-linux)
        compiled by GNU C version 3.3.3 20031206 (prerelease) (Debian).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/i486-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/i486-linux/3.3.3/include
 /usr/include
End of search list.
xx.c: In function `test16':
xx.c:46: warning: implicit declaration of function `printf'
gcc: Internal error: Segmentation fault (program cc1)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bugs,
please see /usr/share/doc/debian/bug-reporting.txt.

Exit 1

-- 
           Summary: cc1 segfault w/-march=pentium4
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dean-gcc at arctic dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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