diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-06-10 17:03:11 -0400 | 
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-06-10 17:03:11 -0400 | 
| commit | 45d792f70272ed57b932816562f31c2f79426c2a (patch) | |
| tree | 118c4fc45cdbcc760775f1b8714c945926396924 /src/include/access/xlog_internal.h | |
| parent | cdd08887b9f160271f8d6695d5914c53814105c6 (diff) | |
Work around gcc 4.6.0 bug that breaks WAL replay.
ReadRecord's habit of using both direct references to tmpRecPtr and
references to *RecPtr (which is pointing at tmpRecPtr) triggers an
optimization bug in gcc 4.6.0, which apparently has forgotten about
aliasing rules.  Avoid the compiler bug, and make the code more readable
to boot, by getting rid of the direct references.  Improve the comments
while at it.
Back-patch to all supported versions, in case they get built with 4.6.0.
Tom Lane, with some cosmetic suggestions from Alex Hunsaker
Diffstat (limited to 'src/include/access/xlog_internal.h')
| -rw-r--r-- | src/include/access/xlog_internal.h | 12 | 
1 files changed, 6 insertions, 6 deletions
diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h index 3f0930f3951..367de374ead 100644 --- a/src/include/access/xlog_internal.h +++ b/src/include/access/xlog_internal.h @@ -154,13 +154,13 @@ typedef XLogLongPageHeaderData *XLogLongPageHeader;  /* Align a record pointer to next page */  #define NextLogPage(recptr) \  	do {	\ -		if (recptr.xrecoff % XLOG_BLCKSZ != 0)	\ -			recptr.xrecoff +=	\ -				(XLOG_BLCKSZ - recptr.xrecoff % XLOG_BLCKSZ);	\ -		if (recptr.xrecoff >= XLogFileSize) \ +		if ((recptr).xrecoff % XLOG_BLCKSZ != 0)	\ +			(recptr).xrecoff +=	\ +				(XLOG_BLCKSZ - (recptr).xrecoff % XLOG_BLCKSZ);	\ +		if ((recptr).xrecoff >= XLogFileSize) \  		{	\ -			(recptr.xlogid)++;	\ -			recptr.xrecoff = 0; \ +			((recptr).xlogid)++;	\ +			(recptr).xrecoff = 0; \  		}	\  	} while (0)  | 
