[Webkit-unassigned] [Bug 224207] New: Suppress -Warray-bounds warning spam in Bitmap.h

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Apr 5 14:44:05 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=224207

            Bug ID: 224207
           Summary: Suppress -Warray-bounds warning spam in Bitmap.h
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Web Template Framework
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mcatanzaro at gnome.org

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210405/1867e35c/attachment.htm>


More information about the webkit-unassigned mailing list