http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53538
Bug #: 53538 Summary: Compile error with ARM NEON intrinsics and certain compile flags Classification: Unclassified Product: gcc Version: 4.5.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: ah...@gmx.net Created attachment 27529 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27529 test program The attached test program fails to compile with the following command line (cross compiling for ARM neon on Ubuntu): gcc -c test_an_bug.c -o test_an_bug.o -O2 -g -Wall -march=armv7-a -mlittle-endian -mfloat-abi=hard -mfpu=neon -mtp=cp15 -mthumb Error message: In file included from test_an_bug.c:2:0: [...]/4.5/include/arm_neon.h: In function 'main': [...]/4.5/include/arm_neon.h:4968:49: error: argument must be a constant [...]/4.5/include/arm_neon.h:4968: confused by earlier errors, bailing out However it builds without warning when either: 1) use -O3 instead of -O2 or 2) use -funroll-loops 3) if you move the intrinsic (vget_lane_u16) outside the for loop 4) if you use literals instead of the variable j I haven't found any detailed documentation on the use of this intrinsic, but it looks a bit odd if it only accepts literals as parameters. At what point did we give up pass-by-value for int? And it certainly is odd that it compiles fine with different optimization levels... Note 1: This is not the original code, it is the minimum test program I derived from it. Note 2: It seems to fail on all compiler versions from 4.5 to 4.7 I've tried.