Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-28483

GDB crashes if boolean variable is uninitialized and not used

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • Not Evaluated
    • None
    • Qt Creator 8.0.2
    • Debugger
    • None
    • Linux/X11

    Description

      When I run the debugger on a C++ project, GDB crashes if one boolean variable has not been initialized upon declaration and is not used in the program, but I set a breakpoint before the 'cout'.

       

      The crash disappears if I either add CREATE_DICOMS to the std::cout line, even if it is uninitialized, or alternatively if I initialize the value upon declaration and do not use it later.

      In contrast, if I run gdb directly from command line, it works always. Here what it says at the breakpoint:

      (gdb) print CREATE_DICOMS
      $1 = <optimized out>
      (gdb) print CREATE_FOLDERS
      $2 = true
      

      So what I am thinking is that somehow this 'optimized out' result is not correctly being parsed by QtCreator and it leads to a crash.

      Here the reproducer code bth.cpp

      #include <iostream>
      
      int main(int argc, char** argv)
      {
       bool CREATE_FOLDERS=true;
       bool CREATE_DICOMS;
      
       std::cout << "Folders: " << CREATE_FOLDERS << std::endl;
       return 0;
      }
      

      And the CMakeLists:

      cmake_minimum_required(VERSION 3.10)
      project(raystretch-clinical LANGUAGES CXX)
      add_executable(bth bth.cpp)
      

      Attachments

        Activity

          People

            hjk hjk
            fmercury Ferdy Mercury
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: