[Bug rtl-optimization/57479] New: [ARM][NEON] internal compiler error: Segmentation fault in add_dependence_list

2013-05-30 Thread bccheng at android dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57479

Bug ID: 57479
   Summary: [ARM][NEON] internal compiler error: Segmentation
fault in add_dependence_list
   Product: gcc
   Version: 4.7.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bccheng at android dot com

I hit an ICE with GCC 4.7.2 and 4.7.3 on a function with lots of ARM NEON code.
The reduced input file is attached (I cannot seem to further reduce it) and
here are the cmdline options I used:

-march=armv7-a -mfloat-abi=softfp -mfpu=neon -mthumb-interwork -g
-frename-registers -O2 -c test.c

Here is the stack trace in gdb when the segfault happens:

Program received signal SIGSEGV, Segmentation fault.
0x00f3cbf2 in add_dependence_list (insn=0x770317e0, list=0x521, 
uncond=1, dep_type=REG_DEP_ANTI)
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/sched-deps.c:1555
1555add_dependence (insn, XEXP (list, 0), dep_type);
(gdb) bt
#0  0x00f3cbf2 in add_dependence_list (insn=0x770317e0, 
list=0x521, uncond=1, dep_type=REG_DEP_ANTI)
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/sched-deps.c:1555
#1  0x00f3fb5c in sched_analyze_insn (deps=0x7fffca30, 
x=0x77030780, insn=0x770317e0)
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/sched-deps.c:2982
#2  0x00f4198d in deps_analyze_insn (deps=0x7fffca30, 
insn=0x770317e0)
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/sched-deps.c:3505
#3  0x00f41e67 in sched_analyze (deps=0x7fffca30, 
head=0x7702a0d8, tail=0x77032320)
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/sched-deps.c:3653
#4  0x009c2155 in compute_block_dependences (bb=0)
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/sched-rgn.c:2702
#5  0x009c35ae in sched_rgn_compute_dependencies (rgn=3)
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/sched-rgn.c:3140
#6  0x009c2d2a in schedule_region (rgn=3)
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/sched-rgn.c:2915
#7  0x009c3d0b in schedule_insns ()
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/sched-rgn.c:3299
#8  0x009c4613 in rest_of_handle_sched2 ()
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/sched-rgn.c:3523
#9  0x00942511 in execute_one_pass (pass=0x1a85ae0 )
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/passes.c:2084
#10 0x009426ea in execute_pass_list (pass=0x1a85ae0 )
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/passes.c:2139
#11 0x0094270b in execute_pass_list (pass=0x1a84ec0 )
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/passes.c:2140
#12 0x0094270b in execute_pass_list (
pass=0x1a84e60 )
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/passes.c:2140
#13 0x00a7c36c in tree_rest_of_compilation (fndecl=0x7729dd00)
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/tree-optimize.c:422
#14 0x007372fa in cgraph_expand_function (node=0x772a3240)
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/cgraphunit.c:1837
#15 0x007374c5 in cgraph_expand_all_functions ()
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/cgraphunit.c:1904
#16 0x00737dd1 in cgraph_optimize ()
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/cgraphunit.c:2218
#17 0x007360e9 in cgraph_finalize_compilation_unit ()
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/cgraphunit.c:1344
#18 0x0063364b in c_write_global_declarations ()
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/c-decl.c:10032
#19 0x00a121a4 in compile_file ()
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/toplev.c:573
#20 0x00a141ab in do_compile ()
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/toplev.c:1938
#21 0x00a1431b in toplev_main (argc=26, argv=0x7fffcec8)
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/toplev.c:2014
#22 0x006c0308 in main (argc=26, argv=0x7fffcec8)
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/main.c:36
(gdb) f 0
#0  0x00f3cbf2 in add_dependence_list (insn=0x770317e0, 
list=0x521, uncond=1, dep_type=REG_DEP_ANTI)
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/sched-deps.c:1555
1555add_dependence (insn, XEXP (list, 0), dep_type);
(gdb) up
#1  0x00f3fb5c in sched_analyze_insn (deps=0x7fffca30, 
x=0x77030780, insn=0x770317e0)
at /tmp/AOSP-toolchain/build/../gcc/gcc-4.7/gcc/sched-deps.c:2982
2982  add_dependence_list (insn, reg_last->sets, 1, REG_DEP_ANTI);
(gdb) p reg_last->sets
$1 = (rtx) 0x521


Looks like reg_last->sets carries some garbage values. I also tried GCC 4.8.0
and it doesn't have the crash. However the code looks very different around
those functions. If there is a patch I can 

[Bug rtl-optimization/57479] [ARM][NEON] internal compiler error: Segmentation fault in add_dependence_list

2013-05-30 Thread bccheng at android dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57479

--- Comment #1 from bccheng at android dot com ---
Created attachment 30232
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30232&action=edit
reduced test input


[Bug rtl-optimization/57479] [ARM][NEON] internal compiler error: Segmentation fault in add_dependence_list

2013-06-02 Thread bccheng at android dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57479

--- Comment #3 from bccheng at android dot com ---
Here is my configuration:

--target=arm-linux-androideabi --host=x86_64-linux-gnu --build=x86_64-linux-gnu

Please let me know if you need additional information.

Thanks!


[Bug target/58854] New: [ARM 4.8 regression] "sub sp, fp, #40" hoisted above frame accesses

2013-10-23 Thread bccheng at android dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58854

Bug ID: 58854
   Summary: [ARM 4.8 regression] "sub sp, fp, #40" hoisted above
frame accesses
   Product: gcc
   Version: 4.8.1
Status: UNCONFIRMED
  Severity: major
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bccheng at android dot com

With GCC 4.8.1 we encountered a regression in linux 3.4 kernel code on ARM
devices. The problematic instruction sequence is below:

sub sp, fp, #40  << fp-48 is above sp now
ldr r3, [fp, #-60]
ldr r0, [fp, #-56]
str r6, [r2]
ldr r2, [fp, #-48]   << clobbered by handler
str r3, [r2] << trying to load from 0x
ldmfd   sp, {r4, r5, r6, r7, r8, r9, r10, fp, sp, pc}

A read-only pointer value is passed to the function and stored at [fp-48]. But
later it is found that the value has been clobbered and become 0x. If I
manually move the "sub sp, fp, #40" instruction right before the ldmfd
instruction, the kernel becomes stable again.

I can reproduce the regression on 4.8.1 and 4.8.2, but not on 4.7. The
compilation command is

arm-eabi-gcc -O2  -marm -fno-omit-frame-pointer -mapcs  -march=armv7-a 
-mabi=aapcs-linux -S test.c

and GCC is configured as
Target: arm-eabi
Configured with: /tmp/AOSP-toolchain/build/../gcc/gcc-4.8/configure
--prefix=/tmp/toolchain-build-eabi/prefix --target=arm-eabi
--host=x86_64-linux-gnu --build=x86_64-linux-gnu --with-gnu-as --with-gnu-ld
--enable-languages=c,c++ --with-gmp=/tmp/toolchain-build-eabi/temp-install
--with-mpfr=/tmp/toolchain-build-eabi/temp-install
--with-mpc=/tmp/toolchain-build-eabi/temp-install
--with-cloog=/tmp/toolchain-build-eabi/temp-install
--with-isl=/tmp/toolchain-build-eabi/temp-install
--with-ppl=/tmp/toolchain-build-eabi/temp-install --disable-ppl-version-check
--disable-cloog-version-check --disable-isl-version-check
--enable-cloog-backend=isl --with-host-libstdcxx='-static-libgcc
-Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --disable-libssp --enable-threads
--disable-nls --disable-libmudflap --disable-libgomp --disable-libstdc__-v3
--disable-sjlj-exceptions --disable-shared --disable-tls --disable-libitm
--with-float=soft --with-fpu=vfp --with-arch=armv5te --enable-target-optspace
--with-abi=aapcs --enable-initfini-array --disable-nls
--prefix=/tmp/toolchain-build-eabi/prefix
--with-sysroot=/tmp/toolchain-build-eabi/prefix/sysroot
--with-binutils-version=2.23 --with-mpfr-version=3.1.1 --with-mpc-version=1.0.1
--with-gmp-version=5.0.5 --with-gcc-version=4.8 --with-gdb-version=7.6
--with-gxx-include-dir=/tmp/toolchain-build-eabi/prefix/include/c++/4.8
--with-bugurl=http://source.android.com/source/report-bugs.html
--disable-bootstrap --disable-libquadmath --enable-plugins
--disable-libsanitizer --enable-gold --enable-graphite=yes
--with-cloog-version=0.18.0 --with-isl-version=0.11.1
--enable-eh-frame-hdr-for-static --with-arch=armv5te --disable-gold
--program-transform-name='s&^&arm-eabi-&'
Thread model: single
gcc version 4.8 (GCC)


[Bug target/58854] [ARM 4.8 regression] "sub sp, fp, #40" hoisted above frame accesses

2013-10-23 Thread bccheng at android dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58854

--- Comment #1 from bccheng at android dot com ---
Created attachment 31083
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31083&action=edit
stripped from kernel 3.4 fs/dcache.c


[Bug target/58854] [4.8 regression] "sub sp, fp, #40" hoisted above frame accesses

2013-10-29 Thread bccheng at android dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58854

--- Comment #6 from bccheng at android dot com ---
Patch appears to be working:

c012c7ec:   e51b3034ldr r3, [fp, #-52]  ; 0x34
c012c7f0:   e51b203cldr r2, [fp, #-60]  ; 0x3c
c012c7f4:   e51b0038ldr r0, [fp, #-56]  ; 0x38
c012c7f8:   e5836000str r6, [r3]
c012c7fc:   e51b3030ldr r3, [fp, #-48]  ; 0x30
c012c800:   e5832000str r2, [r3]
c012c804:   e24bd028sub sp, fp, #40 ; 0x28
c012c808:   e89daff0ldm sp, {r4, r5, r6, r7, r8, r9, sl, fp,
sp, pc}

Thanks!