gcc

[armel] ICE immed_double_const at emit-rtl.c (-mfpu=neon -g)

Bug #736007 reported by Juha Kallioinen on 2011-03-16
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Linaro GCC
Fix Released
Medium
Richard Sandiford
4.6-2011.07-stable
Won't Fix
Medium
Michael Hope
Linaro GCC Tracking
Fix Released
Undecided
Unassigned
gcc
Confirmed
Medium

Bug Description

I've tried this with linaro 2010.09 and 2011.03 and the one that is currently available from Ubuntu Natty repo:

kaltsi@kaltsnatty:~/tmp/ice$ arm-linux-gnueabi-gcc-4.5 --version
arm-linux-gnueabi-gcc-4.5 (Ubuntu/Linaro 4.5.2-3ubuntu3) 4.5.2
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The problem comes when using -mfpu=neon and -g (and at least -O1).

kaltsi@kaltsnatty:~/tmp/ice$ arm-linux-gnueabi-gcc-4.5 -mfpu=neon -O1 -g -c emit-rtl-ice.i
optimized.c: In function ‘move_16bit_to_32bit’:
optimized.c:4:6: internal compiler error: in immed_double_const, at emit-rtl.c:552
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.5/README.Bugs> for instructions.

I do not get the ICE with linaro gcc-4.4 available from Natty.

Michael Hope (michaelh1) wrote :

Confirmed in gcc-linaro-4.5+bzr99489:

ichaelh@ursa1:/scratch/michaelh/bugs$ ../toolchains/gcc-linaro-4.5+bzr99489-armv7l-maverick-cbuild79-carina5-cortexa8r1/bin/gcc -mfpu=neon -O1 -g -c emit-rtl-ice.i
optimized.c: In function 'move_16bit_to_32bit':
optimized.c:4:6: internal compiler error: in immed_double_const, at emit-rtl.c:552

Also appears on a cross compiler. The backtrace is:

#1 0x0000000000580d19 in immed_double_const (i0=0, i1=0, mode=OImode)
    at ../../../src/gcc-linaro-4.5-2011.03-0/gcc/emit-rtl.c:552
#2 0x00000000005a34c3 in expand_expr_real_1 (exp=0x7ffff4dd1ca8, target=0x0,
    tmode=<value optimized out>, modifier=<value optimized out>, alt_rtl=0x0)
    at ../../../src/gcc-linaro-4.5-2011.03-0/gcc/expr.c:8465
#3 0x0000000000521425 in expand_expr (exp=0x7ffff4dd1ca8)
    at ../../../src/gcc-linaro-4.5-2011.03-0/gcc/expr.h:558
#4 expand_debug_expr (exp=0x7ffff4dd1ca8)
    at ../../../src/gcc-linaro-4.5-2011.03-0/gcc/cfgexpand.c:2329
#5 0x00000000005237d8 in expand_debug_locations ()
    at ../../../src/gcc-linaro-4.5-2011.03-0/gcc/cfgexpand.c:3122
#6 gimple_expand_cfg () at ../../../src/gcc-linaro-4.5-2011.03-0/gcc/cfgexpand.c:3885
#7 0x00000000006715dc in execute_one_pass (pass=0xf8a720)
    at ../../../src/gcc-linaro-4.5-2011.03-0/gcc/passes.c:1572

Note that mode is OImode (a 32 byte integer) which makes sense with the int32x4x2 types in the example code.

Changed in gcc-linaro:
status: New → Triaged
importance: Undecided → Medium
Chung-Lin Tang (cltang) wrote :

Also confirmed on upstream trunk.

Chung-Lin Tang (cltang) wrote :

Testing a patch, would you mind also submitting to upstream bugzilla too? Thanks.

Created attachment 23707
pre-processed source

When compiling the attached pre-processed source for arm (-march=armv7-a -mtune=cortex-a8) and using options -mfpu=neon -g -O1 I get an ICE.

kaltsi@kaltsnatty:~/tmp/ice$ arm-linux-gnueabi-gcc-4.5 -mfpu=neon -O1 -g -c emit-rtl-ice.i
optimized.c: In function ‘move_16bit_to_32bit’:
optimized.c:4:6: internal compiler error: in immed_double_const, at emit-rtl.c:552
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.5/README.Bugs> for instructions.

This does not happen if I leave the -g option out.

Also reported to linaro: https://bugs.launchpad.net/gcc-linaro/+bug/736007

Chung-Lin Tang (cltang) on 2011-03-19
Changed in gcc-linaro:
status: Triaged → In Progress
assignee: nobody → Chung-Lin Tang (cltang)
Michael Hope (michaelh1) wrote :

Richard, Chung-Lin: could you follow up on this one please?

I am out of the office until 17/04/2011.

Note: This is an automated response to your message "[Bug 736007] Re:
[armel] ICE immed_double_const at emit-rtl.c (-mfpu=neon -g)" sent on
15/4/2011 4:50:25.

This is the only notification you will receive while this person is away.

Michael Hope <email address hidden> writes:
> Richard, Chung-Lin: could you follow up on this one please?

