This fixes PR61921 - I failed to remember PTA builds fake global decls which we don't have a varpool node for. Fixed.
Tested on x86_64-unknown-linux-gnu, applied. Richard. 2014-07-28 Richard Biener <rguent...@suse.de> PR tree-optimization/61921 * tree-ssa-structalias.c (create_variable_info_for_1): Check if there is a varpool node before dereferencing it. * gfortran.dg/pr61921.f90: New testcase. Index: gcc/tree-ssa-structalias.c =================================================================== --- gcc/tree-ssa-structalias.c (revision 213110) +++ gcc/tree-ssa-structalias.c (working copy) @@ -5650,6 +5650,7 @@ create_variable_info_for_1 (tree decl, c auto_vec<fieldoff_s> fieldstack; fieldoff_s *fo; unsigned int i; + varpool_node *vnode; if (!declsize || !tree_fits_uhwi_p (declsize)) @@ -5671,7 +5672,8 @@ create_variable_info_for_1 (tree decl, c in IPA mode. Else we'd have to parse arbitrary initializers. */ && !(in_ipa_mode && is_global_var (decl) - && varpool_node::get (decl)->get_constructor ())) + && (vnode = varpool_node::get (decl)) + && vnode->get_constructor ())) { fieldoff_s *fo = NULL; bool notokay = false; Index: gcc/testsuite/gfortran.dg/pr61921.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr61921.f90 (revision 0) +++ gcc/testsuite/gfortran.dg/pr61921.f90 (working copy) @@ -0,0 +1,15 @@ +! { dg-do compile } +! { dg-options "-O2 -fipa-pta" } +MODULE min_heap + TYPE heap_t + END TYPE heap_t +CONTAINS + ELEMENTAL FUNCTION get_left_child(n) RESULT (child) + INTEGER, INTENT(IN) :: n + END FUNCTION get_left_child + ELEMENTAL FUNCTION get_value(heap, n) RESULT (value) + TYPE(heap_t), INTENT(IN) :: heap + INTEGER, INTENT(IN) :: n + END FUNCTION get_value +END MODULE min_heap +