X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=libmudflap%2Ftestsuite%2Flibmudflap.c%2Fpass18-frag.c;fp=libmudflap%2Ftestsuite%2Flibmudflap.c%2Fpass18-frag.c;h=c5d5af0fe120f34a630000a55d29d7569e303534;hb=6fed43773c9b0ce596dca5686f37ac3fc0fa11c0;hp=0000000000000000000000000000000000000000;hpb=27b11d56b743098deb193d510b337ba22dc52e5c;p=msp430-gcc.git diff --git a/libmudflap/testsuite/libmudflap.c/pass18-frag.c b/libmudflap/testsuite/libmudflap.c/pass18-frag.c new file mode 100644 index 00000000..c5d5af0f --- /dev/null +++ b/libmudflap/testsuite/libmudflap.c/pass18-frag.c @@ -0,0 +1,27 @@ +#include +#include +#include +int main () +{ +int t; +char foo[3] = { 'b', 'c', 'd' }; +int bar[3] = {1, 2, 0}; +t = 1; + +/* These tests check expression evaluation rules, such as + ensuring that side-effect expression (++) get executed the + right number of times; that array lookup checks nest correctly. */ +foo[t++] = 'a'; +if (foo[0] != 'b' || foo[1] != 'a' || foo[2] != 'd' || t != 2) abort (); +if (bar[0] != 1 || bar[1] != 2 || bar[2] != 0) abort(); + +foo[bar[t--]] = 'e'; +if (foo[0] != 'e' || foo[1] != 'a' || foo[2] != 'd' || t != 1) abort (); +if (bar[0] != 1 || bar[1] != 2 || bar[2] != 0) abort(); + +foo[bar[++t]--] = 'g'; +if (foo[0] != 'g' || foo[1] != 'a' || foo[2] != 'd' || t != 2) abort (); +if (bar[0] != 1 || bar[1] != 2 || bar[2] != -1) abort(); + +return 0; +}