Title: [278878] trunk/Source
Revision
278878
Author
commit-qu...@webkit.org
Date
2021-06-15 09:47:42 -0700 (Tue, 15 Jun 2021)

Log Message

-Warray-bounds warning in Packed.h
https://bugs.webkit.org/show_bug.cgi?id=226557
<rdar://problem/79103658>

Patch by Michael Catanzaro <mcatanz...@gnome.org> on 2021-06-15
Reviewed by Darin Adler.

Source/_javascript_Core:

* b3/air/AirAllocateRegistersByGraphColoring.cpp:
* jit/JITCall.cpp:
(JSC::JIT::compileOpCall):

Source/WTF:

* wtf/Bitmap.h:
(WTF::WordType>::clear): Use the newly-introduced IGNORE_ARRAY_BOUNDS_WARNINGS macros
instead of vanilla IGNORE_WARNINGS.
* wtf/Compiler.h: Add new IGNORE_ARRAY_BOUNDS_WARNINGS_[BEGIN,END] macros, since this
warning is now suppressed in several different places.
* wtf/Packed.h: Suppress the warning. Also, add a static_assert for safety.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (278877 => 278878)


--- trunk/Source/_javascript_Core/ChangeLog	2021-06-15 16:46:14 UTC (rev 278877)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-06-15 16:47:42 UTC (rev 278878)
@@ -1,3 +1,15 @@
+2021-06-15  Michael Catanzaro  <mcatanz...@gnome.org>
+
+        -Warray-bounds warning in Packed.h
+        https://bugs.webkit.org/show_bug.cgi?id=226557
+        <rdar://problem/79103658>
+
+        Reviewed by Darin Adler.
+
+        * b3/air/AirAllocateRegistersByGraphColoring.cpp:
+        * jit/JITCall.cpp:
+        (JSC::JIT::compileOpCall):
+
 2021-06-15  Mark Lam  <mark....@apple.com>
 
         Move setting of scratch buffer active lengths to the runtime functions.

Modified: trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersByGraphColoring.cpp (278877 => 278878)


--- trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersByGraphColoring.cpp	2021-06-15 16:46:14 UTC (rev 278877)
+++ trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersByGraphColoring.cpp	2021-06-15 16:47:42 UTC (rev 278878)
@@ -1467,9 +1467,9 @@
             dataLog("FATAL: No color for ", tmp, "\n");
             dataLog("Code:\n");
 // https://bugs.webkit.org/show_bug.cgi?id=224782
-IGNORE_GCC_WARNINGS_BEGIN("array-bounds")
+IGNORE_ARRAY_BOUNDS_WARNINGS_BEGIN
             dataLog(m_code);
-IGNORE_GCC_WARNINGS_END
+IGNORE_ARRAY_BOUNDS_WARNINGS_END
             RELEASE_ASSERT_NOT_REACHED();
         }
         return reg;
@@ -1485,7 +1485,7 @@
     void initializePrecoloredTmp()
     {
 // https://bugs.webkit.org/show_bug.cgi?id=224782
-IGNORE_GCC_WARNINGS_BEGIN("array-bounds")
+IGNORE_ARRAY_BOUNDS_WARNINGS_BEGIN
         m_coloredTmp.resize(m_lastPrecoloredRegisterIndex + 1);
         for (unsigned i = 1; i <= m_lastPrecoloredRegisterIndex; ++i) {
             Tmp tmp = TmpMapper::tmpFromAbsoluteIndex(i);
@@ -1492,7 +1492,7 @@
             ASSERT(tmp.isReg());
             m_coloredTmp[i] = tmp.reg();
         }
-IGNORE_GCC_WARNINGS_END
+IGNORE_ARRAY_BOUNDS_WARNINGS_END
     }
 
     bool mayBeCoalesced(Arg left, Arg right)

Modified: trunk/Source/WTF/ChangeLog (278877 => 278878)


--- trunk/Source/WTF/ChangeLog	2021-06-15 16:46:14 UTC (rev 278877)
+++ trunk/Source/WTF/ChangeLog	2021-06-15 16:47:42 UTC (rev 278878)
@@ -1,3 +1,18 @@
+2021-06-15  Michael Catanzaro  <mcatanz...@gnome.org>
+
+        -Warray-bounds warning in Packed.h
+        https://bugs.webkit.org/show_bug.cgi?id=226557
+        <rdar://problem/79103658>
+
+        Reviewed by Darin Adler.
+
+        * wtf/Bitmap.h:
+        (WTF::WordType>::clear): Use the newly-introduced IGNORE_ARRAY_BOUNDS_WARNINGS macros
+        instead of vanilla IGNORE_WARNINGS.
+        * wtf/Compiler.h: Add new IGNORE_ARRAY_BOUNDS_WARNINGS_[BEGIN,END] macros, since this
+        warning is now suppressed in several different places.
+        * wtf/Packed.h: Suppress the warning. Also, add a static_assert for safety.
+
 2021-06-15  Brent Fulgham  <bfulg...@apple.com>
 
         [Cocoa] Harden WebAuthn process by restricting to browser-entitled processes

Modified: trunk/Source/WTF/wtf/Bitmap.h (278877 => 278878)


--- trunk/Source/WTF/wtf/Bitmap.h	2021-06-15 16:46:14 UTC (rev 278877)
+++ trunk/Source/WTF/wtf/Bitmap.h	2021-06-15 16:47:42 UTC (rev 278878)
@@ -226,9 +226,9 @@
 template<size_t bitmapSize, typename WordType>
 inline void Bitmap<bitmapSize, WordType>::clear(size_t n)
 {
-IGNORE_WARNINGS_BEGIN("array-bounds")
+IGNORE_ARRAY_BOUNDS_WARNINGS_BEGIN
     bits[n / wordSize] &= ~(one << (n % wordSize));
-IGNORE_WARNINGS_END
+IGNORE_ARRAY_BOUNDS_WARNINGS_END
 }
 
 template<size_t bitmapSize, typename WordType>

Modified: trunk/Source/WTF/wtf/Compiler.h (278877 => 278878)


--- trunk/Source/WTF/wtf/Compiler.h	2021-06-15 16:46:14 UTC (rev 278877)
+++ trunk/Source/WTF/wtf/Compiler.h	2021-06-15 16:47:42 UTC (rev 278878)
@@ -503,6 +503,9 @@
 #define IGNORE_NULL_CHECK_WARNINGS_BEGIN IGNORE_WARNINGS_BEGIN("nonnull")
 #define IGNORE_NULL_CHECK_WARNINGS_END IGNORE_WARNINGS_END
 
+#define IGNORE_ARRAY_BOUNDS_WARNINGS_BEGIN IGNORE_WARNINGS_BEGIN("array-bounds")
+#define IGNORE_ARRAY_BOUNDS_WARNINGS_END IGNORE_WARNINGS_END
+
 /* https://bugs.webkit.org/show_bug.cgi?id=224452 */
 #define IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_BEGIN IGNORE_GCC_WARNINGS_BEGIN("nonnull")
 #define IGNORE_ERRONEOUS_GCC_NULL_CHECK_WARNINGS_END IGNORE_GCC_WARNINGS_END

Modified: trunk/Source/WTF/wtf/Packed.h (278877 => 278878)


--- trunk/Source/WTF/wtf/Packed.h	2021-06-15 16:46:14 UTC (rev 278877)
+++ trunk/Source/WTF/wtf/Packed.h	2021-06-15 16:47:42 UTC (rev 278878)
@@ -115,6 +115,7 @@
     static constexpr bool isAlignmentShiftProfitable = storageSizeWithoutAlignmentShift > storageSizeWithAlignmentShift;
     static constexpr unsigned alignmentShiftSize = isAlignmentShiftProfitable ? alignmentShiftSizeIfProfitable : 0;
     static constexpr unsigned storageSize = storageSizeWithAlignmentShift;
+    static_assert(storageSize <= sizeof(uintptr_t));
 
     constexpr PackedAlignedPtr()
         : m_storage()
@@ -136,11 +137,15 @@
         // FIXME: PackedPtr<> can load memory with one mov by checking page boundary.
         // https://bugs.webkit.org/show_bug.cgi?id=197754
         uintptr_t value = 0;
+
+IGNORE_ARRAY_BOUNDS_WARNINGS_BEGIN
 #if CPU(LITTLE_ENDIAN)
         memcpy(&value, m_storage.data(), storageSize);
 #else
         memcpy(bitwise_cast<uint8_t*>(&value) + (sizeof(void*) - storageSize), m_storage.data(), storageSize);
 #endif
+IGNORE_ARRAY_BOUNDS_WARNINGS_END
+
         if (isAlignmentShiftProfitable)
             value <<= alignmentShiftSize;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to