Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 862891

Summary: sys-devel/gcc: ICE when building media-libs/libjxl in function 'bool jxl_skcms_Parse(const void*, size_t, skcms_ICCProfile*)': at skcms/skcms.cc:1004:6
Product: Gentoo Linux Reporter: tt_1 <herrtimson>
Component: Current packagesAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: UNCONFIRMED ---    
Severity: normal CC: dnovomesky, proxy-maint
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106466
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: compressed build log
compressed preprocessed source
output from emerge --info

Description tt_1 2022-08-02 05:39:41 UTC
Created attachment 796732 [details]
compressed build log

hey everyone, 


I've hit an ICE when compiling =media-libs/libjxl-9999 with gcc-10.4.0: 

 LANG=C /usr/bin/aarch64-unknown-linux-gnu-g++ -DHWY_DISABLED_TARGETS="(HWY_SVE|HWY_SVE2|HWY_SVE_256|HWY_SVE2_128|HWY_RVV)" -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\" -I/var/tmp/portage/media-libs/libjxl-9999/work/libjxl-9999/third_party/skcms  -O2 -pipe -save-temps -fno-rtti -funwind-tables -fno-omit-frame-pointer -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fmacro-prefix-map=/var/tmp/portage/media-libs/libjxl-9999/work/libjxl-9999=. -Wno-builtin-macro-redefined -Wall -Wno-psabi -DJPEGXL_BUNDLE_SKCMS=1 -include /var/tmp/portage/media-libs/libjxl-9999/work/libjxl-9999/third_party/../lib/jxl/enc_jxl_skcms.h -std=c++11 -MD -MT third_party/CMakeFiles/skcms-obj.dir/skcms/skcms.cc.o -MF third_party/CMakeFiles/skcms-obj.dir/skcms/skcms.cc.o.d -o third_party/CMakeFiles/skcms-obj.dir/skcms/skcms.cc.o -c /var/tmp/portage/media-libs/libjxl-9999/work/libjxl-9999/third_party/skcms/skcms.cc
aarch64-unknown-linux-gnu-g++: warning: '-pipe' ignored because '-save-temps' specified
during GIMPLE pass: pre
/var/tmp/portage/media-libs/libjxl-9999/work/libjxl-9999/third_party/skcms/skcms.cc: In function 'bool jxl_skcms_Parse(const void*, size_t, skcms_ICCProfile*)':
/var/tmp/portage/media-libs/libjxl-9999/work/libjxl-9999/third_party/skcms/skcms.cc:1004:6: internal compiler error: Segmentation fault
 1004 | bool skcms_Parse(const void* buf, size_t len, skcms_ICCProfile* profile) {
      |      ^~~~~~~~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.gentoo.org/> for instructions.


I will attach the compressed build log
Comment 1 tt_1 2022-08-02 05:40:14 UTC
Created attachment 796735 [details]
compressed preprocessed source
Comment 2 tt_1 2022-08-02 05:48:47 UTC
Its very difficult for me to nail this bug down: 

it has a chance of about 1/7 to 1/5 to be triggered, so if I repeat the compile ten times in a row its going to show up at least once. this sort of heisenbug behavior gives me a headace, especially as I've talked to the gcc devs and they were unable to reproduce this with the preprocessed sources and their cross compiler setups. 

so, I'm actually asking if some of the toolchain people is able to guide me a bit maybe in how to use valgrind maybe? I'm not a dev obviously, and not anywhere close to being a compiler expert as well, so feel a bit lost.

I wasn't lazy and did some extensive testing, the ICE was introduced with this bugfix: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105998 - possibly incomplete fix then? 

all upstream discussion is in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106466
Comment 3 tt_1 2022-08-02 06:12:40 UTC
Created attachment 796738 [details]
output from emerge --info
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-08-04 02:15:49 UTC
I think you'd be best to just report upstream with what you know, and comment on the bug which introduced it to link to yours.
Comment 5 tt_1 2022-08-04 06:40:36 UTC
yes, there is some progress in debugging this - valgrind shows a memory leak and a possible problem with garbage collection. 

Now, I'm just an average user and not a compiler expert for a second - do you understand what the gcc dev is asking me here? I need some directions :D 



> I suspect this is a GC (garbage collection) issue.
> It might be easier to reduce it using --param ggc-min-expand=1 --param ggc-min->heapsize=1 (and then moving them both to 0 afterwards).


> https://gcc.gnu.org/wiki/A_guide_to_testcase_reduction?highlight=%28reduce%29

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106466#c14
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-08-04 07:01:28 UTC
I think what they're saying is that if you add those flags to when you call gcc (they're CFLAGS), it might make the issue way more reproducible, so it's easier for you to then put it into cvise (see our wiki page)
Comment 7 tt_1 2022-08-04 07:25:26 UTC
like this?  

LANG=C valgrind --leak-check=full /usr/bin/aarch64-unknown-linux-gnu-g++ --param ggc-min-expand=1 --param ggc-min-heapsize=1 -DHWY_DISABLED_TARGETS="(HWY_SVE|HWY_SVE2|HWY_SVE_256|HWY_SVE2_128|HWY_RVV)" -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\" -I/var/tmp/portage/media-libs/libjxl-9999/work/libjxl-9999/third_party/skcms  -O2 -pipe -save-temps -fno-rtti -funwind-tables -fno-omit-frame-pointer -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fmacro-prefix-map=/var/tmp/portage/media-libs/libjxl-9999/work/libjxl-9999=. -Wno-builtin-macro-redefined -Wall -Wno-psabi -DJPEGXL_BUNDLE_SKCMS=1 -include /var/tmp/portage/media-libs/libjxl-9999/work/libjxl-9999/third_party/../lib/jxl/enc_jxl_skcms.h -std=c++11 -MD -MT third_party/CMakeFiles/skcms-obj.dir/skcms/skcms.cc.o -MF third_party/CMakeFiles/skcms-obj.dir/skcms/skcms.cc.o.d -o third_party/CMakeFiles/skcms-obj.dir/skcms/skcms.cc.o -c /var/tmp/portage/media-libs/libjxl-9999/work/libjxl-9999/third_party/skcms/skcms.cc


( if it's correct - swaping to --param ggc-min-expand=0 --param ggc-min-heapsize=0 hangs for some 10 minutes - is that normal? )
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-08-04 07:33:25 UTC
That looks right. Does it fail a bit more often with that? Or always?

As for hang: try without valgrind? I've never used those options so I'm unsure. I think it might be that we have to use =1 to do the reducing but play with =0 once reduced.
Comment 9 tt_1 2022-08-04 08:19:10 UTC
there is no obvious change in ICE behavior when swapping --param ggc-min-expand=1 --param ggc-min-heapsize=1 to 0 , even the preprocessed file skcms.ii are identical, as in they have the same md5 checksum. 

would you like to see them nonetheless?