changeset 786:3ebbec5a72dc

i64 strinit inlined struct init does not zero fill
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 21 Nov 2010 11:44:09 +0900
parents 33d9a4b05bc8
children ffd2e5dbbf64
files .gdbinit Changes mc-code-i64.c mc-codegen.c mc-inline.c mc.h
diffstat 6 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/.gdbinit	Sat Nov 20 18:04:11 2010 +0900
+++ b/.gdbinit	Sun Nov 21 11:44:09 2010 +0900
@@ -25,9 +25,9 @@
 # r -s test/macro.c
 # r -s test/basic.c
 # r -s test/float.c
-# r -s test/strinit.c
+r -s test/strinit.c
 # r -s test/arg.c
-r -s test/obsf2.c
+# r -s test/obsf2.c
 # r -s test/putenemy.c
 # r -s -DINLINE=inline test/code-gen-all.c
 # r -s -DINLINE=inline test/strinit.c
--- a/Changes	Sat Nov 20 18:04:11 2010 +0900
+++ b/Changes	Sun Nov 21 11:44:09 2010 +0900
@@ -9893,4 +9893,15 @@
 作るべき?
 
 
-
+Sun Nov 21 09:51:14 JST 2010
+
+部分的に初期化されない構造体はゼロが入るべきで、それは、local_struct_static
+で行われるのだが、inline 側で正しく対処されてない。
+
+local_struct_static は、inline ではできないみたいに書いてあるけど、
+なんでだろう?
+
+parse_mode でなければ正しく動く。
+
+穴があったら、そこにゼロをいれる見たいなコードにする?
+
--- a/mc-code-i64.c	Sat Nov 20 18:04:11 2010 +0900
+++ b/mc-code-i64.c	Sun Nov 21 11:44:09 2010 +0900
@@ -1418,7 +1418,7 @@
     int r = get_ptr_cache(ncaddr(e1));
     if (cadr(e1)) {
         printf("\tmovl %d(%s),%s\n", cadr(e1),register_name(r,0),
-                register_name(creg,0));
+                register_name(creg,SIZE_OF_INT));
     } else {
         printf("\tmovl (%s),%s\n", register_name(r,0), register_name(creg,SIZE_OF_INT));
     }
--- a/mc-codegen.c	Sat Nov 20 18:04:11 2010 +0900
+++ b/mc-codegen.c	Sun Nov 21 11:44:09 2010 +0900
@@ -46,8 +46,6 @@
 int endian;
 int struct_align;
 
-#define STRUCT_ALIGN 1
-
 static void assign(int e1);
 #if ASM_CODE
 static void gen_asm(int asm0,int in,int out,int opt,int e);
@@ -3952,7 +3950,7 @@
 
     if (inmode) error(-1);
 #if STRUCT_ALIGN
-    if (t!=-99) {
+    if (t!=EMPTY) {
 	int strtype=0;
 	if (t>0 && (car(t)==STRUCT||car(t)==UNION))
 	    strtype=1;
--- a/mc-inline.c	Sat Nov 20 18:04:11 2010 +0900
+++ b/mc-inline.c	Sun Nov 21 11:44:09 2010 +0900
@@ -695,7 +695,7 @@
     int ass,sz,bfd;
 
 #if STRUCT_ALIGN
-    if (t!=-99) {
+    if (t!=EMPTY) {
         int strtype=0;
         if (t>0 && (car(t)==STRUCT||car(t)==UNION))
             strtype=1;
--- a/mc.h	Sat Nov 20 18:04:11 2010 +0900
+++ b/mc.h	Sun Nov 21 11:44:09 2010 +0900
@@ -27,6 +27,8 @@
 #define CASE_CODE 1
 #define ASM_CODE 1
 #define BIT_FIELD_CODE 1
+#define STRUCT_ALIGN 1
+
 
 /* reserved word start */