GCC internal error when compiling NEON intrinsics

180 views
Skip to first unread message

FakeTruth

unread,
Mar 14, 2011, 3:26:45 PM3/14/11
to android-ndk
Hi all,

I have a problem when compiling NEON intrinsics in c++ by using ndk-
build.

Some info:
I have the NDK version r5b

I have set these makefile flags
#Application.mk:
APP_ABI := armeabi armeabi-v7a
#Android.mk:
LOCAL_CFLAGS := -DANDROID_NDK \
-DDISABLE_IMPORTGL \
-ffast-math \
-O3 \
-funroll-loops \
-mfloat-abi=softfp -mfpu=neon \

ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_CFLAGS := -DHAVE_NEON=1
LOCAL_SRC_FILES += cParticles.cpp.neon \
cGame.cpp.neon
else
LOCAL_SRC_FILES += cParticles.cpp \
cGame.cpp
endif

GCC gives me this error:

$ ndk-build
Compile++ thumb : cppwrapper <= cParticles.cpp
SharedLibrary : libcppwrapper.so
Install : libcppwrapper.so => libs/armeabi/libcppwrapper.so
Compile++ thumb : cppwrapper <= cParticles.cpp
D:/my_projects/Android/CppWrapper/jni/cParticles.cpp: In member
function 'void cParticles::Update(float)':
D:/my_projects/Android/CppWrapper/jni/cParticles.cpp:172: internal
compiler error: in change_address_1, at emit-rtl.c:1954
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make: *** [/cygdrive/d/my_projects/Android/CppWrapper/obj/local/
armeabi-v7a/objs/cppwrapper/cParticles.o] Error 1

Here is guilty code:

