[Bug libstdc++/97729] [11 Regression] Link failure due to basic_stringbuf and others when building DLL on MinGW

2020-11-09 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97729

--- Comment #11 from CVS Commits  ---
The master branch has been updated by Jonathan Wakely :

https://gcc.gnu.org/g:0af3930a497e022597a08fa1bcef5e453bfa636f

commit r11-4839-g0af3930a497e022597a08fa1bcef5e453bfa636f
Author: Jonathan Wakely 
Date:   Mon Nov 9 10:16:07 2020 +

libstdc++: Use 'inline' consistently in std::exception_ptr [PR 97729]

With PR c++/67453 fixed we can rely on the 'used' attribute to emit
inline constructors and destructors in libsupc++/eh_ptr.cc. This means
we don't need to suppress the 'inline' keyword on them in that file, and
don't need to force 'always_inline' on them in other files.

libstdc++-v3/ChangeLog:

PR libstdc++/97729
* libsupc++/exception_ptr.h (exception_ptr::exception_ptr())
(exception_ptr::exception_ptr(const exception_ptr&))
(exception_ptr::~exception_ptr()): Remove 'always_inline'
attributes. Use 'inline' unconditionally.

[Bug libstdc++/97729] [11 Regression] Link failure due to basic_stringbuf and others when building DLL on MinGW

2020-11-05 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97729

--- Comment #10 from Jonathan Wakely  ---
Great, thanks for the report and testing the fix.

[Bug libstdc++/97729] [11 Regression] Link failure due to basic_stringbuf and others when building DLL on MinGW

2020-11-05 Thread markus.boeck02 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97729

Markus Böck  changed:

   What|Removed |Added

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

--- Comment #9 from Markus Böck  ---
Can happily report that it links now! Thanks a lot

[Bug libstdc++/97729] [11 Regression] Link failure due to basic_stringbuf and others when building DLL on MinGW

2020-11-05 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97729

Jonathan Wakely  changed:

   What|Removed |Added

   Target Milestone|8.5 |11.0

[Bug libstdc++/97729] [11 Regression] Link failure due to basic_stringbuf and others when building DLL on MinGW

2020-11-05 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97729

Jonathan Wakely  changed:

   What|Removed |Added

  Known to work|10.2.1  |
   Target Milestone|11.0|8.5

--- Comment #8 from Jonathan Wakely  ---
It should be fixed now, could you check?

[Bug libstdc++/97729] [11 Regression] Link failure due to basic_stringbuf and others when building DLL on MinGW

2020-11-05 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97729

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Jonathan Wakely :

https://gcc.gnu.org/g:50b840ac5e1d6534e345c3fee9a97ae45ced6bc7

commit r11-4748-g50b840ac5e1d6534e345c3fee9a97ae45ced6bc7
Author: Jonathan Wakely 
Date:   Thu Nov 5 13:41:40 2020 +

libstdc++: Export basic_stringbuf constructor [PR 97729]

libstdc++-v3/ChangeLog:

PR libstdc++/97729
* config/abi/pre/gnu.ver (GLIBCXX_3.4.29): Add exports.
* src/c++20/sstream-inst.cc (basic_stringbuf): Instantiate
private constructor taking __xfer_bufptrs.

[Bug libstdc++/97729] [11 Regression] Link failure due to basic_stringbuf and others when building DLL on MinGW

2020-11-05 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97729

--- Comment #7 from CVS Commits  ---
The master branch has been updated by Jonathan Wakely :

https://gcc.gnu.org/g:710508c7b1a2c8e1d75d4c4f1ac79473dbf2b2bb

commit r11-4749-g710508c7b1a2c8e1d75d4c4f1ac79473dbf2b2bb
Author: Jonathan Wakely 
Date:   Thu Nov 5 16:19:15 2020 +

libstdc++: Fix multiple definitions of std::exception_ptr functions [PR
97729]

This fixes some multiple definition errors caused by the changes for
PR libstdc++/90295. The previous solution for inlining the members of
std::exception_ptr but still exporting them from the library was to
suppress the 'inline' keyword on those functions when compiling
libsupc++/eh_ptr.cc, so they get defined in that file. That produces ODR
violations though, because there are now both inline and non-inline
definitions in the library, due to the use of std::exception_ptr in
other files sucg as src/c++11/future.cc.

