Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-tidy crashes when running -dump-config on Windows #50876

Closed
zeroxia opened this issue Aug 19, 2021 · 5 comments
Closed

clang-tidy crashes when running -dump-config on Windows #50876

zeroxia opened this issue Aug 19, 2021 · 5 comments
Labels
bugzilla Issues migrated from bugzilla clang-tidy crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@zeroxia
Copy link

zeroxia commented Aug 19, 2021

Bugzilla Link 51534
Version unspecified
OS Windows NT

Extended Description

versions:

C:\temp>C:\opt\LLVM13\bin\clang-tidy --version
LLVM (http://llvm.org/):
LLVM version 13.0.0-rc1
Optimized build with assertions.
Default target: x86_64-pc-windows-msvc
Host CPU: skylake

C:\temp>C:\opt\LLVM12\bin\clang-tidy --version
LLVM (http://llvm.org/):
LLVM version 12.0.0
Optimized build.
Default target: x86_64-pc-windows-msvc
Host CPU: skylake

Crashes:

C:\temp>C:\opt\LLVM13\bin\clang-tidy -dump-config
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: C:\opt\LLVM13\bin\clang-tidy -dump-config
#​0 0x00007ff6828816df (C:\opt\LLVM13\bin\clang-tidy.exe+0x18516df)
#​1 0x00007ff682881989 (C:\opt\LLVM13\bin\clang-tidy.exe+0x1851989)
#​2 0x00007ff68288f20b (C:\opt\LLVM13\bin\clang-tidy.exe+0x185f20b)
#​3 0x00007ff68288f114 (C:\opt\LLVM13\bin\clang-tidy.exe+0x185f114)
#​4 0x00007ff6810506b5 (C:\opt\LLVM13\bin\clang-tidy.exe+0x206b5)
#​5 0x00007ff6811f04fe (C:\opt\LLVM13\bin\clang-tidy.exe+0x1c04fe)
#​6 0x00007ff6811e3c47 (C:\opt\LLVM13\bin\clang-tidy.exe+0x1b3c47)
#​7 0x00007ff68288d2b6 (C:\opt\LLVM13\bin\clang-tidy.exe+0x185d2b6)
#​8 0x00007ff68287618e (C:\opt\LLVM13\bin\clang-tidy.exe+0x184618e)
#​9 0x00007ff6828765e1 (C:\opt\LLVM13\bin\clang-tidy.exe+0x18465e1)
#​10 0x00007ff6810330f6 (C:\opt\LLVM13\bin\clang-tidy.exe+0x30f6)
#​11 0x00007ff6833b7d40 (C:\opt\LLVM13\bin\clang-tidy.exe+0x2387d40)
#​12 0x00007ff8c4f47034 (C:\Windows\System32\KERNEL32.DLL+0x17034)
#​13 0x00007ff8c6182651 (C:\Windows\SYSTEM32\ntdll.dll+0x52651)

C:\temp>C:\opt\LLVM12\bin\clang-tidy -dump-config
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: C:\opt\LLVM12\bin\clang-tidy -dump-config
#​0 0x00007ff6485dea3f (C:\opt\LLVM12\bin\clang-tidy.exe+0x12eea3f)
#​1 0x00007ff6485dec99 (C:\opt\LLVM12\bin\clang-tidy.exe+0x12eec99)
#​2 0x00007ff6485eaf45 (C:\opt\LLVM12\bin\clang-tidy.exe+0x12faf45)
#​3 0x00007ff647433b45 (C:\opt\LLVM12\bin\clang-tidy.exe+0x143b45)
#​4 0x00007ff64742c827 (C:\opt\LLVM12\bin\clang-tidy.exe+0x13c827)
#​5 0x00007ff6485e9636 (C:\opt\LLVM12\bin\clang-tidy.exe+0x12f9636)
#​6 0x00007ff6485d422e (C:\opt\LLVM12\bin\clang-tidy.exe+0x12e422e)
#​7 0x00007ff6485d45ce (C:\opt\LLVM12\bin\clang-tidy.exe+0x12e45ce)
#​8 0x00007ff6472f2f1e (C:\opt\LLVM12\bin\clang-tidy.exe+0x2f1e)
#​9 0x00007ff648fd7680 (C:\opt\LLVM12\bin\clang-tidy.exe+0x1ce7680)
#​10 0x00007ff8c4f47034 (C:\Windows\System32\KERNEL32.DLL+0x17034)
#​11 0x00007ff8c6182651 (C:\Windows\SYSTEM32\ntdll.dll+0x52651)

.clang-tidy file:

https://pastebin.com/9RJ3yLKC

Curiously, I use clangd on VS Code with this .clang-tidy file, there is no issue, and clang-tidy version 10 is also OK.

Content:


Checks: >
clang-analyzer-,
clang-diagnostic-
,

bugprone-argument-comment,
bugprone-assert-side-effect,
bugprone-bad-signal-to-kill-thread,
bugprone-bool-pointer-implicit-conversion,
bugprone-branch-clone,
bugprone-copy-constructor-init,
bugprone-dangling-handle,
bugprone-dynamic-static-initializers,
bugprone-exception-escape,
bugprone-fold-init-type,
bugprone-forward-declaration-namespace,
bugprone-forwarding-reference-overload,
bugprone-inaccurate-erase,
bugprone-incorrect-roundings,
bugprone-infinite-loop,
bugprone-integer-division,
bugprone-lambda-function-name,
bugprone-macro-parentheses,
bugprone-macro-repeated-side-effects,
bugprone-misplaced-operator-in-strlen-in-alloc,
bugprone-misplaced-widening-cast,
bugprone-move-forwarding-reference,
bugprone-multiple-statement-macro,
bugprone-narrowing-conversions,
bugprone-not-null-terminated-result,
bugprone-parent-virtual-call,
bugprone-posix-return,
bugprone-signed-char-misuse,
bugprone-sizeof-container,
bugprone-sizeof-expression,
bugprone-string-constructor,
bugprone-string-integer-assignment,
bugprone-string-literal-with-embedded-nul,
bugprone-suspicious-enum-usage,
bugprone-suspicious-memset-usage,
bugprone-suspicious-missing-comma,
bugprone-suspicious-semicolon,
bugprone-suspicious-string-compare,
bugprone-swapped-arguments,
bugprone-terminating-continue,
bugprone-throw-keyword-missing,
bugprone-too-small-loop-variable,
bugprone-undefined-memory-manipulation,
bugprone-undelegated-constructor,
bugprone-unhandled-self-assignment,
bugprone-unused-raii,
bugprone-unused-return-value,
bugprone-use-after-move,
bugprone-virtual-near-miss,

cppcoreguidelines-avoid-c-arrays,
cppcoreguidelines-avoid-goto,
-cppcoreguidelines-avoid-magic-numbers,
cppcoreguidelines-c-copy-assignment-signature,
cppcoreguidelines-explicit-virtual-functions,
cppcoreguidelines-init-variables,
cppcoreguidelines-interfaces-global-init,
cppcoreguidelines-macro-usage,
cppcoreguidelines-narrowing-conversions,
cppcoreguidelines-no-malloc,
cppcoreguidelines-non-private-member-variables-in-classes,
cppcoreguidelines-owning-memory,
-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-cstyle-cast,
cppcoreguidelines-pro-type-member-init,
cppcoreguidelines-pro-type-reinterpret-cast,
cppcoreguidelines-pro-type-static-cast-downcast,
cppcoreguidelines-pro-type-union-access,
cppcoreguidelines-pro-type-vararg,
cppcoreguidelines-slicing,
cppcoreguidelines-special-member-functions,

google-build-explicit-make-pair,
google-build-namespaces,
-google-build-using-namespace,
google-default-arguments,
google-explicit-constructor,
google-global-names-in-headers,
-google-objc-avoid-nsobject-new,
-google-objc-avoid-throwing-exception,
-google-objc-function-naming,
-google-objc-global-variable-declaration,
google-readability-braces-around-statements,
google-readability-casting,
google-readability-avoid-underscore-in-googletest-name,
-google-readability-todo,
google-runtime-int,
google-runtime-operator,
-google-runtime-references,
google-upgrade-googletest-case,

misc-definitions-in-headers,
misc-misplaced-const,
misc-new-delete-overloads,
misc-non-copyable-objects,
misc-non-private-member-variables-in-classes,
misc-redundant-expression,
misc-static-assert,
misc-throw-by-value-catch-by-reference,
misc-unconventional-assign-operator,
misc-uniqueptr-reset-release,
misc-unused-alias-decls,
-misc-unused-parameters,
misc-unused-using-decls,

modernize-avoid-bind,
modernize-avoid-c-arrays,
modernize-concat-nested-namespaces,
modernize-deprecated-headers,
modernize-deprecated-ios-base-aliases,
modernize-loop-convert,
modernize-make-shared,
modernize-make-unique,
modernize-pass-by-value,
modernize-raw-string-literal,
modernize-redundant-void-arg,
modernize-replace-auto-ptr,
modernize-replace-random-shuffle,
modernize-return-braced-init-list,
modernize-shrink-to-fit,
modernize-unary-static-assert,
modernize-use-auto,
modernize-use-bool-literals,
modernize-use-default-member-init,
modernize-use-emplace,
modernize-use-equals-default,
modernize-use-equals-delete,
modernize-use-nodiscard,
modernize-use-noexcept,
modernize-use-nullptr,
modernize-use-override,
-modernize-use-trailing-return-type,
modernize-use-transparent-functors,
modernize-use-uncaught-exceptions,
modernize-use-using,

performance-faster-string-find,
performance-for-range-copy,
performance-implicit-conversion-in-loop,
performance-inefficient-algorithm,
performance-inefficient-string-concatenation,
performance-inefficient-vector-operation,
performance-move-const-arg,
performance-move-constructor-init,
performance-noexcept-move-constructor,
performance-trivially-destructible,
performance-type-promotion-in-math-fn,
performance-unnecessary-copy-initialization,
performance-unnecessary-value-param,

readability-avoid-const-params-in-decls,
readability-braces-around-statements,
readability-const-return-type,
readability-container-size-empty,
readability-convert-member-functions-to-static,
readability-delete-null-pointer,
readability-deleted-default,
readability-else-after-return,
readability-function-size,
readability-identifier-naming,
readability-implicit-bool-conversion,
readability-inconsistent-declaration-parameter-name,
readability-isolate-declaration,
-readability-magic-numbers,
readability-make-member-function-const,
readability-misleading-indentation,
readability-misplaced-array-index,
readability-named-parameter,
readability-non-const-parameter,
readability-qualified-auto,
readability-redundant-access-specifiers,
readability-redundant-control-flow,
readability-redundant-declaration,
readability-redundant-function-ptr-dereference,
readability-redundant-member-init,
readability-redundant-preprocessor,
readability-redundant-smartptr-get,
readability-redundant-string-cstr,
readability-redundant-string-init,
readability-simplify-boolean-expr,
readability-simplify-subscript-expr,
readability-static-accessed-through-instance,
readability-static-definition-in-anonymous-namespace,
readability-string-compare,
readability-uniqueptr-delete-release,
readability-uppercase-literal-suffix,
hicpp-exception-baseclass,
hicpp-multiway-paths-covered

Turn all the warnings from the checks above into errors.

#WarningsAsErrors: '*'

HeaderFilterRegex: '.*'

AnalyzeTemporaryDtors: false

CheckOptions:

  • key: cppcoreguidelines-no-malloc.Allocations
    value: '::malloc;::calloc'
  • key: cppcoreguidelines-no-malloc.Deallocations
    value: '::free'
  • key: cppcoreguidelines-no-malloc.Reallocations
    value: '::realloc'
  • key: cppcoreguidelines-owning-memory.LegacyResourceConsumers
    value: '::free;::realloc;::freopen;::fclose'
  • key: cppcoreguidelines-owning-memory.LegacyResourceProducers
    value: '::malloc;::aligned_alloc;::realloc;::calloc;::fopen;::freopen;::tmpfile'
  • key: cppcoreguidelines-pro-bounds-constant-array-index.GslHeader
    value: ''
  • key: cppcoreguidelines-pro-bounds-constant-array-index.IncludeStyle
    value: '0'
  • key: cppcoreguidelines-pro-type-member-init.IgnoreArrays
    value: '0'
  • key: cppcoreguidelines-special-member-functions.AllowMissingMoveFunctions
    value: '1'
  • key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
    value: '1'
  • key: google-readability-braces-around-statements.ShortStatementLines
    value: '1'
  • key: google-readability-function-size.StatementThreshold
    value: '800'
  • key: google-readability-namespace-comments.ShortNamespaceLines
    value: '10'
  • key: google-readability-namespace-comments.SpacesBeforeComments
    value: '2'
  • key: modernize-loop-convert.MaxCopySize
    value: '16'
  • key: modernize-loop-convert.MinConfidence
    value: reasonable
  • key: modernize-loop-convert.NamingStyle
    value: CamelCase
  • key: modernize-pass-by-value.IncludeStyle
    value: llvm
  • key: modernize-replace-auto-ptr.IncludeStyle
    value: llvm
  • key: modernize-use-nullptr.NullMacros
    value: 'NULL'
  • key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic¶
    value: 'true'
  • key: misc-non-private-member-variables-in-classes.IgnorePublicMemberVariables¶
    value: 'true'
  • key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
    value: 'true'
    ...
@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
@EugeneZelenko EugeneZelenko added bug Indicates an unexpected problem or unintended behavior platform:windows labels Jan 18, 2022
@llvmbot
Copy link
Collaborator

llvmbot commented Jan 18, 2022

@llvm/issue-subscribers-bug

@sweemer
Copy link

sweemer commented Jan 21, 2022

I get this as well with clang-tidy 14 on Ubuntu 18.04 LTS

$ clang-tidy --version
Ubuntu LLVM version 14.0.0

  Optimized build.
  Default target: x86_64-pc-linux-gnu
  Host CPU: sandybridge
$ clang-tidy -dump-config
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: clang-tidy -dump-config
 #0 0x00007f8da4db0e41 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe2be41)
 #1 0x00007f8da4daeb8e llvm::sys::RunSignalHandlers() (/usr/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe29b8e)
 #2 0x00007f8da4db137b (/usr/lib/x86_64-linux-gnu/libLLVM-14.so.1+0xe2c37b)
 #3 0x00007f8dadfb7980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
 #4 0x0000000000a6f3a9 (/usr/lib/llvm-14/bin/clang-tidy+0xa6f3a9)
 #5 0x0000000000a6f716 (/usr/lib/llvm-14/bin/clang-tidy+0xa6f716)
 #6 0x0000000000a6de8a (/usr/lib/llvm-14/bin/clang-tidy+0xa6de8a)
 #7 0x0000000000a6dd23 (/usr/lib/llvm-14/bin/clang-tidy+0xa6dd23)
 #8 0x00000000008d10fa (/usr/lib/llvm-14/bin/clang-tidy+0x8d10fa)
 #9 0x00000000008d529a (/usr/lib/llvm-14/bin/clang-tidy+0x8d529a)
#10 0x0000000000708c44 (/usr/lib/llvm-14/bin/clang-tidy+0x708c44)
#11 0x0000000000a6e764 (/usr/lib/llvm-14/bin/clang-tidy+0xa6e764)
#12 0x0000000000a5f1fa (/usr/lib/llvm-14/bin/clang-tidy+0xa5f1fa)
#13 0x0000000000460b9e _init (/usr/lib/llvm-14/bin/clang-tidy+0x460b9e)
#14 0x00007f8da31f2bf7 __libc_start_main /build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:344:0
#15 0x000000000045d16a _init (/usr/lib/llvm-14/bin/clang-tidy+0x45d16a)
segmentation fault (core dumped)

@amurzeau
Copy link
Contributor

amurzeau commented Mar 6, 2022

I got this segfault too and in my case it seemed caused by an invalid config in .clang-tidy.
I "fixed" it by removing an invalid key in CheckOptions in .clang-tidy, maybe you have an invalid key too ?

@sweemer
Copy link

sweemer commented Mar 6, 2022

@amurzeau Thanks for the info. As far as I can recall, I did not have a preexisting .clang-tidy file - I was trying to produce a new one by running clang-tidy -dump-config.

I just tried again with clang-tidy 15.0.0 and the error has gone away, so I presume that the underlying issue is now fixed.

@EugeneZelenko EugeneZelenko added crash Prefer [crash-on-valid] or [crash-on-invalid] and removed bug Indicates an unexpected problem or unintended behavior labels Sep 3, 2022
@PiotrZSL PiotrZSL self-assigned this Mar 24, 2023
@PiotrZSL
Copy link
Member

@PiotrZSL PiotrZSL added the awaiting-review Has pending Phabricator review label Mar 24, 2023
@PiotrZSL PiotrZSL removed their assignment Apr 15, 2023
@PiotrZSL PiotrZSL removed the awaiting-review Has pending Phabricator review label Apr 15, 2023
flemairen6 pushed a commit to Xilinx/llvm-project that referenced this issue May 10, 2023
Fixes a crash in dump-config when checks emit warnings trying to read the config

Fixes llvm#50876

Co-authored-by: Piotr Zegar <me@piotrzegar.pl>

Reviewed By: PiotrZSL

Differential Revision: https://reviews.llvm.org/D148436
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang-tidy crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
Development

No branches or pull requests

6 participants