Web lists-archives.com

gcc-6.3.0-1 regression: libstdc++6 DLL breaks exception handling




After upgrading to gcc test version 6.3.0-1, C++ exception handling is broken if DLL version of new libstdc++6 is used.

Testcase:

$ uname -srvmo
CYGWIN_NT-10.0-WOW 2.6.1(0.305/5/3) 2016-12-16 11:50 i686 Cygwin
or:
CYGWIN_NT-10.0 2.6.1(0.305/5/3) 2016-12-16 11:55 x86_64 Cygwin

$ cygcheck -f /bin/g++
gcc-g++-6.3.0-1

$ cygcheck -f /bin/cygstdc++-6.dll
libstdc++6-6.3.0-1

$ cat exc.cc
int main()
{
  try {
    throw 42;
  }
  catch (int i) {
    return i;
  }
  return 0;
}

$ g++ -o exc exc.cc

$ ./exc
Segmentation fault (core dumped)


Workaround: Use statically linked version of new libstdc++6:

$ g++ -static -o exc-static exc.cc

$ ./exc-static

$ echo $?
42


Or: Downgrade cygstdc++6.dll:

$ cygcheck -f /bin/cygstdc++-6.dll
libstdc++6-5.4.0-1

$ ./exc

$ echo $?
42


This also affects existing packages compiled with older g++, for example:

$ /usr/sbin/smartctl -V
smartctl 6.5 2016-05-07 r4318 [x86_64-unknown-cygwin-win10] (cygwin-6.5-1)
...
smartmontools build with: C++98, GCC 5.3.0
...
Segmentation fault (core dumped)


Regards,
Christian


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple