| Summary: | Suppress -Warray-bounds warning spam in Bitmap.h | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Michael Catanzaro <mcatanzaro> | ||||||
| Component: | Web Template Framework | Assignee: | Michael Catanzaro <mcatanzaro> | ||||||
| Status: | RESOLVED FIXED | ||||||||
| Severity: | Normal | CC: | benjamin, bugs-noreply, cdumez, cmarcelo, don.olmstead, ews-watchlist, mcatanzaro | ||||||
| Priority: | P2 | Keywords: | DoNotImportToRadar | ||||||
| Version: | WebKit Nightly Build | ||||||||
| Hardware: | PC | ||||||||
| OS: | Linux | ||||||||
| Attachments: |
|
||||||||
(Note the debug assert might be controversial because this function seems to be called very frequently. I don't mind taking that out if requested.) Created attachment 425209 [details]
Patch
Let's land without the ASSERT. I don't think it matters very much either way. Created attachment 425442 [details]
Patch for landing
Committed r275646: <https://commits.webkit.org/r275646> All reviewed patches have been landed. Closing bug and clearing flags on attachment 425442 [details]. |
With GCC 11, there is a huge warning spam coming from Bitmap.h: In file included from ../../Tools/TestWebKitAPI/Tests/WTF/Bitmap.cpp:27: DerivedSources/ForwardingHeaders/wtf/Bitmap.h: In function ‘void TestWebKitAPI::testBitmapIsFull() [with WordType = unsigned int]’: DerivedSources/ForwardingHeaders/wtf/Bitmap.h:229:24: warning: array subscript ‘_Type {aka const unsigned int [4]}[0]’ is partly outside array bounds of ‘WTF::Bitmap<9, unsigned int> [1]’ [-Warray-bounds] 229 | bits[n / wordSize] &= ~(one << (n % wordSize)); | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../Tools/TestWebKitAPI/Tests/WTF/Bitmap.cpp:104:33: note: while referencing ‘smallBitmap1’ 104 | Bitmap<smallSize, WordType> smallBitmap1; /* Will hold values specified in expectedSmallBits1. */ \ | ^~~~~~~~~~~~ ../../Tools/TestWebKitAPI/Tests/WTF/Bitmap.cpp:108:5: note: in expansion of macro ‘DECLARE_BITMAPS_FOR_TEST’ 108 | DECLARE_BITMAPS_FOR_TEST() \ | ^~~~~~~~~~~~~~~~~~~~~~~~ ../../Tools/TestWebKitAPI/Tests/WTF/Bitmap.cpp:441:5: note: in expansion of macro ‘DECLARE_AND_INIT_BITMAPS_FOR_TEST’ 441 | DECLARE_AND_INIT_BITMAPS_FOR_TEST(); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It prints over 3000 lines of warnings for every translation unit that includes Bitmap.h. After squinting at this for a while, I failed to understand why GCC thought there was a problem here, so instead I added a runtime assert to see if the array bounds are ever exceeded. They are not, at least not by TestWTF nor when smoketesting Epiphany.