diff options
author | Martin Liska <mliska@suse.cz> | 2019-02-04 13:20:59 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2019-02-04 12:20:59 +0000 |
commit | fcd698d713c9864cd17b3df3272d0cc99d4a07fe (patch) | |
tree | 14213508dcff90061b5eefdd5e7a24364174200f /gcc/fortran/scanner.c | |
parent | 1d546c60983797f7090739e50d4bbccc95515d34 (diff) | |
download | gcc-fcd698d713c9864cd17b3df3272d0cc99d4a07fe.zip gcc-fcd698d713c9864cd17b3df3272d0cc99d4a07fe.tar.gz gcc-fcd698d713c9864cd17b3df3272d0cc99d4a07fe.tar.bz2 |
Report error when -fpre-include can't be opened (PR fortran/88912).
2019-02-04 Martin Liska <mliska@suse.cz>
PR fortran/88912
* scanner.c (load_file): Report error for -fpre-include
file and do not ICE.
From-SVN: r268517
Diffstat (limited to 'gcc/fortran/scanner.c')
-rw-r--r-- | gcc/fortran/scanner.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index efb6ebf..08e4521 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); |