changeset 694:edc024fc7472

*** empty log message ***
author kono
date Wed, 17 Oct 2007 18:11:46 +0900
parents e5a498eab0f4
children 3e69986a7b82
files .gdbinit mc-parse.c test/strinit.c
diffstat 3 files changed, 38 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/.gdbinit	Sat Oct 13 18:49:28 2007 +0900
+++ b/.gdbinit	Wed Oct 17 18:11:46 2007 +0900
@@ -13,11 +13,11 @@
 x/1i $eip
 end
 b errmsg
-r -s test/tmp7.c
+# r -s test/tmp7.c
 # r -s test/tmp6.c
 # r -s test/call.c
 # r -s test/code-gen-all.c
 # r -s mc-code-powerpc.c
-# r -s test/strinit.c
+r -s test/strinit.c
 # r -s -DINLINE=inline test/strinit.c
 # r -s test/fact-a.c
--- a/mc-parse.c	Sat Oct 13 18:49:28 2007 +0900
+++ b/mc-parse.c	Wed Oct 17 18:11:46 2007 +0900
@@ -3650,6 +3650,8 @@
 	case INDIRECT:
 	    e=cadr(e);
 	    break;
+	case RSTRUCT:
+	    e=cadr(e);
 	case DREGISTER:  /* should be error? */
 	case FREGISTER:
 	case LREGISTER:
@@ -3669,6 +3671,8 @@
 	    break;
 	case FNAME:
 	    break;
+	case CAST:
+	    if (car(cadr(e))== DECL_DATA) break; 
 	default:error(LVERR);
 	}
 	type=list2(POINTER,type);
@@ -4139,6 +4143,7 @@
 		    } else {
 			e1 = reverse0(e3);
 			e1 = list3(DECL_DATA,e1,t);
+			// e1 = list3(RSTRUCT,e2,e1);
 			e1 = list4(CAST,e1,t,t); // only for cast syntax
 		    }
 		} else {
--- a/test/strinit.c	Sat Oct 13 18:49:28 2007 +0900
+++ b/test/strinit.c	Wed Oct 17 18:11:46 2007 +0900
@@ -247,6 +247,7 @@
        .m = (struct hoge){1,3},
        .c = (int)&temp4,
     };
+    int c[3] = {1,2,3};
 
     printf("#0226:1: %d\n",temp1.a);
     printf("#0227:1: %d\n",temp1.e);
@@ -270,6 +271,36 @@
     linux_kernel();
     int i=1,j=2;
     printf("%d %d\n",i,j);
+
+    printf("b %d %d %d\n",b[0],b[1],b[2]);
+    printf("c %d %d %d\n",c[0],c[1],c[2]);
+
+    struct test t = {1,2,3};
+    printf("t %d %d %d\n",t.a,t.b,t.c);
+
+    struct test3 {
+	int a,b,c;
+    } *p, q, d = {
+	1,2,3,
+    };
+    printf("d %d %d %d\n",d.a,d.b,d.c);
+    p = & (struct test3) {1,2,3};
+    printf("p %d %d %d\n",p->a,p->b,p->c);
+    q =  (struct test3) {1,2,3};
+    printf("q %d %d %d\n",q.a,q.b,q.c);
+
+    struct test4 {
+	struct test5 {
+	    int a,b,c;
+	} d; 
+    } u = { .d = {1,2,3} };
+    struct test4 v = { .d = (struct test5){1,2,3} };
+    
+    printf("u %d %d %d\n",u.d.a,u.d.b,u.d.c);
+
+    printf("v %d %d %d\n",v.d.a,v.d.b,v.d.c);
+
+
     return 0;
 }