aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_0.C
diff options
context:
space:
mode:
authorYiran Wang <yiran@google.com>2015-06-23 15:33:17 -0700
committerYiran Wang <yiran@google.com>2015-06-29 10:56:28 -0700
commit1d9fec7937f45dde5e04cac966a2d9a12f2fc15a (patch)
tree3fbcd18a379a05fd6d43491a107e1f36bc61b185 /gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_0.C
parentf378ebf14df0952eae870c9865bab8326aa8f137 (diff)
downloadtoolchain_gcc-1d9fec7937f45dde5e04cac966a2d9a12f2fc15a.tar.gz
toolchain_gcc-1d9fec7937f45dde5e04cac966a2d9a12f2fc15a.tar.bz2
toolchain_gcc-1d9fec7937f45dde5e04cac966a2d9a12f2fc15a.zip
Synchronize with google/gcc-4_9 to r224707 (from r214835)
Change-Id: I3d6f06fc613c8f8b6a82143dc44b7338483aac5d
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_0.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_0.C48
1 files changed, 48 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_0.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_0.C
new file mode 100644
index 000000000..525480dab
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_0.C
@@ -0,0 +1,48 @@
+// { dg-options "-std=c++11 -O2" }
+
+// A test case for static var promotion on targets like powerpc, where
+// the static initializer data is loaded via indirection through
+// TOC. Ensure that the global label for static initializer data is
+// unique via *.cmo* suffix.
+
+// Bug: after static var promotion in two different modules, we have
+// the following which leads to multiple definition of ._41" error during
+// link time.
+
+// Module 1 Module 2
+// .hidden ._41.cmo.1 .hidden ._41.cmo.3
+// .globl ._41 .globl ._41
+// ._41: ._41:
+// ... ...
+
+
+// Instead we should use the appropriate unique names for initializer
+// data as in the following.
+
+// Module 1 Module 2
+// .hidden ._41.cmo.1 .hidden ._41.cmo.3
+// .globl ._41.cmo.1 .globl ._41.cmo.3
+// ._41.cmo.1: ._41.cmo.3:
+// ... ...
+
+class A {
+ public:
+ int f(int x) const;
+};
+
+class B {
+ public:
+ int f(int x) const;
+};
+
+int main()
+{
+ A *a = new A();
+ B *b = new B();
+ int total = 0;
+ for (int i=0; i<3; ++i) {
+ total += a->f(1);
+ total += b->f(1);
+ }
+ return (total > 0) ? 0 : 1;
+}