5.0.0-0.10
This commit is contained in:
parent
83ca86ca70
commit
c728afb1bb
133
gcc5-pr64858.patch
Normal file
133
gcc5-pr64858.patch
Normal file
@ -0,0 +1,133 @@
|
||||
2015-02-09 Martin Liska <mliska@suse.cz>
|
||||
|
||||
* ipa-icf.c (sem_item_optimizer::register_hooks): Register hooks
|
||||
just if not yet registered.
|
||||
(ipa_icf_generate_summary): Register callgraph hooks.
|
||||
|
||||
* g++.dg/ipa/pr64858.C: New test.
|
||||
|
||||
--- gcc/ipa-icf.c (revision 220530)
|
||||
+++ gcc/ipa-icf.c (revision 220531)
|
||||
@@ -1562,11 +1562,13 @@ sem_item_optimizer::read_summary (void)
|
||||
void
|
||||
sem_item_optimizer::register_hooks (void)
|
||||
{
|
||||
- m_cgraph_node_hooks = symtab->add_cgraph_removal_hook
|
||||
- (&sem_item_optimizer::cgraph_removal_hook, this);
|
||||
-
|
||||
- m_varpool_node_hooks = symtab->add_varpool_removal_hook
|
||||
- (&sem_item_optimizer::varpool_removal_hook, this);
|
||||
+ if (!m_cgraph_node_hooks)
|
||||
+ m_cgraph_node_hooks = symtab->add_cgraph_removal_hook
|
||||
+ (&sem_item_optimizer::cgraph_removal_hook, this);
|
||||
+
|
||||
+ if (!m_varpool_node_hooks)
|
||||
+ m_varpool_node_hooks = symtab->add_varpool_removal_hook
|
||||
+ (&sem_item_optimizer::varpool_removal_hook, this);
|
||||
}
|
||||
|
||||
/* Unregister callgraph and varpool hooks. */
|
||||
@@ -2438,6 +2440,7 @@ ipa_icf_generate_summary (void)
|
||||
if (!optimizer)
|
||||
optimizer = new sem_item_optimizer ();
|
||||
|
||||
+ optimizer->register_hooks ();
|
||||
optimizer->parse_funcs_and_vars ();
|
||||
}
|
||||
|
||||
--- gcc/testsuite/g++.dg/ipa/pr64858.C (revision 0)
|
||||
+++ gcc/testsuite/g++.dg/ipa/pr64858.C (revision 220531)
|
||||
@@ -0,0 +1,93 @@
|
||||
+// { dg-do compile }
|
||||
+// { dg-options "-O2 -std=gnu++11" }
|
||||
+
|
||||
+template <class reference_type> class A
|
||||
+{
|
||||
+ reference_type *m_pBody;
|
||||
+public:
|
||||
+ A (const A &) { m_pBody->acquire (); }
|
||||
+};
|
||||
+class B;
|
||||
+class C
|
||||
+{
|
||||
+protected:
|
||||
+ B *_pInterface;
|
||||
+};
|
||||
+template <class interface_type> class I : C
|
||||
+{
|
||||
+public:
|
||||
+ I (interface_type *);
|
||||
+};
|
||||
+class B
|
||||
+{
|
||||
+public:
|
||||
+ virtual void acquire ();
|
||||
+};
|
||||
+class D
|
||||
+{
|
||||
+protected:
|
||||
+ void acquire ();
|
||||
+};
|
||||
+template <class Ifc1> class J : D, public Ifc1
|
||||
+{
|
||||
+ void
|
||||
+ acquire ()
|
||||
+ {
|
||||
+ D::acquire ();
|
||||
+ }
|
||||
+};
|
||||
+class K : B
|
||||
+{
|
||||
+};
|
||||
+class L;
|
||||
+class F
|
||||
+{
|
||||
+ A<L> m_pDocument;
|
||||
+ F (A<L> const &, int &&);
|
||||
+};
|
||||
+class XUnoTunnel;
|
||||
+class XEventTarget;
|
||||
+template <class, class> class WeakImplHelper3 : D, B
|
||||
+{
|
||||
+ void
|
||||
+ acquire ()
|
||||
+ {
|
||||
+ D::acquire ();
|
||||
+ }
|
||||
+};
|
||||
+template <class> class G
|
||||
+{
|
||||
+public:
|
||||
+ void
|
||||
+ acquire ()
|
||||
+ {
|
||||
+ WeakImplHelper3<XUnoTunnel, XEventTarget> ();
|
||||
+ }
|
||||
+};
|
||||
+struct H
|
||||
+{
|
||||
+ H ()
|
||||
+ : mxAttribList (new J<B>), mxCurrentHandler (0), mxDocHandler (0),
|
||||
+ mxTokenHandler (0)
|
||||
+ {
|
||||
+ }
|
||||
+ I<J<B> > mxAttribList;
|
||||
+ I<int> mxCurrentHandler;
|
||||
+ I<int> mxDocHandler;
|
||||
+ I<int> mxTokenHandler;
|
||||
+};
|
||||
+class L : public G<int>
|
||||
+{
|
||||
+};
|
||||
+class M : public J<K>
|
||||
+{
|
||||
+public:
|
||||
+ M ();
|
||||
+};
|
||||
+template <class interface_type> I<interface_type>::I (interface_type *p1)
|
||||
+{
|
||||
+ B *a = static_cast<B *> (static_cast<void *> (p1));
|
||||
+ _pInterface = a;
|
||||
+ _pInterface->acquire ();
|
||||
+}
|
||||
+F::F (A<L> const &p1, int &&) : m_pDocument (p1) { I<K> (new M); }
|
146
gcc5-pr64979.patch
Normal file
146
gcc5-pr64979.patch
Normal file
@ -0,0 +1,146 @@
|
||||
2015-02-09 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR target/64979
|
||||
* tree-stdarg.c (pass_stdarg::execute): Scan phi node args for
|
||||
va_list escapes.
|
||||
|
||||
* gcc.dg/tree-ssa/stdarg-7.c: New test.
|
||||
* gcc.c-torture/execute/pr64979.c: New test.
|
||||
|
||||
--- gcc/tree-stdarg.c.jj 2015-01-09 21:59:44.000000000 +0100
|
||||
+++ gcc/tree-stdarg.c 2015-02-09 13:14:43.880406573 +0100
|
||||
@@ -856,22 +856,23 @@ pass_stdarg::execute (function *fun)
|
||||
/* For va_list_simple_ptr, we have to check PHI nodes too. We treat
|
||||
them as assignments for the purpose of escape analysis. This is
|
||||
not needed for non-simple va_list because virtual phis don't perform
|
||||
- any real data movement. */
|
||||
- if (va_list_simple_ptr)
|
||||
+ any real data movement. Also, check PHI nodes for taking address of
|
||||
+ the va_list vars. */
|
||||
+ tree lhs, rhs;
|
||||
+ use_operand_p uop;
|
||||
+ ssa_op_iter soi;
|
||||
+
|
||||
+ for (gphi_iterator i = gsi_start_phis (bb); !gsi_end_p (i);
|
||||
+ gsi_next (&i))
|
||||
{
|
||||
- tree lhs, rhs;
|
||||
- use_operand_p uop;
|
||||
- ssa_op_iter soi;
|
||||
+ gphi *phi = i.phi ();
|
||||
+ lhs = PHI_RESULT (phi);
|
||||
|
||||
- for (gphi_iterator i = gsi_start_phis (bb); !gsi_end_p (i);
|
||||
- gsi_next (&i))
|
||||
- {
|
||||
- gphi *phi = i.phi ();
|
||||
- lhs = PHI_RESULT (phi);
|
||||
-
|
||||
- if (virtual_operand_p (lhs))
|
||||
- continue;
|
||||
+ if (virtual_operand_p (lhs))
|
||||
+ continue;
|
||||
|
||||
+ if (va_list_simple_ptr)
|
||||
+ {
|
||||
FOR_EACH_PHI_ARG (uop, phi, soi, SSA_OP_USE)
|
||||
{
|
||||
rhs = USE_FROM_PTR (uop);
|
||||
@@ -894,6 +895,22 @@ pass_stdarg::execute (function *fun)
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ for (unsigned j = 0; !va_list_escapes
|
||||
+ && j < gimple_phi_num_args (phi); ++j)
|
||||
+ if ((!va_list_simple_ptr
|
||||
+ || TREE_CODE (gimple_phi_arg_def (phi, j)) != SSA_NAME)
|
||||
+ && walk_tree (gimple_phi_arg_def_ptr (phi, j),
|
||||
+ find_va_list_reference, &wi, NULL))
|
||||
+ {
|
||||
+ if (dump_file && (dump_flags & TDF_DETAILS))
|
||||
+ {
|
||||
+ fputs ("va_list escapes in ", dump_file);
|
||||
+ print_gimple_stmt (dump_file, phi, 0, dump_flags);
|
||||
+ fputc ('\n', dump_file);
|
||||
+ }
|
||||
+ va_list_escapes = true;
|
||||
+ }
|
||||
}
|
||||
|
||||
for (gimple_stmt_iterator i = gsi_start_bb (bb);
|
||||
@@ -916,8 +933,8 @@ pass_stdarg::execute (function *fun)
|
||||
|
||||
if (is_gimple_assign (stmt))
|
||||
{
|
||||
- tree lhs = gimple_assign_lhs (stmt);
|
||||
- tree rhs = gimple_assign_rhs1 (stmt);
|
||||
+ lhs = gimple_assign_lhs (stmt);
|
||||
+ rhs = gimple_assign_rhs1 (stmt);
|
||||
|
||||
if (va_list_simple_ptr)
|
||||
{
|
||||
--- gcc/testsuite/gcc.dg/tree-ssa/stdarg-7.c.jj 2015-02-09 12:54:44.222284401 +0100
|
||||
+++ gcc/testsuite/gcc.dg/tree-ssa/stdarg-7.c 2015-02-09 12:58:10.406875647 +0100
|
||||
@@ -0,0 +1,22 @@
|
||||
+/* PR target/64979 */
|
||||
+/* { dg-do compile } */
|
||||
+/* { dg-options "-O2 -fdump-tree-stdarg" } */
|
||||
+
|
||||
+#include <stdarg.h>
|
||||
+
|
||||
+void bar (int x, va_list *ap);
|
||||
+
|
||||
+void
|
||||
+foo (int x, ...)
|
||||
+{
|
||||
+ va_list ap;
|
||||
+ int n;
|
||||
+
|
||||
+ va_start (ap, x);
|
||||
+ n = va_arg (ap, int);
|
||||
+ bar (x, (va_list *) ((n == 0) ? ((void *) 0) : &ap));
|
||||
+ va_end (ap);
|
||||
+}
|
||||
+
|
||||
+/* { dg-final { scan-tree-dump "foo: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" } } */
|
||||
+/* { dg-final { cleanup-tree-dump "stdarg" } } */
|
||||
--- gcc/testsuite/gcc.c-torture/execute/pr64979.c.jj 2015-02-09 12:54:01.867984625 +0100
|
||||
+++ gcc/testsuite/gcc.c-torture/execute/pr64979.c 2015-02-09 13:08:17.458818847 +0100
|
||||
@@ -0,0 +1,36 @@
|
||||
+/* PR target/64979 */
|
||||
+
|
||||
+#include <stdarg.h>
|
||||
+
|
||||
+void __attribute__((noinline, noclone))
|
||||
+bar (int x, va_list *ap)
|
||||
+{
|
||||
+ if (ap)
|
||||
+ {
|
||||
+ int i;
|
||||
+ for (i = 0; i < 10; i++)
|
||||
+ if (i != va_arg (*ap, int))
|
||||
+ __builtin_abort ();
|
||||
+ if (va_arg (*ap, double) != 0.5)
|
||||
+ __builtin_abort ();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void __attribute__((noinline, noclone))
|
||||
+foo (int x, ...)
|
||||
+{
|
||||
+ va_list ap;
|
||||
+ int n;
|
||||
+
|
||||
+ va_start (ap, x);
|
||||
+ n = va_arg (ap, int);
|
||||
+ bar (x, (va_list *) ((n == 0) ? ((void *) 0) : &ap));
|
||||
+ va_end (ap);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ foo (100, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0.5);
|
||||
+ return 0;
|
||||
+}
|
45
gcc5-pr64981.patch
Normal file
45
gcc5-pr64981.patch
Normal file
@ -0,0 +1,45 @@
|
||||
2015-02-09 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR sanitizer/64981
|
||||
* builtins.c (expand_builtin): Call targetm.expand_builtin
|
||||
for BUILT_IN_MD builtins regardless of asan_intercepted_p.
|
||||
|
||||
* gcc.dg/asan/pr64981.c: New test.
|
||||
|
||||
--- gcc/builtins.c.jj 2015-01-21 10:29:52.000000000 +0100
|
||||
+++ gcc/builtins.c 2015-02-09 14:02:35.814716664 +0100
|
||||
@@ -5960,6 +5960,9 @@ expand_builtin (tree exp, rtx target, rt
|
||||
machine_mode target_mode = TYPE_MODE (TREE_TYPE (exp));
|
||||
int flags;
|
||||
|
||||
+ if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
|
||||
+ return targetm.expand_builtin (exp, target, subtarget, mode, ignore);
|
||||
+
|
||||
/* When ASan is enabled, we don't want to expand some memory/string
|
||||
builtins and rely on libsanitizer's hooks. This allows us to avoid
|
||||
redundant checks and be sure, that possible overflow will be detected
|
||||
@@ -5968,9 +5971,6 @@ expand_builtin (tree exp, rtx target, rt
|
||||
if ((flag_sanitize & SANITIZE_ADDRESS) && asan_intercepted_p (fcode))
|
||||
return expand_call (exp, target, ignore);
|
||||
|
||||
- if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
|
||||
- return targetm.expand_builtin (exp, target, subtarget, mode, ignore);
|
||||
-
|
||||
/* When not optimizing, generate calls to library functions for a certain
|
||||
set of builtins. */
|
||||
if (!optimize
|
||||
--- gcc/testsuite/gcc.dg/asan/pr64981.c.jj 2015-02-09 14:05:50.252487512 +0100
|
||||
+++ gcc/testsuite/gcc.dg/asan/pr64981.c 2015-02-09 14:05:34.000000000 +0100
|
||||
@@ -0,0 +1,12 @@
|
||||
+/* PR sanitizer/64981 */
|
||||
+/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
|
||||
+/* { dg-options "-fsanitize=address -march=x86-64" } */
|
||||
+
|
||||
+int
|
||||
+main ()
|
||||
+{
|
||||
+ __builtin_ia32_rdtsc ();
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/* { dg-final { scan-assembler-not "__builtin_ia32_rdtsc" } } */
|
Loading…
Reference in New Issue
Block a user