Skip to content

Commit 514b67b

Browse files
author
Nirbhay Choubey
committed
Bug#11761614 MYSQLD SEGFAULTS WHEN BUILT USING
--WITH-MAX-INDEXES=128 Post-push fix for test failure on Solaris.
1 parent 0da56f5 commit 514b67b

File tree

3 files changed

+29
-14
lines changed

3 files changed

+29
-14
lines changed

mysql-test/CMakeLists.txt

+5-3
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,10 @@ ENDFOREACH()
128128
# NOTE: While committing a patch please make sure that the file is unmodified
129129
# and should show the default MAX_INDEXES (i.e. 64U).
130130
IF (MAX_INDEXES)
131-
FILE(WRITE include/max_indexes.inc
132-
"# Warning: This is an auto-generated file. Please do not modify it.
131+
IF(NOT (${MAX_INDEXES} EQUAL 64U))
132+
FILE(WRITE include/max_indexes.inc
133+
"# Warning: This is an auto-generated file. Please do not modify it.
133134
--let $max_indexes = ${MAX_INDEXES}\n")
134-
MESSAGE(STATUS "mysql-test/include/max_indexes.inc adjusted")
135+
MESSAGE(STATUS "mysql-test/include/max_indexes.inc adjusted")
136+
ENDIF()
135137
ENDIF()

sql/sql_bitmap.h

+16-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,17 @@ template <uint default_width> class Bitmap
5858
bitmap_init(&map2, (uint32 *) &buf2, sizeof(ulonglong) * 8, 0);
5959

6060
// Store the original bits.
61-
buf2= map2buff;
61+
if (sizeof(ulonglong) >= 8) {
62+
int8store(const_cast<uchar *>(static_cast<uchar *>
63+
(static_cast<void *>(&buf2))),
64+
map2buff);
65+
} else {
66+
DBUG_ASSERT(sizeof(buffer) >= 4);
67+
int4store(const_cast<uchar *>(static_cast<uchar *>
68+
(static_cast<void *>(&buf2))),
69+
map2buff);
70+
}
71+
6272
bitmap_intersect(&map, &map2);
6373
}
6474
/* Use highest bit for all bits above sizeof(ulonglong)*8. */
@@ -99,9 +109,12 @@ template <uint default_width> class Bitmap
99109
ulonglong to_ulonglong() const
100110
{
101111
if (sizeof(buffer) >= 8)
102-
return uint8korr(buffer);
112+
return uint8korr(static_cast<const uchar *>
113+
(static_cast<const void *>(buffer)));
103114
DBUG_ASSERT(sizeof(buffer) >= 4);
104-
return (ulonglong) uint4korr(buffer);
115+
return (ulonglong)
116+
uint4korr(static_cast<const uchar *>
117+
(static_cast<const void *>(buffer)));
105118
}
106119
uint bits_set() const { return bitmap_bits_set(&map); }
107120
};

unittest/gunit/bitmap-t.cc

+8-8
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class BitmapTest : public ::testing::Test
4242
TEST_F(BitmapTest, IntersectTest)
4343
{
4444
bitmap.set_prefix(4);
45-
bitmap.intersect(0xBBBB);
45+
bitmap.intersect(0xBBBBULL);
4646
EXPECT_TRUE(bitmap.is_set(0));
4747
EXPECT_TRUE(bitmap.is_set(1));
4848
EXPECT_FALSE(bitmap.is_set(2));
@@ -53,19 +53,19 @@ TEST_F(BitmapTest, IntersectTest)
5353
EXPECT_TRUE(bitmap.is_clear_all());
5454
}
5555

56-
TEST_F(BitmapTest, UULTest)
56+
TEST_F(BitmapTest, ULLTest)
5757
{
5858
bitmap.set_all();
59-
bitmap.intersect(0x0123456789ABCDEF);
60-
ulonglong uul= bitmap.to_ulonglong();
61-
EXPECT_TRUE(uul == 0x0123456789ABCDEF);
59+
bitmap.intersect(0x0123456789ABCDEFULL);
60+
ulonglong ull= bitmap.to_ulonglong();
61+
EXPECT_TRUE(ull == 0x0123456789ABCDEFULL);
6262

6363
Bitmap<24> bitmap24;
6464
bitmap24.init();
6565
bitmap24.set_all();
66-
bitmap24.intersect(0x47B);
67-
ulonglong uul24= bitmap24.to_ulonglong();
68-
EXPECT_TRUE(uul24 == 0x47B);
66+
bitmap24.intersect(0x47BULL);
67+
ulonglong ull24= bitmap24.to_ulonglong();
68+
EXPECT_TRUE(ull24 == 0x47BULL);
6969
}
7070

7171
} // namespace

0 commit comments

Comments
 (0)