This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix inconsistent use of integer types in gcc/lto-streamer-out.c


This fixes use of pointers different unsigned integer types as function parameter.
Function prototype is (see gcc/tree-streamer.h):

bool streamer_tree_cache_lookup (struct streamer_tree_cache_d *, tree,
                 unsigned *);

gcc/lto-streamer-out.c passes uint32_t int * as parameter to this method in 2 places.
Current type unisgned is used elsewhere in the same file.

uint32_t is not guaranteed to be the same as unsigned (for DJGPP uint32_t is actually
unsigned long). That causes compile failure for DJGPP native build.

Andris

2015-11-15 Andris Pavenis <andris.pavenis@iki.fi>

* gcc/lto-streamer-out.c (write_global_references): Adjust integer type
  (lto_output_decl_state_refs): Likewise

>From 8962f5b60f3ea241634a5e50cda04dc17ebb1322 Mon Sep 17 00:00:00 2001
From: Andris Pavenis <andris.pavenis@iki.fi>
Date: Sun, 15 Nov 2015 09:57:24 +0200
Subject: [PATCH] lto-streamer-out.c: Fix inconsistent use unsigned integer
 types

* lto-streamer-out (write_global_references, lto_output_decl_state_streams): use integer
 type passed to streamer_tree_cache_lookup.
---
 gcc/lto-streamer-out.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index 11daf7a..7d008b5 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -2402,7 +2402,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);
@@ -2437,7 +2437,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,
-- 
2.4.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]