I think the status here is that we (Chung-Lin, Julian and myself)
have proposed three different patches on the list. They all work
around the underlying problem rather than fix it.

I was hoping the maintainers would pick one, but I suppose the
hackish nature of the patches means that no-one really wants to.

FWIW, I'm happy to defer to Chung-Lin's change for Linaro. I think
his patch has received the most testing and I agree it should be safe.

Richard

Chung-Lin Tang (cltang) wrote :

IMHO, I think that among the proposals, Richard Guenther's actually seems the most elegant (avoid the seemingly unneeded zero-set completely), though I think his patch is not yet really a intended tested fix currently...

Michael Hope (michaelh1) wrote :

OK. Can you move this bug forward then please Chung-Lin? That might be by pinging Richard Guenther and asking him to finish the patch or taking it over yourself.

Michael Hope (michaelh1) wrote :

Richard, could you follow this one up please?

Changed in gcc-linaro:
assignee: Chung-Lin Tang (cltang) → Richard Sandiford (rsandifo)
Michael Hope (michaelh1) wrote :

Still present in gcc-linaro-4.6+bzr106768:

michaelh@ursa1:~/linaro/bugs$ /scratch/michaelh/toolchains/gcc-linaro-4.6+bzr106768-armv7l-natty-cbuild151-ursa4-cortexa9r1/bin/gcc -mfpu=neon -O1 -g -c emit-rtl-ice.i
optimized.c: In function 'move_16bit_to_32bit':
optimized.c:4:6: internal compiler error: in immed_double_const, at emit-rtl.c:550

Adding a test case which Chung-Lin's patch does not appear to fix.

Correction: Chung-Lin's patch does fix this test case. (I was using a stale compiler build when I re-checked.)

Changed in gcc-linaro:
status: In Progress → Fix Committed
Michael Hope (michaelh1) on 2011-08-11
Changed in gcc-linaro:
milestone: none → 4.6-2011.08
Michael Hope (michaelh1) on 2011-08-18
Changed in gcc-linaro:
status: Fix Committed → Fix Released
Michael Hope (michaelh1) wrote :

Withdrawn from stable due to the size of the change and it not affecting a user of the stable branch.

I have some additional info related to this bug:

If I compile the following:

#include "arm_neon.h"
#include "stdlib.h"

int main ()
{
   float r [] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
   float32x4x2_t d;
   d = vld2q_f32 (r);
   vst2q_f32 (r, d);
   return 0;
}

using: arm-linux-androideabi-gcc test.c -mfloat-abi=softfp -mfpu=neon -g -O1

I get:
test.c: In function 'main':
test.c:4:5: internal compiler error: in immed_double_const, at emit-rtl.c:550
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

However, if I comment out vst2q_f32 (r, d);, the problem goes away. Also by not using -g or -O1.

$ arm-linux-androideabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-androideabi-gcc
COLLECT_LTO_WRAPPER=/Users/havard.graff/Code/android-ndk-r7/toolchains/arm-linux-androideabi-4.6.2/prebuilt/darwin-x86/libexec/gcc/arm-linux-androideabi/4.6.2/lto-wrapper
Target: arm-linux-androideabi
Configured with: /Users/havard.graff/Code/selfbuilt_android_toolchain/build/../gcc/gcc-4.6.2/configure --prefix=/Users/havard.graff/Code/android-ndk-r7/toolchains/arm-linux-androideabi-4.6.2/prebuilt/darwin-x86 --target=arm-linux-androideabi --host=i686-apple-darwin --build=i686-apple-darwin --with-gnu-as --with-gnu-ld --enable-languages=c,c++,objc --with-gmp=/tmp/ndk-havard.graff/build/toolchain/temp-install --with-mpfr=/tmp/ndk-havard.graff/build/toolchain/temp-install --with-mpc=/tmp/ndk-havard.graff/build/toolchain/temp-install --disable-libssp --enable-threads --disable-nls --disable-libmudflap --disable-libgomp --disable-sjlj-exceptions --disable-shared --disable-tls --with-float=soft --with-fpu=vfp --with-arch=armv5te --enable-target-optspace --disable-hosted-libstdcxx --enable-cxx-flags='-fexceptions -frtti' --enable-initfini-array --disable-nls --prefix=/Users/havard.graff/Code/android-ndk-r7/toolchains/arm-linux-androideabi-4.6.2/prebuilt/darwin-x86 --with-sysroot=/Users/havard.graff/Code/android-ndk-r7/toolchains/arm-linux-androideabi-4.6.2/prebuilt/darwin-x86/sysroot --with-binutils-version=2.22.51 --with-mpfr-version=2.4.1 --with-gmp-version=4.2.4 --with-gcc-version=4.6.2 --with-gdb-version=6.6 --with-arch=armv5te --program-transform-name='s,^,arm-linux-androideabi-,'
Thread model: posix
gcc version 4.6.2 (GCC)

Changed in gcc:
importance: Unknown → Medium
status: Unknown → Confirmed
Changed in gcc-linaro-tracking:
milestone: none → 4.7.0
status: New → Fix Released

Shouldn't the upstream bug be resolved now?

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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