From: Kirill Yukhin <kirill.yukhin@gmail.com>
To: gcc-patches@gcc.gnu.org, hubicka@ucw.cz
Subject: [PATCH, IPA] Check pointer for 0 before use in `get_odr_type`
Date: Fri, 02 Sep 2016 20:54:00 -0000 [thread overview]
Message-ID: <394ceee5-dfc2-f9a7-c534-7a09f222c2ab@gmail.com> (raw)
Hello,
Looks like `get_odr_type ()` contains code which dereferences
pointer before check it for zero. I moved the line under the check.
Bootstrap/regtest on x?86|x86_64 in progress.
Is it ok for trunk if pass?
gcc/
* gcc/ipa-devirt.c (get_odr_type): Check odr_types_ptr for
zero before dereferencing it.
--
Thanks, K
commit 9b822dfb4db14ce762a8d55cf76c677f3fae04bc
Author: Kirill Yukhin <kirill.yukhin@gmail.com>
Date: Fri Sep 2 23:40:55 2016 +0300
Access odr_type only if odr_type_ptr is not 0.
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 2cf018b..cca912c 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -2132,12 +2132,14 @@ get_odr_type (tree type, bool insert)
}
else if (base_id > val->id)
{
- odr_types[val->id] = 0;
/* Be sure we did not recorded any derived types; these may need
renumbering too. */
gcc_assert (val->derived_types.length() == 0);
if (odr_types_ptr)
- val->id = odr_types.length ();
+ {
+ odr_types[val->id] = 0;
+ val->id = odr_types.length ();
+ }
vec_safe_push (odr_types_ptr, val);
}
return val;
next reply other threads:[~2016-09-02 20:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-02 20:54 Kirill Yukhin [this message]
2016-09-02 21:04 ` Jakub Jelinek
2016-09-02 21:06 ` Kirill Yukhin
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=394ceee5-dfc2-f9a7-c534-7a09f222c2ab@gmail.com \
--to=kirill.yukhin@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
/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).