Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple mismatched-new-delete warnings with gcc 11.3 and -Wall #7

Open
jsaf0 opened this issue Jun 29, 2023 · 4 comments
Open

Multiple mismatched-new-delete warnings with gcc 11.3 and -Wall #7

jsaf0 opened this issue Jun 29, 2023 · 4 comments

Comments

@jsaf0
Copy link

jsaf0 commented Jun 29, 2023

When building latest master (53fded2) with gcc 11.3 (Ubuntu 22.04) and -Wall, the compiler complains about mismatched new-delete warnings. See snippet below:

/home/jfp/async/test/async_for.cpp: In function ‘boost::async::generator<int> test_data_gen()’:
/home/jfp/async/test/async_for.cpp:30:1: warning: ‘static void boost::async::promise_memory_resource_base::operator delete(void*, std::size_t)’ called on pointer returned from a mismatched allocation function [-Wmismatched-new-delete]
   30 | }

Is this warning safe to ignore?

@jsaf0
Copy link
Author

jsaf0 commented Jun 30, 2023

FYI, gcc 13.0.1 does not give the same warnings.

@klemens-morgenstern
Copy link
Collaborator

From what I remember yes, but you might want to run the tests with the address sanitizer before using it in prod.

If this is an error (be it in the compiler), I can just remove the alloc-optimizations on that version.

@jsaf0
Copy link
Author

jsaf0 commented Jun 30, 2023

No errors from building and running the unit tests with address sanitizer enabled - both on gcc 11.3.0 and gcc 13.0.1. So assume it's safe to ignore for now.

My previous comment from before that gcc 13.0.1 doesn't complain about mismatched-new-delete was not correct. When building in "debug mode" with CMake, it still spits out all these warnings. So it would definitely be nice to find a fix in order to avoid disabling this warning for all code.

@klemens-morgenstern
Copy link
Collaborator

I am pinning this because it'll come up again. This is safe, the gcc warnign is a false positive. It machtes the new & delete function signatures, and they don't match for coroutine allocations.

