summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@gcc.gnu.org>2016-08-08 21:45:53 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2016-08-08 21:45:53 +0200
commitad20058031e8610712a70728a39b6a85edf785df (patch)
tree6fb7a102c5418f845c78547f745f742f9cba52bb
parent1c4d457e82695db889b52f62e4d45dec83e1d7f1 (diff)
downloadgcc-ad20058031e8610712a70728a39b6a85edf785df.tar.gz
re PR middle-end/68762 (link error for inline function decorated with OpenMP declare simd)
PR middle-end/68762 * omp-simd-clone.c: Include varasm.h. (simd_clone_create): Copy over DECL_COMDAT, DECL_WEAK, DECL_EXTERNAL, DECL_VISIBILITY, DECL_VISIBILITY_SPECIFIED, DECL_DLLIMPORT_P and for DECL_ONE_ONLY call make_decl_one_only. Fix up spelling in comment and update function name. * g++.dg/vect/pr68762-1.cc: New test. * g++.dg/vect/pr68762-2.cc: New test. * g++.dg/vect/pr68762.h: New file. From-SVN: r239248
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/omp-simd-clone.c16
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/g++.dg/vect/pr68762-1.cc26
-rw-r--r--gcc/testsuite/g++.dg/vect/pr68762-2.cc17
-rw-r--r--gcc/testsuite/g++.dg/vect/pr68762.h11
6 files changed, 84 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1d1f3594d01..e6f076194df 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,4 +1,13 @@
-2016-07-29 Pitchumani Sivanupandi <pitchumani.s@atmel.com>
+2016-08-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/68762
+ * omp-simd-clone.c: Include varasm.h.
+ (simd_clone_create): Copy over DECL_COMDAT, DECL_WEAK, DECL_EXTERNAL,
+ DECL_VISIBILITY, DECL_VISIBILITY_SPECIFIED, DECL_DLLIMPORT_P and for
+ DECL_ONE_ONLY call make_decl_one_only. Fix up spelling in comment and
+ update function name.
+
+2016-07-29 Pitchumani Sivanupandi <pitchumani.s@atmel.com>
* config/avr/driver-avr.c (specfiles_doc_url): Remove.
(avr_diagnose_devicespecs_error): Remove.
diff --git a/gcc/omp-simd-clone.c b/gcc/omp-simd-clone.c
index ad7e83b49e8..467d8725225 100644
--- a/gcc/omp-simd-clone.c
+++ b/gcc/omp-simd-clone.c
@@ -47,6 +47,7 @@ along with GCC; see the file COPYING3. If not see
#include "symbol-summary.h"
#include "ipa-prop.h"
#include "tree-eh.h"
+#include "varasm.h"
/* Allocate a fresh `simd_clone' and return it. NARGS is the number
@@ -435,9 +436,18 @@ simd_clone_create (struct cgraph_node *old_node)
return new_node;
TREE_PUBLIC (new_node->decl) = TREE_PUBLIC (old_node->decl);
-
- /* The function cgraph_function_versioning () will force the new
- symbol local. Undo this, and inherit external visability from
+ DECL_COMDAT (new_node->decl) = DECL_COMDAT (old_node->decl);
+ DECL_WEAK (new_node->decl) = DECL_WEAK (old_node->decl);
+ DECL_EXTERNAL (new_node->decl) = DECL_EXTERNAL (old_node->decl);
+ DECL_VISIBILITY_SPECIFIED (new_node->decl)
+ = DECL_VISIBILITY_SPECIFIED (old_node->decl);
+ DECL_VISIBILITY (new_node->decl) = DECL_VISIBILITY (old_node->decl);
+ DECL_DLLIMPORT_P (new_node->decl) = DECL_DLLIMPORT_P (old_node->decl);
+ if (DECL_ONE_ONLY (old_node->decl))
+ make_decl_one_only (new_node->decl, DECL_ASSEMBLER_NAME (new_node->decl));
+
+ /* The method cgraph_version_clone_with_body () will force the new
+ symbol local. Undo this, and inherit external visibility from
the old node. */
new_node->local.local = old_node->local.local;
new_node->externally_visible = old_node->externally_visible;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 63b3f909050..0822a8af2fa 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2016-08-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/68762
+ * g++.dg/vect/pr68762-1.cc: New test.
+ * g++.dg/vect/pr68762-2.cc: New test.
+ * g++.dg/vect/pr68762.h: New file.
+
2016-08-08 Martin Sebor <msebor@redhat.com>
PR testsuite/72838
diff --git a/gcc/testsuite/g++.dg/vect/pr68762-1.cc b/gcc/testsuite/g++.dg/vect/pr68762-1.cc
new file mode 100644
index 00000000000..118a301ab90
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr68762-1.cc
@@ -0,0 +1,26 @@
+// PR middle-end/68762
+// { dg-require-effective-target vect_simd_clones }
+// { dg-additional-options "-fopenmp-simd -fno-inline" }
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-additional-sources "pr68762-2.cc" }
+
+#include "pr68762.h"
+
+double v[64];
+
+double
+bar ()
+{
+ double sum = 0.0;
+ #pragma omp simd reduction (+: sum)
+ for (int i = 0; i < 64; i++)
+ sum += foo (v[i]);
+ return sum;
+}
+
+int
+main ()
+{
+ if (bar () != 0.0)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/g++.dg/vect/pr68762-2.cc b/gcc/testsuite/g++.dg/vect/pr68762-2.cc
new file mode 100644
index 00000000000..38d624e33e0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr68762-2.cc
@@ -0,0 +1,17 @@
+// PR middle-end/68762
+// { dg-do compile }
+
+#include "pr68762.h"
+
+#pragma omp declare simd
+double
+baz (double x)
+{
+ return x;
+}
+
+double
+fn (double x)
+{
+ return foo (x);
+}
diff --git a/gcc/testsuite/g++.dg/vect/pr68762.h b/gcc/testsuite/g++.dg/vect/pr68762.h
new file mode 100644
index 00000000000..8c34592e156
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr68762.h
@@ -0,0 +1,11 @@
+// PR middle-end/68762
+
+#pragma omp declare simd
+double baz (double x);
+
+#pragma omp declare simd
+inline double
+foo (double d)
+{
+ return baz (d);
+}