aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2014-01-08 22:39:07 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2014-01-08 22:39:07 +0000
commitff36fcbe09845c3bdf11757e96be18741857b4a8 (patch)
treed21f8e2d032efdaf27e5118bc18444f4ba9472b9
parent03694c4310bacc44251926dc68cb3ff22d63e8a7 (diff)
downloadgcc-ff36fcbe09845c3bdf11757e96be18741857b4a8.zip
gcc-ff36fcbe09845c3bdf11757e96be18741857b4a8.tar.gz
gcc-ff36fcbe09845c3bdf11757e96be18741857b4a8.tar.bz2
* cgraph.h (varpool_variable_node): Do not choke on null node.
From-SVN: r206449
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/cgraph.h8
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gnat.dg/weak2.adb10
-rw-r--r--gcc/testsuite/gnat.dg/weak2.ads9
5 files changed, 33 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8bd7ef3..f63918e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 8b25d94..7ce5401 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 155f24d..b1f578c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..9e704b5
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/weak2.adb
@@ -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
index 0000000..0a0011a
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/weak2.ads
@@ -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;