This fixes the endless error reporting for unhandled aliases
by setting TREE_ASM_WRITTEN on the decls we complained about.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress
(sort-of pointless on that target of course).

Richard.

2014-04-11  Richard Biener  <rguent...@suse.de>

        PR middle-end/60797
        * varasm.c (assemble_alias): Avoid endless error reporting
        recursion by setting TREE_ASM_WRITTEN.

        * gcc.dg/pr60797.c: New testcase.

Index: gcc/varasm.c
===================================================================
*** gcc/varasm.c        (revision 209292)
--- gcc/varasm.c        (working copy)
*************** assemble_alias (tree decl, tree target)
*** 5665,5670 ****
--- 5665,5671 ----
  # if !defined(ASM_OUTPUT_WEAK_ALIAS) && !defined (ASM_WEAKEN_DECL)
        error_at (DECL_SOURCE_LOCATION (decl),
                "alias definitions not supported in this configuration");
+       TREE_ASM_WRITTEN (decl) = 1;
        return;
  # else
        if (!DECL_WEAK (decl))
*************** assemble_alias (tree decl, tree target)
*** 5675,5680 ****
--- 5676,5682 ----
          else
            error_at (DECL_SOURCE_LOCATION (decl),
                      "only weak aliases are supported in this configuration");
+         TREE_ASM_WRITTEN (decl) = 1;
          return;
        }
  # endif
Index: gcc/testsuite/gcc.dg/pr60797.c
===================================================================
*** gcc/testsuite/gcc.dg/pr60797.c      (revision 0)
--- gcc/testsuite/gcc.dg/pr60797.c      (working copy)
***************
*** 0 ****
--- 1,8 ----
+ /* { dg-do compile } */
+ /* { dg-skip-if "" { alias } } */
+ 
+ extern int foo __attribute__((alias("bar"))); /* { dg-error "supported" } */
+ int main()
+ {
+   return 0;
+ }

Reply via email to