diff options
author | Richard Biener <rguenther@suse.de> | 2015-04-09 13:37:53 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2015-04-09 13:37:53 +0000 |
commit | ca708025539dace762e23c1a5f97570a51020fc3 (patch) | |
tree | 9b4cb58f256db16c052fce0ddfa2a7b083ddbac8 /libcpp/files.c | |
parent | 3184f36f4f6fa41fe94afe42f11cc0c4c01c5478 (diff) | |
download | gcc-ca708025539dace762e23c1a5f97570a51020fc3.zip gcc-ca708025539dace762e23c1a5f97570a51020fc3.tar.gz gcc-ca708025539dace762e23c1a5f97570a51020fc3.tar.bz2 |
re PR pch/65550 (ICE (segfault) with pch)
2015-04-09 Richard Biener <rguenther@suse.de>
PR pch/65550
* files.c (pch_open_file): Allow main and pre-included files
when trying to open a PCH.
From-SVN: r221949
Diffstat (limited to 'libcpp/files.c')
-rw-r--r-- | libcpp/files.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libcpp/files.c b/libcpp/files.c index a995071..2f491224 100644 --- a/libcpp/files.c +++ b/libcpp/files.c @@ -291,11 +291,13 @@ pch_open_file (cpp_reader *pfile, _cpp_file *file, bool *invalid_pch) /* If the file is not included as first include from either the toplevel file or the command-line it is not a valid use of PCH. */ - if (pfile->all_files - && pfile->all_files->next_file - && !(pfile->all_files->implicit_preinclude - || pfile->all_files->next_file->implicit_preinclude)) - return false; + for (_cpp_file *f = pfile->all_files; f; f = f->next_file) + if (f->implicit_preinclude) + continue; + else if (f->main_file) + break; + else + return false; flen = strlen (path); len = flen + sizeof (extension); |