diff mbox series

AW: Fix for type confusion bug on microblaze

Message ID 00be01d5693e$817cdb70$84769250$@uni-ulm.de
State New
Headers show
Series AW: Fix for type confusion bug on microblaze | expand

Commit Message

Jonas Pfeil Sept. 12, 2019, 7:48 a.m. UTC
Yes, you are correct. Tested it and it works as intended.

Thanks,

Jonas



-----Ursprüngliche Nachricht-----
Von: Jeff Law <law@redhat.com> 
Gesendet: Mittwoch, 11. September 2019 19:33
An: Jonas Pfeil <jonas.pfeil@uni-ulm.de>; gcc-patches@gcc.gnu.org
Betreff: Re: Fix for type confusion bug on microblaze

On 9/11/19 5:28 AM, Jonas Pfeil wrote:
> The Microblaze target confuses unsigned long with HOST_WIDE_INT.
> 
> This works fine for many architectures, but fails on ARM 
> (HOST_WIDE_INT is 8 bytes, unsigned long is 4 bytes). Leading to print 
> a uninitialized register instead of the desired number, fix by using the correct printf-specifier.
> 
> Tested to fix the issue and work with an ARM->MB cross compiler.
> 
> --- a/gcc/config/microblaze/microblaze.h
> +++ b/gcc/config/microblaze/microblaze.h
> @@ -695,7 +695,7 @@ do {
> \
>    fprintf (STREAM, "\t.align\t%d\n", (LOG))
>  
>  #define ASM_OUTPUT_SKIP(STREAM,SIZE)                                   \
> -  fprintf (STREAM, "\t.space\t%lu\n", (SIZE))
> +  fprintf (STREAM, "\t.space\t" HOST_WIDE_INT_PRINT_DEC "\n", (SIZE))
I believe that we should be using HOST_WIDE_INT_PRINT_UNSIGNED, not HOST_WIDE_INT_PRINT_DEC.  Can you please verify that works for your cross builds?

Thanks,
jeff

Comments

Jeff Law Sept. 20, 2019, 10:33 p.m. UTC | #1
On 9/12/19 1:48 AM, Jonas Pfeil wrote:
> Yes, you are correct. Tested it and it works as intended.
> 
> Thanks,
> 
> Jonas
> 
> --- a/gcc/config/microblaze/microblaze.h
> +++ b/gcc/config/microblaze/microblaze.h
> @@ -695,7 +695,7 @@ do {                                                                        \
>    fprintf (STREAM, "\t.align\t%d\n", (LOG))
>  
>  #define ASM_OUTPUT_SKIP(STREAM,SIZE)                                   \
> -  fprintf (STREAM, "\t.space\t%lu\n", (SIZE))
> +  fprintf (STREAM, "\t.space\t" HOST_WIDE_INT_PRINT_UNSIGNED "\n", (SIZE))
>  
>  #define ASCII_DATA_ASM_OP              "\t.ascii\t"
>  #define STRING_ASM_OP                  "\t.asciz\t"
THanks.  I'll be installing this momentarily on the trunk.

jeff
diff mbox series

Patch

--- a/gcc/config/microblaze/microblaze.h
+++ b/gcc/config/microblaze/microblaze.h
@@ -695,7 +695,7 @@  do {                                                                        \
   fprintf (STREAM, "\t.align\t%d\n", (LOG))
 
 #define ASM_OUTPUT_SKIP(STREAM,SIZE)                                   \
-  fprintf (STREAM, "\t.space\t%lu\n", (SIZE))
+  fprintf (STREAM, "\t.space\t" HOST_WIDE_INT_PRINT_UNSIGNED "\n", (SIZE))
 
 #define ASCII_DATA_ASM_OP              "\t.ascii\t"
 #define STRING_ASM_OP                  "\t.asciz\t"