cygwin x86_64: mingw64-g++ 6.4.0 (both i686 and x86_64) issue (bug?) with reinterpret_cast

Paolo ZAMBOTTI paolo.zambotti@st.com
Mon Oct 23 14:47:00 GMT 2017


Hello,

I'm having some issues while compiling C++ code with mingw64 c++ compiler (6.4.0) distributed within Cygwin packages.
I can guess the issue I'm going to report is not strictly related to Cygwin distribution but I cannot test other mingw64 distributions so let me start reporting the issue here...
Once said that, I'm open to any suggestions for better reporting place...

I'm not an expert in C and even less in C++ so I hope to not generate stupid noise... but the same code was compiling fine with previous version (5.4) ...

The attached file is the simplest example that triggers the issue.

If I try to compile with "x86_64-w64-mingw32-gcc -o test.exe test.cpp" the output is the following

test.cpp: In function 'int main(int, char**)':
test.cpp:7:34: error: reinterpret_cast from integer to pointer
   static constexpr void* test2 = (void*)(-1LL);
                                  ^~~~~~~~~~~~~

While, if I try to compile with "i686-w64-mingw32-gcc -o test.exe test.cpp" the output is the following

test.cpp: In function 'int main(int, char**)':
test.cpp:12:34: error: reinterpret_cast from integer to pointer
   static constexpr void* test2 = (void*)(-1L);
                                  ^~~~~~~~~~~~

The test is effectively build to always fail but the current behavior is exactly the opposite of what I was expecting:
x86_64 complains with (-1LL) cast while I was expecting it to fail on (-1L)
i686 complains with (-1L) cast while I was expecting it to fail on (-1LL)


Just to complete the picture, my environment is:
Windows 7 machine
Latest Cygwin (updated today 23 -Oct-2017)

Regards,
Paolo.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.cpp
URL: <http://cygwin.com/pipermail/cygwin/attachments/20171023/257599c0/attachment.ksh>
-------------- next part --------------

--
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


More information about the Cygwin mailing list