Skip to content

Commit 985c8de

Browse files
committed
Suppress -Warray-bounds warning in 9.2's xlog.c.
Late-model gcc delivers a confusing warning "'memcpy' offset [0, 63] is out of the bounds [0, 0]" here, which turns out to be because it thinks the "record" pointer might be NULL, which again is because it doesn't know ereport(PANIC) won't return. The least invasive way to fix that is to insert a couple of abort() calls. It's surprising/fortunate that we don't have this issue in more places ... but this is the last remaining build warning with gcc 11.2.1, so I'll settle for a narrow fix. Discussion: https://postgr.es/m/d0316012-ece7-7b7e-2d36-9c38cb77cb3b@enterprisedb.com
1 parent 3f9700a commit 985c8de

File tree

1 file changed

+4
-0
lines changed
  • src/backend/access/transam

1 file changed

+4
-0
lines changed

src/backend/access/transam/xlog.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6601,6 +6601,7 @@ StartupXLOG(void)
66016601
*/
66026602
ereport(PANIC,
66036603
(errmsg("could not locate a valid checkpoint record")));
6604+
abort(); /* NOTREACHED */
66046605
}
66056606
else
66066607
{
@@ -6614,8 +6615,11 @@ StartupXLOG(void)
66146615
InRecovery = true; /* force recovery even if SHUTDOWNED */
66156616
}
66166617
else
6618+
{
66176619
ereport(PANIC,
66186620
(errmsg("could not locate a valid checkpoint record")));
6621+
abort(); /* NOTREACHED */
6622+
}
66196623
}
66206624
memcpy(&checkPoint, XLogRecGetData(record), sizeof(CheckPoint));
66216625
wasShutdown = (record->xl_info == XLOG_CHECKPOINT_SHUTDOWN);

0 commit comments

Comments
 (0)