Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » MemorySanitizer: use-of-uninitialized-value in CoWork
MemorySanitizer: use-of-uninitialized-value in CoWork [message #52106] Fri, 19 July 2019 22:17 Go to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
Could you please apply a patch below to CoWork?
MemorySanitizer is complaining about uninitialized memory. Theoretically, default constructor of std::exception_ptr is supposed to initialized it, but practically I'm getting a warning.
The problem can be easily fixed.

diff --git a/uppsrc/Core/CoWork.cpp b/uppsrc/Core/CoWork.cpp
index 46e49dc15..abfbae2b8 100644
--- a/uppsrc/Core/CoWork.cpp
+++ b/uppsrc/Core/CoWork.cpp
@@ -113,7 +113,7 @@ void CoWork::Pool::DoJob(MJob& job)
        }
 
        lock.Leave();
-       std::exception_ptr exc;
+       std::exception_ptr exc = nullptr;
        try {
                if(looper)
                        work->looper_fn();
@@ -370,6 +370,7 @@ int CoWork::GetWorkerIndex()
 }
 
 CoWork::CoWork()
+: exc(nullptr)
 {
        LLOG("CoWork constructed " << FormatHex(this));
        todo = 0;

Patched file is attached.
  • Attachment: CoWork.cpp
    (Size: 7.33KB, Downloaded 158 times)


Regards,
Novo
Re: MemorySanitizer: use-of-uninitialized-value in CoWork [message #52108 is a reply to message #52106] Fri, 19 July 2019 23:50 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
This really feels like sanitizer bug, but whatever....
Re: MemorySanitizer: use-of-uninitialized-value in CoWork [message #52109 is a reply to message #52108] Sat, 20 July 2019 01:27 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
mirek wrote on Fri, 19 July 2019 17:50
This really feels like sanitizer bug, but whatever....

Thanks!

I do not think this is a bug. A team working on sanitizers is exceptionally good.
MemorySanitizer reports all uninitialized memory reads, including, for example, memmove and memcpy of uninitialized memory. This is not necessarily a bug, but this allows the sanitizer to be fast unlike valgrind.
The problem is that all sanitizers exit app on first detected error.


Regards,
Novo
Re: MemorySanitizer: use-of-uninitialized-value in CoWork [message #52110 is a reply to message #52109] Sat, 20 July 2019 08:56 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Novo wrote on Sat, 20 July 2019 01:27
mirek wrote on Fri, 19 July 2019 17:50
This really feels like sanitizer bug, but whatever....

Thanks!

I do not think this is a bug. A team working on sanitizers is exceptionally good.
MemorySanitizer reports all uninitialized memory reads, including, for example, memmove and memcpy of uninitialized memory. This is not necessarily a bug, but this allows the sanitizer to be fast unlike valgrind.
The problem is that all sanitizers exit app on first detected error.


Well, but obviously we are not doing anything bad here. So it must be either a bug in sanitizer or in standard library (or perhaps in compiler).

Mirek
Previous Topic: Sorting of strings is broken
Next Topic: Inconsistency between Vector and Index
Goto Forum:
  


Current Time: Thu Mar 28 10:45:55 CET 2024

Total time taken to generate the page: 0.00900 seconds