Bug 11754 - libjpeg-turbo: compiling for powerpc results in toolchain ICE
Summary: libjpeg-turbo: compiling for powerpc results in toolchain ICE
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: graphics (show other bugs)
Version: 2.5
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 4.99
Assignee: Randy MacLeod
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2017-07-04 22:22 UTC by Randy MacLeod
Modified: 2018-12-28 20:23 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
gcc: Update to 7.1.1 pre-release (29.78 KB, patch)
2017-07-04 22:49 UTC, Randy MacLeod
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Randy MacLeod 2017-07-04 22:22:57 UTC
When building libjpeg-turbo for qemuppc, gcc encounters an internal compiler error:

| powerpc-oe-linux-libtool: compile:  powerpc-oe-linux-gcc -m32 -mhard-float -mcpu=7400 -mno-spe --sysroot=/ala-lpggp22/rmacleod/src/distro/yocto/b/ljp/tmp-glibc/work/ppc7400-oe-linux/libjpeg-turbo/1_1.5.1-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I../../libjpeg-turbo-1.5.1/simd -I.. -I../../libjpeg-turbo-1.5.1 -Wall -maltivec -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/ala-lpggp22/rmacleod/src/distro/yocto/b/ljp/tmp-glibc/work/ppc7400-oe-linux/libjpeg-turbo/1_1.5.1-r0=/usr/src/debug/libjpeg-turbo/1_1.5.1-r0 -fdebug-prefix-map=/ala-lpggp22/rmacleod/src/distro/yocto/b/ljp/tmp-glibc/work/ppc7400-oe-linux/libjpeg-turbo/1_1.5.1-r0/recipe-sysroot-native= -fdebug-prefix-map=/ala-lpggp22/rmacleod/src/distro/yocto/b/ljp/tmp-glibc/work/ppc7400-oe-linux/libjpeg-turbo/1_1.5.1-r0/recipe-sysroot= -c ../../libjpeg-turbo-1.5.1/simd/jdcolor-altivec.c  -fPIC -DPIC -o .libs/libsimd_altivec_la-jdcolor-altivec.o
| In file included from ../../libjpeg-turbo-1.5.1/simd/jdcolor-altivec.c:42:0:
| ../../libjpeg-turbo-1.5.1/simd/jdcolext-altivec.c: In function 'jsimd_ycc_rgb_convert_altivec':
| ../../libjpeg-turbo-1.5.1/simd/jdcolext-altivec.c:222:17: internal compiler error: Segmentation fault
|            edgeh = vec_ld(min(num_cols - 1, RGB_PIXELSIZE * 16), outptr);
|            ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| In file included from ../../libjpeg-turbo-1.5.1/simd/jdmerge-altivec.c:42:0:
| ../../libjpeg-turbo-1.5.1/simd/jdmrgext-altivec.c: In function 'jsimd_h2v1_merged_upsample_altivec':
| ../../libjpeg-turbo-1.5.1/simd/jdmrgext-altivec.c:247:17: internal compiler error: Segmentation fault
|            edgeh = vec_ld(min(num_cols - 1, RGB_PIXELSIZE * 16), outptr);
|            ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Please submit a full bug report,
| with preprocessed source if appropriate.
| See <https://gcc.gnu.org/bugs/> for instructions.
| Makefile:626: recipe for target 'libsimd_altivec_la-jdcolor-altivec.lo' failed
| make[3]: *** [libsimd_altivec_la-jdcolor-altivec.lo] Error 1
| make[3]: *** Waiting for unfinished jobs....
| Please submit a full bug report,
| with preprocessed source if appropriate.
| See <https://gcc.gnu.org/bugs/> for instructions.
| Makefile:633: recipe for target 'libsimd_altivec_la-jdmerge-altivec.lo' failed
| make[3]: *** [libsimd_altivec_la-jdmerge-altivec.lo] Error 1
| make[3]: Leaving directory '/ala-lpggp22/rmacleod/src/distro/yocto/b/ljp/tmp-glibc/work/ppc7400-oe-linux/libjpeg-turbo/1_1.5.1-r0/build/simd'
| Makefile:480: recipe for target 'all' failed
| make[2]: *** [all] Error 2
Comment 1 Randy MacLeod 2017-07-04 22:27:52 UTC
I have used creduce to generate a remarkably small reproducer:

