commit bf7236ddf91b0242a3960fb3f66391e1a51b4a74 parent c9538a1cb5279a7a70695c86ad31ea9f85436d59 Author: Roberto E. Vargas Caballero <k0ga@shike2.com> Date: Wed, 2 Sep 2015 17:20:41 +0200 Add basic test for integer constant folding Diffstat:
A | cc1/tests/test019.c | | | 61 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 61 insertions(+), 0 deletions(-)
diff --git a/cc1/tests/test019.c b/cc1/tests/test019.c @@ -0,0 +1,61 @@ + +/* +name: TEST019 +description: Basic test of constant folding in integer arithmetic operations +output: +test019.c:13: warning: division by 0 +test019.c:14: warning: division by 0 +F1 +G1 F1 main +{ +- +A2 I i + A2 #I3 :I + A2 #I1 :I + A2 #I12 :I + A2 #I2 :I + A2 #I0 :I + A2 A2 #I0 %I :I + A2 A2 #I0 %I :I + A2 #I8 :I + A2 #I2 :I + A2 #I4 :I + A2 #IC :I + A2 #I8 :I + A2 #IFFFFFFFD :I + A2 #IFFFFFFF3 :I + A2 #I1 :I + A2 #I0 :I + A2 #I0 :I + A2 #I1 :I + A2 #I0 :I +} +*/ + +#line 1 + +int +main(void) +{ + int i; + + i = 1 + 2; + i = 2 - 1; + i = 3 * 6; + i = 10 / 5; + i = 10 % 5; + i = i % 0; + i = i % 0; + i = 1 << 3; + i = 8 >> 2; + i = 12 & 4; + i = 8 | 4; + i = 12 ^ 4; + i = -(3); + i = ~12; + i = 1 < 3; + i = 2 > 3; + i = 2 >= 3; + i = 2 <= 3; + i = 1 == 0; +}