From: gchare@google.com (Gabriel Charette)
To: reply@codereview.appspotmail.com, gcc-patches@gcc.gnu.org
Subject: [pph] Initialize cache_ix in all paths in pph_start_record (issue4642045)
Date: Sat, 18 Jun 2011 02:49:00 -0000 [thread overview]
Message-ID: <20110618012929.167F61C11F2@gchare.mtv.corp.google.com> (raw)
Clarified comment from v1 of this patch.
2011-06-17 Gabriel Charette <gchare@google.com>
* gcc/cp/pph-streamer-in.c (pph_start_record):
Initialize cache_ix in all paths.
diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c
index b3c2ac9..186100f 100644
--- a/gcc/cp/pph-streamer-in.c
+++ b/gcc/cp/pph-streamer-in.c
@@ -204,7 +204,15 @@ pph_start_record (pph_stream *stream, unsigned *cache_ix)
if (marker == PPH_RECORD_START || marker == PPH_RECORD_SHARED)
*cache_ix = pph_in_uint (stream);
else
- gcc_assert (marker == PPH_RECORD_END);
+ {
+ gcc_assert (marker == PPH_RECORD_END);
+ /* Initialize CACHE_IX to an invalid index. Even though this
+ is never used in practice, the compiler will throw an error
+ if the optimizer inlines this function in a given build as
+ it will complain that " 'ix' may be used uninitialized". */
+ *cache_ix = -1;
+ }
return marker;
}
--
This patch is available for review at http://codereview.appspot.com/4642045
next reply other threads:[~2011-06-18 1:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-18 2:49 Gabriel Charette [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-06-22 19:10 dnovillo
2011-06-17 23:18 Gabriel Charette
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=20110618012929.167F61C11F2@gchare.mtv.corp.google.com \
--to=gchare@google.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=reply@codereview.appspotmail.com \
/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).