https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119101
Bug ID: 119101 Summary: Function compiled with Gflortran appears to produce a pointer that points at itself. Product: gcc Version: 13.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: David.Applegate at global dot amentum.com Target Milestone: --- Created attachment 60646 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60646&action=edit Source file This bug occurs on gfortran 13.2 and 14.2, but not 7.3, 8.5 or 11.5 OS was Oracle Linux 8 and Oracle Linux 9. One of the modules in the fortran code has two return functions: getBC at line 142 and getBC2 at line 165. As far as I can tell these should produce identical results, but you will see from the program output that they do not. Running ddd I was able to see that a circular pointer reference was created at line 97 for the incorrect output. I think the fortran I have written is valid, but even if not, ideally some sort of compilation error when compiled or a runtime error when run would be handy. It took me a long time to track down the issue. This is the compiler version output: COLLECT_GCC=/project/connectflow/gcc/linux64-13.2.0/bin/gcc COLLECT_LTO_WRAPPER=/export/project/connectflow/gcc/linux64-13.2.0/bin/../libexec/gcc/x86_64-pc-linux-gnu/13.2.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-13.2.0/configure --prefix=/users/davida/SOFTWARE/gcc-13.2.0_install/ --disable-multilib --enable-languages=c,c++,fortran Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.2.0 (GCC) This is the compilation command (-save-temps was tried but didn't produce anything): (base) [davida@ada ~]$ /project/connectflow/gcc/linux64-13.2.0/bin/gfortran -Wall -Wextra -fsanitize=address,undefined -fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations test.f90 No output was produced to the terminal. This was the output when the program was run: (base) [davida@ada ~]$ ./a.out DIRICHLET DEFAULT DEFAULT DEFAULT