]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* cgraph.h (varpool_variable_node): Do not choke on null node.
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 8 Jan 2014 22:39:07 +0000 (22:39 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 8 Jan 2014 22:39:07 +0000 (22:39 +0000)
From-SVN: r206449

gcc/ChangeLog
gcc/cgraph.h
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/weak2.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/weak2.ads [new file with mode: 0644]

index 8bd7ef398360d0720245f12bbcb1b1255482477a..f63918e6cc6b32fac7e888ab263497bde3ce37f5 100644 (file)
@@ -1,3 +1,7 @@
+2014-01-08  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * cgraph.h (varpool_variable_node): Do not choke on null node.
+
 2014-01-08  Catherine Moore  <clm@codesourcery.com>
 
        * config/mips/mips.md (simple_return): Attempt to use JRC for microMIPS.
index 8b25d947511d5b050c800a9702a4f4b535b6eacc..7ce54014e1ef26e59dfb4c45c1892de1faf2eac3 100644 (file)
@@ -1426,8 +1426,12 @@ varpool_variable_node (varpool_node *node,
 {
   varpool_node *n;
 
-  n = dyn_cast <varpool_node> (symtab_alias_ultimate_target (node,
-                                                            availability));
+  if (node)
+    n = dyn_cast <varpool_node> (symtab_alias_ultimate_target (node,
+                                                              availability));
+  else
+    n = NULL;
+
   if (!n && availability)
     *availability = AVAIL_NOT_AVAILABLE;
   return n;
index 155f24dae4a71c4685995201912f57753f90f90a..b1f578cc197ea633ddb40ade62ddb4d8254439d3 100644 (file)
@@ -1,3 +1,7 @@
+2014-01-08  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/weak2.ad[sb]: New test.
+
 2014-01-08  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/59471
diff --git a/gcc/testsuite/gnat.dg/weak2.adb b/gcc/testsuite/gnat.dg/weak2.adb
new file mode 100644 (file)
index 0000000..9e704b5
--- /dev/null
@@ -0,0 +1,10 @@
+-- { dg-do compile }
+
+package body Weak2 is
+
+   function F return Integer is
+   begin
+      return Var;
+   end;
+
+end Weak2;
diff --git a/gcc/testsuite/gnat.dg/weak2.ads b/gcc/testsuite/gnat.dg/weak2.ads
new file mode 100644 (file)
index 0000000..0a0011a
--- /dev/null
@@ -0,0 +1,9 @@
+package Weak2 is
+
+   Var : Integer;
+   pragma Import (Ada, Var, "var_name");
+   pragma Weak_External (Var);
+
+   function F return Integer;
+
+end Weak2;