Commit 847311f4 by Andrew Lewycky Committed by Jason Merrill

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
parent ff8b9ca8
2003-03-12 Andrew Lewycky <andrew@mxc.ca>
PR c++/7050
* expr.c (store_expr): Don't attempt to store void-typed trees,
just evaluate them for side effects.
2003-03-12 Neil Booth <neil@daikokuya.co.uk> 2003-03-12 Neil Booth <neil@daikokuya.co.uk>
* cppfiles.c (cpp_rename_file, cpp_push_include): New. * cppfiles.c (cpp_rename_file, cpp_push_include): New.
...@@ -9,10 +15,10 @@ ...@@ -9,10 +15,10 @@
2003-03-12 Nathanael Nerode <neroden@gcc.gnu.org> 2003-03-12 Nathanael Nerode <neroden@gcc.gnu.org>
* aclocal.m4: Introduce gcc_GAS_VERSION_GTE_IFELSE, * aclocal.m4: Introduce gcc_GAS_VERSION_GTE_IFELSE,
_gcc_COMPUTE_GAS_VERSION. _gcc_COMPUTE_GAS_VERSION.
* configure.in: Use them. * configure.in: Use them.
* configure: Regenerate. * configure: Regenerate.
2003-03-12 Bob Wilson <bob.wilson@acm.org> 2003-03-12 Bob Wilson <bob.wilson@acm.org>
......
2003-03-12 Andrew Lewycky <andrew@mxc.ca>
PR c++/7050
* expr.c (cxx_expand_expr): Return const0_rtx for throw
expressions.
2003-03-11 Mark Mitchell <mark@codesourcery.com> 2003-03-11 Mark Mitchell <mark@codesourcery.com>
PR c++/9474 PR c++/9474
......
...@@ -105,7 +105,7 @@ cxx_expand_expr (tree exp, rtx target, enum machine_mode tmode, int modifier) ...@@ -105,7 +105,7 @@ cxx_expand_expr (tree exp, rtx target, enum machine_mode tmode, int modifier)
case THROW_EXPR: case THROW_EXPR:
expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0); expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
return NULL; return const0_rtx;
case MUST_NOT_THROW_EXPR: case MUST_NOT_THROW_EXPR:
expand_eh_region_start (); expand_eh_region_start ();
......
...@@ -4354,6 +4354,16 @@ store_expr (exp, target, want_value) ...@@ -4354,6 +4354,16 @@ store_expr (exp, target, want_value)
int dont_return_target = 0; int dont_return_target = 0;
int dont_store_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) if (TREE_CODE (exp) == COMPOUND_EXPR)
{ {
/* Perform first part of compound expression, then assign from second /* Perform first part of compound expression, then assign from second
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment