+2016-09-19 Jakub Jelinek <jakub@redhat.com>
+ Jan Hubicka <jh@suse.cz>
+
+ PR target/77587
+ * cgraph.c (cgraph_node::rtl_info): Pass &avail to
+ ultimate_alias_target call, return NULL if avail < AVAIL_AVAILABLE.
+ Call ultimate_alias_target just once, not up to 4 times.
+
2016-09-19 Richard Biener <rguenther@suse.de>
* dwarf2out.c (early_dwarf_finished): New global.
cgraph_node *node = get (decl);
if (!node)
return NULL;
- node = node->ultimate_alias_target ();
- if (node->decl != current_function_decl
- && !TREE_ASM_WRITTEN (node->decl))
+ enum availability avail;
+ node = node->ultimate_alias_target (&avail);
+ if (decl != current_function_decl
+ && (avail < AVAIL_AVAILABLE
+ || (node->decl != current_function_decl
+ && !TREE_ASM_WRITTEN (node->decl))))
return NULL;
- /* Allocate if it doesnt exist. */
- if (node->ultimate_alias_target ()->rtl == NULL)
- node->ultimate_alias_target ()->rtl = ggc_cleared_alloc<cgraph_rtl_info> ();
- return node->ultimate_alias_target ()->rtl;
+ /* Allocate if it doesn't exist. */
+ if (node->rtl == NULL)
+ node->rtl = ggc_cleared_alloc<cgraph_rtl_info> ();
+ return node->rtl;
}
/* Return a string describing the failure REASON. */
+2016-09-19 Jakub Jelinek <jakub@redhat.com>
+ Jan Hubicka <jh@suse.cz>
+
+ PR target/77587
+ * gcc.dg/pr77587.c: New test.
+ * gcc.dg/pr77587a.c: New file.
+
2016-09-19 Andre Vehreschild <vehre@gcc.gnu.org>
* gfortran.dg/coarray/alloc_comp_4.f90: New test.
--- /dev/null
+/* PR target/77587 */
+/* { dg-do run } */
+/* { dg-require-weak-override "" } */
+/* { dg-additional-sources "pr77587a.c" } */
+
+void
+bar (long x, long y, long z)
+{
+ struct __attribute__((aligned (16))) S { long a, b, c, d; } s;
+ char *p = (char *) &s;
+ __asm ("" : "+r" (p));
+ if (((__UINTPTR_TYPE__) p) & 15)
+ __builtin_abort ();
+}
--- /dev/null
+/* PR target/77587 */
+/* { dg-do compile } */
+/* { dg-require-weak-override "" } */
+
+void
+foo (long x, long y, long z)
+{
+}
+
+void bar (long x, long y, long z) __attribute__ ((weak, alias ("foo")));
+
+void
+baz (long x, long y, long z)
+{
+ bar (0, 0, 0);
+}
+
+int
+main ()
+{
+ baz (0, 0, 0);
+ return 0;
+}