public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kevin at arilabs dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/95592] New: Collision with struct _Cosh when Cross compiling libstdc++
Date: Mon, 08 Jun 2020 22:58:52 +0000	[thread overview]
Message-ID: <bug-95592-4@http.gcc.gnu.org/bugzilla/> (raw)

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));                        \
     }

             reply	other threads:[~2020-06-08 22:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-08 22:58 kevin at arilabs dot net [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-95592-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).