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

Commit f1a469c

Browse files
committed
Fix use of offsetof()
Using offsetof() with a run-time computed argument is not allowed in either C or C++. Apparently, gcc allows it, but g++ doesn't. Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi> Reviewed-by: Thomas Munro <thomas.munro@enterprisedb.com>
1 parent 3d39244 commit f1a469c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

contrib/bloom/blutils.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ _PG_init(void)
7575
bl_relopt_tab[i + 1].optname = MemoryContextStrdup(TopMemoryContext,
7676
buf);
7777
bl_relopt_tab[i + 1].opttype = RELOPT_TYPE_INT;
78-
bl_relopt_tab[i + 1].offset = offsetof(BloomOptions, bitSize[i]);
78+
bl_relopt_tab[i + 1].offset = offsetof(BloomOptions, bitSize[0]) + sizeof(int) * i;
7979
}
8080
}
8181

0 commit comments

Comments
 (0)