vecmem icon indicating copy to clipboard operation
vecmem copied to clipboard

Memory Resources Shouldn't Return `nullptr` (2024.08.08.)

Open krasznaa opened this issue 6 months ago • 0 comments

@stephenswat brought this up in the past, at which point I admittedly didn't pay maybe enough attention to it. But now, at least with a recent oneAPI / clang version, I bumped into this error:

[ RUN      ] core_memory_resource_tests/memory_resource_test_basic.allocations/host_resource
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/memory_resource:122:7: runtime error: null pointer returned from function declared to never return null
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/memory_resource:121:20: note: returns_nonnull attribute specified here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/memory_resource:122:7 
[       OK ] core_memory_resource_tests/memory_resource_test_basic.allocations/host_resource (0 ms)

We'll need to go through all memory resources, and make sure that they consistently throw std::bad_alloc when something goes wrong... :thinking:

krasznaa avatar Aug 08 '24 07:08 krasznaa