This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On 10/23/2017 02:47 PM, Paolo ZAMBOTTI wrote:
> 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) ...
> 

Neither am I.

> 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);
>                                   ^~~~~~~~~~~~
> 

As a comparison, both -1L and -1LL fails for me on 64bit Linux with
gcc-6.4.0.

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

I think it is best to check with gcc-help what the correct behavior is.


Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]