/*******************************************************************/
float32x4_t* VertPtr = ..some address
float32x4_t* SpeedPtr = ..some address
for( int i = 0; i < NUMCOORDS/4; ++i )
{
*SpeedPtr = vmulq_f32( *SpeedPtr, OneSmall4 );
*VertPtr = vmlaq_f32( *VertPtr, DT4, *SpeedPtr );

/* EVERYTHING WORKS FINE EXCEPT WHEN I PUT ANY INTRINSICS HERE */
*SpeedPtr = vmulq_f32( (*SpeedPtr), OneSmall4 ); // Example line.
Copy-paste from lines above (so it's perfectly valid), this gives an
internal error.
/* ------- */

*(VertPtr+NUMCOORDS/4) = vmlaq_f32( *VertPtr, *SpeedPtr,
LineLength4 );

VertPtr++;
SpeedPtr++;
}
/*******************************************************************/

It seems the compiler doesn't like it when I put intrinsics between
the two vmlaq_f32 calls

Anybody ever had this error, and found a fix?

Thanks,
FakeTruth

Doug Kwan (關振德)

unread,
Mar 14, 2011, 5:35:29 PM3/14/11
to andro...@googlegroups.com, FakeTruth
Thanks for reporting it. I'll take a look today.

-Doug

> --
> You received this message because you are subscribed to the Google Groups "android-ndk" group.
> To post to this group, send email to andro...@googlegroups.com.
> To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
>
>

FakeTruth

unread,
Mar 14, 2011, 5:47:10 PM3/14/11
to android-ndk
Thank you,

I forgot to mention I'm running ndk-build in Windows 7 64-bit through
Cygwin

Carrot

unread,
Mar 21, 2011, 12:17:23 AM3/21/11
to android-ndk
I failed to reproduce the error with the following test case

-----------------------------------------------------------------
#include <arm_neon.h>
#define NUMCOORDS 16

void t0a(float32x4_t* p, float32x4_t* q)
{
float32x4_t OneSmall4 = *p;
float32x4_t DT4 = *q;
float32x4_t LineLength4 = *(p+1);
float32x4_t* VertPtr = p;
float32x4_t* SpeedPtr = q;

for( int i = 0; i < NUMCOORDS/4; ++i )
{
*SpeedPtr = vmulq_f32( *SpeedPtr, OneSmall4 );
*VertPtr = vmlaq_f32( *VertPtr, DT4, *SpeedPtr );

/* EVERYTHING WORKS FINE EXCEPT WHEN I PUT ANY INTRINSICS HERE
*/
*SpeedPtr = vmulq_f32( (*SpeedPtr), OneSmall4 ); // Example
line.
// Copy-paste from lines above (so it's perfectly valid), this
gives internal error.
/* ------- */

*(VertPtr+NUMCOORDS/4) = vmlaq_f32( *VertPtr, *SpeedPtr,
LineLength4 );

VertPtr++;
SpeedPtr++;
}
}
-----------------------------------------------------------------------

My complete compiler command line is

"/usr/local/google/home/carrot/android-ndk-r5/toolchains/arm-linux-
androideabi-4.4.3/prebuilt/linux-x86/libexec/gcc/arm-linux-androideabi/
4.4.3/cc1plus" "-fpreprocessed" "t0a.ii" "-mbionic" "-quiet" "-
dumpbase" "t0a.cpp" "-march=armv7-a" "-mfloat-abi=softfp" "-mfpu=neon"
"-mthumb-interwork" "-mthumb" "-auxbase-strip" "obj/t0a.o" "-g" "-O3"
"-Wno-multichar" "-W" "-Wall" "-Wno-unused" "-Winit-self" "-Wpointer-
arith" "-Werror=return-type" "-Werror=address" "-Werror=sequence-
point" "-Wstrict-aliasing=2" "-fno-exceptions" "-fpic" "-ffunction-
sections" "-fno-short-enums" "-fmessage-length=0" "-finline-functions"
"-fno-inline-functions-called-once" "-fgcse-after-reload" "-frerun-cse-
after-loop" "-frename-registers" "-fomit-frame-pointer" "-fno-strict-
aliasing" "-finline-limit=64" "-fno-rtti" "-o" "t0a.s" -funroll-loops -
ffast-math

Could you provide a complete test case and command line?

thanks
Carrot

mingw android

unread,
Mar 21, 2011, 4:47:27 PM3/21/11
to andro...@googlegroups.com
There were NEON ICEs on Cygwin's r4 too. Try my NDK, all neon stuff I've thrown at it has worked fine.

Cheers,

mingw.android.

FakeTruth

unread,
Mar 22, 2011, 8:48:26 AM3/22/11
to andro...@googlegroups.com
Hi,

Despite the internal error I continued to program my application without specific NEON optimizations.
Today I tried to use NEON anyway again, and I cannot replicate the error anymore.

It seems my problem has been solved over time, though there does seem to be an error in the compiler.

Thanks,
-FakeTruth

2011/3/21 mingw android <mingw....@gmail.com>

Carrot

unread,
Mar 22, 2011, 10:33:05 PM3/22/11
to android-ndk
Internal error is definitely compiler bug. If you could save the test
case and compiler command line options when you meet them in future,
it will be much more helpful.

thank you again
Carrot

Peter Tseng

unread,
Apr 5, 2011, 6:23:33 PM4/5/11
to android-ndk
Were you building with debug set to true? I'm asking because I get an
internal compiler error with debuggable set to true in the manifest
xml file.



On Mar 22, 7:33 pm, Carrot <car...@google.com> wrote:
> Internalerroris definitelycompilerbug. If you could save the test
> case andcompilercommand line options when you meet them in future,
> it will be much more helpful.
>
> thank you again
> Carrot
>
> On Mar 22, 8:48 pm, FakeTruth <faketr...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > Despite theinternalerrorI continued to program my application without

FakeTruth

unread,
Apr 5, 2011, 6:31:52 PM4/5/11
to andro...@googlegroups.com
No it was set to false.

I'm still unable to reproduce my error (and I lost my test case), so I don't know what was going on.

2011/4/6 Peter Tseng <peter...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.

Reply all
Reply to author
Forward
0 new messages