[Bug c++/13531] New: __builtin_apply compilation error for -march=i686 and greater

lowzl at hotmail dot com gcc-bugzilla@gcc.gnu.org
Wed Dec 31 10:36:00 GMT 2003


I do not know exactly what triggers this bug, however, I can repeatedly cause
it, for -march=i686 and greater, for Linux and Cygwin.

My Linux GCC was configured with:                              
 /var/tmp/portage/gcc-3.2.3-r3/work/gcc-3.2.3/configure --prefix=/usr
--bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.2
--includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.2
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.2/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.2/info --enable-shared
--host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --with-system-zlib
--enable-languages=c,c++,f77,objc,java --enable-threads=posix --enable-long-long
--disable-checking --enable-cstdio=stdio --enable-clocale=generic
--enable-__cxa_atexit --enable-version-specific-runtime-libs
--with-gxx-include-dir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/include/g++-v3
--with-local-prefix=/usr/local --enable-shared --enable-nls
--without-included-gettext

I use the stock Cygwin GCC build.

This is the (generated) code in question:

        .loc 1 60 0
        movl    -20(%ebp), %eax
        movl    (%eax), %ecx
        movl    %esp, %esi
        subl    $32, %esp
        leal    8(%esp), %edx ### Should be leal (%esp), %edx or movl %esp, %edx
        movl    (%ecx), %eax
        movl    %eax, (%edx)
        movl    4(%ecx), %eax
        movl    %eax, 4(%edx)
        movl    8(%ecx), %eax
        movl    %eax, 8(%edx)
        movl    12(%ecx), %eax
        movl    %eax, 12(%edx)
        movl    16(%ecx), %eax
        movl    %eax, 16(%edx)
        movl    20(%ecx), %eax
        movl    %eax, 20(%edx)
        movl    24(%ecx), %eax
        movl    %eax, 24(%edx)
        movl    28(%ecx), %eax
        movl    %eax, 28(%edx)
        movl    -20(%ebp), %eax
        addl    $4, %eax
        movl    (%eax), %eax
        movl    -20(%ebp), %edx
        addl    $8, %edx
        movl    (%edx), %edx
        movl    -20(%ebp), %ecx
        addl    $12, %ecx
        movl    (%ecx), %ecx
        movl    -16(%ebp), %ebx
        call    *%ebx
        fstp    %st(1)
        movl    %eax, -168(%ebp)
        movl    %edx, -164(%ebp)
        fstpt   -152(%ebp)
        movl    %esi, %esp
        leal    -168(%ebp), %eax
        movl    %eax, -24(%ebp)

Because of this bug, the arguments are copied offset by 2 positions to the
right, i.e. old arg 1 becomes new arg 3, old arg 2 becomes new arg 4 etc.

I have tested this on 3 different builds of the same GCC source code (on 3
different i686-pc-linux-gnu machines), all produce this error at -march=i686 or
greater. Using -march=i586 and lower does not trigger this bug.

I have also tested this code on the September 2003 update of the Apple Developer
Tools - it compiles correctly there.

-- 
           Summary: __builtin_apply compilation error for -march=i686 and
                    greater
           Product: gcc
           Version: 3.2.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lowzl at hotmail dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu ; i686-pc-cygwin
  GCC host triplet: i686-pc-linux-gnu ; i686-pc-cygwin
GCC target triplet: i686-pc-linux-gnu ; i686-pc-cygwin


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



More information about the Gcc-bugs mailing list