Linaro GCC 4.6.3 Android toolchain show ICE while compling jrevdct.c file from ffmpeg

Bug #915176 reported by ajeet vijayvergiya
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
Triaged
Medium
Unassigned

Bug Description

While compiling ffmpeg for android using linaro gcc 4.6.3 latest release 2011-12 getting ICE while compiling jrevdct.c from ffmpeg/libavcodec. However when I remove -O9 flag (means no optimization) it got compiled successfully

Stack Trace

CC libavcodec/jrevdct.o
*** glibc detected *** /linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1: free(): invalid next size (fast): 0x0a30ce20 ***
======= Backtrace: =========
/lib/libc.so.6[0x4b4e5d22]
/lib/libc.so.6[0x4b4e6e78]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1[0x84d21d7]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1[0x84dcd50]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1(vect_transform_stmt+0x318)[0x84ddc68]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1[0x84f1116]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1[0x84f0fc5]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1[0x84f0fc5]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1[0x84f0fc5]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1[0x84f0fc5]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1[0x84f0fc5]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1(vect_schedule_slp+0x10f)[0x84f625f]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1(vect_slp_transform_bb+0x98)[0x84f6348]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1[0x84f6791]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1(execute_one_pass+0xfb)[0x8354fbb]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1(execute_pass_list+0x1d)[0x835523d]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1(execute_pass_list+0x30)[0x8355250]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1(execute_pass_list+0x30)[0x8355250]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1(tree_rest_of_compilation+0x87)[0x8428867]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1[0x856cda0]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1(cgraph_optimize+0x445)[0x856ebe5]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1(cgraph_finalize_compilation_unit+0x7a)[0x856f06a]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1(c_write_global_declarations+0xca)[0x814b0ba]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1(toplev_main+0xe96)[0x83ea386]
/linaro/android-toolchain-eabi/bin/../libexec/gcc/arm-eabi/4.6.3/cc1(main+0x1b)[0x81ae4eb]
/lib/libc.so.6(__libc_start_main+0xf3)[0x4b4896b3]
======= Memory map: ========
08048000-08d85000 r-xp 00000000 08:01 8128823 /linaro/android-toolchain-eabi/libexec/gcc/arm-eabi/4.6.3/cc1
08d85000-08d86000 r--p 00d3d000 08:01 8128823 /linaro/android-toolchain-eabi/libexec/gcc/arm-eabi/4.6.3/cc1
08d86000-08d92000 rw-p 00d3e000 08:01 8128823 /linaro/android-toolchain-eabi/libexec/gcc/arm-eabi/4.6.3/cc1
08d92000-08ed9000 rw-p 00000000 00:00 0
0a2e0000-0a444000 rw-p 00000000 00:00 0 [heap]
40000000-40001000 r-xp 00000000 00:00 0 [vdso]
40001000-40014000 rw-p 00000000 00:00 0
40014000-40225000 rw-p 00000000 00:00 0
4023d000-4043d000 rw-p 00000000 00:00 0
4b44b000-4b46c000 r-xp 00000000 08:01 3886 /lib/ld-2.14.90.so
4b46c000-4b46d000 r--p 00020000 08:01 3886 /lib/ld-2.14.90.so
4b46d000-4b46e000 rw-p 00021000 08:01 3886 /lib/ld-2.14.90.so
4b470000-4b616000 r-xp 00000000 08:01 11637 /lib/libc-2.14.90.so
4b616000-4b618000 r--p 001a6000 08:01 11637 /lib/libc-2.14.90.so
4b618000-4b619000 rw-p 001a8000 08:01 11637 /lib/libc-2.14.90.so
4b619000-4b61c000 rw-p 00000000 00:00 0
4b63b000-4b63e000 r-xp 00000000 08:01 11672 /lib/libdl-2.14.90.so
4b63e000-4b63f000 r--p 00002000 08:01 11672 /lib/libdl-2.14.90.so
4b63f000-4b640000 rw-p 00003000 08:01 11672 /lib/libdl-2.14.90.so
4b64e000-4b677000 r-xp 00000000 08:01 11666 /lib/libm-2.14.90.so
4b677000-4b678000 r--p 00028000 08:01 11666 /lib/libm-2.14.90.so
4b678000-4b679000 rw-p 00029000 08:01 11666 /lib/libm-2.14.90.so
4b67b000-4b690000 r-xp 00000000 08:01 11671 /lib/libz.so.1.2.5
4b690000-4b691000 rw-p 00014000 08:01 11671 /lib/libz.so.1.2.5
4b693000-4b6af000 r-xp 00000000 08:01 11673 /lib/libgcc_s-4.6.2-20111027.so.1
4b6af000-4b6b0000 rw-p 0001b000 08:01 11673 /lib/libgcc_s-4.6.2-20111027.so.1
bf820000-bf842000 rw-p 00000000 00:00 0 [stack]
libavcodec/jrevdct.c: In function 'j_rev_dct':
libavcodec/jrevdct.c:210:6: internal compiler error: Aborted
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[1]: *** [libavcodec/jrevdct.o] Error 1

