GCC6 compile error: narrowing conversion

Issue #1325 new
Former user created an issue

With gcc6 building will exit unsuccessfully because in sha2.cpp there are some narrowing conversions. See this part of the log:

[  152s] [  6%] Building CXX object dep/aes/CMakeFiles/aes.dir/sha2.cpp.o
[  152s] cd /home/abuild/rpmbuild/BUILD/caesaria-0.5+git20160627/build/dep/aes && /usr/bin/c++     -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -DNDEBUG -O3 -DNDEBUG -fPIC   -o CMakeFiles/aes.dir/sha2.cpp.o -c /home/abuild/rpmbuild/BUILD/caesaria-0.5+git20160627/dep/aes/sha2.cpp
[  153s] /home/abuild/rpmbuild/BUILD/caesaria-0.5+git20160627/dep/aes/sha2.cpp:388:1: error: narrowing conversion of '13096744586834688815ul' from 'long unsigned int' to 'sha2_64t {aka long int}' inside { } [-Wnarrowing]
[  153s]  };
[  153s]  ^
[  153s] /home/abuild/rpmbuild/BUILD/caesaria-0.5+git20160627/dep/aes/sha2.cpp:388:1: error: narrowing conversion of '16840607885511220156ul' from 'long unsigned int' to 'sha2_64t {aka long int}' inside { } [-Wnarrowing]
[  153s] /home/abuild/rpmbuild/BUILD/caesaria-0.5+git20160627/dep/aes/sha2.cpp:388:1: error: narrowing conversion of '10538285296894168987ul' from 'long unsigned int' to 'sha2_64t {aka long int}' inside { } [-Wnarrowing]

Comments (2)

  1. Martin Strympl

    I have fixed this compilation bug by use code

    #include <stdint.h>
     typedef uint64_t sha2_64t;
     #define s_u64 ull
    

    in file dep/aes/sha2.h

  2. Log in to comment