Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1704)

Issue 5872043: [pph] Fix x1mbstate_t.h

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 1 month ago by Diego Novillo
Modified:
12 years, 1 month ago
Reviewers:
CC:
Lawrence Crowl, gcc-patches_gcc.gnu.org
Visibility:
Public.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -5 lines) Patch
M gcc/cp/name-lookup.c View 1 chunk +5 lines, -1 line 0 comments Download
M gcc/testsuite/g++.dg/pph/x1mbstate_t.h View 1 chunk +3 lines, -4 lines 0 comments Download

Messages

Total messages: 1
Diego Novillo
12 years, 1 month ago (2012-03-21 17:30:59 UTC) #1
Fix x1mbstate_t.h.

This patch fixes the parser segmentation fault caused by a name
lookup failure (details in
http://gcc.gnu.org/ml/gcc-patches/2012-03/msg01369.html).

I am not 100% sure that this is the right fix, but Jason seems to
think that the theory behind this is fine (parser does no allow a
USING_DECL to be set in the bindings of an identifier).  I left a
FIXME note to help future debugging.


2012-03-21   Diego Novillo  <dnovillo@google.com>

cp/ChangeLog.pph
	* name-lookup.c (pph_set_namespace_decl_binding): Ignore
	USING_DECLs.

testsuite/ChangeLog.pph
	* g++.dg/pph/x1mbstate_t.h: Mark fixed.

diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 947708d..1b33ce3 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -6271,7 +6271,11 @@ pph_set_namespace_decl_binding (tree decl,
cp_binding_level *bl, int flags)
 {
   /* Set the namespace identifier binding for a single decl.  */
   tree id = DECL_NAME (decl);
-  if (id)
+  /* FIXME pph.  USING_DECLs do not seem to be used in bindings by
+     the parser. This was causing the SEGV in
+     testsuite/g++.dg/pph/x1mbstate_t.h.  It's unclear whether this is
+     the right fix.  */
+  if (id && TREE_CODE (decl) != USING_DECL)
     pph_set_identifier_binding (id, decl, bl, flags);
 }
 
diff --git a/gcc/testsuite/g++.dg/pph/x1mbstate_t.h
b/gcc/testsuite/g++.dg/pph/x1mbstate_t.h
index c07a0cc..4d473e4 100644
--- a/gcc/testsuite/g++.dg/pph/x1mbstate_t.h
+++ b/gcc/testsuite/g++.dg/pph/x1mbstate_t.h
@@ -1,9 +1,8 @@
-// { dg-xfail-if "identifier bindings not set properly" { "*-*-*" } {
"-fpph-map=pph.map"} }
-// { dg-bogus ".*Segmentation fault" "ICE trying to parse std::mbstate_t"  {
xfail *-*-* } 0 }
 #ifndef _X1_MBSTATE_H
 #define _X1_MBSTATE_H
 #include "x0mbstate_t.h"
-// Name lookup for std::mbstate_t fails here.  Instead of returning the global
-// type_decl for mbstate_t, it returns the "usings ::mbstate_t" declaration.
+// Name lookup for std::mbstate_t was failingfails here.  Instead of returning
+// the global type_decl for mbstate_t, it was returning the
+// "usings ::mbstate_t" declaration.
 typedef std::mbstate_t state_type;
 #endif

--
This patch is available for review at http://codereview.appspot.com/5872043
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b