aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2016-12-05 10:38:08 -0500
committerRobert Haas <rhaas@postgresql.org>2016-12-05 10:38:08 -0500
commit88f626f8680fbe93444582317d1adb375111855f (patch)
tree8323bee3b24406c42f94b98e9b03c538e766a32c /src/backend
parent670b3bc8f5d1000b5475e41c6f023c490e8500fe (diff)
downloadpostgresql-88f626f8680fbe93444582317d1adb375111855f.tar.gz
postgresql-88f626f8680fbe93444582317d1adb375111855f.zip
Fix more DSA problems uncovered by the buildfarm.
On 32-bit systems, don't try to use 64-bit DSA pointers, because the computation of DSA_MAX_SEGMENT_SIZE overflows Size. Cast 1 to Size before shifting it, so that the compiler doesn't produce a result of the wrong width. In passing, change one use of size_t to Size.
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/utils/mmgr/dsa.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/utils/mmgr/dsa.c b/src/backend/utils/mmgr/dsa.c
index 0e49e7020df..aa3ab58d38a 100644
--- a/src/backend/utils/mmgr/dsa.c
+++ b/src/backend/utils/mmgr/dsa.c
@@ -98,7 +98,7 @@
#define DSA_OFFSET_BITMASK (((dsa_pointer) 1 << DSA_OFFSET_WIDTH) - 1)
/* The maximum size of a DSM segment. */
-#define DSA_MAX_SEGMENT_SIZE ((size_t) 1 << DSA_OFFSET_WIDTH)
+#define DSA_MAX_SEGMENT_SIZE ((Size) 1 << DSA_OFFSET_WIDTH)
/* Number of pages (see FPM_PAGE_SIZE) per regular superblock. */
#define DSA_PAGES_PER_SUPERBLOCK 16
@@ -1919,7 +1919,7 @@ get_best_segment(dsa_area *area, Size npages)
* The minimum contiguous size that any segment in this bin should
* have. We'll re-bin if we see segments with fewer.
*/
- Size threshold = 1 << (bin - 1);
+ Size threshold = (Size) 1 << (bin - 1);
dsa_segment_index segment_index;
/* Search this bin for a segment with enough contiguous space. */