gcc-10: build error in dom/base/nsTreeSanitizer.cpp - static_assert breaks build
Categories
(Core :: XPCOM, defect)
Tracking
()
People
(Reporter: lenardrspencer, Unassigned)
References
Details
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0
Steps to reproduce:
building with gcc 10 (I know, the build instructions prefer clang)
Actual results:
gcc 10 choked on the new static_assert inserted in dom/base/nsTreeSanitizer.cpp at line 623
Here is the snip from the build log:
11:47.12 /pub/SBo/firefox-85.0/dom/base/nsTreeSanitizer.cpp:623:20: error: non-constant condition for static assertion
11:47.12 623 | static_assert(AllOf(std::begin(kURLAttributesSVG), std::end(kURLAttributesSVG),
11:47.12 | ^
11:47.12 624 | [](auto aURLAttributeSVG) {
11:47.12 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~
11:47.12 625 | return AnyOf(std::begin(kAttributesSVG),
11:47.12 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11:47.12 626 | std::end(kAttributesSVG),
11:47.12 | ~~~~~~~~~~~~~~~~~~~~~~~~~
11:47.12 627 | [&](auto aAttributeSVG) {
11:47.12 | ~~~~~~~~~~~~~~~~~~~~~~~~~
11:47.12 628 | return aAttributeSVG == aURLAttributeSVG;
11:47.12 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11:47.12 629 | });
11:47.12 | ~~~
11:47.12 630 | }));
11:47.12 | ~~
11:47.13 /pub/SBo/firefox-85.0/dom/base/nsTreeSanitizer.cpp:623:20: in ‘constexpr’ expansion of ‘mozilla::AllOf<const nsStaticAtom* const*, <lambda(auto:11)> >(std::begin<const nsStaticAtom* const, 2>(kURLAttributesSVG), std::end<const nsStaticAtom* const, 2>(kURLAttributesSVG), (<lambda closure object><lambda(auto:11)>{}, <lambda(auto:11)>()))’
11:47.13 /pub/SBo/firefox-85.0/obj/dist/include/mozilla/Algorithm.h:24:15: in ‘constexpr’ expansion of ‘aPred.<lambda(auto:11)>(((const nsStaticAtom*)(* aFirst)))’
11:47.13 /pub/SBo/firefox-85.0/dom/base/nsTreeSanitizer.cpp:625:35: in ‘constexpr’ expansion of ‘mozilla::AnyOf<const nsStaticAtom* const*, <lambda(auto:11)> [with auto:11 = const nsStaticAtom*]::<lambda(auto:12)> >(std::begin<const nsStaticAtom* const, 182>(kAttributesSVG), std::end<const nsStaticAtom* const, 182>(kAttributesSVG), <lambda closure object><lambda(auto:11)> [with auto:11 = const nsStaticAtom*]::<lambda(auto:12)>{aURLAttributeSVG})’
11:47.13 /pub/SBo/firefox-85.0/dom/base/nsTreeSanitizer.cpp:628:59: error: ‘((& mozilla::detail::gGkAtoms.mozilla::detail::GkAtoms::mAtoms[1535]) == 0)’ is not a constant expression
11:47.13 628 | return aAttributeSVG == aURLAttributeSVG;
11:47.13 | ^
Expected results:
should have built? but gcc 10 choked on this routine
Comment 1•4 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
Updated•4 years ago
|
Updated•4 years ago
|
Comment 3•4 years ago
|
||
Thanks for reporting this.
Not sure, but this seems to be a GCC bug. See the definition of gGkAtoms
and the declaration and its comment, which refers to a GCC bug.
Updated•4 years ago
|
Updated•4 years ago
|
Comment 4•4 years ago
|
||
I wonder if this is an instance of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89074
Comment 5•4 years ago
|
||
(In reply to Mirko Brodesser (:mbrodesser) from comment #3)
Not sure, but this seems to be a GCC bug. See the definition of
gGkAtoms
and the declaration and its comment, which refers to a GCC bug.
How is that link to the definition relevant? This seems to be more about whether the lambda itself is considered constexpr....
Making it a runtime debug assertion might be an ok alternative.
Comment 6•4 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #5)
(In reply to Mirko Brodesser (:mbrodesser) from comment #3)
Not sure, but this seems to be a GCC bug. See the definition of
gGkAtoms
and the declaration and its comment, which refers to a GCC bug.How is that link to the definition relevant? This seems to be more about whether the lambda itself is considered constexpr....
Because the definition is a constexpr
. The declaration not, though.
I wonder if this is an instance of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89074
Could be. Thanks for digging it out.
Comment 7•4 years ago
|
||
Making it a runtime debug assertion might be an ok alternative.
As a workaround, yes. For simplicity, it could just move to nsTressSanitizer()
.
hey there, do you think you're able to provide a few more informations? I'm using gentoo with gcc-10, and have failed to reproduce your compile failure. Do you maybe use some fancy cflags, like -O3, which is prone to breaking?
Reporter | ||
Comment 9•4 years ago
|
||
I am trying to build with the build script in Slackware64-current. Build options:
OPTIONS="
--enable-official-branding
--prefix=/usr
--libdir=/usr/lib${LIBDIRSUFFIX}
--with-system-zlib
--enable-alsa
--enable-application=browser
--enable-default-toolkit=cairo-gtk3-wayland
--disable-strip
--disable-install-strip
--enable-cpp-rtti
--enable-accessibility
--disable-crashreporter
--disable-debug-symbols
--disable-debug
--disable-updater
--disable-optimize"
export MOZILLA_OFFICIAL="1"
export BUILD_OFFICIAL="1"
export MOZ_PHOENIX="1"
export MOZ_PACKAGE_JSSHELL="1"
export CFLAGS="$SLKCFLAGS"
export CXXFLAGS="$SLKCFLAGS -fno-delete-null-pointer-checks"
export MOZ_MAKE_FLAGS="$NUMJOBS"
export MACH_USE_SYSTEM_PYTHON="1"
SLKCFLAGS="-O2 -fPIC"
NUMJOBS=" -j7"
(I'm on an 8-core processor)
Comment 10•4 years ago
|
||
I just want to chip in that I have also experienced this exact issue today while trying to build FF 88 (mozilla-release) with GCC 10 in Debian Sid. So this issue still exists in the current release.
.mozconfig
:
export CC=gcc-10
export CXX=g++-10
export CFLAGS='-fno-delete-null-pointer-checks'
export CXXFLAGS='-fno-delete-null-pointer-checks'
# this path was edited to shorten the line:
mk_add_options MOZ_OBJDIR=/path/to/obj-firefox
mk_add_options MOZ_MAKE_FLAGS="-j4"
ac_add_options --enable-official-branding
ac_add_options --enable-release
ac_add_options --enable-application=browser
ac_add_options --prefix=/usr
ac_add_options --enable-default-toolkit=cairo-gtk3
ac_add_options --enable-optimize="-O2"
ac_add_options --disable-tests
ac_add_options --disable-necko-wifi
ac_add_options --disable-updater
ac_add_options --disable-elf-hack
ac_add_options --enable-strip
ac_add_options --enable-install-strip
# My system does not use PulseAudio
ac_add_options --disable-pulseaudio
ac_add_options --enable-alsa
Comment 11•2 years ago
|
||
Closing under the assumption that this isn't an issue anymore, based on bug 1611519 being marked as fixed.
Description
•