diff mbox

[pph] Adding one hard and failing ordering test (issue4854042)

Message ID 20110805224930.0B5161C1EDE@gchare.mtv.corp.google.com
State New
Headers show

Commit Message

Gab Charette Aug. 5, 2011, 10:49 p.m. UTC
This is the test I was talking would potentially fail with our current implementation.

And it does.

It has an assembly difference in the order of the global variables, like we used to have in simpler tests.

Gab

2011-08-05  Gabriel Charette  <gchare@google.com>

	* (x0hardorder1.h): New.
	* (x3hardorder2.h): New.
	* (x3hardorder.cc): New.


--
This patch is available for review at http://codereview.appspot.com/4854042

Comments

Diego Novillo Aug. 8, 2011, 4:03 p.m. UTC | #1
On Fri, Aug 5, 2011 at 18:49, Gabriel Charette <gchare@google.com> wrote:
> This is the test I was talking would potentially fail with our current implementation.
>
> And it does.
>
> It has an assembly difference in the order of the global variables, like we used to have in simpler tests.
>
> Gab
>
> 2011-08-05  Gabriel Charette  <gchare@google.com>
>
>        * (x0hardorder1.h): New.
>        * (x3hardorder2.h): New.
>        * (x3hardorder.cc): New.

OK.  Thanks for the test.


Diego.
diff mbox

Patch

diff --git a/gcc/testsuite/g++.dg/pph/x0hardorder1.h b/gcc/testsuite/g++.dg/pph/x0hardorder1.h
new file mode 100644
index 0000000..bfb547e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pph/x0hardorder1.h
@@ -0,0 +1,13 @@ 
+#ifndef HARD_ORDER_1_H
+#define HARD_ORDER_1_H
+
+int a1 = 1;
+
+namespace N {
+    int n1 = 1;
+    int m1 = 2;
+}
+
+float b1 = 1.1;
+
+#endif
diff --git a/gcc/testsuite/g++.dg/pph/x3hardorder.cc b/gcc/testsuite/g++.dg/pph/x3hardorder.cc
new file mode 100644
index 0000000..8f62539
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pph/x3hardorder.cc
@@ -0,0 +1,8 @@ 
+//pph asm xdiff 28345
+//Ordering of globals is different
+
+#include "x3hardorder2.h"
+
+int test () {
+  return a1 + a2 - b1 + b2 * N::n1 + N::n2 - N::m1 + N::m2;
+}
diff --git a/gcc/testsuite/g++.dg/pph/x3hardorder2.h b/gcc/testsuite/g++.dg/pph/x3hardorder2.h
new file mode 100644
index 0000000..d534ae4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pph/x3hardorder2.h
@@ -0,0 +1,18 @@ 
+#ifndef HARD_ORDER_2_H
+#define HARD_ORDER_2_H
+
+int a2 = 2;
+
+namespace N {
+    int n2 = 3;
+}
+
+#include "x0hardorder1.h"
+
+float b2 = 2.2;
+
+namespace N {
+    int m2 = 3;
+}
+
+#endif