Skip to contentSkip to conversation

board/eltec/elppc/misc.c: Fix GCC 4.6 build warning

PATCH New Anatolij Gustschin 3 participants 3 messages Dec 20, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board/eltec/elppc/misc.c: Fix GCC 4.6 build warning

Fix:
misc.c: In function 'misc_init_r':
misc.c:119:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

---
 board/eltec/elppc/misc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
board/eltec/elppc/misc.c +1 -1
index d476cd5..89f1b1d 100644
@@ -116,7 +116,7 @@ int misc_init_r (void)
 		eerev.etheraddr[5] = 0x4D;
 
 		/* cache config word for ELPPC */
-		*(int *) &eerev.res[0] = 0;
+		memset(&eerev.res[0], 0, 4);
 
 		initSrom = 1;	/* force dialog */
 		copyNv = 1;	/* copy to nvram */
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/1 board/eltec/elppc/misc.c: Fix GCC 4.6 build warning

board/eltec/elppc/misc.c int misc_init_r (void) · line 119

Quoted 2 lines · On Tuesday 20 December 2011 12:51:09 Anatolij Gustschin wrote:
board/eltec/elppc/misc.c +1 -1
-		*(int *) &eerev.res[0] = 0;
+		memset(&eerev.res[0], 0, 4);

&foo[0] is the same thing as foo
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20111220/454ce581/attachment.pgp>

#2 lore raw

PATCH 1/1 board/eltec/elppc/misc.c: Fix GCC 4.6 build warning

In reply to Anatolij Gustschin

Dear Anatolij Gustschin,

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

Fix:
misc.c: In function 'misc_init_r':
misc.c:119:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

---
 board/eltec/elppc/misc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

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
Peace was the way.
	-- Kirk, "The City on the Edge of Forever", stardate unknown