# [hackers] [scc] Add basic test for integer constans || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 7 Sep 2015 23:44:56 +0200 (CEST)

commit 5d10713e968041bbb85b19b5dc673d33b7d1ef7d
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Mon Sep 7 19:53:45 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Mon Sep 7 19:53:45 2015 +0200

Add basic test for integer constans

This test fails at this moment because overflow in constant castings
are not correctly handled.

diff --git a/cc1/tests/test022.c b/cc1/tests/test022.c
new file mode 100644
index 0000000..91a2c12
--- /dev/null
+++ b/cc1/tests/test022.c
_AT_@ -0,0 +1,57 @@
+
+/*
+name: TEST022
+description: Basic test for int constants
+comments: This test is done for z80 data types
+output:
+F1
+G1 F1 main
+{
+-
+A2 I i
+A3 N u
+ A2 #I1 :I
+ A2 #IFFFF :I
+ A2 #IFFFF :I
+ A2 #IFFFF :I
+ A2 #IFFFF :I
+ A2 #I3 :I
+ A2 #I1 :I
+ A2 #I0 :I
+ A3 #N1 :N
+ A3 #NFFFF :N
+ A3 #NFFFF :N
+ A3 #NFFFF :N
+ A3 #NFFFF :N
+ A3 #N0 :N
+ A3 #N3 :N
+ A3 #N0 :N
+ y #I0
+}
+*/
+
+int
+main(void)
+{
+ int i;
+ unsigned u;
+
+ i = 1;
+ i = -1;
+ i = -1l;
+ i = -1u;
+ i = -1ll;
+ i = 32766 + 1 & 3;
+ i = (int) 32768 < 0;
+ i = -1u < 0;
+
+ u = 1;
+ u = -1;
+ u = -1l;
+ u = -1u;
+ u = -1ll;
+ u = (unsigned) 32768 < 0;
+ u = 32766 + 1 & 3;
+ u = -1u < 0;
+ return 0;
+}
Received on Mon Sep 07 2015 - 23:44:56 CEST

This archive was generated by hypermail 2.3.0 : Mon Sep 07 2015 - 23:48:11 CEST