Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 736685 - sys-devel/gcc-10.2.0: segfault in mesa when it is build with lto enabled
Summary: sys-devel/gcc-10.2.0: segfault in mesa when it is build with lto enabled
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: https://gcc.gnu.org/PR96482
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-11 06:51 UTC by Johannes Hirte
Modified: 2020-08-23 09:23 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Hirte 2020-08-11 06:51:19 UTC
gcc-10.2 produces wrong code that leads to segfault in mesa, when mesa is build with lto enabled. Upstream bugreports:

https://gitlab.freedesktop.org/mesa/mesa/-/issues/3239

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96482

Reproducible: Always
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-08-11 07:04:35 UTC
It may help to include a backtrace via gdb (use debug symbols: https://wiki.gentoo.org/wiki/Debugging), any other relevant output, and emerge --info, but yes, it seems to be a known upstream issue.
Comment 2 Johannes Hirte 2020-08-13 07:07:45 UTC
(In reply to Sam James from comment #1)
> It may help to include a backtrace via gdb (use debug symbols:
> https://wiki.gentoo.org/wiki/Debugging), any other relevant output, and
> emerge --info, but yes, it seems to be a known upstream issue.

That's why I have omitted the info this time. Upstream has fixed it, so maybe this could be added to the patchset?
Comment 3 Larry the Git Cow gentoo-dev 2020-08-13 09:04:01 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=c446f6f37e5a5f0867527acdb0b78333e3b70822

commit c446f6f37e5a5f0867527acdb0b78333e3b70822
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-08-13 08:39:49 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-08-13 08:39:49 +0000

    10.2.0:backport ipa-cp bit fix (PR/96482)
    
    Reported-by: Johannes Hirte
    Bug: https://bugs.gentoo.org/736685
    Bug: https://gcc.gnu.org/PR96482
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch | 145 ++++++++++++++++++++++++++++++
 10.2.0/gentoo/README.history              |   1 +
 2 files changed, 146 insertions(+)
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2020-08-13 09:06:00 UTC
Queued patch for next gcc-10.2.0 patchset. Will take a few week.

Meanwhile can you test it on your system? You can drop
    https://gitweb.gentoo.org/proj/gcc-patches.git/plain/10.2.0/gentoo/35_all_ipa-fix-bit-CP.patch
to
    /etc/portage/patches/sys-devel/gcc:10/
and rebuild gcc.
Comment 5 Johannes Hirte 2020-08-13 19:00:49 UTC
(In reply to Sergei Trofimovich from comment #4)
> Queued patch for next gcc-10.2.0 patchset. Will take a few week.
> 
> Meanwhile can you test it on your system? You can drop
>    
> https://gitweb.gentoo.org/proj/gcc-patches.git/plain/10.2.0/gentoo/
> 35_all_ipa-fix-bit-CP.patch
> to
>     /etc/portage/patches/sys-devel/gcc:10/
> and rebuild gcc.

Yes, this fixed it. The segfault is gone.
Comment 6 Johannes Hirte 2020-08-17 06:29:29 UTC
I get an ICE when compiling the linux kernel: 

during GIMPLE pass: ccp
fs/btrfs/ctree.c: In function ‘insert_new_root’:
fs/btrfs/ctree.c:3308:21: internal compiler error: in get_default_value, at tree-ssa-ccp.c:311
 3308 | static noinline int insert_new_root(struct btrfs_trans_handle *trans,


I'm just checking if this is caused by this patch.
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2020-08-17 08:31:52 UTC
Try to extract self-contained preprocessed example with https://wiki.gentoo.org/wiki/Gcc-ICE-reporting-guide
Comment 8 Sergei Trofimovich (RETIRED) gentoo-dev 2020-08-17 08:36:47 UTC
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=4a2371497e9bed64aa4f46169127f3ea8e32e726 looks like a plausible fix.
Comment 10 Johannes Hirte 2020-08-17 20:20:31 UTC
(In reply to Johannes Hirte from comment #9)
> Yes it's caused by
> https://gitweb.gentoo.org/proj/gcc-patches.git/plain/10.2.0/gentoo/
> 35_all_ipa-fix-bit-CP.patch,
> 
> I'm testing if
> https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;
> h=4a2371497e9bed64aa4f46169127f3ea8e32e726 is fixing this.

Yes, this fixed the ICE with the linux kernel.
Comment 11 Sergei Trofimovich (RETIRED) gentoo-dev 2020-08-17 21:23:15 UTC
(In reply to Johannes Hirte from comment #10)
> (In reply to Johannes Hirte from comment #9)
> > Yes it's caused by
> > https://gitweb.gentoo.org/proj/gcc-patches.git/plain/10.2.0/gentoo/
> > 35_all_ipa-fix-bit-CP.patch,
> > 
> > I'm testing if
> > https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;
> > h=4a2371497e9bed64aa4f46169127f3ea8e32e726 is fixing this.
> 
> Yes, this fixed the ICE with the linux kernel.

Yay! Thank you for the test! Will queue patch up as well.
Comment 12 Larry the Git Cow gentoo-dev 2020-08-17 21:26:32 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=0d98cab225ecb321bc18d894951bb2d3b7b45bd0

commit 0d98cab225ecb321bc18d894951bb2d3b7b45bd0
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-08-17 21:26:01 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-08-17 21:26:01 +0000

    10.2.0: backport ipa-cp bit fix, part 2 (PR/96482)
    
    Reported-by: Johannes Hirte
    Bug: https://bugs.gentoo.org/736685
    Bug: https://gcc.gnu.org/PR96482
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 10.2.0/gentoo/36_all_ipa-fix-bit-CP-p2.patch | 80 ++++++++++++++++++++++++++++
 10.2.0/gentoo/README.history                 |  1 +
 2 files changed, 81 insertions(+)
Comment 14 Larry the Git Cow gentoo-dev 2020-08-23 09:14:39 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9bba1f72a9210743fddf664b716b5cf288132922

commit 9bba1f72a9210743fddf664b716b5cf288132922
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-08-23 09:11:31 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-08-23 09:11:31 +0000

    10.2.0: cut 2 patchset
    
    Four new patches:
    + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch: fix -O0 crash for ipa/lto
    + 34_all_fundecl-ICE-PR95820.patch: fix ICE on invalid templates
    + 35_all_ipa-fix-bit-CP.patch: fix bad code generation in ipa bit constprop
    + 36_all_ipa-fix-bit-CP-p2.patch: part 2 of previous patch
    
    Bug: https://bugs.gentoo.org/733482
    Bug: https://gcc.gnu.org/PR96291
    Bug: https://bugs.gentoo.org/730406
    Bug: https://gcc.gnu.org/PR95820
    Bug: https://bugs.gentoo.org/736685
    Bug: https://gcc.gnu.org/PR96482
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 10.2.0/gentoo/README.history | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 15 Larry the Git Cow gentoo-dev 2020-08-23 09:23:33 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=653d6bf6ea15bdf2db033e3099913bac47f5b0e0

commit 653d6bf6ea15bdf2db033e3099913bac47f5b0e0
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-08-23 09:17:12 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-08-23 09:17:12 +0000

    sys-devel/gcc:  cut 2 patchset
    
    Four new patches:
    + 33_all_lto-O0-mix-ICE-ipa-PR96291.patch: fix -O0 crash for ipa/lto
    + 34_all_fundecl-ICE-PR95820.patch: fix ICE on invalid templates
    + 35_all_ipa-fix-bit-CP.patch: fix bad code generation in ipa bit constprop
    + 36_all_ipa-fix-bit-CP-p2.patch: part 2 of previous patch
    
    Closes: https://bugs.gentoo.org/733482
    Bug: https://gcc.gnu.org/PR96291
    Closes: https://bugs.gentoo.org/730406
    Bug: https://gcc.gnu.org/PR95820
    Closes: https://bugs.gentoo.org/736685
    Bug: https://gcc.gnu.org/PR96482
    Package-Manager: Portage-3.0.4, Repoman-3.0.1
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 sys-devel/gcc/Manifest             |  1 +
 sys-devel/gcc/gcc-10.2.0-r1.ebuild | 13 +++++++++++++
 2 files changed, 14 insertions(+)