Hello world, the attached patch fixes PR 90813, a regression with proc pointers. The problem was quite complex, and I'd like to thank the people who helped debug this; the most important clue came from Richard. The problem was that, for a procedure pointer variable declared in a module in the same file, we were using a different backend decl in the module than in the main program. This led to the later parts of the compiler to think that the procedure pointer was actually two variables which could not alias. Optimization on some architectures such as Aarch64 and POWER (but not on x86_64) then led to reordering of stores, leading to a segfault. The solution is to put the mangled names into the global variable table, and to look for it when getting its backend declaration. While debugging it, I also put in an option to dump the global symbol table to standard output. I have included this in this patch because I think this may not be the last bug in that area :-) Regression-tested on powerpc64le-unknown-linux-gnu, where the segfault showed up. No test case because is is already in the test suite. Doc changes checked with "make dvi" and "make pdf". OK for trunk? Regards Thomas 2019-07-28 Thomas Koenig PR fortran/90813 * dump-parse-tree.c (show_global_symbol): New function. (gfc_dump_global_symbols): New function. * gfortran.h (gfc_traverse_gsymbol): Add prototype. (gfc_dump_global_symbols): Likewise. * invoke.texi: Document -fdump-fortran-global. * lang.opt: Add -fdump-fortran-global. * parse.c (gfc_parse_file): Handle flag_dump_fortran_global. * symbol.c (gfc_traverse_gsymbol): New function. * trans-decl.c (sym_identifier): New function. (mangled_identifier): New function, doing most of the work of gfc_sym_mangled_identifier. (gfc_sym_mangled_identifier): Use mangled_identifier. Add mangled identifier to global symbol table. (get_proc_pointer_decl): Use backend decl from global identifier if present.