This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] More fallout from Fix PR c++/28250: ICE with invalid catch
On 20 Jul, Mark Mitchell wrote:
> Volker Reichelt wrote:
>
>> The segfault happens deep in the bowels of the middle-end:
>>
>> One question is, why do we end up there at all after an error
>> has been issued?
>
> Exactly! I think that's the right fix. What's the point in doing all
> this cgraph stuff once we've already issued an error?
I just tried the patch below to stop compilation after errors occured.
The results were four new C++ faiilures about missed warnings:
FAIL: g++.dg/warn/pr23075.C (test for warnings, line 14)
FAIL: g++.old-deja/g++.brendan/crash52.C (test for warnings, line 13)
FAIL: g++.old-deja/g++.jason/report.C (test for warnings, line 59)
FAIL: g++.old-deja/g++.jason/report.C (test for warnings, line 74)
These are all "control reaches end of non-void function" warnings,
i.e. warnings from the middle-end. So this is to be expected.
To my surprise there were no testsuite differences for C or Fortran.
The patch fixes 4 ICEs, namely the remaining part from PR 28250,
and the PRs 28257, 28259, and 28267.
Shall I apply this to mainline?
Now or maybe after the 4.2 branch?
What about the 4 regressions?
Regards,
Volker
2006-07-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
* toplev.c (compile_file): Stop compilation on errorcount or
sorrycount.
===================================================================
--- gcc/gcc/toplev.c (revision 115605)
+++ gcc/gcc/toplev.c (working copy)
@@ -1006,7 +1006,7 @@ compile_file (void)
what's left of the symbol table output. */
timevar_pop (TV_PARSE);
- if (flag_syntax_only)
+ if (flag_syntax_only || errorcount || sorrycount)
return;
lang_hooks.decls.final_write_globals ();
===================================================================
2006-07-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
* Make-lang.in (decl2.o): Depend on $(DIAGNOSTIC_H).
* decl2.c: Include diagnostic.h.
(cp_finish_file): Stop compilation on errorcount or sorrycount.
===================================================================
--- gcc/gcc/cp/Make-lang.in (revision 115605)
+++ gcc/gcc/cp/Make-lang.in (working copy)
@@ -238,7 +238,7 @@
debug.h gt-cp-decl.h timevar.h $(TREE_FLOW_H) $(TARGET_H)
cp/decl2.o: cp/decl2.c $(CXX_TREE_H) $(TM_H) flags.h cp/decl.h $(EXPR_H) \
output.h except.h toplev.h $(RTL_H) c-common.h gt-cp-decl2.h cgraph.h \
- c-pragma.h $(TREE_DUMP_H) intl.h $(TARGET_H)
+ c-pragma.h $(TREE_DUMP_H) intl.h $(TARGET_H) $(DIAGNOSTIC_H)
cp/cp-objcp-common.o : cp/cp-objcp-common.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(TREE_H) $(CXX_TREE_H) c-common.h toplev.h langhooks.h \
$(LANGHOOKS_DEF_H) $(DIAGNOSTIC_H) debug.h $(CXX_PRETTY_PRINT_H) \
===================================================================
--- gcc/gcc/cp/decl2.c (revision 115605)
+++ gcc/gcc/cp/decl2.c (working copy)
@@ -51,6 +51,7 @@
#include "c-pragma.h"
#include "tree-dump.h"
#include "intl.h"
+#include "diagnostic.h"
extern cpp_reader *parse_in;
@@ -3257,6 +3258,9 @@ cp_finish_file (void)
}
while (reconsider);
+ if (errorcount || sorrycount)
+ return;
+
/* All used inline functions must have a definition at this point. */
for (i = 0; VEC_iterate (tree, deferred_fns, i, decl); ++i)
{
===================================================================