Patchwork [AArch64] Fix printf format warning in aarch64_print_operand

login
register
mail settings
Submitter James Greenhalgh
Date April 22, 2013, 10:56 a.m.
Message ID <1366628211-25976-1-git-send-email-james.greenhalgh@arm.com>
Download mbox | patch
Permalink /patch/238438/
State New
Headers show

Comments

James Greenhalgh - April 22, 2013, 10:56 a.m.
Hello,

This patch fixes the following warning in config/aarch64/aarch64.c:

.../gcc/config/aarch64/aarch64.c: In function ‘void aarch64_print_operand(FILE*, rtx, char)’:
.../gcc/config/aarch64/aarch64.c:3376:42: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘long unsigned int’ [-Wformat]

By adding the missing w to %wx.

Regression tested on aarch64-none-elf:aarch64.exp with no issues and
checked to ensure the warning clears.

Thanks,
James Greenhalgh

---
gcc/

2013-04-22  James Greenhalgh  <james.greenhalgh@arm.com>

	* config/aarch64/aarch64.c (aarch64_print_operand): Fix asm_fprintf
	format specifier in 'X' case.
Richard Earnshaw - April 25, 2013, 8:38 a.m.
On 22/04/13 11:56, James Greenhalgh wrote:
>
> Hello,
>
> This patch fixes the following warning in config/aarch64/aarch64.c:
>
> .../gcc/config/aarch64/aarch64.c: In function ‘void aarch64_print_operand(FILE*, rtx, char)’:
> .../gcc/config/aarch64/aarch64.c:3376:42: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘long unsigned int’ [-Wformat]
>
> By adding the missing w to %wx.
>
> Regression tested on aarch64-none-elf:aarch64.exp with no issues and
> checked to ensure the warning clears.
>
> Thanks,
> James Greenhalgh
>
> ---
> gcc/
>
> 2013-04-22  James Greenhalgh  <james.greenhalgh@arm.com>
>
> 	* config/aarch64/aarch64.c (aarch64_print_operand): Fix asm_fprintf
> 	format specifier in 'X' case.
>

OK.

R.
James Greenhalgh - June 3, 2013, 3:17 p.m.
> > ---
> > gcc/
> >
> > 2013-04-22  James Greenhalgh  <james.greenhalgh@arm.com>
> >
> > 	* config/aarch64/aarch64.c (aarch64_print_operand): Fix
> asm_fprintf
> > 	format specifier in 'X' case.
> >
> 
> OK.
> 
> R.

Hi,

This warning also occurs on gcc-4_8-branch, can I also backport the fix
to there now that 4.8 is open again?

I've run a regression run for aarch64-none-elf with no regressions.

Thanks,
James
Marcus Shawcroft - June 3, 2013, 3:28 p.m.
On 03/06/13 16:17, James Greenhalgh wrote:
>>> ---
>>> gcc/
>>>
>>> 2013-04-22  James Greenhalgh  <james.greenhalgh@arm.com>
>>>
>>> 	* config/aarch64/aarch64.c (aarch64_print_operand): Fix
>> asm_fprintf
>>> 	format specifier in 'X' case.
>>>
>>
>> OK.
>>
>> R.
>
> Hi,
>
> This warning also occurs on gcc-4_8-branch, can I also backport the fix
> to there now that 4.8 is open again?
>
> I've run a regression run for aarch64-none-elf with no regressions.

OK
/Marcus

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 267ba7f..34e1b7a 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -3373,7 +3373,7 @@  aarch64_print_operand (FILE *f, rtx x, char code)
 	  output_operand_lossage ("invalid operand for '%%%c'", code);
 	  return;
 	}
-      asm_fprintf (f, "0x%x", UINTVAL (x));
+      asm_fprintf (f, "0x%wx", UINTVAL (x));
       break;
 
     case 'w':