Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0ea51ba

Browse files
committed
Fix alignment of stack variable
Declare with union similar to PGAlignedBlock. Report and fix by Andres Freund Discussion: https://postgr.es/m/20240407190731.izm3mdazednrsiqk%40awork3.anarazel.de
1 parent 304b6b1 commit 0ea51ba

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/backend/access/common/tidstore.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,12 @@ void
303303
TidStoreSetBlockOffsets(TidStore *ts, BlockNumber blkno, OffsetNumber *offsets,
304304
int num_offsets)
305305
{
306-
char data[MaxBlocktableEntrySize];
307-
BlocktableEntry *page = (BlocktableEntry *) data;
306+
union
307+
{
308+
char data[MaxBlocktableEntrySize];
309+
BlocktableEntry force_align_entry;
310+
} data;
311+
BlocktableEntry *page = (BlocktableEntry *) data.data;
308312
bitmapword word;
309313
int wordnum;
310314
int next_word_threshold;

0 commit comments

Comments
 (0)