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 regression/44392] New: libgcc compile with --enable-target-optspace (-Os) causes recursion in __bswapsi2


When using --enable-target-optspace on gcc 4.5 function __bswapsi2 in libgcc
generates call to itself which causes infinite recursion. Here is disassembly.

$ arm-none-linux-uclibcgnueabi-objdump -d _bswapsi2_s.o 

_bswapsi2_s.o:     file format elf32-littlearm


Disassembly of section .text:

00000000 <__bswapsi2>:
   0:   e92d4008        push    {r3, lr}
   4:   ebfffffe        bl      0 <__bswapsi2>
   8:   e8bd8008        pop     {r3, pc}


This does not happen on -O1, O2 or O3 where is computes the swapping
and does not call the libgcc function. With gcc 4.4 it does not call
libgcc function even at -Os. I have only tested it on arm architecture.

Here is little program which demonstrates it

typedef signed int SItype;
SItype
__bswapsi2 (SItype u)
{
  return ((((u) & 0xff000000) >> 24)
          | (((u) & 0x00ff0000) >>  8)
          | (((u) & 0x0000ff00) <<  8)
          | (((u) & 0x000000ff) << 24));
}


here is how the gcc was built

/scratch/oe/work/armv5te-oe-linux-gnueabi/gcc-cross-intermediate-4.5-r0+svnr160043/gcc-4.5/build.x86_64-linux.arm-oe-linux-gnueabi/gcc/xgcc
-v
Using built-in specs.
COLLECT_GCC=/scratch/oe/work/armv5te-oe-linux-gnueabi/gcc-cross-intermediate-4.5-r0+svnr160043/gcc-4.5/build.x86_64-linux.arm-oe-linux-gnueabi/gcc/xgcc
Target: arm-oe-linux-gnueabi
Configured with:
/scratch/oe/work/armv5te-oe-linux-gnueabi/gcc-cross-intermediate-4.5-r0+svnr160043/gcc-4.5/configure
--build=x86_64-linux --host=x86_64-linux --target=arm-oe-linux-gnueabi
--prefix=/scratch/oe/cross/armv5te --exec_prefix=/scratch/oe/cross/armv5te
--bindir=/scratch/oe/cross/armv5te/bin --sbindir=/scratch/oe/cross/armv5te/bin
--libexecdir=/scratch/oe/cross/armv5te/libexec
--datadir=/scratch/oe/cross/armv5te/share
--sysconfdir=/scratch/oe/cross/armv5te/etc
--sharedstatedir=/scratch/oe/cross/armv5te/com
--localstatedir=/scratch/oe/cross/armv5te/var
--libdir=/scratch/oe/cross/armv5te/lib
--includedir=/scratch/oe/cross/armv5te/include
--oldincludedir=/scratch/oe/cross/armv5te/include
--infodir=/scratch/oe/cross/armv5te/share/info
--mandir=/scratch/oe/cross/armv5te/share/man
--with-local-prefix=/scratch/oe/sysroots/armv5te-oe-linux-gnueabi/usr
--enable-shared --disable-multilib --disable-threads --enable-languages=c
--program-prefix=arm-oe-linux-gnueabi-
--with-sysroot=/scratch/oe/sysroots/armv5te-oe-linux-gnueabi
--with-build-sysroot=/scratch/oe/sysroots/armv5te-oe-linux-gnueabi
--enable-target-optspace --disable-libmudflap --disable-libgomp
--disable-libssp --with-float=soft --program-prefix=arm-oe-linux-gnueabi-
--enable-__cxa_atexit
Thread model: single
gcc version 4.5.1 20100530 (prerelease) (GCC)


-- 
           Summary: libgcc compile with --enable-target-optspace (-Os)
                    causes recursion in __bswapsi2
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: regression
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: raj dot khem at gmail dot com
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: arm-oe-linux-gnueabi


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


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