public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix PR ada/62019
@ 2014-10-14 21:06 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2014-10-14 21:06 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]

Someone broke again weak external symbols in Ada in exactly the same way as:
  https://gcc.gnu.org/ml/gcc-patches/2014-01/msg00431.html
probably during the ongoing C++ reshuffling:

FAIL: gnat.dg/weak2.adb (test for excess errors)

Tested on x86_64-suse-linux, applied on the mainline as obvious.


2014-10-14  Eric Botcazou  <ebotcazou@adacore.com>

	PR ada/62019
	* tree-eh.c (tree_could_trap) <FUNCTION_DECL>: Revamp and really
	do not choke on null node.
	<VAR_DECL>: Likewise.


-- 
Eric Botcazou

[-- Attachment #2: pr62019.diff --]
[-- Type: text/x-patch, Size: 1622 bytes --]

Index: tree-eh.c
===================================================================
--- tree-eh.c	(revision 216193)
+++ tree-eh.c	(working copy)
@@ -2657,15 +2657,12 @@ tree_could_trap_p (tree expr)
       /* Assume that accesses to weak functions may trap, unless we know
 	 they are certainly defined in current TU or in some other
 	 LTO partition.  */
-      if (DECL_WEAK (expr) && !DECL_COMDAT (expr))
+      if (DECL_WEAK (expr) && !DECL_COMDAT (expr) && DECL_EXTERNAL (expr))
 	{
-	  struct cgraph_node *node;
-	  if (!DECL_EXTERNAL (expr))
-	    return false;
-	  node = cgraph_node::get (expr)->function_symbol ();
-	  if (node && node->in_other_partition)
-	    return false;
-	  return true;
+	  cgraph_node *node = cgraph_node::get (expr);
+	  if (node)
+	    node = node->function_symbol ();
+	  return !(node && node->in_other_partition);
 	}
       return false;
 
@@ -2673,15 +2670,12 @@ tree_could_trap_p (tree expr)
       /* Assume that accesses to weak vars may trap, unless we know
 	 they are certainly defined in current TU or in some other
 	 LTO partition.  */
-      if (DECL_WEAK (expr) && !DECL_COMDAT (expr))
+      if (DECL_WEAK (expr) && !DECL_COMDAT (expr) && DECL_EXTERNAL (expr))
 	{
-	  varpool_node *node;
-	  if (!DECL_EXTERNAL (expr))
-	    return false;
-	  node = varpool_node::get (expr)->ultimate_alias_target ();
-	  if (node && node->in_other_partition)
-	    return false;
-	  return true;
+	  varpool_node *node = varpool_node::get (expr);
+	  if (node)
+	    node = node->ultimate_alias_target ();
+	  return !(node && node->in_other_partition);
 	}
       return false;
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-10-14 21:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-14 21:06 Fix PR ada/62019 Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).