@klemens-morgenstern klemens-morgenstern pinned this issue Aug 24, 2023
@pdimov pdimov unpinned this issue Oct 17, 2023
@pdimov pdimov pinned this issue Oct 17, 2023
klemens-morgenstern added a commit that referenced this issue Oct 18, 2023
```
In file included from libs\cobalt\test\strand.cpp:8:
In file included from .\boost/asio/strand.hpp:582:
In file included from .\boost/asio/io_context_strand.hpp:25:
.\boost/asio/detail/strand_service.hpp(112,15): warning: private field 'io_context_' is not used [-Wunused-private-field]
  io_context& io_context_;
              ^
fatal error: error in backend: failed to perform tail call elimination on a call site marked musttail
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: clang-cl.exe --target=i386-pc-windows-msvc libs\\cobalt\\test\\strand.cpp -c -Fobin.v2\\libs\\cobalt\\test\\strand.test\\clang-win-16.0.6\\debug\\address-model-32\\cxxstd-20-iso\\threading-multi\\strand.obj -TP /EHs /std:c++20 /GR /Z7 /Od /Ob0 /W3 /MDd -DBOOST_ALL_NO_LIB=1 -DBOOST_ASIO_NO_DEPRECATED -DBOOST_COBALT_USE_STD_PMR=1 -DWIN32_LEAN_AND_MEAN -I.
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module 'libs\cobalt\test\strand.cpp'.
4.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@"?do_the_thing@@ya?AU?$promise@X@cobalt@boost@@XZ.resume"'
Exception Code: 0xE0000046
 #0 0x00007ffa840df1ac (C:\Windows\System32\KERNELBASE.dll+0x3f1ac)
 #1 0x00007ff6dde95afa C:\Program Files\LLVM\bin\clang-cl.exe 0x625afa C:\Program Files\LLVM\bin\clang-cl.exe 0x64fbc9
 #2 0x00007ff6dde95afa C:\Program Files\LLVM\bin\clang-cl.exe 0xa731 C:\Program Files\LLVM\bin\clang-cl.exe 0x626b2c
 #3 0x00007ff6dde95afa C:\Program Files\LLVM\bin\clang-cl.exe 0x6269f5 C:\Program Files\LLVM\bin\clang-cl.exe 0x2569828
 #4 0x00007ff6dde95afa C:\Program Files\LLVM\bin\clang-cl.exe 0x23634ef C:\Program Files\LLVM\bin\clang-cl.exe 0x2386421
 #5 0x00007ff6dde95afa C:\Program Files\LLVM\bin\clang-cl.exe 0x236b068 C:\Program Files\LLVM\bin\clang-cl.exe 0x23558ae
 #6 0x00007ff6dde95afa C:\Program Files\LLVM\bin\clang-cl.exe 0x2348a18 C:\Program Files\LLVM\bin\clang-cl.exe 0x1d856b6
 #7 0x00007ff6dde95afa C:\Program Files\LLVM\bin\clang-cl.exe 0x1d8512e C:\Program Files\LLVM\bin\clang-cl.exe 0x1d830cd
 #8 0x00007ff6dde95afa C:\Program Files\LLVM\bin\clang-cl.exe 0x12fbc5c C:\Program Files\LLVM\bin\clang-cl.exe 0x8bd7cd
 #9 0x00007ff6dde95afa C:\Program Files\LLVM\bin\clang-cl.exe 0x3dd07a C:\Program Files\LLVM\bin\clang-cl.exe 0x3e2d63
#10 0x00007ff6dde95afa C:\Program Files\LLVM\bin\clang-cl.exe 0x3dd6f3 C:\Program Files\LLVM\bin\clang-cl.exe 0x17efdbf
#11 0x00007ff6dde95afa C:\Program Files\LLVM\bin\clang-cl.exe 0x1b82a63 C:\Program Files\LLVM\bin\clang-cl.exe 0x33b032b
#12 0x00007ff6dde95afa C:\Program Files\LLVM\bin\clang-cl.exe 0x1aed942 C:\Program Files\LLVM\bin\clang-cl.exe 0x79fbbd
#13 0x00007ff6dde95afa C:\Program Files\LLVM\bin\clang-cl.exe 0x8360de C:\Program Files\LLVM\bin\clang-cl.exe 0xa131
#14 0x00007ff6dde95afa C:\Program Files\LLVM\bin\clang-cl.exe 0x5504 C:\Program Files\LLVM\bin\clang-cl.exe 0x18d41a6
#15 0x00007ff6dde95afa C:\Program Files\LLVM\bin\clang-cl.exe 0x625a15 C:\Program Files\LLVM\bin\clang-cl.exe 0x18d3993
#16 0x00007ff6dde95afa C:\Program Files\LLVM\bin\clang-cl.exe 0x75a1f5 C:\Program Files\LLVM\bin\clang-cl.exe 0x75a53e
#17 0x00007ff6dde95afa C:\Program Files\LLVM\bin\clang-cl.exe 0x777adb C:\Program Files\LLVM\bin\clang-cl.exe 0x4ab7
#18 0x00007ff6dde95afa C:\Program Files\LLVM\bin\clang-cl.exe 0x4626ac0 (C:\Program Files\LLVM\bin\clang-cl.exe+0x625afa)
#19 0x00007ff6dde95afa
#20 0x00007ff6dde95afa (C:\Program Files\LLVM\bin\clang-cl.exe+0x625afa)
0x00007FFA840DF1AC, C:\Windows\System32\KERNELBASE.dll(0x00007FFA840A0000) + 0x3F1AC byte(s), RaiseException() + 0x6C byte(s)
0x00007FF6DDE95AFA, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x625AFA byte(s)
0x00007FF6DDEBFBC9, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x64FBC9 byte(s)
0x00007FF6DD87A731, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0xA731 byte(s)
0x00007FF6DDE96B2C, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x626B2C byte(s)
0x00007FF6DDE969F5, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x6269F5 byte(s)
0x00007FF6DFDD9828, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x2569828 byte(s)
0x00007FF6DFBD34EF, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x23634EF byte(s)
0x00007FF6DFBF6421, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x2386421 byte(s)
0x00007FF6DFBDB068, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x236B068 byte(s)
0x00007FF6DFBC58AE, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x23558AE byte(s)
0x00007FF6DFBB8A18, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x2348A18 byte(s)
0x00007FF6DF5F56B6, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x1D856B6 byte(s)
0x00007FF6DF5F512E, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x1D8512E byte(s)
0x00007FF6DF5F30CD, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x1D830CD byte(s)
0x00007FF6DEB6BC5C, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x12FBC5C byte(s)
0x00007FF6DE12D7CD, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x8BD7CD byte(s)
0x00007FF6DDC4D07A, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x3DD07A byte(s)
0x00007FF6DDC52D63, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x3E2D63 byte(s)
0x00007FF6DDC4D6F3, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x3DD6F3 byte(s)
0x00007FF6DF05FDBF, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x17EFDBF byte(s)
0x00007FF6DF3F2A63, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x1B82A63 byte(s)
0x00007FF6E0C2032B, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x33B032B byte(s)
0x00007FF6DF35D942, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x1AED942 byte(s)
0x00007FF6DE00FBBD, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x79FBBD byte(s)
0x00007FF6DE0A60DE, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x8360DE byte(s)
0x00007FF6DD87A131, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0xA131 byte(s)
0x00007FF6DD875504, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x5504 byte(s)
0x00007FF6DF1441A6, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x18D41A6 byte(s)
0x00007FF6DDE95A15, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x625A15 byte(s)
0x00007FF6DF143993, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x18D3993 byte(s)
0x00007FF6DDFCA1F5, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x75A1F5 byte(s)
0x00007FF6DDFCA53E, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x75A53E byte(s)
0x00007FF6DDFE7ADB, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x777ADB byte(s)
0x00007FF6DD874AB7, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x4AB7 byte(s)
0x00007FF6E1E96AC0, C:\Program Files\LLVM\bin\clang-cl.exe(0x00007FF6DD870000) + 0x4626AC0 byte(s)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants