Running ./f951 -quiet ^D crashes in gfc_create_decls: /* Build our translation-unit decl. */ current_translation_unit = build_translation_unit_decl (get_identifier (main_input_filename)); because main_input_filename is null in this case. We can fix it like below, where main_input_filename will be set to "".
Bootstrapped/regtested on x86_64-linux, ok for trunk? 2018-05-10 Marek Polacek <pola...@redhat.com> PR fortran/85735 * options.c (gfc_post_options): Set main_input_filename. diff --git gcc/fortran/options.c gcc/fortran/options.c index 1405f1cf008..3c17a583f62 100644 --- gcc/fortran/options.c +++ gcc/fortran/options.c @@ -313,6 +313,7 @@ gfc_post_options (const char **pfilename) if (gfc_current_form == FORM_UNKNOWN) { gfc_current_form = FORM_FREE; + main_input_filename = filename; gfc_warning_now (0, "Reading file %qs as free form", (filename[0] == '\0') ? "<stdin>" : filename); } Marek