| Summary: | TestWTF.WTF_Expected.Unexpected is not MSVC-safe | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ross Kirsling <ross.kirsling> |
| Component: | Tools / Tests | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW --- | ||
| Severity: | Normal | CC: | achristensen, jfbastien, lforschler, stephan.szabo, ysuzuki |
| Priority: | P2 | ||
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=188811 | ||
|
Description
Ross Kirsling
2018-07-17 13:39:50 PDT
(In reply to Ross Kirsling from comment #0) > ...due to the fact that MSVC evidently keeps a separate string for each > const char* variable when they're declared constexpr: > https://godbolt.org/g/HGC8nw Dunno why this link isn't working -- I made another one here: https://godbolt.org/g/Bbwngz As a solution, we could drop constexpr, add const, or use a value of a type other than const char*, but I want to make sure we're not losing some important coverage in doing so. JF, what would you prefer? (In reply to Ross Kirsling from comment #1) > (In reply to Ross Kirsling from comment #0) > > ...due to the fact that MSVC evidently keeps a separate string for each > > const char* variable when they're declared constexpr: > > https://godbolt.org/g/HGC8nw > > Dunno why this link isn't working -- I made another one here: > https://godbolt.org/g/Bbwngz > > As a solution, we could drop constexpr, add const, or use a value of a type > other than const char*, but I want to make sure we're not losing some > important coverage in doing so. JF, what would you prefer? This is a test of constexpr. Dropping constexpr defeats the purpose of the test. When I compile your second link with /O1 I get two identical functions. Seems like an MSVC bug? This is comparing the const char * pointers held in the unexpected object, they really should be the same. (In reply to JF Bastien from comment #2) > This is a test of constexpr. Dropping constexpr defeats the purpose of the > test. When I compile your second link with /O1 I get two identical > functions. Seems like an MSVC bug? This is comparing the const char * > pointers held in the unexpected object, they really should be the same. I agree that it seems like an MSVC bug... It seems allowable for the compiler to decide whether to keep one or two strings for the following: > constexpr auto foo = "oops"; > constexpr auto bar = "oops"; (In fact, MSVC has a compiler option to control this: https://msdn.microsoft.com/en-us/library/s0s0asdt.aspx) But to convert `constexpr auto bar(foo);` into `constexpr auto bar = "oops";` and thereby treat it as a new string seems questionable. I certainly figured that constexpr was crucial to this test case, I just wondered whether changing the type or making it constexpr const (which evidently works) would be allowable. Either way, we can try submitting an MSVC issue. Created ticket here: https://developercommunity.visualstudio.com/content/problem/295413/strange-behavior-when-aliasing-constexpr-const-cha.html This is now resolved for Release mode as a side effect of bug 188811, as we were disabling string pooling for unclear reasons. This will still fail in Debug though, so we can either leave this bug open to track the MSVC ticket linked above, or we could #if out the test for MSVC Debug with a FIXME comment. |