Proxmark / proxmark3

Proxmark 3
http://www.proxmark.org/
GNU General Public License v2.0
3.11k stars 903 forks source link

Build error (hitagS.c, bitwise comparison) #605

Closed ikarus23 closed 6 years ago

ikarus23 commented 6 years ago

Hi, I get the following build error. I've not been able to look into it yet. Maybe later this week.

arm-none-eabi-gcc -c -I../include -I../common -I. -Wall -Werror -pedantic -std=c99 -Os -DWITH_ISO14443a_StandAlone -DWITH_LF -DWITH_ISO15693 -DWITH_ISO14443a -DWITH_ISO14443b -DWITH_ICLASS -DWITH_LEGICRF -DWITH_HITAG  -DWITH_CRC -DON_DEVICE -DWITH_HFSNOOP -fno-strict-aliasing -ffunction-sections -fdata-sections -DZ_SOLO -DZ_PREFIX -DNO_GZIP -DZLIB_PM3_TUNED -I../zlib -mthumb -mthumb-interwork -o obj/hitagS.o hitagS.c 
hitagS.c: In function 'SimulateHitagSTag':
hitagS.c:988:27: error: bitwise comparison always evaluates to false [-Werror=tautological-compare]
  if((tag.pages[1][2]&0x80)==1)
                           ^~
hitagS.c:991:26: error: bitwise comparison always evaluates to false [-Werror=tautological-compare]
  if((tag.pages[1][2]&0x2)==1)
                          ^~
hitagS.c:999:27: error: bitwise comparison always evaluates to false [-Werror=tautological-compare]
  if((tag.pages[1][1]&0x80)==1)
                           ^~
hitagS.c:1002:27: error: bitwise comparison always evaluates to false [-Werror=tautological-compare]
  if((tag.pages[1][1]&0x40)==1)
                           ^~
hitagS.c:1005:27: error: bitwise comparison always evaluates to false [-Werror=tautological-compare]
  if((tag.pages[1][1]&0x20)==1)
                           ^~
hitagS.c:1008:27: error: bitwise comparison always evaluates to false [-Werror=tautological-compare]
  if((tag.pages[1][1]&0x10)==1)
                           ^~
hitagS.c:1011:26: error: bitwise comparison always evaluates to false [-Werror=tautological-compare]
  if((tag.pages[1][1]&0x8)==1)
                          ^~
hitagS.c:1014:26: error: bitwise comparison always evaluates to false [-Werror=tautological-compare]
  if((tag.pages[1][1]&0x4)==1)
                          ^~
hitagS.c:1017:26: error: bitwise comparison always evaluates to false [-Werror=tautological-compare]
  if((tag.pages[1][1]&0x2)==1)
                          ^~
cc1: all warnings being treated as errors
iceman1001 commented 6 years ago

Which version of gcc are you running? Is it a new one?

arm-none-eabi-gcc --version

But yes, ( value & 0x2) == 1 can never be true. Either >1, or == 0x2 CoverityScan complained about this one. I fixed it last year apparently.

https://github.com/iceman1001/proxmark3/commit/8bc17414fda96cf485c8b07d5b14f27e2977394a#diff-589b396aa9cc54b383991e0b312a9950

ikarus23 commented 6 years ago

arm-none-eabi-gcc (Arch Repository) 8.1.0 (I'm running Arch Linux, so yeah, it should be the latest version.)

ikarus23 commented 6 years ago

https://github.com/Proxmark/proxmark3/pull/606 works like a charm. Thanks @pwpiwi!