PR c/37171
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Sep 2008 18:42:48 +0000 (18:42 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Sep 2008 18:42:48 +0000 (18:42 +0000)
* g++.dg/ext/attrib34.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139904 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/attrib34.C [new file with mode: 0644]

index 5c75e1f..b30e345 100644 (file)
@@ -1,3 +1,8 @@
+2008-09-02  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/37171
+       * g++.dg/ext/attrib34.C: New test.
+
 2008-09-02  Sebastian Pop  <sebastian.pop@amd.com>
            Tobias Grosser  <grosser@fim.uni-passau.de>
            Jan Sjodin  <jan.sjodin@amd.com>
diff --git a/gcc/testsuite/g++.dg/ext/attrib34.C b/gcc/testsuite/g++.dg/ext/attrib34.C
new file mode 100644 (file)
index 0000000..f479414
--- /dev/null
@@ -0,0 +1,19 @@
+// PR c/37171
+// { dg-do compile }
+// { dg-options "-O2 -fdump-tree-optimized" }
+
+unsigned int f1 () __attribute__((const));
+unsigned int f2 () __attribute__((__const));
+unsigned int f3 () __attribute__((__const__));
+
+unsigned int f4 ()
+{
+  return f1 () + f1 () + f1 () + f1 ()
+        + f2 () + f2 () + f2 () + f2 ()
+        + f3 () + f3 () + f3 () + f3 ();
+}
+
+// { dg-final { scan-tree-dump-times "= f1 \\(\\)" 1 "optimized" } }
+// { dg-final { scan-tree-dump-times "= f2 \\(\\)" 1 "optimized" } }
+// { dg-final { scan-tree-dump-times "= f3 \\(\\)" 1 "optimized" } }
+// { dg-final { cleanup-tree-dump "optimized" } }