public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/95592] New: Collision with struct _Cosh when Cross compiling libstdc++
@ 2020-06-08 22:58 kevin at arilabs dot net
  2020-06-08 23:01 ` [Bug libstdc++/95592] " kevin at arilabs dot net
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: kevin at arilabs dot net @ 2020-06-08 22:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95592

            Bug ID: 95592
           Summary: Collision with struct _Cosh when Cross compiling
                    libstdc++
           Product: gcc
           Version: 8.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kevin at arilabs dot net
  Target Milestone: ---

I am cross compiling gcc 8.3.0 for QNX 6.6. While doing so,
libstdc++-v3/include/bits/valarray_after.h was having trouble with "struct
_Cosh" defined in valarray_before.h because it was colliding with the function
_Cosh() is defined in one of the target OS's headers.

Specifically it was having trouble with (around line 445 of valarray_after.h):

   _DEFINE_EXPR_UNARY_FUNCTION(cosh, _Cosh)

The compiler was using the function declaration of _Cosh instead of struct
_Cosh.

There were other _DEFINE_EXPR_UNARY_FUNCTION that had the same issue (I don't
remember which ones as I focused on _Cosh). 

Below is a patch to valarray_after.h that fixes the issue.  I'm pretty sure QNX
may be the only target OS with this problem, so I am content if this doesn't
make it in gcc, but thought that perhaps removing ambiguity from the preceding
template definitions wouldn't be bad.

I took a look at gcc 9 and 10 code base and the issue appears to exist there as
well.

Thanks
Kevin


Index: libstdc++-v3/include/bits/valarray_after.h
===================================================================
--- libstdc++-v3/include/bits/valarray_after.h  (revision 1469)
+++ libstdc++-v3/include/bits/valarray_after.h  (working copy)
@@ -422,20 +422,20 @@

 #define _DEFINE_EXPR_UNARY_FUNCTION(_Name, _UName)                       \
   template<class _Dom>                                                   \
-    inline _Expr<_UnClos<_UName, _Expr, _Dom>,                           \
+    inline _Expr<_UnClos<struct _UName, _Expr, _Dom>,                         
 \
                  typename _Dom::value_type>                              \
     _Name(const _Expr<_Dom, typename _Dom::value_type>& __e)             \
     {                                                                    \
       typedef typename _Dom::value_type _Tp;                             \
-      typedef _UnClos<_UName, _Expr, _Dom> _Closure;                     \
+      typedef _UnClos<struct _UName, _Expr, _Dom> _Closure;                   
 \
       return _Expr<_Closure, _Tp>(_Closure(__e()));                      \
     }                                                                    \
                                                                          \
   template<typename _Tp>                                                 \
-    inline _Expr<_UnClos<_UName, _ValArray, _Tp>, _Tp>                   \
+    inline _Expr<_UnClos<struct _UName, _ValArray, _Tp>, _Tp>                 
 \
     _Name(const valarray<_Tp>& __v)                                      \
     {                                                                    \
-      typedef _UnClos<_UName, _ValArray, _Tp> _Closure;                  \
+      typedef _UnClos<struct _UName, _ValArray, _Tp> _Closure;                
 \
       return _Expr<_Closure, _Tp>(_Closure(__v));                        \
     }

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/95592] Collision with struct _Cosh when Cross compiling libstdc++
  2020-06-08 22:58 [Bug libstdc++/95592] New: Collision with struct _Cosh when Cross compiling libstdc++ kevin at arilabs dot net
@ 2020-06-08 23:01 ` kevin at arilabs dot net
  2020-06-08 23:02 ` kevin at arilabs dot net
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: kevin at arilabs dot net @ 2020-06-08 23:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95592

Kevin Stallard <kevin at arilabs dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
               Host|Ubuntu 20.04                |Ubuntu 18.04.4

--- Comment #1 from Kevin Stallard <kevin at arilabs dot net> ---
I should also add that this was build with gcc 7.5.0 on Ubuntu

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/95592] Collision with struct _Cosh when Cross compiling libstdc++
  2020-06-08 22:58 [Bug libstdc++/95592] New: Collision with struct _Cosh when Cross compiling libstdc++ kevin at arilabs dot net
  2020-06-08 23:01 ` [Bug libstdc++/95592] " kevin at arilabs dot net
