summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/postincr-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/postincr-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/postincr-1.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/postincr-1.c b/gcc/testsuite/gcc.dg/postincr-1.c
new file mode 100644
index 000000000..752cda40c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/postincr-1.c
@@ -0,0 +1,21 @@
+/* Simple test for proper postincrement semantics. */
+/* { dg-do run } */
+
+extern void abort (void);
+
+int i;
+int c;
+int *f ()
+{
+ ++c;
+ return &i;
+}
+
+int main ()
+{
+ int r;
+ r = (*f())++;
+ if (!(r == 0 && i == 1 && c == 1))
+ abort ();
+ return 0;
+}