Skip to content

[clang-tidy] bugprone-unchecked-optional-access aborted with some AOSP source files #57036

@chih-hung

Description

@chih-hung

This clang-tidy crash is reproducible with the latest clang-tidy source tree.
I found it when testing revision r468909.

The clang-tidy stack dump points to bugprone-unchecked-optional-access check.
If that check is disabled in the attached test.sh, clang-tidy will not abort.

To reproduce:

(1) unzip the attached test.zip file

(2) modify TIDY in test.sh to point to an clang-tidy built
from r461044 or newer, when the bugprone-unchecked-optional-access
check was added.

Note that attached test.i.cc is preprocessed from one of several
AOSP source files that have this problem.

The clang-tidy aborted with stack dump:

1.  <eof> parser at end of file
2.  ASTMatcher: Processing 'bugprone-unchecked-optional-access' against:
    FunctionDecl astc_codec::UnpackLogicalBlock : <device/generic/vulkan-cereal/third-party/astc-codec/src/decoder/logical_astc_block.cc:243:1, line:260:1>
--- Bound Nodes Begin --- 
    T - { RecordType : astc_codec::VoidExtentData 
    fun - { FunctionDecl astc_codec::UnpackLogicalBlock : <device/generic/vulkan-cereal/third-party/astc-codec/src/decoder/logical_astc_block.cc:243:1, line:260:1> }
--- Bound Nodes End ---

test.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang-tidyclang:dataflowClang Dataflow Analysis framework - https://clang.llvm.org/docs/DataFlowAnalysisIntro.htmlcrashPrefer [crash-on-valid] or [crash-on-invalid]

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions