Skip to contentSkip to conversation

kwbimage.c: Fix compile warning when building on 64 bit systems

PATCH New Wolfgang Denk 4 participants 21 messages Sep 11, 2009 – Sep 18, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kwbimage.c: Fix compile warning when building on 64 bit systems

Fix this warning when building on 64 bit systems:
tools/kwbimage.c: In function 'kwbimage_checksum32':
tools/kwbimage.c:135: warning: format '%d' expects type 'int', but argument 4 has type 'long unsigned int'

Cc Prafulla Wadaskar <[email protected]>
---
 tools/kwbimage.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/kwbimage.c +1 -1
index 28dc2d6..ee067cb 100644
@@ -131,7 +131,7 @@ static uint32_t kwbimage_checksum32 (uint32_t *start, uint32_t len, uint32_t csu
 		return 0;
 
 	if (len % sizeof(uint32_t)) {
-		printf ("Error:%s[%d] - lenght is not in multiple of %d\n",
+		printf ("Error:%s[%d] - lenght is not in multiple of %ld\n",
 			__FUNCTION__, len, sizeof(uint32_t));
 		return 0;
 	}
Signature · 1 line
1.6.0.6
#1 lore raw

PATCH 1/1 net/bootp.c: fix compile warning

Fix warning: bootp.c:695: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
 net/bootp.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
net/bootp.c +5 -1
index 0799ae2..3093852 100644
@@ -683,6 +683,9 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp)
 {
 	uchar *end = popt + BOOTP_HDR_SIZE;
 	int oplen, size;
+#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
+	int *to_ptr;
+#endif
 
 	while (popt < end && *popt != 0xff) {
 		oplen = *(popt + 1);
@@ -692,7 +695,8 @@ static void DhcpOptionsProcess (uchar * popt, Bootp_t *bp)
 			break;
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
 		case 2:		/* Time offset	*/
-			NetCopyLong ((ulong *)&NetTimeOffset, (ulong *) (popt + 2));
+			to_ptr = &NetTimeOffset;
+			NetCopyLong ((ulong *)to_ptr, (ulong *)(popt + 2));
 			NetTimeOffset = ntohl (NetTimeOffset);
 			break;
 #endif
Signature · 1 line
1.6.0.6
author Applied
#2 lore raw

PATCH 1/1 net/bootp.c: fix compile warning

Quoted 8 lines · In message <[email protected]> you wrote:

Fix warning: bootp.c:695: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
 net/bootp.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

Applied.

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If all the Chinese simultaneously jumped into the Pacific  off  a  10
foot platform erected 10 feet off their coast, it would cause a tidal
wave that would destroy everything in this country west of Nebraska.
#3 lore raw

PATCH 1/1 board/flagadm/flash.c: fix compile warning

In reply to Wolfgang Denk

Fix warning: flash.c:531: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
 board/flagadm/flash.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
board/flagadm/flash.c +2 -1
index bbefbac..ff37d9e 100644
@@ -528,7 +528,8 @@ int write_word (flash_info_t *info, ulong dest, ulong da)
 	ulong start;
 	char csr;
 	int flag;
-	ushort * d = (ushort*)&da;
+	ulong *dla = &da;
+	ushort *d = (ushort*)dla;
 	int i;
 
 	/* Check if Flash is (sufficiently) erased */
Signature · 1 line
1.6.0.6
#4 lore raw

PATCH 1/1 board/flagadm/flash.c: fix compile warning

Quoted 14 lines · Wolfgang Denk

Fix warning: flash.c:531: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
 board/flagadm/flash.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
board/flagadm/flash.c +0 -0
index bbefbac..ff37d9e 100644

board/flagadm/flash.c int write_word (flash_info_t *info, ulong dest, ulong da) · line 532

Quoted 6 lines
board/flagadm/flash.c +2 -1
@@ -528,7 +528,8 @@ int write_word (flash_info_t *info, ulong dest, ulong da)
 	ulong start;
 	char csr;
 	int flag;
-	ushort * d = (ushort*)&da;
+	ulong *dla = &da;
+	ushort *d = (ushort*)dla;

I don't see how this is any more legal under strict aliasing rules -- you just made it a little more complicated and fooled the compiler into not warning.

-Scott

#5 lore raw

PATCH 1/1 board/flagadm/flash.c: fix compile warning

Dear Scott Wood,

Quoted 8 lines · In message <[email protected]> you wrote:

board/flagadm/flash.c int write_word (flash_info_t *info, ulong dest, ulong da) · line 532

Quoted 4 lines
board/flagadm/flash.c +2 -1
-	ushort * d = (ushort*)&da;
+	ulong *dla = &da;
+	ushort *d = (ushort*)dla;

I don't see how this is any more legal under strict aliasing rules -- you just made it a little more complicated and fooled the compiler into not warning.

Hm... I apologize if I don;t understand this any better, but for me silencing the compiler was all that I intended at this moment ;-)

Do you have any better approach?

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Eureka!                                                 -- Archimedes
#6 lore raw

PATCH 1/1 board/flagadm/flash.c: fix compile warning

Quoted 10 lines · Wolfgang Denk

Dear Scott Wood,

Quoted 6 lines · In message <[email protected]> you wrote:

board/flagadm/flash.c int write_word (flash_info_t *info, ulong dest, ulong da) · line 532

Quoted 3 lines
board/flagadm/flash.c +2 -1
-	ushort * d = (ushort*)&da;
+	ulong *dla = &da;
+	ushort *d = (ushort*)dla;

I don't see how this is any more legal under strict aliasing rules -- you just made it a little more complicated and fooled the compiler into not warning.

Quoted 2 lines

Hm... I apologize if I don;t understand this any better, but for me silencing the compiler was all that I intended at this moment ;-)

I find that ironic given the previous claim that -fno-strict-aliasing was just silencing warnings. :-)

