diff options
author | Andrew Lewycky <andrew@mxc.ca> | 2003-03-12 17:24:48 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2003-03-12 17:24:48 -0500 |
commit | 847311f4570e0182e9f9c4759fcffd7c4da07477 (patch) | |
tree | c8a7fb056d60c96eb16729f4d66e63d6bfdcbd45 /gcc/expr.c | |
parent | ff8b9ca85f20291cddd44025f1f395bffe433133 (diff) | |
download | gcc-847311f4570e0182e9f9c4759fcffd7c4da07477.zip gcc-847311f4570e0182e9f9c4759fcffd7c4da07477.tar.gz gcc-847311f4570e0182e9f9c4759fcffd7c4da07477.tar.bz2 |
re PR c++/7050 (g++ segfaults on: (i ? get_string() : throw))
PR c++/7050
* expr.c (store_expr): Don't attempt to store void-typed trees,
just evaluate them for side effects.
* cp/expr.c (cxx_expand_expr): Return const0_rtx for throw
expressions.
From-SVN: r64268
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -4354,6 +4354,16 @@ store_expr (exp, target, want_value) int dont_return_target = 0; int dont_store_target = 0; + if (VOID_TYPE_P (TREE_TYPE (exp))) + { + /* C++ can generate ?: expressions with a throw expression in one + branch and an rvalue in the other. Here, we resolve attempts to + store the throw expression's nonexistant result. */ + if (want_value) + abort (); + expand_expr (exp, const0_rtx, VOIDmode, 0); + return NULL_RTX; + } if (TREE_CODE (exp) == COMPOUND_EXPR) { /* Perform first part of compound expression, then assign from second |