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

Issue 5844068: [pph] Add reduced test case for a common lookup failure

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 (+19 lines, -0 lines) Patch
A gcc/testsuite/g++.dg/pph/x0mbstate_t.h View 1 chunk +10 lines, -0 lines 0 comments Download
A gcc/testsuite/g++.dg/pph/x1mbstate_t.h View 1 chunk +9 lines, -0 lines 0 comments Download

Messages

Total messages: 1
Diego Novillo
12 years, 1 month ago (2012-03-20 17:08:05 UTC) #1
Add reduced test case for a common lookup failure.

This is reduced from the standard library.  The type mbstate_t is
declared in the global scope and then incorporated into 'std' via
using.

When the header doing this is converted into a PPH image, the lookup
for identifier 'mbstate_t' produces the USING_DECL instead of the
TYPE_DECL in the global scope.

This causes the parser to segfault while parsing 'typedef
std::mbstate_t state_type' in the user of that PPH image.

Working on a fix shortly.


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

	* g++.dg/pph/x0mbstate_t.h: New.
	* g++.dg/pph/x1mbstate_t.h: New.

diff --git a/gcc/testsuite/g++.dg/pph/x0mbstate_t.h
b/gcc/testsuite/g++.dg/pph/x0mbstate_t.h
new file mode 100644
index 0000000..dceb3e4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pph/x0mbstate_t.h
@@ -0,0 +1,10 @@
+#ifndef _X0_MBSTATE_T_H
+#define _X0_MBSTATE_T_H
+
+typedef int mbstate_t;
+
+namespace std
+{
+  using ::mbstate_t;
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/pph/x1mbstate_t.h
b/gcc/testsuite/g++.dg/pph/x1mbstate_t.h
new file mode 100644
index 0000000..c07a0cc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pph/x1mbstate_t.h
@@ -0,0 +1,9 @@
+// { 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.
+typedef std::mbstate_t state_type;
+#endif

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

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