From e9d01715bd7e033eacfbadbfab5f1f206221305c Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 7 Nov 2019 10:44:21 +0100 Subject: [PATCH] Clear version_info_node in delete_function_version. 2019-11-07 Martin Liska PR c++/92354 * cgraph.c (delete_function_version): Clear global variable version_info_node if equal to deleted function. 2019-11-07 Martin Liska PR c++/92354 * g++.target/i386/pr92354.C: New test. From-SVN: r277913 --- gcc/ChangeLog | 7 +++++++ gcc/cgraph.c | 3 +++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.target/i386/pr92354.C | 8 ++++++++ 4 files changed, 23 insertions(+) create mode 100644 gcc/testsuite/g++.target/i386/pr92354.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 94f72ddade6..c5818165a4c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-11-07 Martin Liska + + PR c++/92354 + * cgraph.c (delete_function_version): Clear global + variable version_info_node if equal to deleted + function. + 2019-11-07 Martin Liska * fold-const.c (operand_compare::operand_equal_p): Add comparison diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 699209654f8..896a3fcf275 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -197,6 +197,9 @@ delete_function_version (cgraph_function_version_info *decl_v) if (decl_v == NULL) return; + if (version_info_node == decl_v) + version_info_node = NULL; + if (decl_v->prev != NULL) decl_v->prev->next = decl_v->next; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c6d907275f5..08f290baa2b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-11-07 Martin Liska + + PR c++/92354 + * g++.target/i386/pr92354.C: New test. + 2019-11-07 Prathamesh Kulkarni * gcc.dg/tree-ssa/pr92163.c: Add dg-require-effective-target fopenacc. diff --git a/gcc/testsuite/g++.target/i386/pr92354.C b/gcc/testsuite/g++.target/i386/pr92354.C new file mode 100644 index 00000000000..0f48fb72899 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr92354.C @@ -0,0 +1,8 @@ +/* PR c++/92354 */ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "--param ggc-min-heapsize=0" } */ + +__attribute__ ((target ("default"))) void f (); +__attribute__ ((target ("sse"))) void f (); +__attribute__ ((target ("default"))) void f (); -- 2.30.2