David Grayson | 2 Aug 05:56 2015

Patch: complete implementation of intsafe.h

Hello.  Attached is a patch that adds a complete implementation of intsafe.h that I generated and tested
using Ruby.  It would be great if someone could merge it in.

The version of intsafe.h included in this patch can also be viewed here:


That repository also has Ruby scripts that I used to help generate and test the header.  Hopefully we can keep
using those scripts to update intsafe.h in the future instead of editing it by hand.  I believe using
scripts to generate a highly-repetitive header like this is the best way to ensure consistency and avoid errors.

This patch also fixes the definitions of CHAR_MIN and CHAR_MAX in limits.h so that they have the right
values when char is unsigned (-funsigned-char).  This change is necessary to make intsafe.h work because
I used limits defined in limits.h and stdint.h instead of redefining them.

Some statistics:

- The intsafe.h documentation from Microsoft defines 253 inline functions:
   - 193 integer conversion functions
   - 60 math operations (20 types with 3 operations each)
- This implementation of intsafe.h is only 1562 lines (6.2 lines per function)
   - 134 function bodies
   - 119 functions defined as a simple preprocessor macro pointing a compatible function
- This implementation of intsafe.h is generated from 693 lines of Ruby code
- Microsoft's bulky version from the Windows SDK takes 8570 lines (33.9 lines per function)

I made very light use of the preprocessor because I had Ruby at my disposal, and I think this resulted in very
clear and easy to understand code.  One thing that makes the code easier to check is the lack of casting in the
main computations.  Casting can suppress a lot of useful compiler warnings so I simply didn't do it, and I
fixed the root causes of the warnings instead.
(Continue reading)

Mateusz | 2 Aug 00:27 2015

Proposition for locking printf

We have 4 functions from printf family that output to FILE stream:
printf, vprintf, fprintf, vfprintf

We have also puts/fputs functions that output to FILE stream and are 
always directly from msvcrt.dll.

puts/fputs functions are atomic with Microsoft lock. If we want 
mingw-w64 printf functions (__USE_MINGW_ANSI_STDIO) to be atomic against 
puts/fputs functions, we must copy lock from Microsoft sources.

Microsoft use _lock_file/_unlock_file lock to stdio functions, so patch 
for mingw-w64
printf, vprintf, fprintf, vfprintf
functions are obvious -- _lock_file -> __pformat -> _unlock_file

There is one problem: _lock_file/_unlock_file are exported from 
msvcr*.dll starting from version msvcr90.dll. There are no such 
functions in msvcrt.dll & msvcr80.dll.

My proposition: we can add obvious patch to mingw-w64 printf functions 
family and copy _lock_file/_unlock_file from MS sources and add only to 
libmsvcrt.a & libmsvcr80.a.

I attached diff file that is not complete -- there is to do add 
mingw_lock.c source to libmsvcrt.a & libmsvcr80.a.

Simplified version of this patch is used without problems in x265 
community -- in message 
(Continue reading)

Matthias-Christian Ott | 31 Jul 15:44 2015

Missing CLSIDs and IIDs in msxml2.h

It seems that msxml2.h is manually generated and therefore many CLSIDs
and IIDs are missing. For example, I had to add the following
definitions for one of my projects:

DEFINE_GUID(IID_ISAXXMLReader, 0xa4f96ed0, 0xf829, 0x476e, 0x81, 0xc0,
0xcd, 0xc7, 0xbd, 0x2a, 0x08, 0x02);
DEFINE_GUID(CLSID_SAXXMLReader30, 0x3124c396, 0xfb13, 0x4836, 0xa6,
0xad, 0x13, 0x17, 0xf1, 0x71, 0x36, 0x88);
DEFINE_GUID(IID_ISAXContentHandler, 0x1545cdfa, 0x9e4e, 0x4497, 0xa8,
0xa4, 0x2b, 0xf7, 0xd0, 0x11, 0x2c, 0x44);
DEFINE_GUID(IID_ISAXErrorHandler, 0xa60511c4, 0xccf5, 0x479e, 0x98,
0xa3, 0xdc, 0x8d, 0xc5, 0x45, 0xb7, 0xd0);
DEFINE_GUID(IID_ISAXLexicalHandler, 0x7f85d5f5, 0x47a8, 0x4497, 0xbd,
0xa5, 0x84, 0xba, 0x04, 0x81, 0x9e, 0xa6);

I suppose it's a wasted effort to manually add the other missing IDs, so
I'm not sending a patch (as suggested in the IRC channel). It seems
better to automatically generate the header with Wine's IDL compiler.
However, I'm not a mingw-w64 developer and could live with the current
#if defined(__MINGW64__) || defined(__MINGW32__) in my code.

- Matthias-Christian Ott

niXman | 29 Jul 15:18 2015

troubles building gcc-5.2(i686-posix-sjlj)