@ 2020-06-08 23:02 ` kevin at arilabs dot net
  2020-10-28 12:50 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: kevin at arilabs dot net @ 2020-06-08 23:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95592

--- Comment #2 from Kevin Stallard <kevin at arilabs dot net> ---
Please forgive the fat fingers.

gcc 7.5.0 on Ubuntu 18.04.4 is the host used to build the cross compiler.

(In reply to Kevin Stallard from comment #1)
> I should also add that this was build with gcc 7.5.0 on Ubuntu

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/95592] Collision with struct _Cosh when Cross compiling libstdc++
  2020-06-08 22:58 [Bug libstdc++/95592] New: Collision with struct _Cosh when Cross compiling libstdc++ kevin at arilabs dot net
  2020-06-08 23:01 ` [Bug libstdc++/95592] " kevin at arilabs dot net
  2020-06-08 23:02 ` kevin at arilabs dot net
@ 2020-10-28 12:50 ` cvs-commit at gcc dot gnu.org
  2020-10-28 12:51 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-28 12:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95592

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:72a87d82e0d0741d75c72c8f3d2fc070e3a02b5f

commit r11-4476-g72a87d82e0d0741d75c72c8f3d2fc070e3a02b5f
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Oct 28 12:35:44 2020 +0000

    libstdc++: Fix name clash with _Cosh in QNX headers [PR 95592]

    This replaces unqualified names like _Cosh with struct std::_Cosh to
    ensure there is no ambiguity with other entities with the same name.

    libstdc++-v3/ChangeLog:

            PR libstdc++/95592
            * include/bits/valarray_after.h (_DEFINE_EXPR_UNARY_OPERATOR)
            (_DEFINE_EXPR_BINARY_OPERATOR, _DEFINE_EXPR_BINARY_FUNCTION):
            Use elaborated-type-specifier and qualified-id to avoid
            ambiguities with QNX system headers.
            * testsuite/26_numerics/valarray/95592.cc: New test.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/95592] Collision with struct _Cosh when Cross compiling libstdc++
  2020-06-08 22:58 [Bug libstdc++/95592] New: Collision with struct _Cosh when Cross compiling libstdc++ kevin at arilabs dot net
                   ` (2 preceding siblings ...)
  2020-10-28 12:50 ` cvs-commit at gcc dot gnu.org
@ 2020-10-28 12:51 ` redi at gcc dot gnu.org
  2021-03-29 20:01 ` cvs-commit at gcc dot gnu.org
  2021-03-29 20:03 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2020-10-28 12:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95592

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |build
   Target Milestone|---                         |11.0
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed in GCC 11. Probably OK to backport, but I'll wait a bit.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/95592] Collision with struct _Cosh when Cross compiling libstdc++
  2020-06-08 22:58 [Bug libstdc++/95592] New: Collision with struct _Cosh when Cross compiling libstdc++ kevin at arilabs dot net
                   ` (3 preceding siblings ...)
  2020-10-28 12:51 ` redi at gcc dot gnu.org
@ 2021-03-29 20:01 ` cvs-commit at gcc dot gnu.org
  2021-03-29 20:03 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-29 20:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95592

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:fa9c46939f9a5c5eb90338b80b213ec1e3579df7

commit r10-9567-gfa9c46939f9a5c5eb90338b80b213ec1e3579df7
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Oct 28 12:35:44 2020 +0000

    libstdc++: Fix name clash with _Cosh in QNX headers [PR 95592]

    This replaces unqualified names like _Cosh with struct std::_Cosh to
    ensure there is no ambiguity with other entities with the same name.

    libstdc++-v3/ChangeLog:

            PR libstdc++/95592
            * include/bits/valarray_after.h (_DEFINE_EXPR_UNARY_OPERATOR)
            (_DEFINE_EXPR_BINARY_OPERATOR, _DEFINE_EXPR_BINARY_FUNCTION):
            Use elaborated-type-specifier and qualified-id to avoid
            ambiguities with QNX system headers.
            * testsuite/26_numerics/valarray/95592.cc: New test.

    (cherry picked from commit 72a87d82e0d0741d75c72c8f3d2fc070e3a02b5f)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug libstdc++/95592] Collision with struct _Cosh when Cross compiling libstdc++
  2020-06-08 22:58 [Bug libstdc++/95592] New: Collision with struct _Cosh when Cross compiling libstdc++ kevin at arilabs dot net
                   ` (4 preceding siblings ...)
  2021-03-29 20:01 ` cvs-commit at gcc dot gnu.org
@ 2021-03-29 20:03 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2021-03-29 20:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95592

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.0                        |10.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-29 20:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-08 22:58 [Bug libstdc++/95592] New: Collision with struct _Cosh when Cross compiling libstdc++ kevin at arilabs dot net
2020-06-08 23:01 ` [Bug libstdc++/95592] " kevin at arilabs dot net
2020-06-08 23:02 ` kevin at arilabs dot net
2020-10-28 12:50 ` cvs-commit at gcc dot gnu.org
2020-10-28 12:51 ` redi at gcc dot gnu.org
2021-03-29 20:01 ` cvs-commit at gcc dot gnu.org
2021-03-29 20:03 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).