diff options
author | Gabriel Dos Reis <gdr@gcc.gnu.org> | 2003-07-15 23:31:52 +0000 |
---|---|---|
committer | Gabriel Dos Reis <gdr@gcc.gnu.org> | 2003-07-15 23:31:52 +0000 |
commit | b0e3f7ec306dafdaf554f5b3eea03de75cec2a84 (patch) | |
tree | 8c95ca0c8979930a9bfa16aad26f060327c7ca5b | |
parent | 71628aa09889112d4acdfcea51b85d43808e1d74 (diff) | |
download | gcc-b0e3f7ec306dafdaf554f5b3eea03de75cec2a84.zip gcc-b0e3f7ec306dafdaf554f5b3eea03de75cec2a84.tar.gz gcc-b0e3f7ec306dafdaf554f5b3eea03de75cec2a84.tar.bz2 |
re PR c++/11531 (ICE on invalid code (returning to void))
PR c++/11531
* diagnostic.c (diagnostic_report_diagnostic): Don't ICE if we're
not recursing on hard error.
(diagnostic_for_decl): Likewise.
* diagnostic.def: Rearrange.
cp/
* typeck.c (check_return_expr): Fix thinko in diagnostic.
From-SVN: r69425
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 6 | ||||
-rw-r--r-- | gcc/diagnostic.c | 4 | ||||
-rw-r--r-- | gcc/diagnostic.def | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/crash-1.C | 3 |
6 files changed, 22 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d7f64de..24c45c7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2003-07-16 Gabriel Dos Reis <gcc@integrable-solutions.net> + + PR c++/11531 + * diagnostic.c (diagnostic_report_diagnostic): Don't ICE if we're + not recursing on hard error. + (diagnostic_for_decl): Likewise. + * diagnostic.def: Rearrange. + 2003-07-15 J"orn Rennecke <joern.rennecke@superh.com> * dwarf2out.c (expand_builtin_init_dwarf_reg_sizes): diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ff60075..1d25e86 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2003-07-16 Gabriel Dos Reis <gdr@integrable-solutions.net> + + PR c++/11531 + * typeck.c (check_return_expr): Fix thinko in diagnostic. + 2003-07-15 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> PR c++/10108 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 8e1e0df..b0bb1ac 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -6123,7 +6123,7 @@ check_return_expr (tree retval) that's supposed to return a value. */ if (!retval && fn_returns_value_p) { - pedwarn ("return-statement with no value, in function returning `%D'", + pedwarn ("return-statement with no value, in function returning '%T'", valtype); /* Clear this, so finish_function won't say that we reach the end of a non-void function (which we don't, we gave a @@ -6140,8 +6140,8 @@ check_return_expr (tree retval) its side-effects. */ finish_expr_stmt (retval); else - pedwarn ("return-statement with a value, in function returning `%D'", - retval); + pedwarn ("return-statement with a value, in function " + "returning 'void'"); current_function_returns_null = 1; diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index c9bef1a..3475611 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -1020,7 +1020,7 @@ void diagnostic_report_diagnostic (diagnostic_context *context, diagnostic_info *diagnostic) { - if (context->lock++) + if (context->lock++ && diagnostic->kind < DK_SORRY) error_recursion (context); if (diagnostic_count_diagnostic (context, diagnostic)) @@ -1042,7 +1042,7 @@ static void diagnostic_for_decl (diagnostic_context *context, diagnostic_info *diagnostic, tree decl) { - if (context->lock++) + if (context->lock++ && diagnostic->kind < DK_SORRY) error_recursion (context); if (diagnostic_count_diagnostic (context, diagnostic)) diff --git a/gcc/diagnostic.def b/gcc/diagnostic.def index 83e5d9c..6820bb7 100644 --- a/gcc/diagnostic.def +++ b/gcc/diagnostic.def @@ -1,7 +1,7 @@ DEFINE_DIAGNOSTIC_KIND (DK_FATAL, "fatal error: ") DEFINE_DIAGNOSTIC_KIND (DK_ICE, "internal compiler error: ") -DEFINE_DIAGNOSTIC_KIND (DK_SORRY, "sorry, unimplemented: ") DEFINE_DIAGNOSTIC_KIND (DK_ERROR, "error: ") +DEFINE_DIAGNOSTIC_KIND (DK_SORRY, "sorry, unimplemented: ") DEFINE_DIAGNOSTIC_KIND (DK_WARNING, "warning: ") DEFINE_DIAGNOSTIC_KIND (DK_ANACHRONISM, "anachronism: ") DEFINE_DIAGNOSTIC_KIND (DK_NOTE, "note: ") diff --git a/gcc/testsuite/g++.dg/other/crash-1.C b/gcc/testsuite/g++.dg/other/crash-1.C new file mode 100644 index 0000000..e9a2d79 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/crash-1.C @@ -0,0 +1,3 @@ + +void f() { return 0; } // { dg-error "return-statement" } + |