I'm trying to build gcc-5.2(i686-posix-sjlj) but faced with error when 
libgcc is configured for stage1: "checking for suffix of object files... 
error: cannot compute suffix of object files: cannot compile"

The full log is here: 
'libgcc/config.log' here: 

As I can see, in the 'libgcc/config.log' there are two types of errors:
1. "fatal error: error closing -: Broken pipe"
2. "error while loading shared libraries: ?: cannot open shared object 
file: No such file or directory"

Any ideas?


Before that, I have successfully built gcc-5.2 as x86_64-posix-sjlj.

Hayden Livingston | 29 Jul 14:59 2015

GCC 5.2 with JIT language frontend

Hello all,

I'm trying to get GCC 5.2 to build with the JIT language frontend.

Apparently I'm the only person who is trying to do this (JIT language
was started in 5.1)

What's the recommended way to proceed your first build? Cygwin? MSYS2?

I tried this a few months ago and things didn't work out. I'm going to
try again.

If others want to try:


Robin Whittle | 29 Jul 10:49 2015

Re: static debug stl crash on exit with global variable __gnu_cxx::__concurrence_lock_error

I just joined this list and am writing as a reply to a message from
Norbert Pfeiler on 2015-05-25.  He identified an minimal test program to
generate an error, at the end of the executable's run:
__gnu_cxx::__concurrence_lock_error when the libstdc++ Debug Mode
(bounds checking and the like) is enabled.

All that seems to be required is to declare a vector, map or set (or I
guess any Containers Library object), but not, at least, an int or a
string, so there is one such object before main(), and another inside
main().  A map outside and a set inside will cause the error.  Likewise
one or more vectors outside and one or more vectors inside.

This appears to be the problem underlying two other bug reports: firstly
for TDM-GCC, which I understand is derived from mingw-w64:


and secondly for GCC itself, which does not seem to be at fault, since
there is no such problem with the Linux version:


All this activity is from about 2015-05-10, but I wrote more to the 264
bug above, and now to here, because the same problems occur with TDM-GCC
5.1.0, which was released on 2015-06-28.  In that bug 264, John E.
(TDM-GCC) stated that the problem was with winpthreads.

I lack the expertise and inclination to delve deeply into winpthreads or
any other innards of the library or compiler.  I hope some good soul
will do so.
(Continue reading)

Jacek Caban | 28 Jul 16:28 2015

[PATCH 2/2] Added sphelper.h file.

 mingw-w64-headers/include/sphelper.h | 77
 1 file changed, 77 insertions(+)
 create mode 100644 mingw-w64-headers/include/sphelper.h

Mingw-w64-public mailing list
Jacek Caban | 28 Jul 16:28 2015

[PATCH 1/2] Added sperror.h file.

 mingw-w64-headers/include/sperror.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 mingw-w64-headers/include/sperror.h

Mingw-w64-public mailing list
Edward Diener | 28 Jul 14:27 2015

Strange linker error with gcc-5.1 32-bit involving 'virtual thunk'

Without trying immediately to give specific code for what is a large 
project, I am getting linker errors when trying to link a second shared 
library which depends on a first shared library that has linked 
successfully. The errors

undefined reference to `virtual thunk to 
undefined reference to `virtual thunk to 
boost::archive::archive_exception::what() const'
collect2.exe: error: ld returned 1 exit status

The xml_wgrammar.o file is being linked into the second shared library. 
The xml_wgrammar.cpp file includes xml_archive_exception.hpp. The 
xml_archive_exception.hpp includes and derives from 
archive_exception.hpp. Both xml_archive_exception and archive_exception 
have their implementation in the first shared library and have their 
necessary implementations exported. The implementation of 
archive_exception::what() is exported in the first shared library and is 
imported when seen by xml_wgrammar.cpp.

What is so strange is that there is no call to archive_exception::what() 
in the preprocessed output of xml_wgrammar.cpp.

Does anybody have any idea what might be going on here before I take the 
time to reduce this situation into a short enough fragment to show in a 
subsequent thread in this post ?
(Continue reading)

Alexey Pavlov | 28 Jul 06:09 2015


Hi, guys!

Our users (MSYS2) report lot of crashes in different applications. We found that that crash are happen after upgrading winpthreads and caused one or both of two commits:
Rewrite the mutex implementation for better performance - https://github.com/msys2/mingw-w64/commit/1968e60cd5d59727bb325d5b69c8f0d7a2f1fe1b

I have no yet good testcase. This is GDB backtrace from one of our users https://gist.github.com/achadwick/01c6a1b519a36dcdbe0a


Mingw-w64-public mailing list
Jacek Caban | 27 Jul 11:23 2015

[PATCH] wrl: Added ComPtr implementation.

 mingw-w64-headers/include/wrl/client.h   | 290
 mingw-w64-headers/include/wrl/internal.h |   6 +
 2 files changed, 296 insertions(+)

Mingw-w64-public mailing list