* [PATCH, IPA] Check pointer for 0 before use in `get_odr_type`
@ 2016-09-02 20:54 Kirill Yukhin
2016-09-02 21:04 ` Jakub Jelinek
0 siblings, 1 reply; 3+ messages in thread
From: Kirill Yukhin @ 2016-09-02 20:54 UTC (permalink / raw)
To: gcc-patches, hubicka
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;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH, IPA] Check pointer for 0 before use in `get_odr_type`
2016-09-02 20:54 [PATCH, IPA] Check pointer for 0 before use in `get_odr_type` Kirill Yukhin
@ 2016-09-02 21:04 ` Jakub Jelinek
2016-09-02 21:06 ` Kirill Yukhin
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2016-09-02 21:04 UTC (permalink / raw)
To: Kirill Yukhin; +Cc: gcc-patches, hubicka
On Fri, Sep 02, 2016 at 11:53:01PM +0300, Kirill Yukhin wrote:
> 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.
I've already tested/posted
http://gcc.gnu.org/ml/gcc-patches/2016-09/msg00089.html
for this.
Jakub
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH, IPA] Check pointer for 0 before use in `get_odr_type`
2016-09-02 21:04 ` Jakub Jelinek
@ 2016-09-02 21:06 ` Kirill Yukhin
0 siblings, 0 replies; 3+ messages in thread
From: Kirill Yukhin @ 2016-09-02 21:06 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches, hubicka
On 02.09.2016 23:56, Jakub Jelinek wrote:
> On Fri, Sep 02, 2016 at 11:53:01PM +0300, Kirill Yukhin wrote:
>> gcc/
>> * gcc/ipa-devirt.c (get_odr_type): Check odr_types_ptr for
>> zero before dereferencing it.
>
> I've already tested/posted
> http://gcc.gnu.org/ml/gcc-patches/2016-09/msg00089.html
> for this.
Okay, disregard then.
--
Thanks, K
>
> Jakub
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-02 21:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-02 20:54 [PATCH, IPA] Check pointer for 0 before use in `get_odr_type` Kirill Yukhin
2016-09-02 21:04 ` Jakub Jelinek
2016-09-02 21:06 ` Kirill Yukhin
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).