Hello, I'm working on a GCC patch that fixes the type of Ada functions that return their result by reference: the debugging information currently says they return a pointer to the result and my patch turns these into references. The intent is that when evaluating a call to such functions from debuggers, the returned value is automatically dereferenced: # Currently we have: (gdb) print my_function("foo") $1 = (access ...) 0x... # We would like to have instead: (gdb) print my_function("foo") $1 = Doing so in GDB is currently not possible when the referenced object type is dynamic. Indeed, the return value for such calls is not in memory and GDB considers reference types as dynamic iff the referenced type is dynamic. As a consequence, the type resolving process ends up trying to read memory at address 0x0, fails to do so and aborts printing the final value: # With my locally patched GCC, I have: (gdb) print my_function("foo") $1 = Cannot access memory at address 0x0 The attached patch fixes GDB so that the above works. It just makes GDB never consider reference types as dynamic (which makes sense per se IMHO) so this memory problem does not occurs. I tested this patch on x86_64-linux with C, C++, Ada, Fortran and Java compilers: it triggers no regression. Note that the testcase it adds (gdb.ada/funcall_ref.exp) cannot pass without my local GCC patch and relies on my previous submitted patch (https://www.sourceware.org/ml/gdb-patches/2015-03/msg00241.html). Ok to push? Thank you in advance! gdb/ChangeLog: 2015-03-10 Pierre-Marie de Rodat * gdbtypes.c (is_dynamic_type_internal): Remove special handling of TYPE_CODE_REF types so that they are not considered as dynamic depending on the referenced type. gdb/testsuite/ChangeLog: 2015-03-10 Pierre-Marie de Rodat * gdb.ada/funcall_ref.exp: New file. * gdb.ada/funcall_ref/foo.adb: New file. -- Pierre-Marie de Rodat