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

Bug 758446

Summary: www-client/firefox breaks under GCC 10 when using -O3
Product: Gentoo Linux Reporter: Esteve Varela Colominas <esteve.varela>
Component: Current packagesAssignee: Mozilla Gentoo Team <mozilla>
Status: RESOLVED UPSTREAM    
Severity: normal CC: alexander, herrtimson, jstein, sam, toolchain, wgh
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://bugzilla.mozilla.org/show_bug.cgi?id=1682191
See Also: https://bugs.gentoo.org/show_bug.cgi?id=894120
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 915000, 706426    

Description Esteve Varela Colominas 2020-12-04 21:38:03 UTC
Under GCC 10, this package seems to break a bunch of addons if you use either '-O2 -flto' or '-O3' to build. This affects the USE=lto and USE=pgo USE flags, as the latter implicitly enables '-O3'.

The issue is most notably manifested as violentmonkey not being able to run any userscripts, and seemingly clearing all userscripts upon restart. Checking about:debugging yields the following error, which doesn't appear when the browser's built with just '-O2':
https://files.catbox.moe/vodnfn.png

Is this a supported configuration by upstream, or do they only support Clang? If so, should this be reported upstream?
Comment 1 Esteve Varela Colominas 2020-12-04 21:45:45 UTC
Relevant GentooLTO issue: https://github.com/InBetweenNames/gentooLTO/issues/650
Comment 2 Thomas Deutschmann (RETIRED) gentoo-dev 2020-12-05 00:08:51 UTC
According to your linked Github issue this is not related to LTO, it's caused by -O3 (which will also get enabled when using LTO).
Comment 3 Thomas Deutschmann (RETIRED) gentoo-dev 2020-12-05 00:13:59 UTC
Please show us

`emerge --info www-client/firefox | tail -n 11`
Comment 4 Thomas Deutschmann (RETIRED) gentoo-dev 2020-12-05 00:15:21 UTC
`emerge --info sys-devel/gcc | tail -n 11` so we know which GCC patch set you are using.
Comment 5 Esteve Varela Colominas 2020-12-06 18:33:48 UTC
I could've sworn this was reproducible with USE=lto on -O2, but I guess not.
These are the minimum settings I could reproduce the issue with:

$ emerge --info www-client/firefox | tail -n 11

=================================================================
                        Package Settings
=================================================================

www-client/firefox-78.5.0::gentoo was built with the following:
USE="dbus eme-free openh264 pulseaudio system-av1 system-harfbuzz system-icu system-jpeg system-libevent system-libvpx system-webp -clang -debug -geckodriver -gmp-autoupdate -hardened -hwaccel -jack -lto -pgo (-screencast) (-selinux) -wayland -wifi" ABI_X86="(64)" L10N="ca es-ES -ach -af -an -ar -ast -az -be -bg -bn -br -bs -ca-valencia -cak -cs -cy -da -de -dsb -el -en-CA -en-GB -eo -es-AR -es-CL -es-MX -et -eu -fa -ff -fi -fr -fy -ga -gd -gl -gn -gu -he -hi -hr -hsb -hu -hy -ia -id -is -it -ja -ka -kab -kk -km -kn -ko -lij -lt -lv -mk -mr -ms -my -nb -ne -nl -nn -oc -pa -pl -pt-BR -pt-PT -rm -ro -ru -si -sk -sl -son -sq -sr -sv -ta -te -th -tl -tr -trs -uk -ur -uz -vi -xh -zh-CN -zh-TW"
CFLAGS="-march=znver1 -O3 -pipe -w"
CXXFLAGS="-march=znver1 -O3 -pipe -w"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -march=znver1 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fno-semantic-interposition -fuse-linker-plugin -pipe -w --param=lto-max-streaming-parallelism=2 -Wl,--compress-debug-sections=zlib -Wl,-rpath=/usr/lib64/firefox,--enable-new-dtags"

$ emerge --info sys-devel/gcc | tail -n 11
=================================================================
                        Package Settings
=================================================================

sys-devel/gcc-10.2.0-r3::gentoo was built with the following:
USE="(cxx) fortran graphite lto (multilib) nls nptl openmp pch pgo (pie) sanitize vtv (-ada) -d -debug -doc (-fixed-point) -go (-hardened) -jit (-libssp) -objc -objc++ -objc-gc -ssp -systemtap -test -vanilla -zstd" ABI_X86="(64)"
CFLAGS="-march=znver1 -pipe -w -Wl,-O1 -Wl,--as-needed -O2"
CXXFLAGS="-march=znver1 -pipe -w -Wl,-O1 -Wl,--as-needed -O2"
FEATURES="strict preserve-libs multilib-strict unknown-features-warn usersandbox ebuild-locks network-sandbox merge-sync userpriv assume-digests binpkg-dostrip config-protect-if-modified ipc-sandbox sfperms news distlocks userfetch xattr binpkg-docompress protect-owned qa-unresolved-soname-deps unmerge-logs buildpkg sandbox unmerge-orphans binpkg-logs fixlafiles parallel-fetch binpkg-multi-instance pid-sandbox usersync"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -march=znver1 -pipe -w"
Comment 6 Thomas Deutschmann (RETIRED) gentoo-dev 2020-12-13 22:05:56 UTC
It's not just ESR and not just add-ons affected.
Comment 7 Larry the Git Cow gentoo-dev 2020-12-14 00:18:44 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2fed8b79dc9c6284243ef81f7d32e8e528728a95

