Here is the g++ commandline:

g++ -MMD -MF obj/third_party/angle/libGLESv2/entry_points_gles_ext_autogen.o.d -DLIBGLESV2_IMPLEMENTATION -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_X11=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -DCOMPONENT_BUILD -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DANGLE_IS_64_BIT_CPU -DGL_APICALL=__attribute__\(\(visibility\(\"default\"\)\)\) -DGL_API=__attribute__\(\(visibility\(\"default\"\)\)\) -DGL_GLES_PROTOTYPES=1 -DEGL_EGL_PROTOTYPES=1 -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES -DANGLE_CAPTURE_ENABLED=0 -DLIBANGLE_IMPLEMENTATION -DANGLE_USE_X11 -DANGLE_ENABLE_OPENGL -DANGLE_ENABLE_OPENGL_NULL -DANGLE_ENABLE_NULL -DANGLE_ENABLE_VULKAN -DANGLE_ENABLE_SWIFTSHADER -DANGLE_USE_CUSTOM_VULKAN_CMD_BUFFERS=1 -DANGLE_ENABLE_VULKAN -DANGLE_ENABLE_SWIFTSHADER -DANGLE_USE_CUSTOM_VULKAN_CMD_BUFFERS=1 -I../../third_party/angle/include -I../../third_party/angle/src -Igen/angle -I../../third_party/angle/src/common/third_party/base -I../../third_party/angle/include -I../../third_party/angle/include -I../../third_party/angle/src -I../../third_party/angle/include -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -funwind-tables -fPIC -pipe -pthread -m64 -march=x86-64 -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -Wall -Wno-unused-local-typedefs -Wno-maybe-uninitialized -Wno-deprecated-declarations -Wno-comments -Wno-packed-not-aligned -Wno-missing-field-initializers -Wno-unused-parameter -O2 -fno-ident -fdata-sections -ffunction-sections -fno-omit-frame-pointer -g0 -fvisibility=hidden -std=gnu++14 -Wno-narrowing -Wno-class-memaccess -fno-exceptions -fno-rtti -fvisibility-inlines-hidden -c ../../third_party/angle/src/libGLESv2/entry_points_gles_ext_autogen.cpp -o obj/third_party/angle/libGLESv2/entry_points_gles_ext_autogen.o

The error with gcc 10:

In file included from ../../third_party/angle/src/libANGLE/Context.h:18,
                 from ../../third_party/angle/src/libGLESv2/entry_points_gles_ext_autogen.cpp:13:
../../third_party/angle/src/libANGLE/angletypes.h:427:2:   in 'constexpr' expansion of 'angle::PackedEnumMap<gl::ComponentType, unsigned int>(std::initializer_list<std::pair<gl::ComponentType, unsigned int> >{((const std::pair<gl::ComponentType, unsigned int>*)(& const std::pair<gl::ComponentType, unsigned int> [3]{std::pair<gl::ComponentType, unsigned int>{gl::ComponentType::Float, 65537}, std::pair<gl::ComponentType, unsigned int>{gl::ComponentType::Int, 1}, std::pair<gl::ComponentType, unsigned int>{gl::ComponentType::UnsignedInt, 65536}})), 3})'
../../third_party/angle/src/common/PackedEnums.h:89:72: error: modifying a const object '(unsigned int&)(&(&(const Storage&)(&((angle::PackedEnumMap<gl::ComponentType, unsigned int>*)this)->angle::PackedEnumMap<gl::ComponentType, unsigned int>::mPrivateData))->std::array<unsigned int, 4>::operator[](((std::array<unsigned int, 4>::size_type)((angle::PackedEnumMap<gl::ComponentType, unsigned int>::UnderlyingType)it->std::pair<gl::ComponentType, unsigned int>::first))))' is not allowed in a constant expression
   88 |             const_cast<T &>(const_cast<const Storage &>(
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   89 |                 mPrivateData)[static_cast<UnderlyingType>(it->first)]) = it->second;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
In file included from ../../third_party/angle/src/libANGLE/Caps.h:12,
                 from ../../third_party/angle/src/libANGLE/Context.h:20,
                 from ../../third_party/angle/src/libGLESv2/entry_points_gles_ext_autogen.cpp:13:
../../third_party/angle/src/libANGLE/angletypes.h:427:2: note: originally declared 'const' here
  427 | }};
      |  ^
In file included from ../../third_party/angle/src/libANGLE/Context.h:18,
                 from ../../third_party/angle/src/libGLESv2/entry_points_gles_ext_autogen.cpp:13:
../../third_party/angle/src/libANGLE/Context.inl.h:36:2:   in 'constexpr' expansion of 'angle::PackedEnumMap<gl::PrimitiveMode, int>(std::initializer_list<std::pair<gl::PrimitiveMode, int> >{((const std::pair<gl::PrimitiveMode, int>*)(& const std::pair<gl::PrimitiveMode, int> [11]{std::pair<gl::PrimitiveMode, int>{gl::PrimitiveMode::Points, 1}, std::pair<gl::PrimitiveMode, int>{gl::PrimitiveMode::Lines, 2}, std::pair<gl::PrimitiveMode, int>{gl::PrimitiveMode::LineLoop, 2}, std::pair<gl::PrimitiveMode, int>{gl::PrimitiveMode::LineStrip, 2}, std::pair<gl::PrimitiveMode, int>{gl::PrimitiveMode::Triangles, 3}, std::pair<gl::PrimitiveMode, int>{gl::PrimitiveMode::TriangleStrip, 3}, std::pair<gl::PrimitiveMode, int>{gl::PrimitiveMode::TriangleFan, 3}, std::pair<gl::PrimitiveMode, int>{gl::PrimitiveMode::LinesAdjacency, 2}, std::pair<gl::PrimitiveMode, int>{gl::PrimitiveMode::LineStripAdjacency, 2}, std::pair<gl::PrimitiveMode, int>{gl::PrimitiveMode::TrianglesAdjacency, 3}, std::pair<gl::PrimitiveMode, int>{gl::PrimitiveMode::TriangleStripAdjacency, 3}})), 11})'
../../third_party/angle/src/common/PackedEnums.h:89:72: error: modifying a const object '(int&)(&(&(const Storage&)(&((angle::PackedEnumMap<gl::PrimitiveMode, int>*)this)->angle::PackedEnumMap<gl::PrimitiveMode, int>::mPrivateData))->std::array<int, 14>::operator[](((std::array<int, 14>::size_type)((angle::PackedEnumMap<gl::PrimitiveMode, int>::UnderlyingType)it->std::pair<gl::PrimitiveMode, int>::first))))' is not allowed in a constant expression
   88 |             const_cast<T &>(const_cast<const Storage &>(
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   89 |                 mPrivateData)[static_cast<UnderlyingType>(it->first)]) = it->second;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
In file included from ../../third_party/angle/src/libGLESv2/entry_points_gles_ext_autogen.cpp:14:
../../third_party/angle/src/libANGLE/Context.inl.h:36:2: note: originally declared 'const' here
   36 | }};
      |  ^