The new solution is to define all the relevant members as 'inline'
unconditionally, but use __attribute__((used)) to cause definitions to
be emitted in libsupc++/eh_ptr.cc as before. This doesn't quite work
however, because PR c++/67453 means the attribute is ignored on
constructors and destructors. As a workaround, the old solution
(conditionally inline) is still used for those members, but they are
given the always_inline attribute so that they aren't emitted in
src/c++11/future.o as inline definitions.

libstdc++-v3/ChangeLog:

PR libstdc++/97729
* include/std/future (__basic_future::_M_get_result): Use
nullptr for null pointer constant.
* libsupc++/eh_ptr.cc (operator==, operator!=): Remove
definitions.
* libsupc++/exception_ptr.h (_GLIBCXX_EH_PTR_USED): Define
macro to conditionally add __attribute__((__used__)).
(operator==, operator!=, exception_ptr::exception_ptr())
(exception_ptr::exception_ptr(const exception_ptr&))
(exception_ptr::~exception_ptr())
(exception_ptr::operator=(const exception_ptr&))
(exception_ptr::swap(exception_ptr&)): Always define as
inline. Add macro to be conditionally "used".

[Bug libstdc++/97729] [11 Regression] Link failure due to basic_stringbuf and others when building DLL on MinGW

2020-11-05 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97729

--- Comment #5 from Jonathan Wakely  ---
Yes sorry, I get the same error. I should have tested it first! Working patch
on the way ...

[Bug libstdc++/97729] [11 Regression] Link failure due to basic_stringbuf and others when building DLL on MinGW

2020-11-05 Thread markus.boeck02 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97729

--- Comment #4 from Markus Böck  ---
Indeed that sounds like it might be the issue. I am currently on a very recent
version of binutils:

$ ./x86_64-w64-mingw32-ld --versionGNU ld (GNU
Binutils) 2.35.50.20200709 
Copyright (C) 2020 Free Software Foundation, Inc.  
This
program is free software; you may redistribute it under the terms of   
   the GNU General Public License version 3 or
(at your option) a later version.  
This program has absolutely no warranty.

Changing the lines you posted above yields me a compiler error now:

libtool: compile:  /mnt/c/GCC-Build-Array/gcc/build-host-x86_64/./gcc/xgcc
-shared-libgcc -B/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/./gcc -nostdinc++
-L/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/src
-L/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/src/.libs
-L/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/libsupc++/.libs
-L/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/install/x86_64-w64-mingw32/lib
-L/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/install/mingw/lib -isystem
/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/install/x86_64-w64-mingw32/include
-isystem /mnt/c/GCC-Build-Array/gcc/build-host-x86_64/install/mingw/include
-B/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/install/x86_64-w64-mingw32/bin/
-B/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/install/x86_64-w64-mingw32/lib/
-isystem
/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/install/x86_64-w64-mingw32/include
-isystem
/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/install/x86_64-w64-mingw32/sys-include
-I/mnt/c/GCC-Build-Array/gcc/libstdc++-v3/../libgcc
-I/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/include/x86_64-w64-mingw32
-I/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/include
-I/mnt/c/GCC-Build-Array/gcc/libstdc++-v3/libsupc++
-I/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/install/include -std=gnu++11
-D_GLIBCXX_SHARED -fno-implicit-templates -Wall -Wextra -Wwrite-strings
-Wcast-qual -Wabi=2 -fdiagnostics-show-location=once -ffunction-sections
-fdata-sections -frandom-seed=future.lo -Wno-error=format-extra-args
-Wno-error=format -g1 -fdebug-prefix-map=/mnt/c=C: -c
../../../../../libstdc++-v3/src/c++11/future.cc -o future.o
In file included from ../../../../../libstdc++-v3/src/c++11/future.cc:29:
/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/include/future:
In member function 'std::__future_base::_Result<_Res>&
std::__basic_future<_Res>::_M_get_result() const':
/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/include/future:712:30:
error: ambiguous overload for 'operator==' (operand types are
'std::__exception_ptr::exception_ptr' and 'int')
  712 | if (!(__res._M_error == 0))
  |   ~~ ^~ ~
  | |   |
  | |   int
  | std::__exception_ptr::exception_ptr