$ cat testcase.i 
jsimd_ycc_extbgrx_convert_altivec_outptr; 
__attribute__ ( ( altivec 
                  ( __builtin_vec_ld 
                    ( 1, jsimd_ycc_extbgrx_convert_altivec_outptr ) 

--------------------------------------------

Using this script:
$ cat check.sh  
#!/bin/sh 
# gcc -c -O -Wfatal-errors $1 2>&1 | grep 'internal compiler error' 
set -x 
TESTCASE=${1:-testcase.i} 
powerpc-oe-linux-gcc -Wfatal-errors -m32 -mhard-float -mcpu=7400 -mno-spe -Wall -Wextra --sysroot=/buildarea/rmacleod/src/distro/yocto/b/sd-ppc/tmp-glibc/work/ppc7400-oe-linux/libjpeg-turbo/1_1.5.2-r0/recipe-sysroot -DHAVE_CONFIG_H -I. -I/buildarea/rmacleod/src/distro/yocto/b/sd-ppc/tmp-glibc/work/ppc7400-oe-linux/libjpeg-turbo/1_1.5.2-r0/libjpeg-turbo-1.5.2/simd -I/buildarea/rmacleod/src/distro/yocto/b/sd-ppc/tmp-glibc/work/ppc7400-oe-linux/libjpeg-turbo/1_1.5.2-r0/libjpeg-turbo-1.5.2 -I../../libjpeg-turbo-1.5.2 -Wall -maltivec -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/buildarea/rmacleod/src/distro/yocto/b/sd-ppc/tmp-glibc/work/ppc7400-oe-linux/libjpeg-turbo/1_1.5.2-r0=/usr/src/debug/libjpeg-turbo/1_1.5.2-r0 -fdebug-prefix-map=/buildarea/rmacleod/src/distro/yocto/b/sd-ppc/tmp-glibc/work/ppc7400-oe-linux/libjpeg-turbo/1_1.5.2-r0/recipe-sysroot-native= -fdebug-prefix-map=/buildarea/rmacleod/src/distro/yocto/b/sd-ppc/tmp-glibc/work/ppc7400-oe-linux/libjpeg-turbo/1_1.5.2-r0/recipe-sysroot=  -fPIC -DPIC -o .libs/libsimd_altivec_la-jdcolor-altivec.o -c testcase.i  2>&1 | grep 'internal compiler error:'
if ! test $? = 0; then
   exit 1
fi
exit 0
---------------

then:
$ creduce check.sh testcase.i
where testcase.i is initially the preprocessor output generated by the compiler command line in the initial bug report with the -save-temps flag used.
Comment 2 Randy MacLeod 2017-07-04 22:34:42 UTC
The bug also seems to still occur with the snapshot of the upcoming 7.1.1 release: 
   gcc-7.1.1.inc:RELEASE = "7-20170629" 
using the gcc-7.1.1 recipes that I put together. I was able to build core-image-minimal and the right bits appear to be downloaded and patched without any changes to the existing list of patches. 

I'll report the bug upstream once my account has been enabled.
Comment 3 Randy MacLeod 2017-07-04 22:49:12 UTC
Created attachment 3858 [details]
gcc: Update to 7.1.1 pre-release

Patch attached in case anyone else wants to confirm or work with the newer version of the toolchain.
Comment 4 Randy MacLeod 2017-07-05 00:02:36 UTC
gcc defect: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81317
Comment 5 Randy MacLeod 2017-07-17 18:35:41 UTC
The GCC devs has committed a fix upstream, I'll be testing it this week.
Comment 6 Randy MacLeod 2017-08-17 01:45:31 UTC
The test fixed one of the minimal reproducers that I found but not the main bug.
I've tested with gcc-7.2 and the problem and the functionally identical stacktrace remain. I've updated the gcc defect.
Comment 7 Randy MacLeod 2017-09-21 00:10:38 UTC
The gcc dev can't reproduce this bug and I haven't heard of anyone other than me encountering the error so it makes sense to push it to 2.5. We may get the Wind River toolchain team to work on it but they are not available at the moment.
Comment 8 Randy MacLeod 2017-11-23 16:09:24 UTC
A local toolchain expert has started working on this defect.
Comment 9 Randy MacLeod 2018-01-18 20:00:06 UTC
We have a fix but I need to test it and get it upstream.
Comment 10 Randy MacLeod 2018-12-28 20:23:34 UTC
Works for me on the thud and master branches.
The toolchain patches that I had didn't apply to the older branch since people updated the toolchain to fix spectre/meltdown bugs.

If this error affects you, and you can reproduce it using poky, please re-open the defect.