https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64654
Bug ID: 64654 Summary: problem of handling character arguments in parent of an 'entry' with fewer arguments leads at -O0 Product: gcc Version: 4.8.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: d.pashov at gmail dot com Created attachment 34474 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34474&action=edit test case Incorrect code is generated with -O0 or -fcheck=all for a subroutine having a character argument of passed length and which also contains entries with different (or fewer) arguments. Example test case is attached. The executable crashes with SIGSERV right after entering the entry, before the first executable statement in the entry. I suspect it tries to resolve the charater arguments of the parent subroutine routine which have their 'len' passed. It does not happen for other arguments or len=* or array arguments. Some samples are in the example file. The problem seemigly goes away for -O1 and higher optimisation levels if -fcheck=all is not used. While the program the works as expected it makes debugging inconvenient. I did check the f2008 standard carefully and came to the conclusion that the code is not doing anything in violation. I have found it on v4.8.1 and have the impresison that it did not exist some time before but could not find a working version (only tried 4.6). v4.8.3, v4.9.0 and 5.0 also have the bug. Results of running the code with varios configurations are in a comment in the attached file.