diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-08-19 07:34:40 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-08-19 07:34:40 +0000 |
commit | 912f9e817e0492ddc2a1c6ee4f41a427b43cf440 (patch) | |
tree | 335fa7ed68bccaabc938e142eabc167ac296372e /gcc/testsuite/gcc.c-torture/execute/dbra-1.c | |
parent | d3739bcdc296c9e9dbebea8ef89de4479bdfb4ad (diff) | |
download | gcc-912f9e817e0492ddc2a1c6ee4f41a427b43cf440.tar.gz |
Initial revision
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@14840 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/dbra-1.c')
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/dbra-1.c | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/dbra-1.c b/gcc/testsuite/gcc.c-torture/execute/dbra-1.c new file mode 100644 index 00000000000..20ae8988ec8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/dbra-1.c @@ -0,0 +1,95 @@ +f1 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (--a == -1) + return i; + } + return -1; +} + +f2 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (--a != -1) + return i; + } + return -1; +} + +f3 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (--a == 0) + return i; + } + return -1; +} + +f4 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (--a != 0) + return i; + } + return -1; +} + +f5 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (++a == 0) + return i; + } + return -1; +} + +f6 (a) + long a; +{ + int i; + for (i = 0; i < 10; i++) + { + if (++a != 0) + return i; + } + return -1; +} + + +main() +{ + if (f1 (5L) != 5) + abort (); + if (f2 (1L) != 0) + abort (); + if (f2 (0L) != 1) + abort (); + if (f3 (5L) != 4) + abort (); + if (f4 (1L) != 1) + abort (); + if (f4 (0L) != 0) + abort (); + if (f5 (-5L) != 4) + abort (); + if (f6 (-1L) != 1) + abort (); + if (f6 (0L) != 0) + abort (); + exit (0); +} |