Bug 239897 - [GCC] REGRESSION(r293605): error: cannot convert ‘<brace-enclosed initializer list>’ to ‘unsigned char:3’ in initialization
Summary: [GCC] REGRESSION(r293605): error: cannot convert ‘<brace-enclosed initializer...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Diego Pino
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-04-29 05:31 PDT by Diego Pino
Modified: 2022-05-05 05:15 PDT (History)
10 users (show)

See Also:


Attachments
Patch (1.47 KB, patch)
2022-04-29 05:37 PDT, Diego Pino
no flags Details | Formatted Diff | Diff
Patch (1.62 KB, patch)
2022-05-04 19:36 PDT, Diego Pino
no flags Details | Formatted Diff | Diff
[fast-cq] Patch (1.65 KB, patch)
2022-05-04 23:31 PDT, Diego Pino
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (1.64 KB, patch)
2022-05-05 00:39 PDT, Diego Pino
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Pino 2022-04-29 05:31:26 PDT
The Debian 10 build bot (GCC 8.3) is failing with the following error:

```
./../Source/JavaScriptCore/bytecode/MethodOfGettingAValueProfile.h:113:43: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘unsigned char:3’ in initialization
```

https://build.webkit.org/#/builders/46/builds/13117

It seems setting the bit size of a typed enum is not supported by GCC8.3.
Comment 1 Diego Pino 2022-04-29 05:37:37 PDT
Created attachment 458583 [details]
Patch
Comment 2 Darin Adler 2022-05-03 17:02:01 PDT
Comment on attachment 458583 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=458583&action=review

> Source/JavaScriptCore/bytecode/MethodOfGettingAValueProfile.h:111
> -    Kind m_kind : bitsOfKind { Kind::None };
> +    Kind m_kind { Kind::None };

I believe this will make the object larger. Can we keep the optimization under other compilers?
Comment 3 Yusuke Suzuki 2022-05-03 18:42:19 PDT
Comment on attachment 458583 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=458583&action=review

>> Source/JavaScriptCore/bytecode/MethodOfGettingAValueProfile.h:111
>> +    Kind m_kind { Kind::None };
> 
> I believe this will make the object larger. Can we keep the optimization under other compilers?

Yes, this needs to be small. So, we need different solution.
Comment 4 Darin Adler 2022-05-04 14:59:40 PDT
Comment on attachment 458583 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=458583&action=review

>>> Source/JavaScriptCore/bytecode/MethodOfGettingAValueProfile.h:111
>>> +    Kind m_kind { Kind::None };
>> 
>> I believe this will make the object larger. Can we keep the optimization under other compilers?
> 
> Yes, this needs to be small. So, we need different solution.

Should be able to work around this by using the type unsigned and casting to and from Kind when accessing the data member. It would be a shame to do that forever though. We want to work around the problem somehow in a way that can easily be removed once gcc is sufficiently improved.
Comment 5 Diego Pino 2022-05-04 19:36:55 PDT
Created attachment 458842 [details]
Patch
Comment 6 Yusuke Suzuki 2022-05-04 23:12:27 PDT
Comment on attachment 458842 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=458842&action=review

r=me with comment.

> Source/JavaScriptCore/bytecode/MethodOfGettingAValueProfile.h:50
> +    MethodOfGettingAValueProfile() { m_kind = Kind::None; }

Please use initialization list, and annotate it with constexpr.

constexpr MethodOfGettingAValueProfile()
    : m_kind(Kind::None)
{
}
Comment 7 Diego Pino 2022-05-04 23:31:42 PDT
Created attachment 458852 [details]
[fast-cq] Patch
Comment 8 Diego Pino 2022-05-05 00:23:28 PDT
(In reply to Yusuke Suzuki from comment #6)
> Comment on attachment 458842 [details]
> Patch

> Please use initialization list, and annotate it with constexpr.
> 
> constexpr MethodOfGettingAValueProfile()
>     : m_kind(Kind::None)
> {
> }

It seems the constructor cannot be `constexpr`.

```
/app/webkit/Source/JavaScriptCore/bytecode/MethodOfGettingAValueProfile.h: In constructor ‘constexpr JSC::MethodOfGettingAValueProfile::MethodOfGettingAValueProfile()’:
/app/webkit/Source/JavaScriptCore/bytecode/MethodOfGettingAValueProfile.h:51:28: error: call to non-‘constexpr’ function ‘JSC::CodeOrigin::CodeOrigin()’
   51 |         : m_kind(Kind::None)
```
Comment 9 Diego Pino 2022-05-05 00:39:19 PDT
Created attachment 458855 [details]
Patch
Comment 10 EWS 2022-05-05 05:14:00 PDT
Committed r293828 (250301@main): <https://commits.webkit.org/250301@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 458855 [details].
Comment 11 Radar WebKit Bug Importer 2022-05-05 05:15:15 PDT
<rdar://problem/92789338>