Thomas Koenig wrote:
One thing that you can do is to change this to + if (unlikely(source->base_addr == NULL)) + return NULL; to minimize the runtime impact.
As Jakub already wrote in his reply, the middle end already assumes the condition as unlikely.
(The middle end always does so for "== NULL" – whether it should is another question.)
As for a test case, a lot of test cases in class_optional_2.f90 are commented out. Some of these could probably be uncommented now, but it is not too urgent now.
Good point! I think we should do it now – otherwise, we will forget it. (But one should test using valgrind whether it really works or only accidentally.)
Tobias