]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* cgraphunit.c (handle_alias_pairs): Reset the alias flag after the
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 18 Aug 2013 14:58:58 +0000 (14:58 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 18 Aug 2013 14:58:58 +0000 (14:58 +0000)
error message is issued for an alias to undefined symbol.

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

gcc/ChangeLog
gcc/cgraphunit.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/specs/linker_alias.ads [new file with mode: 0644]

index faa465ab27ff0a4b0da489876772fe5aebbfe662..8579567edc3a06c1c8bd03b02cbd0a0c183a0de4 100644 (file)
@@ -1,3 +1,8 @@
+2013-08-18  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * cgraphunit.c (handle_alias_pairs): Reset the alias flag after the
+       error message is issued for an alias to undefined symbol.
+
 2013-08-18  Jan Hubicka  <jh@suse.cz>
 
        * cgraph.c (cgraph_create_indirect_edge): Discover
index 3cd2b417ca7bb9ea5daf5852f9f2adbaebdcf571..1a4f99febf9b105753de77afdffea41db3733d05 100644 (file)
@@ -1004,7 +1004,7 @@ analyze_functions (void)
 
 /* Translate the ugly representation of aliases as alias pairs into nice
    representation in callgraph.  We don't handle all cases yet,
-   unforutnately.  */
+   unfortunately.  */
 
 static void
 handle_alias_pairs (void)
@@ -1016,10 +1016,11 @@ handle_alias_pairs (void)
     {
       symtab_node target_node = symtab_node_for_asm (p->target);
 
-      /* Weakrefs with target not defined in current unit are easy to handle; they
-        behave just as external variables except we need to note the alias flag
-        to later output the weakref pseudo op into asm file.  */
-      if (!target_node && lookup_attribute ("weakref", DECL_ATTRIBUTES (p->decl)) != NULL)
+      /* Weakrefs with target not defined in current unit are easy to handle:
+        they behave just as external variables except we need to note the
+        alias flag to later output the weakref pseudo op into asm file.  */
+      if (!target_node
+         && lookup_attribute ("weakref", DECL_ATTRIBUTES (p->decl)) != NULL)
        {
          symtab_node node = symtab_get_node (p->decl);
          if (node)
@@ -1034,6 +1035,9 @@ handle_alias_pairs (void)
       else if (!target_node)
        {
          error ("%q+D aliased to undefined symbol %qE", p->decl, p->target);
+         symtab_node node = symtab_get_node (p->decl);
+         if (node)
+           node->symbol.alias = false;
          alias_pairs->unordered_remove (i);
          continue;
        }
index 4d41fad6bd1ac7a3ca8590a20021997826469fd6..f73467422538551a1a3b315d598156261f9efdba 100644 (file)
@@ -1,3 +1,7 @@
+2013-08-18  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/specs/linker_alias.ads: New test.
+
 2013-08-16  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/58164
diff --git a/gcc/testsuite/gnat.dg/specs/linker_alias.ads b/gcc/testsuite/gnat.dg/specs/linker_alias.ads
new file mode 100644 (file)
index 0000000..dd1d042
--- /dev/null
@@ -0,0 +1,9 @@
+-- { dg-do compile }
+
+package Linker_Alias is
+
+   Var : Integer;  -- { dg-error "aliased to undefined symbol" }
+   pragma Export (C, Var, "my_var");
+   pragma Linker_Alias (Var, "var2");
+
+end Linker_Alias;