[hackers] [scc] Add basic test about pointer and structs || Roberto E. Vargas Caballero
commit 84ce51804b0bef5931a83fb48a5dbafc1e793443
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Tue Aug 25 15:34:58 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Tue Aug 25 15:34:58 2015 +0200
Add basic test about pointer and structs
diff --git a/cc1/tests/test017.c b/cc1/tests/test017.c
new file mode 100644
index 0000000..69d1476
--- /dev/null
+++ b/cc1/tests/test017.c
_AT_@ -0,0 +1,56 @@
+/*
+name: TEST017
+description: Basic test about pointers and structs
+output:
+F1
+G9 F1 main
+{
+-
+S2 s1
+(
+M3 I y
+M4 I z
+)
+A2 S2 nested
+S6 s2
+(
+M8 P p
+)
+A3 S6 v
+ A3 M8 .P A2 'P :P
+ A3 M8 .P _AT_S2 M3 .I #I1 :I
+ A3 M8 .P _AT_S2 M4 .I #I2 :I
+ j L4 A2 M3 .I #I1 =I
+ yI #I1
+L4
+ j L5 A2 M4 .I #I2 =I
+ yI #I2
+L5
+ yI #I0
+}
+*/
+
+#line 1
+
+struct s1 {
+ int y;
+ int z;
+};
+
+struct s2 {
+ struct s1 *p;
+};
+
+int main()
+{
+ struct s1 nested;
+ struct s2 v;
+ v.p = &nested;
+ v.p->y = 1;
+ v.p->z = 2;
+ if (nested.y != 1)
+ return 1;
+ if (nested.z != 2)
+ return 2;
+ return 0;
+}
Received on Tue Aug 25 2015 - 20:18:21 CEST
This archive was generated by hypermail 2.3.0
: Tue Aug 25 2015 - 20:24:11 CEST