microsoft / microsoft/vscode-cpptools

Stepping over std::vector<std::string> v{""} with g++-12 incorrect jumps to the end of the function

Open
#11,987 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug debugger help wanted
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and version: Ubuntu22
  • VS Code: latest
  • C/C++ extension: latest
  • GDB / LLDB version: gdb 12.1 (also repros with 13).
Bug Summary and Steps to Reproduce
  1. Use C++ code
#include <vector>
#include <string>
int main()
{
    std::vector<std::string> v{""};
    return 0;
}
  1. Put a breakpoint on the std::vector line and use F5.
  2. Choose to compile with the g++-12 compiler -- it doesn't repro if you switch to g++-11.
  3. Step over the std::vector function.

Bug: The stepping jumps to the bottom of the function instead of going to the next line. This occurs if additional lines of code are added as well. Stepping an extra time goes to the next line (return 0).

image
Debugger Configurations
{
  "tasks": [
    {
      "type": "cppbuild",
      "label": "C/C++: g++-12 build active file",
      "command": "/usr/bin/g++-12",
      "args": [
        "-fdiagnostics-color=always",
        "-g",
        "${file}",
        "-o",
        "${fileDirname}/${fileBasenameNoExtension}"
      ],
      "options": {
        "cwd": "${fileDirname}"
      },
      "problemMatcher": [
        "$gcc"
      ],
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "detail": "Task generated by Debugger."
    }
  ],
  "version": "2.0.0"
}

launch.json is the default generated with F5.
Debugger Logs
...
Other Extensions

No response

Additional Information

I didn't find this bug -- it was found by an "internal team".

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named. Reproduce the behavior with the supplied C++ program, g++-12, GDB 12.1 or 13, and the shown build task and default launch.json; compare it with g++-11. Done means stepping over the vector initialization reaches the next source line correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.