This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ PATCH] Fix repo.c error handling (PR c++/26917)


Hi!

If compiling a foo.C file that has errors in it with -frepo and
a foo.rpo exists, cc1plus crashes.  The problem is double fclose,
init_repo is called first, repo_file = fopen ("foo.rpo", ...), reads
it and fclose (repo_file).  When finish_repo is called, errorcount != 0,
so it doesn't reopen_repo_file_for_write (); and at the end does
if (repo_file) fclose (repo_file).  But, repo_file has been already
fclosed in init_repo and has not been reinitialized in
reopen_repo_file_for_write.
One option is to clear repo_file right after fclose, then such a
problem shouldn't ever reappear.
Or we can nuke the global repo_file variable, as it is only used
within init_repo and finish_repo, but in both cases it is supposed
to be a different thing that is live only for the duration of
init_repo resp. finish_repo.

Attached are both alternatives.
Ok for trunk/4.1 (and which one)?

	Jakub

Attachment: gcc41-pr26917-1.patch
Description: Text document

Attachment: gcc41-pr26917-2.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]