diff options
author | Mark Mitchell <mmitchel@gcc.gnu.org> | 2001-02-20 18:22:32 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2001-02-20 18:22:32 +0000 |
commit | c9407e4c671efb42c76dbb80a13ecf0c5dc09f05 (patch) | |
tree | 40949ebadccd8eec61e63b81100bb256e38ed590 | |
parent | 0cbd39801459319899e08e930f5257c2ced61ddb (diff) | |
download | gcc-c9407e4c671efb42c76dbb80a13ecf0c5dc09f05.zip gcc-c9407e4c671efb42c76dbb80a13ecf0c5dc09f05.tar.gz gcc-c9407e4c671efb42c76dbb80a13ecf0c5dc09f05.tar.bz2 |
stmt.c (expand_return): If an attempt is made to return the error_mar_node...
* stmt.c (expand_return): If an attempt is made to return the
error_mar_node, treat the return like a return without a value.
From-SVN: r39924
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/stmt.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/return1.C | 18 |
4 files changed, 30 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index df1b7fb..70b8d26 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-02-20 Mark Mitchell <mark@codesourcery.com> + + * stmt.c (expand_return): If an attempt is made to return the + error_mar_node, treat the return like a return without a value. + 2001-02-19 Zack Weinberg <zackw@stanford.edu> * sibcall.c (skip_copy_to_return_value): Call diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 45c61d1..5387d68 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1075,8 +1075,7 @@ Sun Feb 4 15:52:44 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> * class.c (check_field_decls): Don't special case anonymous fields in error messages. - (note_name_declared_inpwdpwd - _class): Use %D on diagnostic. + (note_name_declared_in_class): Use %D on diagnostic. * tree.c (pod_type_p): Use strip_array_types. (cp_valid_lang_attribute): Likewise. @@ -2946,7 +2946,12 @@ expand_return (retval) #endif if (retval == error_mark_node) - retval_rhs = NULL_TREE; + { + /* Treat this like a return of no value from a function that + returns a value. */ + expand_null_return (); + return; + } else if (TREE_CODE (retval) == RESULT_DECL) retval_rhs = retval; else if ((TREE_CODE (retval) == MODIFY_EXPR || TREE_CODE (retval) == INIT_EXPR) diff --git a/gcc/testsuite/g++.old-deja/g++.other/return1.C b/gcc/testsuite/g++.old-deja/g++.other/return1.C new file mode 100644 index 0000000..42a7e47 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/return1.C @@ -0,0 +1,18 @@ +// Build don't link: +// Special g++ Option: +// Origin: holmen@mail.nu + +struct C { + int f() {return 0;} +}; + +struct D { + C a[1]; + C* g(); +}; + +C* D::g() { + int i = 0; + while (i < 1 && a[i].f() != 1) {} + return undefined_variable; // ERROR - +} |