Closed Quuxplusone closed 3 years ago
Can you please provide a minimal code sample for reproducing?
cat main.cpp
class RetT { public:
RetT() : code_(0)
{
}
RetT(const uint32_t code) : code_(code)
{
}
~RetT()
{
}
bool Ok() const
{
return code_ == 0;
}
private:
uint32_t code_;
};
static RetT Test(bool& isSet) { return 0; }
int main() { bool isSet = false;
if( Test(isSet).Ok() && isSet )
{
if( Test( isSet).Ok() && isSet )
{
// do smth
}
}
return 0;
}
~/experiments$ clang-tidy-12 --checks=bugprone-redundant-branch-condition main.cpp Error while trying to load a compilation database: Could not auto-detect compilation database for file "main.cpp" No compilation database found in /home/vst/experiments or any parent directory fixed-compilation-database: Error while opening fixed database: No such file or directory json-compilation-database: Error while opening JSON database: No such file or directory Running without flags. PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace. Stack dump:
Will be fixed in https://reviews.llvm.org/D91037
Ubuntu 20.04 1:12~++20201026065856+bd07be4f3f7-1~exp1~20201026180537.203
clang-tidy-12 --version LLVM (http://llvm.org/): LLVM version 12.0.0
Optimized build. Default target: x86_64-pc-linux-gnu Host CPU: haswell
make
T++ src/lib/libndmIpSec.o (out=$(clang-tidy-12 -warnings-as-errors= -header-filter=. -checks=-,android-,-android-cloexec-pipe,bugprone-,cert-,cppcoreguidelines-,google-build-namespaces,google-readability-casting,google-runtime-memset,llvm-namespace-comment,llvm-twine-local,misc-,modernize-redundant-void-arg,modernize-use-override,perfomance-,readability-,-android-cloexec-accept,-android-cloexec-fopen,-android-cloexec-open,-bugprone-branch-clone,-bugprone-macro-parentheses,-bugprone-narrowing-conversions,-bugprone-parent-virtual-call,-bugprone-reserved-identifier,-bugprone-suspicious-missing-comma,-cert-dcl37-c,-cert-dcl21-cpp,-cert-dcl50-cpp,-cert-dcl51-cpp,-cert-dcl59-cpp,-cert-oop54-cpp,-cppcoreguidelines-avoid-c-arrays,-cppcoreguidelines-avoid-goto,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-avoid-non-const-global-variables,-cppcoreguidelines-macro-usage,-cppcoreguidelines-narrowing-conversions,-cppcoreguidelines-non-private-member-variables-in-classes,-cppcoreguidelines-owning-memory,-cppcoreguidelines-prefer-member-initializer,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-pro-type-vararg,-cppcoreguidelines-slicing,-cppcoreguidelines-special-member-functions,-google-build-namespaces,-misc-definitions-in-headers,-misc-macro-parentheses,-misc-no-recursion,-misc-non-private-member-variables-in-classes,-misc-suspicious-missing-comma,-misc-unused-parameters,-misc-redundant-expression,-readability-avoid-const-params-in-decls,-readability-function-cognitive-complexity,-readability-function-size,-readability-implicit-bool-conversion,-readability-magic-numbers,-readability-misleading-indentation,-readability-simplify-boolean-expr,-readability-static-definition-in-anonymous-namespace,-readability-use-anyofallof src/lib/libndmIpSec.cpp -- -I "src" -I "/usr/lib/llvm-12/lib/clang/12.0.0/include" -DL10N_DOMAIN="\"IpSec\"" -DIDENT=\"lib::libndmIpSec\" -DNAMESPACE=\"lib\" -DNDM_CORE_MODULE_PDEP="\"libndmBridge libndmCore libndmInterface libndmIp\"" -DNDM_CORE_MODULE_LDEP="\"libndmBridge libndmCore libndmInterface libndmIp\"" -DNDM_CORE_MODULE_NAME=libndmIpSec -Isrc -Isrc/Base -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -DEVENT_DEBUG -DCLOUD_DEBUG -DUSE_NDM_NDSS -DNDM_PLATFORM_PC -DTARGET_VENDOR="\"NDM Systems, Inc.\"" -DTARGET_VENDOR_SHORT="\"NDM\"" -DTARGET_VENDOR_URL="\"http://www.ndmsystems.com\"" -DTARGET_DEVICE_MANUFACTURER="\"NDM Systems, Inc.\"" -DTARGET_MODEL_SERIES="\"\"" -DTARGET_VENDOR_EMAIL="\"info@ndmsystems.com\"" -DTARGET_CUSTOMER="\"NDM\"" -DTARGET_DEFAULT_PRODUCT="\"\"" -DTARGET_BOARD__="\"pc_ra\"" -DTARGET_FEATURES__="\"\"" -DNDM_VERSION="\"v3.06(AAA.0)A3\"" -DNDM_VERSION_EPOCH="\"3\"" -DNDM_VERSION_MAJOR="\"06\"" -DNDM_VERSION_MINOR="\"3\"" -DNDM_VERSION_STAGE="\"A\"" -DNDM_VERSION_MAINT="\"0\"" -DNDM_VERSION_EXACT="\"11-dd0c22a30\"" -DNDM_VERSION_CDATE="\"29 Oct 2020\"" -DBSP_VERSION_MAINT="\""0"\"" -DBSP_VERSION_BUILD="\""0"\"" -DBSP_VERSION_EXACT="\"\"" -DBSP_VERSION_CDATE="\"29 Oct 2020\"" -DNDM_DEVICE_ID=0x00000000 -DKERNEL_RELEASE="\"5.4.0-52-generic\"" -DFLASHFS="\"/flash\"" -DTMPFS="\"/tmp\"" -DSTORAGEFS="\"/storage\"" -DLIB_DIRECTORY="\"./lib\"" -DAMENDS_DIRECTORY="\"./amends\"" -DCA_CERTS_DIRECTORY="\"./ca-certificates\"" -DCA_CERTS_SIGN_DIRECTORY="\"./sign-ca-certificates\"" -DEULA_ROOT_DIRECTORY="\"./eula\"" -DDPN_ROOT_DIRECTORY="\"./dpn\"" -DNDM_ENV_PATH="\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:.\"" -DNDM_MODULES_PACK_NAME="\"\"" -DNDM_FEEDBACK="\"ndmf\"" -DNDM_CORE_SOCKET="\"/var/run/ndm.core.socket\"" -DNDM_FEEDBACK_SOCKET="\"/var/run/ndm.feedback.socket\"" -DNDM_FEEDBACK_PORT=41231 -DNDM_EVENT_SOCKET="\"/var/run/ndm.event.socket\"" -DNDM_SCGI_SOCKET="\"/var/run/ndm.scgi.socket\"" -DNDM_AUTH_SOCKET="\"/var/run/ndm.auth.socket\"" -DNDM_MOUNT_ROOT_PATH="\"/tmp/mnt\"" -DNDM_MODULES_PACK="\"\"" -ffunction-sections -fdata-sections -fvisibility-inlines-hidden -fno-implement-inlines -pthread -Werror -fno-exceptions -fno-rtti -std=c++11 -Wall -Waddress -Wcast-align -Wcast-qual -Wempty-body -Wformat -Wformat-security -Wformat=2 -Wframe-larger-than=262144 -Wignored-qualifiers -Winit-self -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wno-format-nonliteral -Wno-inline -Wnon-virtual-dtor -Woverloaded-virtual -Wparentheses -Wpointer-arith -Wredundant-decls -Wshadow -Wstack-protector -Wswitch-default -Wswitch-enum -Wtype-limits -Wundef -Wunreachable-code -Wunused -Wvla -Wwrite-strings -fasynchronous-unwind-tables -fno-common -fno-optimize-sibling-calls -fnon-call-exceptions -fstack-protector-all -ftabstop=4 -g3 -ggdb3 -pipe -W -Warc-maybe-repeated-use-of-weak -Warc-repeated-use-of-weak -Warray-bounds-pointer-arithmetic -Wassign-enum -Wbad-function-cast -Wbind-to-temporary-copy -Wbitfield-enum-conversion -Wc++-compat -Wc++11-compat -Wc++11-compat-pedantic -Wc++11-extra-semi -Wc++11-narrowing -Wc++14-binary-literal -Wc++14-extensions -Wc++17-extensions -Wchar-subscripts -Wclass-varargs -Wcomma -Wconditional-uninitialized -Wconsumed -Wdirect-ivar-access -Wdollar-in-identifier-extension -Wdouble-promotion -Wduplicate-enum -Wduplicate-method-arg -Wduplicate-method-match -Wembedded-directive -Wempty-translation-unit -Wexplicit-ownership-type -Wflexible-array-extensions -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wfor-loop-analysis -Wformat-non-iso -Wformat-pedantic -Wgcc-compat -Wglobal-constructors -Wgnu -Wheader-hygiene -Widiomatic-parentheses -Wimplicit-fallthrough-per-function -Wimplicit-retain-self -Winfinite-recursion -Winvalid-offsetof -Wkeyword-macro -Wlanguage-extension-token -Wloop-analysis -Wmethod-signatures -Wmicrosoft -Wmismatched-tags -Wmissing-braces -Wmissing-field-initializers -Wmissing-method-return-type -Wmissing-prototypes -Wmissing-variable-declarations -Wnon-virtual-dtor -Wnull-pointer-arithmetic -Wnullability-extension -Wnullable-to-nonnull-conversion -Wover-aligned -Woverlength-strings -Woverloaded-virtual -Woverriding-method-mismatch -Wpessimizing-move -Wrange-loop-analysis -Wredundant-move -Wredundant-parens -Wsection -Wself-move -Wsemicolon-before-method-body -Wsequence-point -Wshadow-all -Wshift-sign-overflow -Wsign-compare -Wsometimes-uninitialized -Wspir-compat -Wstrict-prototypes -Wstrict-selector-match -Wstring-conversion -Wsuper-class-method-mismatch -Wtautological-compare -Wthread-safety -Wundeclared-selector -Wundef -Wundefined-func-template -Wundefined-internal-type -Wundefined-reinterpret-cast -Wunguarded-availability -Wunguarded-availability-new -Wunneeded-internal-declaration -Wunneeded-member-function -Wunreachable-code-aggressive -Wunused -Wvector-conversion -Wvla -Wweak-template-vtables -Wno-c++98-compat-bind-to-temporary-copy -Wno-cast-align -Wno-global-constructors -Wno-gnu-anonymous-struct -Wno-gnu-folding-constant -Wno-gnu-zero-variadic-macro-arguments -Wno-implicit-fallthrough -Wno-keyword-macro -Wno-language-extension-token -Wno-missing-prototypes -Wno-shadow -Wno-unused-parameter -Wno-unused-result -Wno-zero-length-array 2>&1); err=$?; if [ $err -ne 0 ]; then echo "$out"; fi; exit $err) Segmentation fault (core dumped) PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace. Stack dump: