diff mbox

[C] Mixed pointer types in call to streamer_tree_cache_lookup() in gcc/lto-streamer-out.c

Message ID 5041FDE7.1000104@iki.fi
State New
Headers show

Commit Message

Andris Pavēnis Sept. 1, 2012, 12:21 p.m. UTC
uint32_t * is used as a 3rd parameter in call to streamer_tree_cache_lookup()
in 2 places in gcc/lto-streamer-out.c when the procedure prototype have
unsigned *. They are not guaranteed to be the same for all targets
(I got error when building for DJGPP)

Andris

ChangeLog entry

2012-09-01  Andris Pavenis <andris.pavenis@iki.fi>

	* lto-streamer-out.c (write_global_references, lto_output_decl_state_refs):
	Fix parameter type in call to streamer_tree_cache_lookup

Comments

Richard Biener Sept. 3, 2012, 12:27 p.m. UTC | #1
On Sat, Sep 1, 2012 at 2:21 PM, Andris Pavenis <andris.pavenis@iki.fi> wrote:
> uint32_t * is used as a 3rd parameter in call to
> streamer_tree_cache_lookup()
> in 2 places in gcc/lto-streamer-out.c when the procedure prototype have
> unsigned *. They are not guaranteed to be the same for all targets
> (I got error when building for DJGPP)

Ok.

Thanks,
Richard.

> Andris
>
> ChangeLog entry
>
> 2012-09-01  Andris Pavenis <andris.pavenis@iki.fi>
>
>         * lto-streamer-out.c (write_global_references,
> lto_output_decl_state_refs):
>         Fix parameter type in call to streamer_tree_cache_lookup
Andris Pavēnis Sept. 3, 2012, 4:10 p.m. UTC | #2
On 09/03/2012 03:27 PM, Richard Guenther wrote:
> On Sat, Sep 1, 2012 at 2:21 PM, Andris Pavenis <andris.pavenis@iki.fi> wrote:
>> uint32_t * is used as a 3rd parameter in call to
>> streamer_tree_cache_lookup()
>> in 2 places in gcc/lto-streamer-out.c when the procedure prototype have
>> unsigned *. They are not guaranteed to be the same for all targets
>> (I got error when building for DJGPP)
>
> Ok.

I do not have SVN write access, so I cannot commit myself

Andris

>
> Thanks,
> Richard.
>
>> Andris
>>
>> ChangeLog entry
>>
>> 2012-09-01  Andris Pavenis <andris.pavenis@iki.fi>
>>
>>          * lto-streamer-out.c (write_global_references,
>> lto_output_decl_state_refs):
>>          Fix parameter type in call to streamer_tree_cache_lookup
>
Richard Biener Sept. 4, 2012, 9:33 a.m. UTC | #3
On Mon, Sep 3, 2012 at 6:10 PM, Andris Pavenis <andris.pavenis@iki.fi> wrote:
> On 09/03/2012 03:27 PM, Richard Guenther wrote:
>>
>> On Sat, Sep 1, 2012 at 2:21 PM, Andris Pavenis <andris.pavenis@iki.fi>
>> wrote:
>>>
>>> uint32_t * is used as a 3rd parameter in call to
>>> streamer_tree_cache_lookup()
>>> in 2 places in gcc/lto-streamer-out.c when the procedure prototype have
>>> unsigned *. They are not guaranteed to be the same for all targets
>>> (I got error when building for DJGPP)
>>
>>
>> Ok.
>
>
> I do not have SVN write access, so I cannot commit myself

Hmm, OTOH your patch looks wrong as

@@ -1131,7 +1131,7 @@ lto_output_decl_state_refs (struct output_block *ob,
                            struct lto_out_decl_state *state)
 {
   unsigned i;
-  uint32_t ref;
+  unsigned ref;
   tree decl;

   /* Write reference to FUNCTION_DECL.  If there is not function,

conflicts with

  streamer_tree_cache_lookup (ob->writer_cache, decl, &ref);
  gcc_assert (ref != (unsigned)-1);
  lto_output_data_stream (out_stream, &ref, sizeof (uint32_t));

where the on-disk format expects uint32_t layout.  Thus I think
streamer_tree_cache_lookup should instead use uint32_t consistently.

Richard.

> Andris
>
>
>>
>> Thanks,
>> Richard.
>>
>>> Andris
>>>
>>> ChangeLog entry
>>>
>>> 2012-09-01  Andris Pavenis <andris.pavenis@iki.fi>
>>>
>>>          * lto-streamer-out.c (write_global_references,
>>> lto_output_decl_state_refs):
>>>          Fix parameter type in call to streamer_tree_cache_lookup
>>
>>
>
diff mbox

Patch

diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index 2adae74..12335c5 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -1098,7 +1098,7 @@  write_global_references (struct output_block *ob,
 
   for (index = 0; index < size; index++)
     {
-      uint32_t slot_num;
+      unsigned slot_num;
 
       t = lto_tree_ref_encoder_get_tree (encoder, index);
       streamer_tree_cache_lookup (ob->writer_cache, t, &slot_num);
@@ -1131,7 +1131,7 @@  lto_output_decl_state_refs (struct output_block *ob,
 			    struct lto_out_decl_state *state)
 {
   unsigned i;
-  uint32_t ref;
+  unsigned ref;
   tree decl;
 
   /* Write reference to FUNCTION_DECL.  If there is not function,