https://bugs.kde.org/show_bug.cgi?id=527051

            Bug ID: 527051
           Summary: qproperty-type-mismatch segfaults when Q_PROPERTY is
                    expanded from inside another macro
    Classification: Developer tools
           Product: clazy
      Version First unspecified
       Reported In:
          Platform: Debian stable
                OS: Linux
            Status: REPORTED
          Severity: crash
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

Created attachment 197075
  --> https://bugs.kde.org/attachment.cgi?id=197075&action=edit
Repro for qproperty-type-mismatch segfault

DESCRIPTION

qproperty-type-mismatch segfaults when Q_PROPERTY is expanded from inside
another macro (see gadget.h in attached repro).

STEPS TO REPRODUCE
1. cmake -S . -B build
2. clazy-standalone -p build -checks=qproperty-type-mismatch t.cpp

OBSERVED RESULT

$ clazy-standalone --version
clazy version 1.18.0 (v1.17.1-66-g4100430f-dirty)
Debian LLVM version 19.1.7
  Optimized build.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7ced421 in QPropertyTypeMismatch::VisitMacroExpands(clang::Token
const&, clang::SourceRange const&, clang::MacroInfo const*) () from
.../lib/ClazyPlugin.so
(gdb) bt
#0  0x00007ffff7ced421 in QPropertyTypeMismatch::VisitMacroExpands(clang::Token
const&, clang::SourceRange const&, clang::MacroInfo const*) () from
.../lib/ClazyPlugin.so
#1  0x00007ffff7dc6621 in ClazyPreprocessorCallbacks::MacroExpands(clang::Token
const&, clang::MacroDefinition const&, clang::SourceRange, clang::MacroArgs
const*) ()
   from .../lib/ClazyPlugin.so
#2  0x00007ffff43e99b9 in ?? () from /lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#3  0x00007ffff440be8f in
clang::Preprocessor::HandleMacroExpandedIdentifier(clang::Token&,
clang::MacroDefinition const&) ()
   from /lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#4  0x00007ffff442b8e8 in clang::Preprocessor::HandleIdentifier(clang::Token&)
() from /lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#5  0x00007ffff442bd2d in clang::Preprocessor::Lex(clang::Token&) () from
/lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#6  0x00007ffff4418abf in clang::Preprocessor::Handle_Pragma(clang::Token&) ()
from /lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#7  0x00007ffff440bd73 in
clang::Preprocessor::HandleMacroExpandedIdentifier(clang::Token&,
clang::MacroDefinition const&) ()
   from /lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#8  0x00007ffff442b8e8 in clang::Preprocessor::HandleIdentifier(clang::Token&)
() from /lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#9  0x00007ffff442bd2d in clang::Preprocessor::Lex(clang::Token&) () from
/lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#10 0x00007ffff443af4d in ?? () from /lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#11 0x00007ffff4504554 in
clang::Parser::ExpectAndConsume(clang::tok::TokenKind, unsigned int,
llvm::StringRef) ()
   from /lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#12 0x00007ffff44779ad in
clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier,
clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&,
clang::ParsingDeclRAIIObject*) () from
/lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#13 0x00007ffff44791dd in
clang::Parser::ParseCXXClassMemberDeclarationWithPragmas(clang::AccessSpecifier&,
clang::ParsedAttributes&, clang::TypeSpecifierType, clang::Decl*) () from
/lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#14 0x00007ffff4473073 in
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) ()
from /lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#15 0x00007ffff4470c54 in
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&,
clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::ParsedAttributes&) ()
   from /lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#16 0x00007ffff4450248 in
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*,
clang::ImplicitTypenameContext) ()
   from /lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#17 0x00007ffff450a52f in
clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&,
clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) ()
from /lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#18 0x00007ffff450a25f in
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&,
clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) ()
from /lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#19 0x00007ffff450944c in
clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&,
clang::ParsedAttributes&, clang::ParsingDeclSpec*) () from
/lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#20 0x00007ffff45078d7 in
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&,
clang::Sema::ModuleImportState&) ()
   from /lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#21 0x00007ffff443457e in clang::ParseAST(clang::Sema&, bool, bool) () from
/lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#22 0x00007ffff6547779 in clang::FrontendAction::Execute() () from
/lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#23 0x00007ffff64b6074 in
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) ()
   from /lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#24 0x00007ffff674a615 in
clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>,
clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>,
clang::DiagnosticConsumer*) ()
   from /lib/x86_64-linux-gnu/libclang-cpp.so.19.1
--Type <RET> for more, q to quit, c to continue without paging--
#25 0x00007ffff674a393 in clang::tooling::ToolInvocation::runInvocation(char
const*, clang::driver::Compilation*,
std::shared_ptr<clang::CompilerInvocation>,
std::shared_ptr<clang::PCHContainerOperations>) ()
   from /lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#26 0x00007ffff6749127 in clang::tooling::ToolInvocation::run() () from
/lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#27 0x00007ffff674c44f in
clang::tooling::ClangTool::run(clang::tooling::ToolAction*) () from
/lib/x86_64-linux-gnu/libclang-cpp.so.19.1
#28 0x0000555555558609 in main ()
(gdb) 


EXPECTED RESULT

Not a crash.

SOFTWARE/OS VERSIONS
Operating System: Debian 13
Qt Version: 6.11.2

ADDITIONAL INFORMATION

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to