BoomerangDecompiler / boomerang

Boomerang Decompiler - Fighting the code-rot :)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: Cast from 'Instruction*' to 'long int' loses precision [-fpermissive]

Cinek75 opened this issue · comments

Last git repos.
Msys2 environment with gcc 6.2.0, mingw-w64-x86_64-toolchain.
Make failed.

D:/Devel/boomerang/src/db/exp.cpp: In member function 'virtual bool RefExp::oper ator==(const Exp&) const':
D:/Devel/boomerang/src/db/exp.cpp:418:19: error: cast from 'Instruction_' to 'lo ng int' loses precision [-fpermissive]
if ((long int)def == -1)
^~~
D:/Devel/boomerang/src/db/exp.cpp:422:29: error: cast from 'Instruction_' to 'lo ng int' loses precision [-fpermissive]
if ((long)((RefExp &)o).def == -1)
^~~
make[2]: *** [db/CMakeFiles/db.dir/build.make:207: db/CMakeFiles/db.dir/exp.cpp. o] Error 1
make[1]: *** [CMakeFiles/Makefile2:520: db/CMakeFiles/db.dir/all] Error 2
make: *** [Makefile:95: all] Error 2

D:/Devel/boomerang/src/db/exp.cpp: In member function 'virtual bool RefExp::oper ator==(const Exp&) const':
D:/Devel/boomerang/src/db/exp.cpp:422:29: error: cast from 'Instruction_' to 'lo ng int' loses precision [-fpermissive]
if ((long)((RefExp &)o).def == -1)
^~~
make[2]: *_* [db/CMakeFiles/db.dir/build.make:207: db/CMakeFiles/db.dir/exp.cpp. o] Error 1
make[1]: *** [CMakeFiles/Makefile2:520: db/CMakeFiles/db.dir/all] Error 2
make: *** [Makefile:95: all] Error 2

Add the following code in the file to fix the problem.

Change code in file exp.cpp:
change "if ((long)def == -1)" to "if ((long long int)def == -1)"

Change code in file basicblock.cpp:
change "if ((long)def == -1) " to "if ((long long int)def == -1)"

Thank You for reporting this, the fix I've pushed is a bit different than the one You've suggested, but should work as well 😄