Topic: WolfTpm build error (annoying warning as error - GCC)
Hello,
While compiling WolfTpm files on Ubuntu, gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
I encounter this annoying warning as error. Can someone please help on how to get rid of this?
Build error: New warnings appeared:
../wolftpm/wolftpm/tpm2_types.h: In function ‘word64 ByteReverseWord64(word64)’:
../wolftpm/wolftpm/tpm2_types.h:655:66: warning: left shift count >= width of type [-Wshift-count-overflow]
return (word64)((word64)ByteReverseWord32((word32)value)) << 32 |
^~
../wolftpm/wolftpm/tpm2_types.h:656:66: warning: right shift count >= width of type [-Wshift-count-overflow]
(word64)ByteReverseWord32((word32)(value >> 32));
The build flag: CFLAGS = -Wshift-count-overflow
does not help and neither does
#pragma GCC diagnostic ignored "-Wshift-count-overflow"
The problem is in this function in tpm2_types.h, but I don't want to modify it.
static inline word64 ByteReverseWord64(word64 value)
{
return (word64)((word64)ByteReverseWord32((word32)value)) << 32 |
(word64)ByteReverseWord32((word32)(value >> 32));
}
Thanks,
Sam