rockchip-linux / rkdeveloptool

GNU General Public License v2.0
159 stars 91 forks source link

Build failure: Comparison of char index with -1 in main.cpp:upgrade_loader() #6

Open afaerber opened 7 years ago

afaerber commented 7 years ago

On several non-x86 architectures (ARM, PowerPC, S/390) I am getting build failures with GCC 6.3.1:

[   31s] main.cpp: In function 'bool upgrade_loader(STRUCT_RKDEVICE_DESC&, char*)':
[   31s] main.cpp:1550:13: error: comparison is always false due to limited range of data type [-Werror=type-limits]
[   31s]    if (index == -1) {
[   31s]        ~~~~~~^~~~~
[   31s] main.cpp:1574:13: error: comparison is always false due to limited range of data type [-Werror=type-limits]
[   31s]    if (index == -1) {
[   31s]        ~~~~~~^~~~~
[   33s] cc1plus: all warnings being treated as errors
[   33s] make[1]: *** [Makefile:454: main.o] Error 1
[   33s] make[1]: Leaving directory '/home/abuild/rpmbuild/BUILD/rkdeveloptool-0~git.20170425.e5ee8cc'
[   33s] make: *** [Makefile:470: all-recursive] Error 1

That suggests the type of index, char, is unsigned on those platforms, and that the variable type of index should be changed - either to signed char or maybe to int.

tstellanova commented 6 years ago

Seeing the same problem. Unable to build natively on Rock64

Nelson-numerical-software commented 5 years ago

workaround remove: -Wextra and -Wno-type-limits in makefile.am

gounthar commented 5 years ago

Will try that, thanks.