commit 2fed8b79dc9c6284243ef81f7d32e8e528728a95
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-12-14 00:15:24 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-12-14 00:17:05 +0000

    profiles/base/package.use.force: force USE=clang for firefox/thunderbird
    
    Bug: https://bugs.gentoo.org/758446
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 profiles/base/package.use.force | 8 ++++++++
 1 file changed, 8 insertions(+)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4f3afb07a1550e4133182c736491f72a3d06c09f

commit 4f3afb07a1550e4133182c736491f72a3d06c09f
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-12-14 00:10:00 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-12-14 00:17:05 +0000

    mail-client/thunderbird: use Clang by default
    
    Bug: https://bugs.gentoo.org/758446
    Package-Manager: Portage-3.0.12, Repoman-3.0.2
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 mail-client/thunderbird/thunderbird-78.5.1.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5b92571ae9ad649ad61e9886500b4feedb8de915

commit 5b92571ae9ad649ad61e9886500b4feedb8de915
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-12-14 00:06:31 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-12-14 00:17:04 +0000

    www-client/firefox: use Clang by default
    
    Bug: https://bugs.gentoo.org/758446
    Package-Manager: Portage-3.0.12, Repoman-3.0.2
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 www-client/firefox/firefox-78.5.0.ebuild   | 2 +-
 www-client/firefox/firefox-83.0.ebuild     | 2 +-
 www-client/firefox/firefox-84.0_rc2.ebuild | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
Comment 8 WGH 2020-12-15 22:23:58 UTC
Is forcing
Comment 9 Larry the Git Cow gentoo-dev 2020-12-21 23:43:30 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=10b8a24ed8ea22f75979d312ccc4f6bc8dd986e6

commit 10b8a24ed8ea22f75979d312ccc4f6bc8dd986e6
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-12-21 21:36:46 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-12-21 23:40:54 +0000

    profiles/base/package.use.force: no longer force USE=clang for Mozilla
    
    Bug: https://bugs.gentoo.org/758446
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 profiles/base/package.use.force | 9 ---------
 1 file changed, 9 deletions(-)

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

commit f373b422ad975add8b59468f781d10b3b2106b3f
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-12-21 21:36:02 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-12-21 23:40:53 +0000

    dev-lang/spidermonkey: synchronize with www-client/firefox
    
    Bug: https://bugs.gentoo.org/758446
    Package-Manager: Portage-3.0.12, Repoman-3.0.2
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 dev-lang/spidermonkey/spidermonkey-78.6.0.ebuild | 9 +++++++++
 1 file changed, 9 insertions(+)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7b374e16a74185d720c52c887d746bc2cc1206cd

commit 7b374e16a74185d720c52c887d746bc2cc1206cd
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-12-21 21:23:09 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-12-21 23:40:53 +0000

    mail-client/thunderbird: synchronize with www-client/firefox
    
    Bug: https://bugs.gentoo.org/758446
    Package-Manager: Portage-3.0.12, Repoman-3.0.2
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 mail-client/thunderbird/thunderbird-78.6.0.ebuild | 7 +++++++
 1 file changed, 7 insertions(+)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=09886ee677ea97b80f1469dc7534ff6aea6247cb

commit 09886ee677ea97b80f1469dc7534ff6aea6247cb
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-12-21 21:18:14 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-12-21 23:40:52 +0000

    www-client/firefox: disable loop vectorization
    
    Loop vectorization, -ftree-loop-vectorize, which will be auto-enabled
    when using -O3, is broken in GCC 10+.
    
    Many thanks to Dave Hughes (xaero) for running countless tests to
    find the issue.
    
    Bug: https://bugs.gentoo.org/758446
    Package-Manager: Portage-3.0.12, Repoman-3.0.2
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 www-client/firefox/firefox-78.6.0.ebuild | 7 +++++++
 www-client/firefox/firefox-84.0.ebuild   | 7 +++++++
 2 files changed, 14 insertions(+)
Comment 10 tt_1 2021-01-01 14:25:23 UTC
so, is this a gcc-10 bug? maybe you want to cc toolchain then?
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-01-02 06:32:26 UTC
(In reply to tt_1 from comment #10)
> so, is this a gcc-10 bug? maybe you want to cc toolchain then?

It was debugged with slyfox, so they are aware. But we can do it anyway.
Comment 12 Sergei Trofimovich (RETIRED) gentoo-dev 2021-01-02 09:59:55 UTC
I was not able to reproduce the failure locally on a clean profile.

Generally if -ftree-loop-vectorize helps it usually hints at aliasing bugs in the program (and probably not in a complier). Having a smll deterministic reproducer of a bug would help to nail down what is at fault.
Comment 13 Andreas K. Hüttel archtester gentoo-dev 2021-03-06 15:30:58 UTC
Since the workaround commits from comment #9 make the build work with gcc-10, I'm removing this from the gcc-10 stable blockers.
Comment 14 Joonas Niilola gentoo-dev 2022-09-28 12:46:25 UTC
I'm pretty sure it works now with versions we have in tree.