As requested, preprocessed sources (gcc -E) from gcc 9.2.0 and gcc-10.0.1-0.8.fc32.x86_64 are available here:

https://spot.fedorapeople.org/entry_points_gles_ext_autogen.E.gcc9
https://spot.fedorapeople.org/entry_points_gles_ext_autogen.E.gcc10

I think this failure is occurring because of this reference in the GCC10 changelog:

* G++ can now detect modifying constant objects in constexpr evaluation (which is undefined behavior).

I understand that it is undefined behavior in the C++14 standard, but given that it is explicitly permitted in C++17 (and that it was implicitly permitted with this hack in C++14), it feels like this is a regression. Nevertheless, I would appreciate any help in resolving this so that we have a working Chromium in Fedora 32.

Thanks in advance,
Tom




On Mon, Mar 2, 2020 at 9:16 AM Jakub Jelinek <jakub@redhat.com> wrote:
On Mon, Mar 02, 2020 at 08:57:46AM -0500, Tom Callaway wrote:
> Wait, I know that $TOPIC is scary, come back.
>
> Chromium has this chunk of code (in
> third_party/angle/src/common/PackedEnums.h):
>
>              // This horrible const_cast pattern is necessary to work
> around a constexpr limitation.
>              // See https://stackoverflow.com/q/34199774/ . Note that it
> should be fixed with C++17.
>              const_cast<T &>(const_cast<const Storage &>(
>                 mPrivateData)[static_cast<UnderlyingType>(it->first)]) =
> it->second;
>
> This code built with gcc9, but with gcc10 it no longer works.

Is it now rejected with some error (which)?
Generally, such code snippets aren't really very useful because they lack
context, so what we really need is full preprocessed sources + g++ command
line options used to reproduce it, if gcc9 built and gcc10 doesn't, best
preprocessed sources from both gcc 9 and gcc 10, so that we can find out if
it is a header change or compiler change that matters.

        Jakub
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-leave@lists.fedoraproject.org
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org