public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andris Pavenis <andris.pavenis@iki.fi>
To: GCC Patches <gcc-patches@gcc.gnu.org>, DJ Delorie <dj@delorie.com>
Subject: [PATCH] Fix inconsistent use of integer types in gcc/lto-streamer-out.c
Date: Sun, 15 Nov 2015 08:21:00 -0000	[thread overview]
Message-ID: <5648408B.9040107@iki.fi> (raw)

[-- Attachment #1: Type: text/plain, Size: 710 bytes --]

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


[-- Attachment #2: 0001-lto-streamer-out.c-Fix-inconsistent-use-unsigned-int.patch --]
[-- Type: text/x-patch, Size: 1173 bytes --]

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


             reply	other threads:[~2015-11-15  8:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-15  8:21 Andris Pavenis [this message]
2015-11-16 11:12 ` Richard Biener
2015-11-16 16:23   ` Andris Pavenis
2015-11-16 21:13     ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5648408B.9040107@iki.fi \
    --to=andris.pavenis@iki.fi \
    --cc=dj@delorie.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).