runtime error when compiled with -fsanitize=undefined

20 views
Skip to first unread message

yakup....@gmail.com

unread,
Jul 14, 2022, 7:36:38 PM7/14/22
to UPC++
Hi,

when I compile my program that uses sequential backend of upcxx with undefined behaviour sanitizer on gcc 11 and upcxx 2022.03.0, I get the following runtime error:

/usr/local/include/upcxx/lpc_dormant.hpp:248:22: runtime error: member call on null pointer of type 'struct persona_tls'
/usr/local/include/upcxx/persona.hpp:720:18: runtime error: reference binding to null pointer of type 'struct persona_tls'

I don't use personas in my code. No upcxx::persona appears in my code, so I wanted to ask is this runtime error known already? What could may have caused it any ideas?

Thanks in advance,
Yakup

yakup....@gmail.com

unread,
Jul 14, 2022, 7:37:24 PM7/14/22
to UPC++
Also I want to mention that my program runs without any issues until the end and terminates without a problem

15 Temmuz 2022 Cuma tarihinde saat 01:36:38 UTC+2 itibarıyla yakup....@gmail.com şunları yazdı:

Colin MacLean

unread,
Jul 14, 2022, 8:07:43 PM7/14/22
to yakup....@gmail.com, UPC++
Hi Yakup,

This appears to be a bug in GCC's sanitizer. The the_persona_tls in is a global __thread storage duration variable where basically all the internal thread-local stuff is kept within the runtime. The address of the_persona_tls cannot be null but the sanitizer is reporting that *this is forming a reference to a null pointer, which cannot be correct. This probably has something to do with it being thread local storage making GCC confused.

Although this particular instance is erroneous, UPC++ also relies on known-to-work behavior that's UB according to the C++ standard, such as converting function pointers to and from uintptr_t. We try to avoid UB whenever possible, but there are some things we need to do that the standard doesn't have a mechanism for. Running a UB sanitizer isn't something I'd expect to work with UPC++.

-Colin MacLean

--
You received this message because you are subscribed to the Google Groups "UPC++" group.
To unsubscribe from this group and stop receiving emails from it, send an email to upcxx+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/upcxx/6193238c-2b52-41f0-909e-dfa50a1ec2dbn%40googlegroups.com.

yakup....@gmail.com

unread,
Jul 14, 2022, 8:29:36 PM7/14/22
to UPC++
I see, thanks for the clarification. I wanted to try it as I have a bug that appears only with high node counts >=32, and only when the code is optimized. So I wanted to check for undefined behaviors with some tools. Then I am guessing other tools like memory sanitizer or callgrind could help much, am I right?


15 Temmuz 2022 Cuma tarihinde saat 02:07:43 UTC+2 itibarıyla ColinMacLean şunları yazdı:

Dan Bonachea

unread,
Jul 14, 2022, 8:54:37 PM7/14/22
to yakup....@gmail.com, UPC++
Hi Yakup -

Please have a look at our debugging recommendations document:

https://bitbucket.org/berkeleylab/upcxx/wiki/docs/debugging.md

this includes instructions on using UPC++ with Valgrind, which can sometimes find memory errors for you.
However there are some fundamental limitations to that approach in a multi-process job (also documented there).

Hope this helps..
-D

Reply all
Reply to author
Forward
0 new messages