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

            Bug ID: 502458
           Summary: crash in qstring-comparison-to-implicit-char
    Classification: Developer tools
           Product: clazy
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: unassigned-b...@kde.org
          Reporter: mar...@coopmasters.de
                CC: smart...@kde.org
  Target Milestone: ---

SUMMARY


STEPS TO REPRODUCE
1. create a minimal project
main.cpp
~~~~
#include <QByteArray>
#include <QString>

int main() {
    QByteArray ba = "this is a qbytearray";
    if ((ba == QStringLiteral("windows_generic_MSG")))
    {
        return 1;
    }

    return 0;
}
~~~~
and this CMakeLists.txt
~~~~
cmake_minimum_required(VERSION 3.29)
project(clazyerror)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if(CMAKE_EXPORT_COMPILE_COMMANDS)
    set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES
${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
endif()
set(CMAKE_CXX_STANDARD 17)
find_package(Qt5Core REQUIRED)

add_executable(clazyerror main.cpp)
target_link_libraries(clazyerror Qt5::Core)
~~~


2. 
3. 

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: qt5-base 5.15.16+kde+r130-4 ( archlinux)

ADDITIONAL INFORMATION
Stack trace:
<unknown> 0x00007fffea4a5624
QStringComparisonToImplicitChar::VisitStmt
qstring-comparison-to-implicit-char.cpp:45
ClazyASTConsumer::VisitStmt Clazy.cpp:149
ClazyASTConsumer::HandleTranslationUnit Clazy.cpp:168
main ClazyStandaloneMain.cpp:216


First commit with this crash: 
commit 215b2ca9e187d638d153bbeccdab8bf82f536e2b
Author: Alexander Lohnau <alexander.loh...@gmx.de>
Date:   Mon Dec 23 10:31:20 2024 +0100

    Optimize more codepaths to use operator enum instead of string comparisons

    This is a small optimization, but checking the operator costs 1/10 of the
time of a string comparison.
    Especially for the often used Utils and level0 check, this is sensible
    to have.

 LLVM (version: 19.1.7)

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

Reply via email to