RESOLVED FIXED 211044
[WTF] Workaround gcc bug for unsigned bitfield related usual arithmetic conversions
https://bugs.webkit.org/show_bug.cgi?id=211044
Summary [WTF] Workaround gcc bug for unsigned bitfield related usual arithmetic conve...
Joonghun Park
Reported 2020-04-26 02:12:11 PDT
(unsigned + signed) should return unsigned int type as a common type defined by usual arithmetic conversions. But gcc 9.3.0 returns signed int type for this case. I filed a bug for this issue on gcc bugzilla, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94767. To workaround this, I originally submitted the patch, http://svn.webkit.org/repository/webkit/trunk@260715, but according to Darin's comment, use unsigned integer suffix instead of static_cast<unsigned>.
Attachments
Patch (2.58 KB, patch)
2020-04-26 02:15 PDT, Joonghun Park
no flags
Joonghun Park
Comment 1 2020-04-26 02:15:01 PDT
EWS
Comment 2 2020-04-26 11:55:25 PDT
Committed r260727: <https://trac.webkit.org/changeset/260727> All reviewed patches have been landed. Closing bug and clearing flags on attachment 397614 [details].
Radar WebKit Bug Importer
Comment 3 2020-04-26 11:56:17 PDT
Joonghun Park
Comment 4 2020-04-27 03:09:23 PDT
FYI, in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94767, Jonathan Wakely left a comment for a c++ standard entry for this issue. http://eel.is/c++draft/conv.prom#5, and the statement of this link is as below. "A prvalue for an integral bit-field ([class.bit]) can be converted to a prvalue of type int if int can represent all the values of the bit-field; otherwise, it can be converted to unsigned int if unsigned int can represent all the values of the bit-field. If the bit-field is larger yet, no integral promotion applies to it. If the bit-field has an enumerated type, it is treated as any other value of that type for promotion purposes." So I think gcc's build warning, warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare] was valid one and this patch could be a proper fix, not just a workaround.
Note You need to log in before you can comment on or make changes to this bug.