diff --git a/tests/plat/b/incdec_b.b b/tests/plat/b/incdec_b.b index b3cb16da5..4edf5f6bf 100644 --- a/tests/plat/b/incdec_b.b +++ b/tests/plat/b/incdec_b.b @@ -1,65 +1,70 @@ # +/* External variables to defeat constant folding. */ +zero 0; +one 1; + i 0; ext_t() { - extrn i; + extrn zero, one, i; - i = 0; + i = zero; if (!(i++ == 0)) fail(__LINE__); - i == 1; + i = one; if (!(i-- == 1)) fail(__LINE__); if (!(i == 0)) fail(__LINE__); - i = 0; + i = zero; if (!(++i == 1)) fail(__LINE__); if (!(i == 1)) fail(__LINE__); - i == 1; + i = one; if (!(--i == 0)) fail(__LINE__); if (!(i == 0)) fail(__LINE__); } int_t() { - auto i; + extrn zero, one; + auto i; - i = 0; + i = zero; if (!(i++ == 0)) fail(__LINE__); - i == 1; + i = one; if (!(i-- == 1)) fail(__LINE__); if (!(i == 0)) fail(__LINE__); - i = 0; + i = zero; if (!(++i == 1)) fail(__LINE__); if (!(i == 1)) fail(__LINE__); - i == 1; + i = one; if (!(--i == 0)) fail(__LINE__); if (!(i == 0)) fail(__LINE__); } star_t() { - extrn i; + extrn zero, one, i; auto p; p = &i; - i = 0; + i = zero; if (!((*p)++ == 0)) fail(__LINE__); - i == 1; + i = one; if (!((*p)-- == 1)) fail(__LINE__); if (!(i == 0)) fail(__LINE__); - i = 0; + i = zero; if (!(++(*p) == 1)) fail(__LINE__); if (!(i == 1)) fail(__LINE__); - i == 1; + i = one; if (!(--(*p) == 0)) fail(__LINE__); if (!(i == 0)) fail(__LINE__); }