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.yuk...@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;