mkimage: Fix strict-aliasing compiler warning
PATCH 1/1 mkimage: Fix strict-aliasing compiler warning
Version 4.2.4 of gcc produces the following warnings without this change:
mkimage.c: In function ?main?:
mkimage.c:204: warning: dereferencing type-punned pointer will break strict-aliasing rules mkimage.c:222: warning: dereferencing type-punned pointer will break strict-aliasing rules
Signed-off-by Peter Tyser <[email protected]>
--- tools/mkimage.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-)
tools/mkimage.c +3 -5
@@ -145,7 +145,7 @@ main (int argc, char **argv) {int ifd =-1 ;struct stat sbuf; -unsigned char *ptr; +char *ptr;int retval =0 ;struct image_type_params *tparams =NULL ;
@@ -201,8 +201,7 @@ main (int argc, char **argv)case 'a' :if (--argc <=0 )usage (); - params.addr =strtoul (*++argv, - (char **)&ptr,16 ); + params.addr =strtoul (*++argv, &ptr,16 );if (*ptr) { fprintf (stderr, "%s: invalid load address %s\n",
@@ -219,8 +218,7 @@ main (int argc, char **argv)case 'e' :if (--argc <=0 )usage (); - params.ep =strtoul (*++argv, - (char **)&ptr,16 ); + params.ep =strtoul (*++argv, &ptr,16 );if (*ptr) { fprintf (stderr, "%s: invalid entry point %s\n",
Signature · 1 line
1.6.2.1
Wolfgang Denk
AppliedPATCH 1/1 mkimage: Fix strict-aliasing compiler warning
Dear Peter Tyser,
Quoted 9 lines · In message <[email protected]> you wrote:
Version 4.2.4 of gcc produces the following warnings without this change:
mkimage.c: In function `main':
mkimage.c:204: warning: dereferencing type-punned pointer will break strict-aliasing rules mkimage.c:222: warning: dereferencing type-punned pointer will break strict-aliasing rulesSigned-off-by Peter Tyser <[email protected]>--- tools/mkimage.c | 8 +++----- 1 files changed, 3 insertions(+), 5 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 I'm what passes for a Unix guru in my office. This is a frightening concept. - Lee Ann Goldstein, in <[email protected]>