Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit df0f4fe

Browse files
committed
Add missing padding from MemoryChunk struct
Buildfarm animals skate, grison and mamba are Assert failing on the pointer being given to repalloc not being MAXALIGNED. c6e0fe1 made changes in that area. All of these animals are 32-bit with a MAXIMUM_ALIGNOF of 8 and a SIZEOF_VOID_P of 4. I suspect that the pointer is not properly aligned due to the lack of padding in the MemoryChunk struct. Here we add the same type of padding that was previously used in AllocChunkData and GenerationChunk that c6e0fe1 neglected to add. Discussion: https://postgr.es/m/CAA4eK1%2B1JyW5TiL%3DyV-3Uq1CrfnTyn0Xrk5uArt31Z%3D8rgPhXQ%40mail.gmail.com
1 parent c6a43c2 commit df0f4fe

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/include/utils/memutils_memorychunk.h

+8
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,14 @@ typedef struct MemoryChunk
111111
{
112112
#ifdef MEMORY_CONTEXT_CHECKING
113113
Size requested_size;
114+
#define MEMORYCHUNK_RAWSIZE (SIZEOF_SIZE_T + 8)
115+
#else
116+
#define MEMORYCHUNK_RAWSIZE 8
117+
#endif /* MEMORY_CONTEXT_CHECKING */
118+
119+
/* ensure proper alignment by adding padding if needed */
120+
#if (MEMORYCHUNK_RAWSIZE % MAXIMUM_ALIGNOF) != 0
121+
char padding[MAXIMUM_ALIGNOF - MEMORYCHUNK_RAWSIZE % MAXIMUM_ALIGNOF];
114122
#endif
115123

116124
/* bitfield for storing details about the chunk */

0 commit comments

Comments
 (0)