/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/include/future:712:30:
note: candidate: 'operator==(std::__exception_ptr::exception_ptr::__safe_bool
{aka void (std::__exception_ptr::exception_ptr::*)()},
std::__exception_ptr::exception_ptr::__safe_bool {aka void
(std::__exception_ptr::exception_ptr::*)()})' (built-in)
  712 | if (!(__res._M_error == 0))
  |   ~~~^~~~
In file included from
/mnt/c/GCC-Build-Array/gcc/libstdc++-v3/libsupc++/exception:147,
 from
/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/include/mutex:40,
 from
/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/include/future:38,
 from ../../../../../libstdc++-v3/src/c++11/future.cc:29:
/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/include/bits/exception_ptr.h:223:5:
note: candidate: 'bool std::__exception_ptr::operator==(const
std::__exception_ptr::exception_ptr&, const
std::__exception_ptr::exception_ptr&)'
  223 | operator==(const exception_ptr&, const exception_ptr&)
  | ^~~~
Makefile:644: recipe for target 'future.lo' failed
make[5]: Leaving directory
'/mnt/c/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/src/c++11'

[Bug libstdc++/97729] [11 Regression] Link failure due to basic_stringbuf and others when building DLL on MinGW

2020-11-05 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97729

--- Comment #3 from Jonathan Wakely  ---
It could be a difference in the linker. I'm using the mingw cross-binutils that
comes with Fedora:

$ /usr/bin/x86_64-w64-mingw32-ld --version
GNU ld version 2.32-%{release}
Copyright (C) 2019 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.


The exception_ptr symbols should get suppressed with:

--- a/libstdc++-v3/src/c++11/future.cc
+++ b/libstdc++-v3/src/c++11/future.cc
@@ -22,6 +22,9 @@
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // .

+// Prevent multiple definitions of exception_ptr inline members (PR 97729)
+#define _GLIBCXX_EH_PTR_COMPAT
+
 #include 
 #include 

[Bug libstdc++/97729] [11 Regression] Link failure due to basic_stringbuf and others when building DLL on MinGW

2020-11-05 Thread markus.boeck02 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97729

--- Comment #2 from Markus Böck  ---
Created attachment 49507
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49507=edit
config.h

Applied the patch and it fixed the issue regarding the undefined references.
Still getting the multiple definitions of exception_ptr:

/mnt/c/GCC-Build/NewestLinux/bin/x86_64-w64-mingw32-ld:
../libsupc++/.libs/libsupc++convenience.a(nested_exception.o): in function
`std::__exception_ptr::exception_ptr::~exception_ptr()':
C:/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/libsupc++/C:/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/include/bits/exception_ptr.h:194:
multiple definition of `std::__exception_ptr::exception_ptr::~exception_ptr()';
../libsupc++/.libs/libsupc++convenience.a(eh_ptr.o):C:/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/libsupc++/C:/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/include/bits/exception_ptr.h:194:
first defined here
/mnt/c/GCC-Build/NewestLinux/bin/x86_64-w64-mingw32-ld:
../src/c++11/.libs/libc++11convenience.a(future.o): in function
`std::__exception_ptr::exception_ptr::exception_ptr()':
C:/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/src/c++11/C:/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/include/bits/std_mutex.h:105:
multiple definition of `std::__exception_ptr::exception_ptr::exception_ptr()';
../libsupc++/.libs/libsupc++convenience.a(eh_ptr.o):C:/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/libsupc++/C:/GCC-Build-Array/gcc/build-host-x86_64/x86_64-w64-mingw32/libstdc++-v3/include/bits/exception_ptr.h:176:
first defined here

I am using a cross compiler setup (though in WSL 1) as well so I'd be curious
what leads to the differences in reproducability as this is not the first time
this has happened. I'll attach my config.h if that helps. The MinGW version I
use is current trunk.

[Bug libstdc++/97729] [11 Regression] Link failure due to basic_stringbuf and others when building DLL on MinGW

2020-11-05 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97729

Jonathan Wakely  changed:

   What|Removed |Added

   Keywords||build
Summary|Link failure due to |[11 Regression] Link
   |basic_stringbuf and others  |failure due to
   |when building DLL on MinGW  |basic_stringbuf and others
   ||when building DLL on MinGW
  Known to work||10.2.1
  Known to fail||11.0
   Priority|P3  |P1
   Target Milestone|--- |11.0