Problem 1720 - compile error: cast from 'PSTR {aka char*}' to 'DWORD {aka long unsigned int }' loses precision
Summary: compile error: cast from 'PSTR {aka char*}' to 'DWORD {aka long unsigned int ...
Status: CLOSED WONTFIX
Alias: None
Product: Geant4
Classification: Unclassified
Component: cmake (show other problems)
Version: 10.0
Hardware: PC Windows
: P5 trivial
Assignee: Ben Morgan
URL:
Depends on:
Blocks:
 
Reported: 2015-03-12 19:02 CET by Mojca Miklavec
Modified: 2018-05-08 14:45 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Mojca Miklavec 2015-03-12 19:02:06 CET
I tried to compile Geant4.10.0.p04 with mingw-w64 (x86_64-4.9.2-posix-seh-rt_v3-rev1) on Windows 7. I generated the makefiles for MinGW with cmake-gui. But the compilation breaks with:

[  3%] Building CXX object CMakeFiles/genwindef.dir/cmake/Modules/genwindef/LibSymbolInfo.cpp.obj
C:\app\geant4.10.00.p04\cmake\Modules\genwindef\LibSymbolInfo.cpp: In member function 'BOOL CLibSymbolInfo::Dump(LPTSTR, std::ostream&)':
C:\app\geant4.10.00.p04\cmake\Modules\genwindef\LibSymbolInfo.cpp:18:59: error: cast from 'PSTR {aka char*}' to 'DWORD {aka long unsigned int
}' loses precision [-fpermissive]
 #define MakePtr( cast, ptr, addValue ) (cast)( (DWORD)(ptr) + (DWORD)(addValue))
                                                           ^
C:\app\geant4.10.00.p04\cmake\Modules\genwindef\LibSymbolInfo.cpp:92:13: note: in expansion of macro 'MakePtr'
   pMbrHdr = MakePtr( PIMAGE_ARCHIVE_MEMBER_HEADER, pArchiveStartString,
             ^
C:\app\geant4.10.00.p04\cmake\Modules\genwindef\LibSymbolInfo.cpp:18:80: warning: cast to pointer from integer of different size [-Wint-to-po
inter-cast]
 #define MakePtr( cast, ptr, addValue ) (cast)( (DWORD)(ptr) + (DWORD)(addValue))
                                                                                ^
C:\app\geant4.10.00.p04\cmake\Modules\genwindef\LibSymbolInfo.cpp:92:13: note: in expansion of macro 'MakePtr'
   pMbrHdr = MakePtr( PIMAGE_ARCHIVE_MEMBER_HEADER, pArchiveStartString,
             ^
C:\app\geant4.10.00.p04\cmake\Modules\genwindef\LibSymbolInfo.cpp:18:59: error: cast from 'PDWORD {aka long unsigned int*}' to 'DWORD {aka lo
ng unsigned int}' loses precision [-fpermissive]
 #define MakePtr( cast, ptr, addValue ) (cast)( (DWORD)(ptr) + (DWORD)(addValue))
                                                           ^
C:\app\geant4.10.00.p04\cmake\Modules\genwindef\LibSymbolInfo.cpp:108:24: note: in expansion of macro 'MakePtr'
   PSTR pszSymbolName = MakePtr( PSTR, pMemberOffsets, 4 * cSymbols );
                        ^
C:\app\geant4.10.00.p04\cmake\Modules\genwindef\LibSymbolInfo.cpp:18:80: warning: cast to pointer from integer of different size [-Wint-to-po
inter-cast]
 #define MakePtr( cast, ptr, addValue ) (cast)( (DWORD)(ptr) + (DWORD)(addValue))
                                                                                ^
C:\app\geant4.10.00.p04\cmake\Modules\genwindef\LibSymbolInfo.cpp:108:24: note: in expansion of macro 'MakePtr'
   PSTR pszSymbolName = MakePtr( PSTR, pMemberOffsets, 4 * cSymbols );
                        ^
CMakeFiles\genwindef.dir\build.make:76: recipe for target 'CMakeFiles/genwindef.dir/cmake/Modules/genwindef/LibSymbolInfo.cpp.obj' failed
mingw32-make[2]: *** [CMakeFiles/genwindef.dir/cmake/Modules/genwindef/LibSymbolInfo.cpp.obj] Error 1
CMakeFiles\Makefile2:409: recipe for target 'CMakeFiles/genwindef.dir/all' failed
mingw32-make[1]: *** [CMakeFiles/genwindef.dir/all] Error 2
makefile:135: recipe for target 'all' failed
mingw32-make: *** [all] Error 2


I will try if I will have more luck with i686.
Comment 1 Ben Morgan 2015-03-17 11:26:11 CET
MinGW isn't a supported platform, and we don't currently have the resource to add it to the testing system - hence the WONTFIX.

However, if you're able to supply a patch then we'll certainly look at incorporating this, even if we're unable to test.
Comment 2 Mojca Miklavec 2015-03-17 11:33:40 CET
I would gladly investigate further, but I need at least some rough pointers.

I know some C++, but I don't understand this pointer casting. i686 compiled successfully after I made some trivial patches. With x86_64 I'm stuck.