From: Martin Liska Date: Mon, 4 Feb 2019 12:20:59 +0000 (+0100) Subject: Report error when -fpre-include can't be opened (PR fortran/88912). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fcd698d713c9864cd17b3df3272d0cc99d4a07fe;p=gcc.git Report error when -fpre-include can't be opened (PR fortran/88912). 2019-02-04 Martin Liska PR fortran/88912 * scanner.c (load_file): Report error for -fpre-include file and do not ICE. From-SVN: r268517 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 6f0e9e69495..c3b4a5c0ff6 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2019-02-04 Martin Liska + + PR fortran/88912 + * scanner.c (load_file): Report error for -fpre-include + file and do not ICE. + 2019-02-02 Dominique d'Humieres PR fortran/81344 diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index efb6ebf9509..08e4521a86d 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -2478,8 +2478,14 @@ load_file (const char *realfilename, const char *displayedname, bool initial) input = gfc_open_included_file (realfilename, false, false); if (input == NULL) { - fprintf (stderr, "%s:%d: Error: Can't open included file '%s'\n", - current_file->filename, current_file->line, filename); + /* For -fpre-include file, current_file is NULL. */ + if (current_file) + fprintf (stderr, "%s:%d: Error: Can't open included file '%s'\n", + current_file->filename, current_file->line, filename); + else + fprintf (stderr, "Error: Can't open pre-included file '%s'\n", + filename); + return false; } stat_result = stat (realfilename, &st);