C++ PATCH to fix crash building libstdc++ with -fabi-version=1

Message ID 4C99445A.1040800@redhat.com
State New
Headers show

Commit Message

Jason Merrill Sept. 21, 2010, 11:48 p.m.
I tried building libstdc++ with -fabi-version=1 -Wabi to see what 
warnings it would produce, and it crashed on atomic.cc trying to mangle 
a SCOPE_REF where op 1 is an IDENTIFIER_NODE rather than the DECL that 
the code expected.

Tested x86_64-pc-linux-gnu, applied to trunk.


commit 5ee539810a1c405172eaaff79dfdec8cf98bb282
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Sep 21 16:59:12 2010 -0400

    	* mangle.c (write_expression) [SCOPE_REF]: Only do -fabi-version=1
    	special handling if we know the member.

diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 03e2837..39001c5 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -2491,7 +2491,7 @@  write_expression (tree expr)
       tree scope = TREE_OPERAND (expr, 0);
       tree member = TREE_OPERAND (expr, 1);
-      if (!abi_version_at_least (2))
+      if (!abi_version_at_least (2) && DECL_P (member))
 	  write_string ("sr");
 	  write_type (scope);