aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/testsuite/gcc.dg/postincr-1.c19
1 files changed, 19 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 0000000..6aa203c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/postincr-1.c
@@ -0,0 +1,19 @@
+/* Simple test for proper postincrement semantics. */
+/* { dg-do run } */
+
+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;
+}