https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65932

            Bug ID: 65932
           Summary: [5.1 Regression] Linux-3.10.75 on arm926ej-s does not
                    boot due to wrong code generation
           Product: gcc
           Version: 5.1.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: christian.eggers at kathrein dot de
  Target Milestone: ---

Created attachment 35424
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35424&action=edit
Preprocessed source

gcc version: 5.1.0 / 5.1.1 (current git snapshot)

host : x86_64_suse_linux (13.1)

target: arm-arm926ejs-linux-gnueabi

Configured with:
/home/eggers/Projekte/cds/repos/software/tools/toolchain/src/gcc-gcc-5-branch-1e71966/configure
--prefix=/home/eggers/Projekte/cds/repos/software/tools/toolchain/build/arm-arm926ejs-linux-gnueabi/arm-arm926ejs-linux-gnueabi
--with-pkgversion='Kathrein CDS 15278' --target=arm-arm926ejs-linux-gnueabi
--disable-multilib
--mandir=/home/eggers/Projekte/cds/repos/software/tools/toolchain/build/arm-arm926ejs-linux-gnueabi/arm-arm926ejs-linux-gnueabi/share/man
--infodir=/home/eggers/Projekte/cds/repos/software/tools/toolchain/build/arm-arm926ejs-linux-gnueabi/arm-arm926ejs-linux-gnueabi/share/info
--with-gmp=/home/eggers/Projekte/cds/repos/software/tools/toolchain/build/install
--with-mpfr=/home/eggers/Projekte/cds/repos/software/tools/toolchain/build/install
--with-mpc=/home/eggers/Projekte/cds/repos/software/tools/toolchain/build/install
--with-isl=/home/eggers/Projekte/cds/repos/software/tools/toolchain/build/install
--with-sysroot=/home/eggers/Projekte/cds/repos/software/tools/toolchain/build/arm-arm926ejs-linux-gnueabi/arm-arm926ejs-linux-gnueabi/sys-root
--disable-nls
--with-slibdir=/home/eggers/Projekte/cds/repos/software/tools/toolchain/build/arm-arm926ejs-linux-gnueabi/arm-arm926ejs-linux-gnueabi/sys-root/lib
--with-gxx-include-dir=/home/eggers/Projekte/cds/repos/software/tools/toolchain/build/arm-arm926ejs-linux-gnueabi/arm-arm926ejs-linux-gnueabi/sys-root/usr/include/c++/gcc-5-branch-1e71966
--enable-shared --enable-__cxa_atexit --enable-c99 --enable-threads=posix
--disable-install-libiberty --with-system-zlib --with-cpu=arm926ej-s
--with-float=soft --with-mode=arm --enable-languages=c,c++ --enable-long-long

command line: arm-arm926ejs-linux-gnueabi-gcc -Wp,-MD,lib/.vsprintf.o.d 
-nostdinc -isystem
/home/eggers/Projekte/cds/repos/software/tools/toolchain/build/arm-arm926ejs-linux-gnueabi/arm-arm926ejs-linux-gnueabi/lib64/gcc/arm-arm926ejs-linux-gnueabi/5.1.0/include
-I/home/eggers/Projekte/cds/repos/software/cts/common/platform_linux/external/kernel/linux/linux-3.10/arch/arm/include
-Iarch/arm/include/generated 
-I/home/eggers/Projekte/cds/repos/software/cts/common/platform_linux/external/kernel/linux/linux-3.10/include
-Iinclude
-I/home/eggers/Projekte/cds/repos/software/cts/common/platform_linux/external/kernel/linux/linux-3.10/arch/arm/include/uapi
-Iarch/arm/include/generated/uapi
-I/home/eggers/Projekte/cds/repos/software/cts/common/platform_linux/external/kernel/linux/linux-3.10/include/uapi
-Iinclude/generated/uapi -include
/home/eggers/Projekte/cds/repos/software/cts/common/platform_linux/external/kernel/linux/linux-3.10/include/linux/kconfig.h

-I/home/eggers/Projekte/cds/repos/software/cts/common/platform_linux/external/kernel/linux/linux-3.10/lib
-Ilib -D__KERNEL__ -mlittle-endian  
-I/home/eggers/Projekte/cds/repos/software/cts/common/platform_linux/external/kernel/linux/linux-3.10/arch/arm/mach-at91/include
-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -Werror-implicit-function-declaration -Wno-format-security
-fno-delete-null-pointer-checks -Os -Wno-maybe-uninitialized
-fno-dwarf2-cfi-asm -mabi=aapcs-linux -mno-thumb-interwork -funwind-tables
-marm -D__LINUX_ARM_ARCH__=5 -march=armv5te -mtune=arm9tdmi -msoft-float -Uarm
-Wframe-larger-than=1024 -fno-stack-protector -Wno-unused-but-set-variable
-fomit-frame-pointer -fno-var-tracking-assignments -g
-fno-inline-functions-called-once -Wdeclaration-after-statement
-Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO   
-D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(vsprintf)" 
-D"KBUILD_MODNAME=KBUILD_STR(vsprintf)" -c -o lib/vsprintf.o
/home/eggers/Projekte/cds/repos/software/cts/common/platform_linux/external/kernel/linux/linux-3.10/lib/vsprintf.c

linux-3.10.75 compiled with gcc-4.9.2  --> running
same kernel compiled with gcc-5.1.0 / gcc-5.1.1 (git snapshot) --> NOT running

Observations

Function string() (part of vsnprintf()) in lib/vsprintf.c is not compiled
correctly:

     f5c:       e1dd51f8        ldrsh   r5, [sp, #24]

[...] 
# r5 = 0xFFFF FFFF
     f70:       e2453001        sub     r3, r5, #1
# r3 = 0xFFFF FFFE
     f74:       e1a03803        lsl     r3, r3, #16
# r3 = 0xFFFE 0000
                while (len < spec.field_width--) {
     f78:       e1500005        cmp     r0, r5
# r0 = 8
# r5 = 0xFFFF FFFF  --> correct
     f7c:       e1a03823        lsr     r3, r3, #16
# r3 = 0x0000 FFFE
     f80:       aa000005        bge     f9c <string.isra.5+0x64>
# branch taken --> correct

[...]
     f9c:       e1a05003        mov     r5, r3
# r5 = r3 = 0x0000 FFFE

[...]
        while (len < spec.field_width--) {
     fdc:       e1500005        cmp     r0, r5
# r0 (len) = 8
# r5 (spec.field_width) is still 0x0000 FFFE  --> not ok
# spec.field_width should be 0xFFFF FFFE at this point

     fe0:       e1a03823        lsr     r3, r3, #16
     fe4:       aa000005        bge     1000 <string.isra.5+0xc8>
# branch NOT taken --> wrong

Reply via email to