[Bug c/58758] New: [4.8 REGRESSION] error: bp cannot be used in asm here

paulepanter at users dot sourceforge.net gcc-bugzilla@gcc.gnu.org
Wed Oct 16 21:51:00 GMT 2013


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

            Bug ID: 58758
           Summary: [4.8 REGRESSION] error: bp cannot be used in asm here
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: paulepanter at users dot sourceforge.net

Starting with GCC 4.8.x, there are reports from coreboot [1] and IPXE [2] that
gcc does not compile some files previously being compiled without problems by
gcc from, for example, GCC 4.7.3.

Here are the relevant parts from coreboot’s
`src/cpu/amd/car/post_cache_as_ram.c` [3].

$ more testeb.c
#include <stdio.h>

#define CONFIG_RAMTOP 0x200000
#define CONFIG_DCACHE_RAM_BASE 0xcc000
#define CONFIG_DCACHE_RAM_SIZE 0x4000

int main(void)
{
    printf("Copying data from cache to RAM -- switching to use RAM as stack...
");

    memcopy((void *)((CONFIG_RAMTOP)-CONFIG_DCACHE_RAM_SIZE), (void
*)CONFIG_DCACHE_RAM_BASE, CONFIG_DCACHE_RAM_SIZE); //inline

    __asm__ volatile (
        /* set new esp */ /* before CONFIG_RAMBASE */
        "subl   %0, %%esp\n\t"
        ::"a"( (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE)-
(CONFIG_RAMTOP) )
        /* discard all registers (eax is used for %0), so gcc redoes everything
           after the stack is moved */
        : "cc", "memory", "%ebx", "%ecx", "%edx", "%esi", "%edi", "%ebp"
    );
    printf("Done.\n");
}
$ gcc --verbose testeb.c
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc-4.8.real
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i486-linux-gnu/4.8/lto-wrapper
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.8.1-10'
--with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin
--with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
--enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-i386/jre
--enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-i386
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-i386
--with-arch-directory=i386 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-targets=all --enable-multiarch --with-arch-32=i586
--with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release
--build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.8.1 (Debian 4.8.1-10) 
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=i586'
 /usr/lib/gcc/i486-linux-gnu/4.8/cc1 -quiet -v -imultiarch i386-linux-gnu
testeb.c -quiet -dumpbase testeb.c -mtune=generic -march=i586 -auxbase testeb
-version -o /tmp/cc3rTPy8.s
GNU C (Debian 4.8.1-10) version 4.8.1 (i486-linux-gnu)
    compiled by GNU C version 4.8.1, GMP version 5.1.2, MPFR version 3.1.1-p2,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include/i386-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/i486-linux-gnu/4.8/../../../../i486-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i486-linux-gnu/4.8/include
 /usr/local/include
 /usr/lib/gcc/i486-linux-gnu/4.8/include-fixed
 /usr/include/i386-linux-gnu
 /usr/include
End of search list.
GNU C (Debian 4.8.1-10) version 4.8.1 (i486-linux-gnu)
    compiled by GNU C version 4.8.1, GMP version 5.1.2, MPFR version 3.1.1-p2,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 9410f42d7e8107336c1fb0157782c770
testeb.c: In function ‘main’:
testeb.c:22:1: error: bp cannot be used in asm here
 }
 ^

[1] http://review.coreboot.org/#/c/3930/
[2]
https://github.com/ipxe/ipxe/commit/238050dfd46e3c4a87329da1d48b4d8dde5af8a1
[3]
http://review.coreboot.org/gitweb?p=coreboot.git;a=blob;f=src/cpu/amd/car/post_cache_as_ram.c;h=eca7673df3ca5a579296e4d173233d9036488101;hb=HEAD#l122


More information about the Gcc-bugs mailing list