Message ID | 20110628002701.B0BCA1C1BE0@gchare.mtv.corp.google.com |
---|---|
State | New |
Headers | show |
diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c index 93b5685..cfa2ce5 100644 --- a/gcc/cp/pph-streamer-in.c +++ b/gcc/cp/pph-streamer-in.c @@ -1141,6 +1141,11 @@ pph_add_bindings_to_namespace (struct cp_binding_level *bl, tree ns) { tree t, chain; + /* The chains are built backwards (ref: add_decl_to_level@name-lookup.c), + reverse them before putting them back in. */ + bl->names = nreverse (bl->names); + bl->namespaces = nreverse (bl->namespaces); + for (t = bl->names; t; t = chain) { /* Pushing a decl into a scope clobbers its DECL_CHAIN. diff --git a/gcc/testsuite/g++.dg/pph/c1limits-externalid.cc b/gcc/testsuite/g++.dg/pph/c1limits-externalid.cc index 8d2da40..8b5039c 100644 --- a/gcc/testsuite/g++.dg/pph/c1limits-externalid.cc +++ b/gcc/testsuite/g++.dg/pph/c1limits-externalid.cc @@ -1,2 +1 @@ -// pph asm xdiff #include "c1limits-externalid.h" diff --git a/gcc/testsuite/g++.dg/pph/c1varorder.cc b/gcc/testsuite/g++.dg/pph/c1varorder.cc new file mode 100644 index 0000000..2db8209 --- /dev/null +++ b/gcc/testsuite/g++.dg/pph/c1varorder.cc @@ -0,0 +1,7 @@ +#include "c1varorder.h" +// pph asm xdiff + +int foo(void) +{ + return var1 - var2; +} diff --git a/gcc/testsuite/g++.dg/pph/c1varorder.h b/gcc/testsuite/g++.dg/pph/c1varorder.h new file mode 100644 index 0000000..a87c80c --- /dev/null +++ b/gcc/testsuite/g++.dg/pph/c1varorder.h @@ -0,0 +1,7 @@ +#ifndef __C1VARORDER_H +#define __C1VARORDER_H + +int var1; +int var2; + +#endif diff --git a/gcc/testsuite/g++.dg/pph/pph.map b/gcc/testsuite/g++.dg/pph/pph.map index 2735af8..2ed5bf2 100644 --- a/gcc/testsuite/g++.dg/pph/pph.map +++ b/gcc/testsuite/g++.dg/pph/pph.map @@ -25,6 +25,7 @@ c1simple2.h c1simple2.pph c1struct.h c1struct.pph c1typerefs.h c1typerefs.pph c1variables.h c1variables.pph +c1varorder.h c1varorder.pph c2builtin1.h c2builtin1.pph c2builtin2.h c2builtin2.pph c2builtin3.h c2builtin3.pph