MSVC: error C4789: in function 'main' buffer '' of size 12 bytes will be overrun; 8 bytes will be written starting at offset 11

Open
#2,099 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
cpp
Domain
compilers

Research direction

Start with the minimal C++20 reproduction and the reported diagnostic at include\stdexec__detail__basic_sender.hpp line 443. Compile with MSVC 19.51.36244 using the listed flags, including -sdl, and compare the result with /w14789. Done means determining whether C4789 is a false positive and identifying the relevant behavior in stdexec.

Written by the indexing model from the issue text.

Description

Compiling the code below with latest MSVC (cl 19.51.36244) and the flags -std:c++20 -MD -O2 -Zc:__cplusplus -Zc:preprocessor -sdl gives the error:

include\stdexec\__detail\__basic_sender.hpp(443) : error C4789: in function 'main' buffer '' of size 12 bytes will be overrun; 8 bytes will be written starting at offset 11

It might be a false positive but I'm not sure and thought it might be worth reporting.

BTW: It's an error only because of -sdl and can be downgraded back to a warning with /w14789


#include <stdexec/execution.hpp>

using namespace stdexec;

auto main() -> int {
    auto work = just() | let_value([] { return just(); });
    sync_wait(just(uintptr_t{0})
              | let_value([unused_capture = 0, unused_capture2 = work](uintptr_t /*unused_value*/) { return just(); }));
}
Dominant language
C++
Stars
2.4k
Forks
270
Avg merge
2d 17h
Merged PRs (30d)
37

Contributor guide

No contributing guide indexed for this repository

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.

More from NVIDIA/stdexec

All issues in NVIDIA/stdexec

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.