My CFLAGS are

export CFLAGS="-O9 -DANDROID -march=armv7-a -ffast-math -fomit-frame-pointer -nostdlib -lc -lm -L $NDKHOME/platforms/android-8/arch-arm/usr/lib/ -I $NDKHOME/platforms/android-8/arch-arm/usr/include/ -fPIC -mtune=cortex-a8 -mfpu=neon -funroll-loops -Isdl -ldl -fno-short-enums -ftree-vectorize -mvectorize-with-neon-quad -mfloat-abi=softfp -funsafe-math-optimizations -funswitch-loops -fsingle-precision-constant -ftree-loop-linear -D__linux__ -Ifreetype/include -floop-strip-mine -floop-block -fgraphite-identity"

If you need any more info/file let me know i will upload that also

Revision history for this message
Asa Sandahl (asa-sandahl) wrote :

Could you provide the pre-processed source please so that we can look into it? The easiest way is to add --save-temps to the gcc flags and grab jrevdct.ii.

Changed in gcc-linaro:
status: New → Incomplete
Revision history for this message
ajeet vijayvergiya (ajeet-vijay) wrote :

Attached files with --save-temps flag

summary: - Linaro GCC 4.3 Android toolchain show ICE while compling jrevdct.c file
- from ffmpeg
+ Linaro GCC 4.6.3 Android toolchain show ICE while compling jrevdct.c
+ file from ffmpeg
Revision history for this message
Ramana Radhakrishnan (ramana) wrote :

Reduced testcase.

typedef int __int32_t;
typedef __int32_t int32_t;
typedef short DCTELEM;
typedef DCTELEM DCTBLOCK[64];
void j_rev_dct(DCTBLOCK data)
{
  int32_t d0, d1, d2, d3, d4, d5, d6, d7;
  register DCTELEM *dataptr;
  int rowctr;
  dataptr = data;
  for (rowctr = 8 -1; rowctr >= 0; rowctr--) {
    register int *idataptr = (int*)dataptr;
    d0 = dataptr[0];
    if ((d1 | d2 | d3 | d4 | d5 | d6 | d7) == 0) {
      if (d0) {
          DCTELEM dcval = (DCTELEM) (d0 << 2);
          register int v = (dcval & 0xffff) | ((dcval << 16) & 0xffff0000);
          idataptr[0] = v;
          idataptr[1] = v;
          idataptr[2] = v;
          idataptr[3] = v;
      }
    }
  }

Revision history for this message
Asa Sandahl (asa-sandahl) wrote :

Thank you for the bug report. I've confirmed this with gcc-linaro-4.6-2011.12 on ARM:

asa-san@ursa4:~/bugs/lp915176$ /tools/toolchains/arch/armv7l/gcc-linaro-4.6-2011.12-armv7l-natty-cbuild212-tcpanda03-cortexa9r1/bin/gcc -O3 --std=c99 -c jrevdct.i
*** glibc detected *** /tools/toolchains/arch/armv7l/gcc-linaro-4.6-2011.12-armv7l-natty-cbuild212-tcpanda03-cortexa9r1/bin/../libexec/gcc/armv7l-unknown-linux-gnueabi/4.6.3/cc1: free(): invalid next size (fast): 0x0088a950 ***
libavcodec/jrevdct.c: In function 'j_rev_dct':
libavcodec/jrevdct.c:210:6: internal compiler error: Aborted

The test case has been reduced, see previous comment. Also, please note that I had to add the --std=c99 option to be able to compile the file jrevdct.i.

The work-around is to compile at -O2.
The error does not occur on gcc-linaro-4.6-2011.11, gcc-linaro-4.5-2012.01 or FSF trunk.
This means the error was introduced in gcc-linaro-4.6-2011.12. It could have been fixed, or be latent, on trunk.

I've set it to medium priority. There is a work around, but the error is still serious because there seems to be a double free somewhere.

Changed in gcc-linaro:
status: Incomplete → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.