re PR c++/7050 (g++ segfaults on: (i ? get_string() : throw))
authorAndrew Lewycky <andrew@mxc.ca>
Wed, 12 Mar 2003 22:24:48 +0000 (17:24 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 12 Mar 2003 22:24:48 +0000 (17:24 -0500)
        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

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/expr.c
gcc/expr.c

index f970d7b997c41bedacf34f2cec4603a055485b78..30dbe70a6d3be338d069b238c958334b3fafd61c 100644 (file)
@@ -1,3 +1,9 @@
+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>
 
        * cppfiles.c (cpp_rename_file, cpp_push_include): New.
 
 2003-03-12  Nathanael Nerode  <neroden@gcc.gnu.org>
 
-        * aclocal.m4: Introduce gcc_GAS_VERSION_GTE_IFELSE,
-        _gcc_COMPUTE_GAS_VERSION.
-        * configure.in: Use them.
-        * configure: Regenerate.
+       * aclocal.m4: Introduce gcc_GAS_VERSION_GTE_IFELSE,
+       _gcc_COMPUTE_GAS_VERSION.
+       * configure.in: Use them.
+       * configure: Regenerate.
 
 2003-03-12  Bob Wilson  <bob.wilson@acm.org>
 
index 1e3380881db7f47d6c3f7fb740d8fd9f00efe1a5..71d753625b8fe037c085a103f6d3447c2c8e9131 100644 (file)
@@ -1,3 +1,9 @@
+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>
 
        PR c++/9474
index 7252a4df9c3ca2afd7c18ce0366797d84f1977f2..160a946ef9a7cfd51fa35258eaed544f54d15c42 100644 (file)
@@ -105,7 +105,7 @@ cxx_expand_expr (tree exp, rtx target, enum machine_mode tmode, int modifier)
       
     case THROW_EXPR:
       expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
-      return NULL;
+      return const0_rtx;
 
     case MUST_NOT_THROW_EXPR:
       expand_eh_region_start ();
index 46b264ea584e601f315fe20c50e0b1ecf0532f41..e540fb231588b3dbd1f03bf8113527451b46b351 100644 (file)
@@ -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