Especially since that actually turned off the problematic language feature (which is more intended for number crunching code than device drivers).

Much like your argument in favor of leaving d-cache disabled, this is a bootloader -- why complicate it to deal with a fancy compiler optimization that isn't going to make any performance difference that matters, could break things even in places where GCC doesn't warn, and is easily disabled?

Quoted 1 line

Do you have any better approach?

union {
	u32 data32;
	u16 data16[2];
} data;

data.data32 = da;

if ((addr[0] & data.data16[0]) != data.data16[0] ||

     (addr[1] & data.data16[1]) != data.data16[1])
	return 2;

etc.

-Scott

#7 lore raw

PATCH v2 1/1 board/flagadm/flash.c: fix compile warning

Fix warning: flash.c:531: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
v2: change implementation as suggested by Scott Wood in

    http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/67828/focus=67900
 board/flagadm/flash.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
board/flagadm/flash.c +9 -3
index bbefbac..a69b1a4 100644
@@ -528,11 +528,17 @@ int write_word (flash_info_t *info, ulong dest, ulong da)
 	ulong start;
 	char csr;
 	int flag;
-	ushort * d = (ushort*)&da;
 	int i;
+	union {
+		u32 data32;
+		u16 data16[2];
+	} data;
+
+	data.data32 = da;
 
 	/* Check if Flash is (sufficiently) erased */
-	if (((*addr & d[0]) != d[0]) || ((*(addr+1) & d[1]) != d[1])) {
+	if (((*addr & data.data16[0]) != data.data16[0]) ||
+	    ((*(addr+1) & data.data16[1]) != data.data16[1])) {
 		return (2);
 	}
 	/* Disable interrupts which might cause a timeout here */
@@ -544,7 +550,7 @@ int write_word (flash_info_t *info, ulong dest, ulong da)
 		*addr = 0x0010;
 
 		/* Write Data */
-		*addr = d[i];
+		*addr = data.data16[i];
 
 		/* re-enable interrupts if necessary */
 		if (flag)
Signature · 1 line
1.6.0.6
author Applied
#8 lore raw

PATCH v2 1/1 board/flagadm/flash.c: fix compile warning

Quoted 11 lines · In message <[email protected]> you wrote:

Fix warning: flash.c:531: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
v2: change implementation as suggested by Scott Wood in

    http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/67828/focus=67900
 board/flagadm/flash.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

Applied.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
This cultural mystique surrounding the  biological  function  --  you
realize humans are overly preoccupied with the subject.
	-- Kelinda the Kelvan, "By Any Other Name", stardate 4658.9
#9 lore raw

PATCH 1/1 drivers/net/natsemi.c: fix compile warning

In reply to Wolfgang Denk

Fix warning: natsemi.c:757: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
 drivers/net/natsemi.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/natsemi.c +2 -1
index ce12c3b..e09da1d 100644
@@ -754,7 +754,8 @@ natsemi_send(struct eth_device *dev, volatile void *packet, int length)
 {
 	u32 i, status = 0;
 	u32 tx_status = 0;
-	vu_long *res = (vu_long *)&tx_status;
+	u32 *tx_ptr = &tx_status;
+	vu_long *res = (vu_long *)tx_ptr;
 
 	/* Stop the transmitter */
 	OUTL(dev, TxOff, ChipCmd);
Signature · 1 line
1.6.0.6
author Applied
#10 lore raw

PATCH 1/1 drivers/net/natsemi.c: fix compile warning

Quoted 8 lines · In message <[email protected]> you wrote:

Fix warning: natsemi.c:757: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
 drivers/net/natsemi.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Applied.

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I object to intellect without discipline;  I object to power without
constructive purpose.
	-- Spock, "The Squire of Gothos", stardate 2124.5
#11 lore raw

PATCH 1/1 sk98lin: fix compile warnings

In reply to Wolfgang Denk

Fix warnings:
skge.c: In function 'BoardInitMem':
skge.c:1389: warning: dereferencing type-punned pointer will break strict-aliasing rules skge.c:1390: warning: dereferencing type-punned pointer will break strict-aliasing rules skge.c:1391: warning: dereferencing type-punned pointer will break strict-aliasing rules skgesirq.c: In function 'SkGePortCheckUpXmac':
skgesirq.c:1301: warning: dereferencing type-punned pointer will break strict-aliasing rules skgesirq.c:1301: warning: dereferencing type-punned pointer will break strict-aliasing rules skgesirq.c:1398: warning: dereferencing type-punned pointer will break strict-aliasing rules skgesirq.c:1398: warning: dereferencing type-punned pointer will break strict-aliasing rules skrlmt.c: In function 'SkRlmtInit':
skrlmt.c:661: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c: In function 'SkMacPromiscMode':
skxmac2.c:753: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c:753: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c: In function 'SkMacHashing':
skxmac2.c:803: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c:803: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c: In function 'SkMacFlushTxFifo':
skxmac2.c:1115: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c:1115: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c: In function 'SkMacFlushRxFifo':
skxmac2.c:1145: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c:1145: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c: In function 'SkXmInitPauseMd':
skxmac2.c:1987: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c:1987: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c: In function 'SkXmOverflowStatus':
skxmac2.c:4236: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c:4236: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c:4242: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c:4242: warning: dereferencing type-punned pointer will break strict-aliasing rules

---
 drivers/net/sk98lin/skge.c     |   12 +++++++++---
 drivers/net/sk98lin/skgesirq.c |    7 +++++--
 drivers/net/sk98lin/skrlmt.c   |    3 ++-
 drivers/net/sk98lin/skxmac2.c  |   20 +++++++++++++-------
 4 files changed, 29 insertions(+), 13 deletions(-)
drivers/net/sk98lin/skge.c +9 -3
index c815480..df764b4 100644
@@ -1382,13 +1382,19 @@ int	TxDescrSize;	/* the size of a tx descriptor rounded up to alignment*/
 	pAC->TxDescrPerRing = TX_RING_SIZE / RxDescrSize;
 
 	for (i=0; i<pAC->GIni.GIMacsFound; i++) {
+		TXD **txd_head, **txd_tail, **txd_prev;
+
+		txd_head = &pAC->TxPort[i][0].pTxdRingHead;
+		txd_tail = &pAC->TxPort[i][0].pTxdRingTail;
+		txd_prev = &pAC->TxPort[i][0].pTxdRingPrev;
+
 		SetupRing(
 			pAC,
 			pAC->TxPort[i][0].pTxDescrRing,
 			pAC->TxPort[i][0].VTxDescrRing,
-			(RXD**)&pAC->TxPort[i][0].pTxdRingHead,
-			(RXD**)&pAC->TxPort[i][0].pTxdRingTail,
-			(RXD**)&pAC->TxPort[i][0].pTxdRingPrev,
+			(RXD**)txd_head,
+			(RXD**)txd_tail,
+			(RXD**)txd_prev,
 			&pAC->TxPort[i][0].TxdRingFree,
 			SK_TRUE);
 		SetupRing(
drivers/net/sk98lin/skgesirq.c +5 -2
index 106fe48..53229d2 100644
@@ -1266,6 +1266,7 @@ int		Port)		/* Which port should be checked */
 	SK_GEPORT	*pPrt;		/* GIni Port struct pointer */
 	int			Done;
 	SK_U32		GpReg;		/* General Purpose register value */
+	SK_U32		*pGpReg;	/* Pointer to -- " -- */
 	SK_U16		Isrc;		/* Interrupt source register */
 	SK_U16		IsrcSum;	/* Interrupt source register sum */
 	SK_U16		LpAb;		/* Link Partner Ability */
@@ -1274,6 +1275,8 @@ int		Port)		/* Which port should be checked */
 	SK_BOOL		AutoNeg;	/* Is Auto-negotiation used ? */
 	SK_U8		NextMode;	/* Next AutoSensing Mode */
 
+	pGpReg = &GpReg;
+
 	pPrt = &pAC->GIni.GP[Port];
 
 	if (pPrt->PHWLinkUp) {
@@ -1298,7 +1301,7 @@ int		Port)		/* Which port should be checked */
 
 	if (pPrt->PLinkBroken) {
 		/* Link was broken */
-		XM_IN32(IoC, Port, XM_GP_PORT, &GpReg);
+		XM_IN32(IoC, Port, XM_GP_PORT, pGpReg);
 
 		if ((GpReg & XM_GP_INP_ASS) == 0) {
 			/* The Link is in sync */
@@ -1395,7 +1398,7 @@ int		Port)		/* Which port should be checked */
 	 * here we usually can check whether the link is in sync and
 	 * auto-negotiation is done.
 	 */
-	XM_IN32(IoC, Port, XM_GP_PORT, &GpReg);
+	XM_IN32(IoC, Port, XM_GP_PORT, pGpReg);
 	XM_IN16(IoC, Port, XM_ISRC, &Isrc);
 	IsrcSum |= Isrc;
 
drivers/net/sk98lin/skrlmt.c +2 -1
index 2e7924d..a178dff 100644
@@ -657,8 +657,9 @@ int		Level)	/* Initialization Level */
 		}
 
 		for (i = 0; i < (SK_U32)pAC->GIni.GIMacsFound; i++) {
+			SK_U64 *pRandom = &Random;
 			Random = SkOsGetTime(pAC);
-			*(SK_U32*)&pAC->Rlmt.Port[i].Random = *(SK_U32*)&Random;
+			*(SK_U32*)&pAC->Rlmt.Port[i].Random = *(SK_U32*)pRandom;
 
 			for (j = 0; j < 4; j++) {
 				pAC->Rlmt.Port[i].Random[j] ^= pAC->Rlmt.Port[i].AddrPort->
drivers/net/sk98lin/skxmac2.c +13 -7
index e0ded42..2f7c054 100644
@@ -747,10 +747,11 @@ SK_BOOL	Enable)	/* Enable / Disable */
 {
 	SK_U16	RcReg;
 	SK_U32	MdReg;
+	SK_U32	*pMdReg = &MdReg;
 
 	if (pAC->GIni.GIGenesis) {
 
-		XM_IN32(IoC, Port, XM_MODE, &MdReg);
+		XM_IN32(IoC, Port, XM_MODE, pMdReg);
 		/* enable or disable promiscuous mode */
 		if (Enable) {
 			MdReg |= XM_MD_ENA_PROM;
@@ -797,10 +798,11 @@ SK_BOOL	Enable)	/* Enable / Disable */
 {
 	SK_U16	RcReg;
 	SK_U32	MdReg;
+	SK_U32	*pMdReg = &MdReg;
 
 	if (pAC->GIni.GIGenesis) {
 
-		XM_IN32(IoC, Port, XM_MODE, &MdReg);
+		XM_IN32(IoC, Port, XM_MODE, pMdReg);
 		/* enable or disable hashing */
 		if (Enable) {
 			MdReg |= XM_MD_ENA_HASH;
@@ -1109,10 +1111,11 @@ SK_IOC	IoC,	/* IO context */
 int		Port)	/* Port Index (MAC_1 + n) */
 {
 	SK_U32	MdReg;
+	SK_U32	*pMdReg = &MdReg;
 
 	if (pAC->GIni.GIGenesis) {
 
-		XM_IN32(IoC, Port, XM_MODE, &MdReg);
+		XM_IN32(IoC, Port, XM_MODE, pMdReg);
 
 		XM_OUT32(IoC, Port, XM_MODE, MdReg | XM_MD_FTF);
 	}
@@ -1139,10 +1142,11 @@ SK_IOC	IoC,	/* IO context */
 int		Port)	/* Port Index (MAC_1 + n) */
 {
 	SK_U32	MdReg;
+	SK_U32	*pMdReg = &MdReg;
 
 	if (pAC->GIni.GIGenesis) {
 
-		XM_IN32(IoC, Port, XM_MODE, &MdReg);
+		XM_IN32(IoC, Port, XM_MODE, pMdReg);
 
 		XM_OUT32(IoC, Port, XM_MODE, MdReg | XM_MD_FRF);
 	}
@@ -1961,6 +1965,7 @@ int		Port)		/* Port Index (MAC_1 + n) */
 {
 	SK_GEPORT	*pPrt;
 	SK_U32		DWord;
+	SK_U32		*pDWord = &DWord;
 	SK_U16		Word;
 
 	pPrt = &pAC->GIni.GP[Port];
@@ -1984,7 +1989,7 @@ int		Port)		/* Port Index (MAC_1 + n) */
 
 	XM_OUT16(IoC, Port, XM_MMU_CMD, Word);
 
-	XM_IN32(IoC, Port, XM_MODE, &DWord);
+	XM_IN32(IoC, Port, XM_MODE, pDWord);
 
 	if (pPrt->PFlowCtrlStatus == SK_FLOW_STAT_SYMMETRIC ||
 		pPrt->PFlowCtrlStatus == SK_FLOW_STAT_LOC_SEND) {
@@ -4228,18 +4233,19 @@ SK_U64	*pStatus)	/* ptr for return overflow status value */
 {
 	SK_U64	Status;	/* Overflow status */
 	SK_U32	RegVal;
+	SK_U32	*pRegVal = &RegVal;
 
 	Status = 0;
 
 	if ((IStatus & XM_IS_RXC_OV) != 0) {
 
-		XM_IN32(IoC, Port, XM_RX_CNT_EV, &RegVal);
+		XM_IN32(IoC, Port, XM_RX_CNT_EV, pRegVal);
 		Status |= (SK_U64)RegVal << 32;
 	}
 
 	if ((IStatus & XM_IS_TXC_OV) != 0) {
 
-		XM_IN32(IoC, Port, XM_TX_CNT_EV, &RegVal);
+		XM_IN32(IoC, Port, XM_TX_CNT_EV, pRegVal);
 		Status |= (SK_U64)RegVal;
 	}
 
Signature · 1 line
1.6.0.6
#12 lore raw

PATCH 1/1 sk98lin: fix compile warnings

Quoted 33 lines · In message <[email protected]> you wrote:

Fix warnings:
skge.c: In function 'BoardInitMem':
skge.c:1389: warning: dereferencing type-punned pointer will break strict-aliasing rules skge.c:1390: warning: dereferencing type-punned pointer will break strict-aliasing rules skge.c:1391: warning: dereferencing type-punned pointer will break strict-aliasing rules skgesirq.c: In function 'SkGePortCheckUpXmac':
skgesirq.c:1301: warning: dereferencing type-punned pointer will break strict-aliasing rules skgesirq.c:1301: warning: dereferencing type-punned pointer will break strict-aliasing rules skgesirq.c:1398: warning: dereferencing type-punned pointer will break strict-aliasing rules skgesirq.c:1398: warning: dereferencing type-punned pointer will break strict-aliasing rules skrlmt.c: In function 'SkRlmtInit':
skrlmt.c:661: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c: In function 'SkMacPromiscMode':
skxmac2.c:753: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c:753: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c: In function 'SkMacHashing':
skxmac2.c:803: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c:803: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c: In function 'SkMacFlushTxFifo':
skxmac2.c:1115: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c:1115: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c: In function 'SkMacFlushRxFifo':
skxmac2.c:1145: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c:1145: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c: In function 'SkXmInitPauseMd':
skxmac2.c:1987: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c:1987: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c: In function 'SkXmOverflowStatus':
skxmac2.c:4236: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c:4236: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c:4242: warning: dereferencing type-punned pointer will break strict-aliasing rules skxmac2.c:4242: warning: dereferencing type-punned pointer will break strict-aliasing rules

Quoted 8 lines
---
 drivers/net/sk98lin/skge.c     |   12 +++++++++---
 drivers/net/sk98lin/skgesirq.c |    7 +++++--
 drivers/net/sk98lin/skrlmt.c   |    3 ++-
 drivers/net/sk98lin/skxmac2.c  |   20 +++++++++++++-------
 4 files changed, 29 insertions(+), 13 deletions(-)

Aplied.

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Marriage is the triumph  of  imagination  over  intelligence.  Second
marriage is the triumph of hope over experience.
#13 lore raw

PATCH 1/1 board/esd/common/flash.c: Fix compile warning

In reply to Wolfgang Denk

Fix warning: ../common/flash.c:635: warning: dereferencing type-punned pointer will break strict-aliasing rules

Cc Matthias Fuchs <[email protected]>
Cc Stefan Roese <[email protected]>
---
 board/esd/common/flash.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
board/esd/common/flash.c +2 -1
index 3ea053b..38a58fb 100644
@@ -630,9 +630,10 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
  */
 static int write_word (flash_info_t *info, ulong dest, ulong data)
 {
+	ulong *data_ptr = &data;
 	volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *)(info->start[0]);
 	volatile CONFIG_SYS_FLASH_WORD_SIZE *dest2 = (CONFIG_SYS_FLASH_WORD_SIZE *)dest;
-	volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 = (CONFIG_SYS_FLASH_WORD_SIZE *)&data;
+	volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 = (CONFIG_SYS_FLASH_WORD_SIZE *)data_ptr;
 	ulong start;
 	int flag;
 	int i;
Signature · 1 line
1.6.0.6
#14 lore raw

PATCH 1/1 board/esd/common/flash.c: Fix compile warning

Quoted 26 lines · Wolfgang Denk

Fix warning: ../common/flash.c:635: warning: dereferencing type-punned pointer will break strict-aliasing rules

Cc Matthias Fuchs <[email protected]>
Cc Stefan Roese <[email protected]>
---
 board/esd/common/flash.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
board/esd/common/flash.c +2 -1
index 3ea053b..38a58fb 100644
@@ -630,9 +630,10 @@ int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
  */
 static int write_word (flash_info_t *info, ulong dest, ulong data)
 {
+	ulong *data_ptr = &data;
 	volatile CONFIG_SYS_FLASH_WORD_SIZE *addr2 = (CONFIG_SYS_FLASH_WORD_SIZE *)(info->start[0]);
 	volatile CONFIG_SYS_FLASH_WORD_SIZE *dest2 = (CONFIG_SYS_FLASH_WORD_SIZE *)dest;
-	volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 = (CONFIG_SYS_FLASH_WORD_SIZE *)&data;
+	volatile CONFIG_SYS_FLASH_WORD_SIZE *data2 = (CONFIG_SYS_FLASH_WORD_SIZE *)data_ptr;
 	ulong start;
 	int flag;
 	int i;
#15 lore raw

PATCH 1/1 board/esd/common/flash.c: Fix compile warning

In reply to Wolfgang Denk
Quoted 6 lines · On Friday 11 September 2009 11:18:22 Wolfgang Denk wrote:

Fix warning: ../common/flash.c:635: warning: dereferencing type-punned pointer will break strict-aliasing rules

Cc Matthias Fuchs <[email protected]>
Cc Stefan Roese <[email protected]>

Thanks.

Cheers,
Stefan

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

author Applied
#16 lore raw

PATCH 1/1 board/esd/common/flash.c: Fix compile warning

In reply to Wolfgang Denk
Quoted 9 lines · In message <[email protected]> you wrote:

Fix warning: ../common/flash.c:635: warning: dereferencing type-punned pointer will break strict-aliasing rules

Cc Matthias Fuchs <[email protected]>
Cc Stefan Roese <[email protected]>
---
 board/esd/common/flash.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Applied.

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Operating-system software is the program that  orchestrates  all  the
basic functions of a computer.
- The Wall Street Journal, Tuesday, September 15, 1987, page 40
#17 lore raw

PATCH 1/1 board/esd/cpci750/ide.c: fix compile warning

In reply to Wolfgang Denk

Fix warning: ide.c:54: warning: dereferencing type-punned pointer will break strict-aliasing rules

Cc Matthias Fuchs <[email protected]>
Cc Stefan Roese <[email protected]>
---
 board/esd/cpci750/ide.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
board/esd/cpci750/ide.c +6 -2
index 638219f..a3bd1b7 100644
@@ -48,14 +48,18 @@ int ide_preinit (void)
 	if (devbusfn == -1)
 	        devbusfn = pci_find_device (0x1095, 0x3114, 0);
 	if (devbusfn != -1) {
+		ulong *ide_bus_offset_ptr;
+
 		status = 0;
 
+		ide_bus_offset_ptr = &ide_bus_offset[0];
 		pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_0,
-				       (u32 *) & ide_bus_offset[0]);
+				       (u32 *)ide_bus_offset_ptr);
 		ide_bus_offset[0] &= 0xfffffffe;
 		ide_bus_offset[0] += CONFIG_SYS_PCI0_IO_SPACE;
+		ide_bus_offset_ptr = &ide_bus_offset[1];
 		pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_2,
-				       (u32 *) & ide_bus_offset[1]);
+				       (u32 *)ide_bus_offset_ptr);
 		ide_bus_offset[1] &= 0xfffffffe;
 		ide_bus_offset[1] += CONFIG_SYS_PCI0_IO_SPACE;
 	}
Signature · 1 line
1.6.0.6
#18 lore raw

PATCH 1/1 board/esd/cpci750/ide.c: fix compile warning

Quoted 6 lines · On Friday 11 September 2009 11:18:23 Wolfgang Denk wrote:

Fix warning: ide.c:54: warning: dereferencing type-punned pointer will break strict-aliasing rules

Cc Matthias Fuchs <[email protected]>
Cc Stefan Roese <[email protected]>

I added Reinhard Arlt to Cc, as he's the maintainer for this board.

But I can't spot any problems, so here my:

Thanks.

Cheers,
Stefan

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

author Applied
#19 lore raw

PATCH 1/1 board/esd/cpci750/ide.c: fix compile warning

In reply to Wolfgang Denk
Quoted 9 lines · In message <[email protected]> you wrote:

Fix warning: ide.c:54: warning: dereferencing type-punned pointer will break strict-aliasing rules

Cc Matthias Fuchs <[email protected]>
Cc Stefan Roese <[email protected]>
---
 board/esd/cpci750/ide.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

Applied.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
He who hesitates is not only lost, but miles from the next exit.
author Applied
#20 lore raw

PATCH 1/1 kwbimage.c: Fix compile warning when building on 64 bit systems

In reply to Wolfgang Denk
Quoted 10 lines · In message <[email protected]> you wrote:

Fix this warning when building on 64 bit systems:
tools/kwbimage.c: In function 'kwbimage_checksum32':
tools/kwbimage.c:135: warning: format '%d' expects type 'int', but argument 4 has type 'long unsigned int'

Cc Prafulla Wadaskar <[email protected]>
---
 tools/kwbimage.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Applied.

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"It's like deja vu all over again."                      - Yogi Berra