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.

I've tried two ways to fix this:

A) Changing that line of code to:

   mPrivateData[static_cast<UnderlyingType>(it->first)] = it->second;

AND

  Building all of chromium with -std=c++17

This results in a chromium that builds but segfaults immediately:

Stack trace of thread 333141:
                #0  0x000056480cc9b2d8
_Z41__static_initialization_and_destruction_0ii.constprop.0
(chromium-browser + 0x6b82d8)
                #1  0x000056480f130dfd __libc_csu_init (chromium-browser +
0x2b4ddfd)
                #2  0x00007f0a04a2cfce __libc_start_main (libc.so.6 +
0x26fce)
                #3  0x000056480ccaf21e _start (chromium-browser + 0x6cc21e)

B) Cheating and accessing the std::array's underlying array directly
(thanks to Raphael Kubo Da Costa for the idea):

   mPrivateData._M_elems[static_cast<UnderlyingType>(it->first)] =
it->second;

That change enables chromium to build, but it segfaults in the same way.

Now, it's possible that this change is a red herring and that something
else in GCC10 is causing the segfault, but I'm out of ideas on how to
proceed. If someone with GCC knowhow could help out here, it would be
greatly appreciated.

Thanks in advance,
Tom
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@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

Reply via email to