boostorg / boostorg/cobalt

Access violation when returing object with specific layout on MSVC

Open
#172 16 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
347
Forks
47
Avg merge
3d 8h
Merged PRs (30d)
1

Description

Code:
```c++
#include
#include
#include

#include

namespace cobalt = boost::cobalt;

struct ExampleStruct
{
std::string str;
std::uint8_t padding[32];
};

cobalt::task getResult()
{
// error on this return
co_return {};
}

cobalt::main co_main(int /*argc*/, char** /*argv*/)
{
co_await getResult();
// Never displayed
std::puts("Done");
co_return 0;
}

```

Built on Windows 10 64-bit using MSVC 17.9.5 (cl version 19.39.33523 for x64) with following command:
```
cl /Femain.exe main.cpp /nologo /external:IC:\Users\chodorowskip\repo\deps\vc143\boost-1.85.0\include\boost-1_85 /std:c++20 /MD /Z7 /O2 /EHsc /D_WIN32_WINNT=0x0601 /W4 /external:W0 /link /PROFILE /LIBPATH:C:\Users\chodorowskip\repo\deps\vc143\boost-1.85.0\lib libboost_cobalt-vc143-mt-x64-1_85.lib
```

Error
```
Exception thrown at 0x00007FF728E265E1 in main.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
```

Error doesn't seem to happen with debug configuration.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.