Misalign address in the test rather than structure
authorOpenJDK Team <openjdk-21@packages.debian.org>
Wed, 22 Jan 2025 07:58:11 +0000 (08:58 +0100)
committerMatthias Klose <doko@ubuntu.com>
Wed, 22 Jan 2025 07:58:11 +0000 (08:58 +0100)
mk68-support.diff aligned metaspace structures by 4 bytes breaking the test.
Add 1 to address type rather than aligned structure to produce misaligned pointer.

Gbp-Pq: Name misalign-pointer-for-armhf.patch

test/hotspot/gtest/metaspace/test_is_metaspace_obj.cpp

index 820ad1fd3d16f9e733820ee3fc48672ce7a9070e..c4b36e608a669e2a65110fd83e4783644c7fad0b 100644 (file)
@@ -61,7 +61,7 @@ public:
     ASSERT_TRUE(MetaspaceObj::is_valid(p));
 
     // A misaligned object shall not be recognized
-    const MetaspaceObj* p_misaligned = (MetaspaceObj*)((address)p) + 1;
+    const MetaspaceObj* p_misaligned = (MetaspaceObj*)((address)p + 1);
     ASSERT_FALSE(MetaspaceObj::is_valid(p_misaligned));
 
     // Test VirtualSpaceList::contains
@@ -72,7 +72,7 @@ public:
     ASSERT_TRUE(vslist->contains((MetaWord*)p));
 
     // A misaligned pointer shall still be recognized by list::contains
-    ASSERT_TRUE(vslist->contains((MetaWord*)((address)p) + 1));
+    ASSERT_TRUE(vslist->contains((MetaWord*)((address)p + 1)));
 
     // Now for some bogus values
     ASSERT_FALSE(MetaspaceObj::is_valid((MetaspaceObj*)NULL));