[Bug middle-end/68762] link error for inline function decorated with OpenMP declare simd

2018-11-19 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68762

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Jakub Jelinek  ---
Fixed.

[Bug middle-end/68762] link error for inline function decorated with OpenMP declare simd

2018-11-19 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68762

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org

--- Comment #6 from Martin Liška  ---
Jakub: Can the bug be marked as resolved?

[Bug middle-end/68762] link error for inline function decorated with OpenMP declare simd

2016-08-08 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68762

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Mon Aug  8 19:45:53 2016
New Revision: 239248

URL: https://gcc.gnu.org/viewcvs?rev=239248=gcc=rev
Log:
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.

Added:
trunk/gcc/testsuite/g++.dg/vect/pr68762-1.cc
trunk/gcc/testsuite/g++.dg/vect/pr68762-2.cc
trunk/gcc/testsuite/g++.dg/vect/pr68762.h
Modified:
trunk/gcc/ChangeLog
trunk/gcc/omp-simd-clone.c
trunk/gcc/testsuite/ChangeLog

[Bug middle-end/68762] link error for inline function decorated with OpenMP declare simd

2016-08-08 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68762

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2016-08-08
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #4 from Jakub Jelinek  ---
Created attachment 39072
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39072=edit
gcc7-pr68762.patch

Untested fix.  That said, using #pragma omp declare simd is usually quite
pointless on inline functions, those are usually inlined and then there is no
point in the declaration.

[Bug middle-end/68762] link error for inline function decorated with OpenMP declare simd

2016-08-04 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68762

Andrew Pinski  changed:

   What|Removed |Added

 Target||x86_64-*-*

--- Comment #3 from Andrew Pinski  ---
_ZGVbN2v__Z3food should have been in its own comdat section.

Note on aarch64-linux-gnu I don't hit this bug but that is because aarch64 does
not have a simd version of exp, cos or sin (we should be that a different
story).

[Bug middle-end/68762] link error for inline function decorated with OpenMP declare simd

2015-12-07 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68762

--- Comment #1 from Richard Biener  ---
You need to provide a out-of-line copy of foo for example by adding a

extern double foo (double d);

to foobar.cpp.  At least if this were C, not 100% sure about C++.

OTOH SIMD support may simply fail to provide proper linkage to the clones.

[Bug middle-end/68762] link error for inline function decorated with OpenMP declare simd

2015-12-07 Thread gilles.civario at ichec dot ie
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68762

--- Comment #2 from gilles  ---
TBH I don't know anything about the C inline keyword, aside from it existence.
My issue has definitely to do with the C++ inline keyword. And the important
point I (hope I) know about it is that the full definition of the function
should be available in every compilation unit where the function is used. This
is commonly done by putting the definition of the function into a header file.
Another very important point is that the inline keyword is a suggestion given
to the compiler, which it is at liberty to follow or to ignore. Therefore, an
inline function can (should?) also have an external linkage. But since it is
compiled as many times as there are of compilation units where it was defined,
all its identical binary definitions have somehow to be "merge" at link time.
I must admit that this part is a bit of black magic to me, but I seen that the
use of weak symbols into the object files does the trick.

Now about the "omp declare simd" attribute: nowhere in the OpenMP standard is
it mentioned that an inline function cannot be declared as such. Therefore,
considering that some explicit restrictions on the type of functions that can
be are listed, it seems fair to assume that inline functions (as not listed as
unfit) can be declared simd. And actually, so long as the simd-inline function
get inlned by the complier, all goes well even with GCC (it works in any case
with the Intel compler BTW). But as soon as, for a reason or another, the
function isn't inlined, the compilation fails at the linking stage with a
"multiple definition" error.
And it looks like the reason is that the symbols for the vectorised versions of
the out-of-line inline function are strong symbols instead of weak symbols.
So my guess, and please forgive me if what I say is stupid, is that these
symbols would only need to be defined weak for the bug to get fixed.

I hope this makes (even a little) sense since I feel I'm playing way off my
league here.