For the following fragment : #include <spu_intrinsics.h> vector unsigned int f() { return spu_splats( (unsigned int)7 ); } Compiling with spu-elf-gcc is fine. Compiling with spu-elf-g++ generates an error: $ usr/bin/spu-elf-g++ -c splat.cpp splat.cpp: In function 'unsigned int __vector__ f()': splat.cpp:3: note: use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts splat.cpp:3: error: cannot convert 'unsigned char __vector__' to 'unsigned int __vector__' in return Replacing spu_splats with __builtin_spu_splats_4 allows the fragment to be compiled correctly. Observed with r137813. Compiles as expected in : gcc version 4.4.0 20080404 (experimental) gcc version 4.3.0 20071012 (experimental) gcc version 4.1.1 (IBM SDK 3.0 release)
Works for me with: GNU C++ (GCC) version 4.4.0 20080711 (experimental) [trunk revision 137727] (spu-elf) So this has to be a very recent regression.
I reverted to r137727 and rebuilt it all and still see the error. Any obvious mistake in the following? ../gcc/configure --prefix=${HOME}/usr --enable-languages=c,c++ --with-newlib --with-headers --target=spu-elf make && make install Other things I should check?
These are the options I use: --target=spu-elf --prefix=${HOME}/gcc-spu --with-mpfr=/usr/local --with-newlib --enable-languages=c,c++,objc --with-headers
[apinski@dhcp-10-98-10-216 ~]$ ~/gcc-spu/bin/spu-elf-gcc t.cc -S -v Using built-in specs. Target: spu-elf Configured with: /home/apinski/src/local/gcc/configure --target=spu-elf --prefix=/home/apinski/gcc-spu --with-mpfr=/usr/local --with-newlib --enable-languages=c,c++,objc --with-headers Thread model: single gcc version 4.4.0 20080711 (experimental) [trunk revision 137727] (GCC) COLLECT_GCC_OPTIONS='-S' '-v' /home/apinski/gcc-spu/libexec/gcc/spu-elf/4.4.0/cc1plus -quiet -v t.cc -quiet -dumpbase t.cc -auxbase t -version -o t.s ignoring nonexistent directory "/home/apinski/gcc-spu/lib/gcc/spu-elf/4.4.0/../../../../spu-elf/sys-include" #include "..." search starts here: #include <...> search starts here: /home/apinski/gcc-spu/lib/gcc/spu-elf/4.4.0/../../../../spu-elf/include/c++/4.4.0 /home/apinski/gcc-spu/lib/gcc/spu-elf/4.4.0/../../../../spu-elf/include/c++/4.4.0/spu-elf /home/apinski/gcc-spu/lib/gcc/spu-elf/4.4.0/../../../../spu-elf/include/c++/4.4.0/backward /home/apinski/gcc-spu/lib/gcc/spu-elf/4.4.0/include /home/apinski/gcc-spu/lib/gcc/spu-elf/4.4.0/include-fixed /home/apinski/gcc-spu/lib/gcc/spu-elf/4.4.0/../../../../spu-elf/include End of search list. GNU C++ (GCC) version 4.4.0 20080711 (experimental) [trunk revision 137727] (spu-elf) compiled by GNU C version 4.1.0 20060304 (Red Hat 4.1.0-3), GMP version 4.2.1, MPFR version 2.2.1. GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 6f14eb7742734115a119ca07da3cf037 COMPILER_PATH=/home/apinski/gcc-spu/libexec/gcc/spu-elf/4.4.0/:/home/apinski/gcc-spu/libexec/gcc/spu-elf/4.4.0/:/home/apinski/gcc-spu/libexec/gcc/spu-elf/:/home/apinski/gcc-spu/lib/gcc/spu-elf/4.4.0/:/home/apinski/gcc-spu/lib/gcc/spu-elf/:/home/apinski/gcc-spu/lib/gcc/spu-elf/4.4.0/../../../../spu-elf/bin/ LIBRARY_PATH=/home/apinski/gcc-spu/lib/gcc/spu-elf/4.4.0/:/home/apinski/gcc-spu/lib/gcc/spu-elf/4.4.0/../../../../spu-elf/lib/ COLLECT_GCC_OPTIONS='-S' '-v'
Created attachment 15912 [details] Preprocessed source $ usr/bin/spu-elf-g++ splat.cpp -v Using built-in specs. Target: spu-elf Configured with: ../gcc/configure --prefix=/home/jonathan/usr --enable-languages=c,c++ --with-newlib --with-headers --target=spu-elf Thread model: single gcc version 4.4.0 20080711 (experimental) (GCC) COLLECT_GCC_OPTIONS='-v' /home/jonathan/usr/libexec/gcc/spu-elf/4.4.0/cc1plus -quiet -v splat.cpp -quiet -dumpbase splat.cpp -auxbase splat -version -o /tmp/ccxYOpg1.s ignoring nonexistent directory "/home/jonathan/usr/lib/gcc/spu-elf/4.4.0/../../../../spu-elf/sys-include" #include "..." search starts here: #include <...> search starts here: /home/jonathan/usr/lib/gcc/spu-elf/4.4.0/../../../../spu-elf/include/c++/4.4.0 /home/jonathan/usr/lib/gcc/spu-elf/4.4.0/../../../../spu-elf/include/c++/4.4.0/spu-elf /home/jonathan/usr/lib/gcc/spu-elf/4.4.0/../../../../spu-elf/include/c++/4.4.0/backward /home/jonathan/usr/lib/gcc/spu-elf/4.4.0/include /home/jonathan/usr/lib/gcc/spu-elf/4.4.0/include-fixed /home/jonathan/usr/lib/gcc/spu-elf/4.4.0/../../../../spu-elf/include End of search list. GNU C++ (GCC) version 4.4.0 20080711 (experimental) (spu-elf) compiled by GNU C version 4.3.1, GMP version 4.2.2, MPFR version 2.3.1. GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 0796f6f7f5d948d81ac2e84f3843bd7d splat.cpp: In function 'unsigned int __vector__ f()': splat.cpp:3: note: use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts splat.cpp:3: error: cannot convert 'unsigned char __vector__' to 'unsigned int __vector__' in return
Maybe 4.3.1 is miscompiling GCC 4.4.0 here.
I tried a build using 4.2.4 - same problem.
Tried again building with 4.2.4 (and this time with no ccache :\) Code compiles as expected. It appears that the 4.3.1 that I have has problems. Trying again with fsf gcc-4.3.1.
../gcc-4.3.1/configure --prefix=${HOME}/gcc-native/ --enable-languages=c make && make install CC=~/gcc-native/bin/gcc ../gcc/configure --prefix=${HOME}/gcc-spu --enable-languages=c,c++ --with-newlib --with-headers --target=spu-elf make -j4 CC=~/gcc-native/bin/gcc && make CC=~/gcc-native/bin/gcc install $ gcc-spu/bin/spu-elf-g++ splat.cpp -c -v Using built-in specs. Target: spu-elf Configured with: ../gcc/configure --prefix=/home/jonathan/gcc-spu --enable-languages=c,c++ --with-newlib --with-headers --target=spu-elf Thread model: single gcc version 4.4.0 20080716 (experimental) (GCC) COLLECT_GCC_OPTIONS='-c' '-v' /home/jonathan/gcc-spu/libexec/gcc/spu-elf/4.4.0/cc1plus -quiet -v splat.cpp -quiet -dumpbase splat.cpp -auxbase splat -version -o /tmp/ccTwlij4.s ignoring nonexistent directory "/home/jonathan/gcc-spu/lib/gcc/spu-elf/4.4.0/../../../../spu-elf/sys-include" #include "..." search starts here: #include <...> search starts here: /home/jonathan/gcc-spu/lib/gcc/spu-elf/4.4.0/../../../../spu-elf/include/c++/4.4.0 /home/jonathan/gcc-spu/lib/gcc/spu-elf/4.4.0/../../../../spu-elf/include/c++/4.4.0/spu-elf /home/jonathan/gcc-spu/lib/gcc/spu-elf/4.4.0/../../../../spu-elf/include/c++/4.4.0/backward /home/jonathan/gcc-spu/lib/gcc/spu-elf/4.4.0/include /home/jonathan/gcc-spu/lib/gcc/spu-elf/4.4.0/include-fixed /home/jonathan/gcc-spu/lib/gcc/spu-elf/4.4.0/../../../../spu-elf/include End of search list. GNU C++ (GCC) version 4.4.0 20080716 (experimental) (spu-elf) compiled by GNU C version 4.3.1, GMP version 4.2.2, MPFR version 2.3.1. GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: b3d5544b58f1447fbeb69330a4fd2dff splat.cpp: In function 'unsigned int __vector__ f()': splat.cpp:3: note: use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts splat.cpp:3: error: cannot convert 'unsigned char __vector__' to 'unsigned int __vector__' in return
In other words, gcc-4.3.1 creates a wrong-functioning spu-elf-g++
*** Bug 39887 has been marked as a duplicate of this bug. ***
spu as a target has been removed since GCC 10.