Linaro / OpenCSD

CoreSight trace stream decoder developed openly
https://github.com/Linaro/opencsd/wiki
Other
143 stars 54 forks source link

A possible bug found by compiler #23

Closed yabinc closed 4 years ago

yabinc commented 4 years ago

external/OpenCSD/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp:1391:29: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand] if(getComponentOpMode() && OCSD_OPFLG_PKTDEC_ERROR_BAD_PKTS) ^ ~~~~~~~~ external/OpenCSD/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp:1391:29: note: use '&' for a bitwise operation if(getComponentOpMode() && OCSD_OPFLG_PKTDEC_ERROR_BAD_PKTS) ^~ & external/OpenCSD/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp:1391:29: note: remove constant to silence this warning if(getComponentOpMode() && OCSD_OPFLG_PKTDEC_ERROR_BAD_PKTS) ~^~~~~~~~~~~ 1 error generated.

Below are the compile flags we used:

prebuilts/clang/host/linux-x86/clang-r377782c/bin/clang++ -c -Wno-enum-compare -Wno-enum-compare-switch -Wno-null-pointer-arithmetic -Wno-null-dereference -Wno-pointer-compare -Wno-xor-used-as-pow -Wno-final-dtor-non-final-class -mthumb -Os -fomit-frame-pointer -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -no-canonical-prefixes -DNDEBUG -UDEBUG -fno-exceptions -Wno-multichar -O2 -g -fno-strict-aliasing -Werror=date-time -Werror=pragma-pack -Werror=pragma-pack-suspicious-include -fdebug-prefix-map=/proc/self/cwd= -Dcompiler_offsetof=builtin_offsetof -faddrsig -Werror=int-conversion -fexperimental-new-pass-manager -Wno-reserved-id-macro -Wno-unused-command-line-argument -fcolor-diagnostics -Wno-zero-as-null-pointer-constant -Wno-sign-compare -Wno-defaulted-function-deleted -Wno-inconsistent-missing-override -Wno-c99-designator -ftrivial-auto-var-init=pattern -ffunction-sections -fdata-sections -fno-short-enums -funwind-tables -fstack-protector-strong -Wa,--noexecstack -D_FORTIFY_SOURCE=2 -Wstrict-aliasing=2 -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Werror=format-security -nostdlibinc -msoft-float -march=armv8-a -mfloat-abi=softfp -mfpu=neon-fp-armv8 -target armv7a-linux-androideabi10000 -Bprebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/arm-linux-androideabi/bin -fPIC -Wsign-promo -Wimplicit-fallthrough -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -Wno-gnu-include-next -fvisibility-inlines-hidden -Iexternal/OpenCSD/decoder/include -Iexternal/OpenCSD -DLIBC_API=10000 -DLIBM_API=10000 -DLIBDL_API=10000 -Iexternal/libcxx/include -Iexternal/libcxxabi/include -Ibionic/libc/include -Wall -Werror -std=gnu++17 -Wno-ignored-qualifiers -Wno-unused-parameter -Wno-switch -Wno-unused-private-field -Wno-implicit-fallthrough -fexceptions -frtti -Isystem/core/include -Isystem/media/audio/include -Ihardware/libhardware/include -Ihardware/libhardware_legacy/include -Ihardware/ril/include -Iframeworks/native/include -Iframeworks/native/opengl/include -Iframeworks/av/include -isystem bionic/libc/include -isystem bionic/libc/kernel/uapi -isystem bionic/libc/kernel/uapi/asm-arm -isystem bionic/libc/kernel/android/scsi -isystem bionic/libc/kernel/android/uapi -Ilibnativehelper/include_jni -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast -Werror=fortify-source -Werror=address-of-temporary -Werror=return-type -Wno-tautological-constant-compare -Wno-tautological-type-limit-compare -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-int-in-bool-context -Wno-sizeof-array-div -Wno-tautological-overlap-compare -MD -MF out/soong/.intermediates/external/OpenCSD/libopencsd_decoder/android_arm_armv8-a_static/obj/external/OpenCSD/decoder/source/etmv4/trc_pkt_decode_etmv4i.o.d -o out/soong/.intermediates/external/OpenCSD/libopencsd_decoder/android_arm_armv8-a_static/obj/external/OpenCSD/decoder/source/etmv4/trc_pkt_decode_etmv4i.o external/OpenCSD/decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp

mikel-armbb commented 4 years ago

Thanks for reporting this. I can confirm this is an error.

The line of code has been corrected and warning option added to the project gcc makefile to ensure sure errors are caught in future.

Next patch release will contain a fix.

Regards

Mike