2014-07-28 Richard Biener <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 28 Jul 2014 08:25:34 +0000 (08:25 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 28 Jul 2014 08:25:34 +0000 (08:25 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213114 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr61921.f90 [new file with mode: 0644]
gcc/tree-ssa-structalias.c

index 5476b59..740971a 100644 (file)
@@ -1,3 +1,9 @@
+2014-07-28  Richard Biener  <rguenther@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.
+
 2014-07-28  Roman Gareev  <gareevroman@gmail.com>
 
        * graphite-sese-to-poly.c:
index 581aedf..68499d9 100644 (file)
@@ -1,5 +1,10 @@
 2014-07-28  Richard Biener  <rguenther@suse.de>
 
+       PR tree-optimization/61921
+       * gfortran.dg/pr61921.f90: New testcase.
+
+2014-07-28  Richard Biener  <rguenther@suse.de>
+
        PR rtl-optimization/61801
        * gcc.target/i386/pr61801.c: New testcase.
 
diff --git a/gcc/testsuite/gfortran.dg/pr61921.f90 b/gcc/testsuite/gfortran.dg/pr61921.f90
new file mode 100644 (file)
index 0000000..52b6176
--- /dev/null
@@ -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
+
index 1879fc0..0aa0c4b 100644 (file)
@@ -5650,6 +5650,7 @@ create_variable_info_for_1 (tree decl, const char *name)
   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, const char *name)
         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;