Mercurial > hg > CbC > CbC_gcc
comparison libmudflap/testsuite/libmudflap.c/pass18-frag.c @ 0:a06113de4d67
first commit
author | kent <kent@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 17 Jul 2009 14:47:48 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:a06113de4d67 |
---|---|
1 #include <stdio.h> | |
2 #include <stdlib.h> | |
3 #include <string.h> | |
4 int main () | |
5 { | |
6 int t; | |
7 char foo[3] = { 'b', 'c', 'd' }; | |
8 int bar[3] = {1, 2, 0}; | |
9 t = 1; | |
10 | |
11 /* These tests check expression evaluation rules, such as | |
12 ensuring that side-effect expression (++) get executed the | |
13 right number of times; that array lookup checks nest correctly. */ | |
14 foo[t++] = 'a'; | |
15 if (foo[0] != 'b' || foo[1] != 'a' || foo[2] != 'd' || t != 2) abort (); | |
16 if (bar[0] != 1 || bar[1] != 2 || bar[2] != 0) abort(); | |
17 | |
18 foo[bar[t--]] = 'e'; | |
19 if (foo[0] != 'e' || foo[1] != 'a' || foo[2] != 'd' || t != 1) abort (); | |
20 if (bar[0] != 1 || bar[1] != 2 || bar[2] != 0) abort(); | |
21 | |
22 foo[bar[++t]--] = 'g'; | |
23 if (foo[0] != 'g' || foo[1] != 'a' || foo[2] != 'd' || t != 2) abort (); | |
24 if (bar[0] != 1 || bar[1] != 2 || bar[2] != -1) abort(); | |
25 | |
26 return 0; | |
27 } |