changeset 444:8bec605d1701

small sized struct
author kono
date Sun, 21 Nov 2004 11:20:56 +0900
parents f2d2e27a00a0
children 5ec2a88b9f4d
files Changes Makefile Makefile.linuxzaurus Makefile.mips mc-code-arm.c mc-code-ia32.c mc-code-mips.c mc-code-powerpc.c mc-codegen.c mc-parse.c test/obsf2.c test/simp.c
diffstat 12 files changed, 275 insertions(+), 163 deletions(-) [+]
line wrap: on
line diff
--- a/Changes	Sun Nov 21 01:27:21 2004 +0900
+++ b/Changes	Sun Nov 21 11:20:56 2004 +0900
@@ -6683,9 +6683,15 @@
 MIPS と ARM は、ちょっとしくじってるな。
 
 あれ、複数のファイルをコンパイルするときの問題があったような
-気がするんだが...
+気がするんだが... あるね。
+    ./mc-hoge mc-*.c
 
 
 Sat Nov 20 22:00:36 JST 2004
 
 あぁ、なんかいろいろ破壊しているし〜
+
+なんか、いろいろ残ってたね。ia32 の long eq/ne 。 int + unsigned が
+unsigned になったり。
+
+size < int のstruct の値の渡し方がおかしい
--- a/Makefile	Sun Nov 21 01:27:21 2004 +0900
+++ b/Makefile	Sun Nov 21 11:20:56 2004 +0900
@@ -81,6 +81,7 @@
 	make check TARGET=test/tmp9
 	make check TARGET=test/enum
 	make check TARGET=test/obsf
+	make check TARGET=test/obsf2
 	make check TARGET=test/long
 	make check TARGET=test/tstdarg
 	make check TARGET=test/switch
@@ -117,7 +118,7 @@
 #	-./$(MC) -Itest/ -s $(TARGET).c
 
 check: $(MC) $(TARGET).c
-	-gcc $(STDFLAG) $(TARGET).c -o b.out $(MLIB)
+	-gcc $(CFLAGS) $(STDFLAG) $(TARGET).c -o b.out $(MLIB)
 	-./b.out > $(TARGET).gcc.out
 	-./$(MC) -s $(TARGET).c
 	-gcc $(TARGET).s $(MLIB)
--- a/Makefile.linuxzaurus	Sun Nov 21 01:27:21 2004 +0900
+++ b/Makefile.linuxzaurus	Sun Nov 21 11:20:56 2004 +0900
@@ -1,18 +1,24 @@
 CC = gcc
 # -O3
-CFLAGS = -fsigned-char -pipe -g -Wall -I. -I/home/zaurus/develop/include
+# CFLAGS = -g -Wall -I.
+# CFLAGS = -g -Wall -I. -pg -fprofile-arcs -ftest-coverage
+# LDFLAGS = -pg
+# for Linux Zaurus
+CFLAGS = -fsigned-char -pipe -g -I. -I/home/zaurus/develop/include
 BASE=0
 STAGE=1
 MFLAGS=$(MFALGS) BASE=$(BASE) STAGE=$(STAGE)
-ARCH=powerpc
+ARCH=arm
 MC=mc-$(ARCH)
-# MLIB = -lm
+MLIB = -lm
 PRINTF= # printf.c
 CONVERTER=conv/c.o conv/null.o
 # conv/c2cbc.o conv/cbc2c.o
 COMPLIB = mc-parse.o mc-codegen.o mc-switch.o mc-macro.o mc-tree.o
 # CODE=mc-code-ia32.c
 CODE=mc-code-$(ARCH).c
+#
+TARGET=test/simp
 
 all: mc mc-ia32 mc-powerpc mc-mips mc-arm
 
@@ -27,16 +33,16 @@
 		conv/conv.h conv/convdef.h conv/null.c
 
 mc-powerpc : mc-code-powerpc.o $(COMPLIB) $(CONVERTER)
-	$(CC) -g mc-code-powerpc.o $(COMPLIB) $(CONVERTER) -o $@
+	$(CC) $(LDFLAGS) -g mc-code-powerpc.o $(COMPLIB) $(CONVERTER) -o $@
 
 mc-ia32 : mc-code-ia32.o $(COMPLIB) $(CONVERTER)
-	$(CC) -g mc-code-ia32.o $(COMPLIB) $(CONVERTER) -o $@
+	$(CC) $(LDFLAGS) -g mc-code-ia32.o $(COMPLIB) $(CONVERTER) -o $@
 
 mc-mips : mc-code-mips.o $(COMPLIB) $(CONVERTER)
-	$(CC) -g mc-code-mips.o $(COMPLIB) $(CONVERTER) -o $@
+	$(CC) $(LDFLAGS) -g mc-code-mips.o $(COMPLIB) $(CONVERTER) -o $@
 
 mc-arm : mc-code-arm.o $(COMPLIB) $(CONVERTER)
-	$(CC) -g mc-code-arm.o $(COMPLIB) $(CONVERTER) -o $@
+	$(CC) $(LDFLAGS) -g mc-code-arm.o $(COMPLIB) $(CONVERTER) -o $@
 
 conv/conv.h: conv_func.tbl conv_func.pl
 	perl conv_func.pl
@@ -75,6 +81,7 @@
 	make check TARGET=test/tmp9
 	make check TARGET=test/enum
 	make check TARGET=test/obsf
+	make check TARGET=test/obsf2
 	make check TARGET=test/long
 	make check TARGET=test/tstdarg
 	make check TARGET=test/switch
@@ -83,6 +90,8 @@
 	make check TARGET=test/bitfield
 	make check TARGET=test/bitfield1
 	make check TARGET=test/cext
+	make check TARGET=test/const
+	make check TARGET=test/void_code
 #	make check TARGET=test/scope STDFLAG="-std=gnu99"
 #MK =-make
 MK=
@@ -109,7 +118,7 @@
 #	-./$(MC) -Itest/ -s $(TARGET).c
 
 check: $(MC) $(TARGET).c
-	-gcc $(STDFLAG) $(TARGET).c -o b.out $(MLIB)
+	-gcc $(CFLAGS) $(STDFLAG) $(TARGET).c -o b.out $(MLIB)
 	-./b.out > $(TARGET).gcc.out
 	-./$(MC) -s $(TARGET).c
 	-gcc $(TARGET).s $(MLIB)
@@ -207,5 +216,3 @@
 	-diff b04.s b24.s
 
 
-# DO NOT DELETE
-
--- a/Makefile.mips	Sun Nov 21 01:27:21 2004 +0900
+++ b/Makefile.mips	Sun Nov 21 11:20:56 2004 +0900
@@ -1,6 +1,10 @@
-CC = gcc 
+CC = gcc
 # -O3
 CFLAGS = -g -Wall -I.
+# CFLAGS = -g -Wall -I. -pg -fprofile-arcs -ftest-coverage
+# LDFLAGS = -pg
+# for Linux Zaurus
+# CFLAGS = -fsigned-char -pipe -g -I. -I/home/zaurus/develop/include
 BASE=0
 STAGE=1
 MFLAGS=$(MFALGS) BASE=$(BASE) STAGE=$(STAGE)
@@ -13,8 +17,10 @@
 COMPLIB = mc-parse.o mc-codegen.o mc-switch.o mc-macro.o mc-tree.o
 # CODE=mc-code-ia32.c
 CODE=mc-code-$(ARCH).c
+#
+TARGET=test/simp
 
-all: mc mc-ia32 mc-powerpc mc-mips
+all: mc mc-ia32 mc-powerpc mc-mips mc-arm
 
 mc:  mc-$(ARCH)
 	cp mc-$(ARCH) mc
@@ -27,13 +33,16 @@
 		conv/conv.h conv/convdef.h conv/null.c
 
 mc-powerpc : mc-code-powerpc.o $(COMPLIB) $(CONVERTER)
-	$(CC) -g mc-code-powerpc.o $(COMPLIB) $(CONVERTER) -o $@
+	$(CC) $(LDFLAGS) -g mc-code-powerpc.o $(COMPLIB) $(CONVERTER) -o $@
 
 mc-ia32 : mc-code-ia32.o $(COMPLIB) $(CONVERTER)
-	$(CC) -g mc-code-ia32.o $(COMPLIB) $(CONVERTER) -o $@
+	$(CC) $(LDFLAGS) -g mc-code-ia32.o $(COMPLIB) $(CONVERTER) -o $@
 
 mc-mips : mc-code-mips.o $(COMPLIB) $(CONVERTER)
-	$(CC) -g mc-code-mips.o $(COMPLIB) $(CONVERTER) -o $@
+	$(CC) $(LDFLAGS) -g mc-code-mips.o $(COMPLIB) $(CONVERTER) -o $@
+
+mc-arm : mc-code-arm.o $(COMPLIB) $(CONVERTER)
+	$(CC) $(LDFLAGS) -g mc-code-arm.o $(COMPLIB) $(CONVERTER) -o $@
 
 conv/conv.h: conv_func.tbl conv_func.pl
 	perl conv_func.pl
@@ -72,6 +81,7 @@
 	make check TARGET=test/tmp9
 	make check TARGET=test/enum
 	make check TARGET=test/obsf
+	make check TARGET=test/obsf2
 	make check TARGET=test/long
 	make check TARGET=test/tstdarg
 	make check TARGET=test/switch
@@ -79,6 +89,10 @@
 	make check TARGET=test/code-gen-all
 	make check TARGET=test/bitfield
 	make check TARGET=test/bitfield1
+	make check TARGET=test/cext
+	make check TARGET=test/const
+	make check TARGET=test/void_code
+#	make check TARGET=test/scope STDFLAG="-std=gnu99"
 #MK =-make
 MK=
 check-all-code:
@@ -93,6 +107,7 @@
 	make check-code$(MK) TARGET=test/tmp2
 	make check-code$(MK) TARGET=test/tmp4
 #	make check-code$(MK) TARGET=test/tmp6
+	make check-code$(MK) TARGET=test/scope
 
 check-nkf:
 	( cd nkf203; $(CC) -g -o nkf1 nkf.c utf8tbl.c )
@@ -103,7 +118,7 @@
 #	-./$(MC) -Itest/ -s $(TARGET).c
 
 check: $(MC) $(TARGET).c
-	-gcc $(TARGET).c -o b.out $(MLIB)
+	-gcc $(STDFLAG) $(TARGET).c -o b.out $(MLIB)
 	-./b.out > $(TARGET).gcc.out
 	-./$(MC) -s $(TARGET).c
 	-gcc $(TARGET).s $(MLIB)
@@ -145,7 +160,7 @@
                 mc-code-mips.c
 
 clean :
-	-rm -f mc mc-ia32 mc-powerpc mc-mips *.bak *.s *.o *.cc mc mc1 mc2 a.out *~ core* */*.o *.bak test/*.s test/*.cc test/*.o test/*.bak test/*~ conv/*.s conv/*.cc conv/*.o conv/*.bak conv/*~ *.out */*.out *.i */*.i
+	-rm -f mc mc-ia32 mc-powerpc mc-mips mc-arm *.bak *.s *.o *.cc mc mc1 mc2 a.out *~ core* */*.o *.bak test/*.s test/*.cc test/*.o test/*.bak test/*~ conv/*.s conv/*.cc conv/*.o conv/*.bak conv/*~ *.out */*.out *.i */*.i
 
 mc1 : b00.s b01.s mc-codegen.o mc-tree.o mc-switch.o mc-macro.o $(CONVERTER)
 	$(CC) -g -o $@ $(PRINTF) b00.s b01.s mc-codegen.o mc-tree.o mc-switch.o mc-macro.o $(CONVERTER)
@@ -203,114 +218,65 @@
 
 # DO NOT DELETE
 
-mc-code-ia32.o: /usr/include/stdio.h /usr/include/features.h
-mc-code-ia32.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-mc-code-ia32.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-mc-code-ia32.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-mc-code-ia32.o: /usr/include/bits/sched.h /usr/include/libio.h
-mc-code-ia32.o: /usr/include/_G_config.h /usr/include/wchar.h
-mc-code-ia32.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-mc-code-ia32.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-mc-code-ia32.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-mc-code-ia32.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h
-mc-code-ia32.o: mc-code.h
-mc-codegen.o: /usr/include/stdio.h /usr/include/features.h
-mc-codegen.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-mc-codegen.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-mc-codegen.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-mc-codegen.o: /usr/include/bits/sched.h /usr/include/libio.h
-mc-codegen.o: /usr/include/_G_config.h /usr/include/wchar.h
-mc-codegen.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-mc-codegen.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-mc-codegen.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-mc-codegen.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h
-mc-codegen.o: mc-code.h
-mc-parse.o: /usr/include/stdio.h /usr/include/features.h
-mc-parse.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-mc-parse.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-mc-parse.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-mc-parse.o: /usr/include/bits/sched.h /usr/include/libio.h
-mc-parse.o: /usr/include/_G_config.h /usr/include/wchar.h
-mc-parse.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-mc-parse.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-mc-parse.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-mc-parse.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h
-mc-parse.o: mc-switch.h mc-macro.h conv/conv.h
-mc-tree.o: /usr/include/stdio.h /usr/include/features.h
-mc-tree.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-mc-tree.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-mc-tree.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-mc-tree.o: /usr/include/bits/sched.h /usr/include/libio.h
-mc-tree.o: /usr/include/_G_config.h /usr/include/wchar.h
-mc-tree.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-mc-tree.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-mc-tree.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-mc-tree.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h
-mc-switch.o: /usr/include/stdio.h /usr/include/features.h
-mc-switch.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-mc-switch.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-mc-switch.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-mc-switch.o: /usr/include/bits/sched.h /usr/include/libio.h
-mc-switch.o: /usr/include/_G_config.h /usr/include/wchar.h
-mc-switch.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-mc-switch.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-mc-switch.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-mc-switch.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-codegen.h
-mc-switch.o: mc-code.h
-mc-macro.o: /usr/include/stdio.h /usr/include/features.h
-mc-macro.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-mc-macro.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-mc-macro.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-mc-macro.o: /usr/include/bits/sched.h /usr/include/libio.h
-mc-macro.o: /usr/include/_G_config.h /usr/include/wchar.h
-mc-macro.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-mc-macro.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-mc-macro.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-mc-macro.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-macro.h
-mc-macro.o: mc-code.h
-conv/c.o: /usr/include/stdio.h /usr/include/features.h
-conv/c.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-conv/c.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-conv/c.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-conv/c.o: /usr/include/bits/sched.h /usr/include/libio.h
-conv/c.o: /usr/include/_G_config.h /usr/include/wchar.h
-conv/c.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-conv/c.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-conv/c.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-conv/c.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h conv/conv.h
-conv/c.o: conv/convdef.h conv/c.h
+mc-code-ia32.o: /usr/include/stdio.h /usr/include/sys/types.h
+mc-code-ia32.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
+mc-code-ia32.o: /usr/include/machine/types.h /usr/include/ppc/types.h
+mc-code-ia32.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
+mc-code-ia32.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h mc.h
+mc-code-ia32.o: mc-parse.h mc-codegen.h mc-code.h
+mc-codegen.o: /usr/include/stdio.h /usr/include/sys/types.h
+mc-codegen.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
+mc-codegen.o: /usr/include/machine/types.h /usr/include/ppc/types.h
+mc-codegen.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
+mc-codegen.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h mc.h
+mc-codegen.o: mc-parse.h mc-codegen.h mc-code.h
+mc-parse.o: /usr/include/stdio.h /usr/include/sys/types.h
+mc-parse.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
+mc-parse.o: /usr/include/machine/types.h /usr/include/ppc/types.h
+mc-parse.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
+mc-parse.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h mc.h
+mc-parse.o: mc-parse.h mc-codegen.h mc-switch.h mc-macro.h conv/conv.h
+mc-tree.o: /usr/include/stdio.h /usr/include/sys/types.h
+mc-tree.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
+mc-tree.o: /usr/include/machine/types.h /usr/include/ppc/types.h
+mc-tree.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
+mc-tree.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h mc.h
+mc-tree.o: mc-parse.h
+mc-switch.o: /usr/include/stdio.h /usr/include/sys/types.h
+mc-switch.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
+mc-switch.o: /usr/include/machine/types.h /usr/include/ppc/types.h
+mc-switch.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
+mc-switch.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h mc.h
+mc-switch.o: mc-parse.h mc-codegen.h mc-code.h
+mc-macro.o: /usr/include/stdio.h /usr/include/sys/types.h
+mc-macro.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
+mc-macro.o: /usr/include/machine/types.h /usr/include/ppc/types.h
+mc-macro.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
+mc-macro.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h mc.h
+mc-macro.o: mc-parse.h mc-macro.h mc-code.h
+conv/c.o: /usr/include/stdio.h /usr/include/sys/types.h
+conv/c.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
+conv/c.o: /usr/include/machine/types.h /usr/include/ppc/types.h
+conv/c.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
+conv/c.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h mc.h
+conv/c.o: mc-parse.h conv/conv.h conv/convdef.h conv/c.h
 conv/c2cbc.o: mc.h
 conv/cbc2c.o: mc.h
-conv/null.o: /usr/include/stdio.h /usr/include/features.h
-conv/null.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-conv/null.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-conv/null.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-conv/null.o: /usr/include/bits/sched.h /usr/include/libio.h
-conv/null.o: /usr/include/_G_config.h /usr/include/wchar.h
-conv/null.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-conv/null.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-conv/null.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-conv/null.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h conv/conv.h
-conv/null.o: conv/convdef.h conv/null.h
-mc-code-powerpc.o: /usr/include/stdio.h /usr/include/features.h
-mc-code-powerpc.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-mc-code-powerpc.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-mc-code-powerpc.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-mc-code-powerpc.o: /usr/include/bits/sched.h /usr/include/libio.h
-mc-code-powerpc.o: /usr/include/_G_config.h /usr/include/wchar.h
-mc-code-powerpc.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-mc-code-powerpc.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-mc-code-powerpc.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-mc-code-powerpc.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-code.h
-mc-code-powerpc.o: mc-codegen.h
-mc-code-mips.o: /usr/include/stdio.h /usr/include/features.h
-mc-code-mips.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
-mc-code-mips.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stddef.h
-mc-code-mips.o: /usr/include/bits/types.h /usr/include/bits/pthreadtypes.h
-mc-code-mips.o: /usr/include/bits/sched.h /usr/include/libio.h
-mc-code-mips.o: /usr/include/_G_config.h /usr/include/wchar.h
-mc-code-mips.o: /usr/include/bits/wchar.h /usr/include/gconv.h
-mc-code-mips.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/stdarg.h
-mc-code-mips.o: /usr/lib/gcc-lib/mipsEEel-linux/2.95.2/include/va-mips.h
-mc-code-mips.o: /usr/include/bits/stdio_lim.h mc.h mc-parse.h mc-code.h
-mc-code-mips.o: mc-codegen.h
+conv/null.o: /usr/include/stdio.h /usr/include/sys/types.h
+conv/null.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
+conv/null.o: /usr/include/machine/types.h /usr/include/ppc/types.h
+conv/null.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
+conv/null.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h mc.h
+conv/null.o: mc-parse.h conv/conv.h conv/convdef.h conv/null.h
+mc-code-powerpc.o: /usr/include/stdio.h /usr/include/sys/types.h
+mc-code-powerpc.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
+mc-code-powerpc.o: /usr/include/machine/types.h /usr/include/ppc/types.h
+mc-code-powerpc.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
+mc-code-powerpc.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h
+mc-code-powerpc.o: mc.h mc-parse.h mc-code.h mc-codegen.h
+mc-code-mips.o: /usr/include/stdio.h /usr/include/sys/types.h
+mc-code-mips.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
+mc-code-mips.o: /usr/include/machine/types.h /usr/include/ppc/types.h
+mc-code-mips.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
+mc-code-mips.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h mc.h
+mc-code-mips.o: mc-parse.h mc-code.h mc-codegen.h
--- a/mc-code-arm.c	Sun Nov 21 01:27:21 2004 +0900
+++ b/mc-code-arm.c	Sun Nov 21 11:20:56 2004 +0900
@@ -34,7 +34,7 @@
 static void ld_indexx(int byte, int n, int xreg,int reg,int sign);
 static void local_table(void);
 static void shift(char *op, int creg,int reg);
-static int struct_push(int e4,int t,int arg);
+static int push_struct(int e4,int t,int arg);
 static void register_usage(char *s);
 static void code_add(int reg,int offset,int r);
 static void const_list_table();
@@ -1976,15 +1976,15 @@
 }
 
 int
-struct_push(int e4,int t,int arg)
-{
-    int length,count;
+push_struct(int e4,int t,int arg)
+{
+    int length,len0,count;
     int dreg = -1,sreg; char *drn,*crn,*srn;
     int arg_disp = cadr(arg);
     int on_register,arg_reg;
     g_expr(e4);
     if (!is_int_reg(creg)) error(-1);
-    length=size(t);
+    len0=length=size(t);
     if(length%SIZE_OF_INT) {
         length += SIZE_OF_INT - (length%SIZE_OF_INT);
     }
@@ -1992,8 +1992,10 @@
     on_register = 0;
     // arg_reg = 1-CALLER_ARG(arg_disp-ARG_LVAR_OFFSET)/SIZE_OF_INT;
     arg_reg = (arg_disp-ARG_LVAR_OFFSET)/SIZE_OF_INT + 1;
-    while (arg_disp>=ARG_LVAR_OFFSET && CALLER_ARG(arg_disp-ARG_LVAR_OFFSET)<0) {
-	/* some part will be in registers */
+    while (length>0 && 
+             arg_disp>=ARG_LVAR_OFFSET && 
+             CALLER_ARG(arg_disp-ARG_LVAR_OFFSET)<0) {
+	/* some part will be on registers */
 	on_register ++; 
 	length-=SIZE_OF_INT; arg_disp+= SIZE_OF_INT;
     }
@@ -2034,7 +2036,10 @@
 	if (dreg!=-1) free_register(dreg);
     }
     for (count=0,arg_reg; on_register-->0; arg_reg++,count+=SIZE_OF_INT) {
-	printf("\tldr\t%s, [%s, #%d]\n", register_name(arg_reg), crn,count);
+	// len0 = (len0>2)?0:len0;
+	printf("\t%s\t%s, [%s, #%d]\n", cload(0,0),
+		register_name(arg_reg), crn,count);
+	use_input_reg(arg_reg,1);
     }
     return length/SIZE_OF_INT;
 }
@@ -2257,6 +2262,10 @@
     return ARG_LVAR_OFFSET+arg*SIZE_OF_INT;
 }
 
+/* 
+     Mark argument register is used. This is too complex.
+     There must be an easy way.
+ */
 
 static void
 use_input_reg(int reg,int mode)
@@ -2585,9 +2594,9 @@
 	    e4 = car(e3);
 	    t  = caddr(e3);
 	    arg = get_input_arg(t,AS_ARG,caddr(stargs),cadddr(stargs),0);
-	    struct_push(e4,t,arg);
+	    push_struct(e4,t,arg);
 	    car(e3)=0;  // done
-	    if (car(arg)==REGISTER)
+	    if (car(arg)==REGISTER)   // wrong?
 		use_input_reg(cadr(arg),1);
 	}
     } else {
--- a/mc-code-ia32.c	Sun Nov 21 01:27:21 2004 +0900
+++ b/mc-code-ia32.c	Sun Nov 21 11:20:56 2004 +0900
@@ -177,6 +177,7 @@
 static int edx_setup(int rreg);
 static void edx_cleanup();
 static void local_table(void);
+static int push_struct(int e4,int t) ;
 #if FLOAT_CODE
 static char * fload(int d);
 static int code_d1(double d);
@@ -1167,8 +1168,8 @@
     regv[creg]=1;
 }
 
-int
-struct_push(int e4,int t) 
+static int
+push_struct(int e4,int t) 
 {
     int length,xreg,save,lreg,count;
     g_expr(e4);
@@ -1276,7 +1277,7 @@
 	    stack_depth += SIZE_OF_FLOAT;
 	    continue;
 	} else if (car(t)==STRUCT||car(t)==UNION) {
-	    nargs += struct_push(e4,t);
+	    nargs += push_struct(e4,t);
 	    continue;
 	} else {
 	    error(TYERR);
--- a/mc-code-mips.c	Sun Nov 21 01:27:21 2004 +0900
+++ b/mc-code-mips.c	Sun Nov 21 11:20:56 2004 +0900
@@ -27,7 +27,7 @@
 static void ld_indexx(int byte, int n, int xreg,int reg,int sign);
 static void local_table(void);
 static void shift(char *op, int creg,int reg);
-static int struct_push(int e4,int t,int arg);
+static int push_struct(int e4,int t,int arg);
 static void register_usage(char *s);
 
 static int creg;
@@ -1601,7 +1601,7 @@
 }
 
 int
-struct_push(int e4,int t,int arg)
+push_struct(int e4,int t,int arg)
 {
     int length,count;
     int dreg,sreg; char *drn,*crn,*srn;
@@ -2152,7 +2152,7 @@
 	    e4 = car(e3);
 	    t  = caddr(e3);
 	    arg = get_input_arg(t,AS_ARG,caddr(stargs),cadddr(stargs),0);
-	    struct_push(e4,t,arg);
+	    push_struct(e4,t,arg);
 	    car(e3)=0;  // done
 	    if (car(arg)==REGISTER)
 		use_input_reg(cadr(arg),1);
--- a/mc-code-powerpc.c	Sun Nov 21 01:27:21 2004 +0900
+++ b/mc-code-powerpc.c	Sun Nov 21 11:20:56 2004 +0900
@@ -35,7 +35,7 @@
 static void ld_indexx(int byte, int n, int xreg,int reg,int sign);
 static void local_table(void);
 static void shift(char *op, int creg,int reg);
-static int struct_push(int e4,int t,int arg);
+static int push_struct(int e4,int t,int arg);
 
 
 static int creg;
@@ -1569,7 +1569,7 @@
 }
 
 int
-struct_push(int e4,int t,int arg) 
+push_struct(int e4,int t,int arg) 
 {
     int length,count;
     int dreg,sreg; char *drn,*crn,*srn;
@@ -2037,7 +2037,7 @@
             e4 = car(e3);
             t  = caddr(e3);
             arg = get_input_arg(t,AS_ARG,caddr(stargs),cadddr(stargs),0);
-            struct_push(e4,t,arg);
+            push_struct(e4,t,arg);
             car(e3)=0;  // done
         }
     } else {
--- a/mc-codegen.c	Sun Nov 21 01:27:21 2004 +0900
+++ b/mc-codegen.c	Sun Nov 21 11:20:56 2004 +0900
@@ -2562,8 +2562,8 @@
 		if (endian) n->dsp += size_of_int-size_of_short;
 	    }
 	    args += size_of_int;
-#if  0
-	} else if(type>0&&(type==UNION||type==STRUCT)) {
+#if  1
+	} else if(type>0&&(car(type)==UNION||car(type)==STRUCT)) {
 	    n->dsp = args;
 	    args += ((sz+(size_of_int-1))&~(size_of_int-1));
 #endif
@@ -3460,9 +3460,14 @@
 	if (car(e)==CONST && cadr(e)==0)
 	    return(e1);
 	if (car(e)==CONST) {
-	    if(car(e1)==ADDRESS&&car(cadr(e1))!=GVAR) {
-		return(list2(ADDRESS,list2(car(cadr(e1)),
-		    cadr(cadr(e1))+cadr(e))));
+	    if(car(e1)==ADDRESS) {
+		if (car(cadr(e1))!=GVAR) {
+		    return(list2(ADDRESS,
+			list2(car(cadr(e1)),cadr(cadr(e1))+cadr(e))));
+		} else {
+		    return(list2(ADDRESS,
+			list3(GVAR,cadr(cadr(e1))+cadr(e),caddr(cadr(e1)))));
+		}
 	    } else if(car(e1)==GVAR) {
 		return(list3(GVAR,cadr(e1)+cadr(e),caddr(e1)));
 	    } else if(car(e1)==LVAR) {
--- a/mc-parse.c	Sun Nov 21 01:27:21 2004 +0900
+++ b/mc-parse.c	Sun Nov 21 11:20:56 2004 +0900
@@ -365,6 +365,9 @@
    Par file initialization.
  */
 
+static int free_glist2_list = 0;
+static int free_glist3_list = 0;
+
 static void
 reinit(void)
 {
@@ -380,6 +383,8 @@
     for(p=nptr_pool;p;p=p->next) p->ptr=p->first;
     free_nptr_list = 0;
     for(i=0;i<GSYMS;i++) htable[i] = 0;
+    free_glist2_list = 0;
+    free_glist3_list = 0;
 
     heap_init();
 
@@ -1307,8 +1312,12 @@
 		    conv->decl_data_end_();
 		    if (caddr(t)==0) {           /* size not defined      */
 			caddr(t)=i+1;           /* define array size     */
-		    } else if (0 && caddr(t)!=i+1) {  /* size match?           */
-			error(TYERR);
+		    } else if (caddr(t)!=i+1) {  /* size match?           */
+			if (caddr(t) < i ) {   /* too many data */
+			    // this check is sligtly odd (fix me)
+			    // error(INERR);
+			} else
+			    assign_data(list2(CONST,caddr(t)-i),EMPTY,n,offset);
 		    }
 		    getsym(0);
 		    return offset;
@@ -3981,9 +3990,6 @@
     return e;
 }
 
-static int free_glist2_list = 0;
-static int free_glist3_list = 0;
-
 extern int
 glist2(int e1,int e2)
 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/obsf2.c	Sun Nov 21 11:20:56 2004 +0900
@@ -0,0 +1,111 @@
+typedef struct {
+    char x,y; 
+} s;
+
+char c[]={' ','\'','.',':',0x1b,'[','H'} ,
+  M[ 1843]={4,5,6,} ,
+  *m=&M[3],
+  e;
+int a,b;
+
+s P[15],Q[15];
+
+o(x,y){
+  a=80*(y/2)+x,b= 1+(y&1);
+  e?(m[a]|=b):(m[a]&=~b);
+
+  printf("x %02x y %02x a %04x m[a] %02x\n",x,y,a,m[a]);
+}
+
+W(s*p,s*q){
+  s t;
+  t=*p;
+  *p=*q;
+  *q=t;
+}
+
+l(s p, s q){
+  s t;
+  int x=p.x-q.x,
+      y=p.y-q.y,
+      w,
+      v;
+
+printf("p.x %02x p.y %02x q.x %02x q.y %02x\n",p.x,p.y,q.x,q.y);
+
+  x=x<0?-x:x;
+  y=y<0?-y:y;
+  if(y<x){
+    if( q.x<p.x)
+	W(&p,&q);
+    v=p.y<=q.y?1:-1;
+    w=(y%x)/2;
+    for(; p.x<=q.x; p.x++){
+      o(p.x, p.y);
+      if((w-=y)<=0)
+        w+=x,p.y+=v;
+    }
+  } else if(y){
+    if(q.y<p.y) 
+      W(&p,&q);
+    v=!(p.  x>q.x)?1:-1;
+    w=(x%y)/2;
+    for(; p.y<=q.y; p.y++){
+      o(p.x,q.y);
+      if((w-=x)<=0)
+	w+= y,
+	p.x+=v;
+    }
+  }
+}
+
+r(s*p,s q){
+  p->x=((rand()%80)-q.x)/11;
+  p->y=((rand()%48)-q.y)/11;
+printf("r: p->x %02x p->y %02x\n",p->x,p->y);
+}
+
+d(s*p,s q,s r){
+printf("d0: q->x %02x q->y %02x\n",q.x,q.y);
+printf("d1: r->x %02x r->y %02x\n",r.x,r.y);
+  p->x=q.x+r.x;
+  p->y=q.y+r.y;
+printf("d2: p->x %02x p->y %02x\n",p->x,p->y);
+}
+
+main(i,j,k){
+  s R,S;
+  int count;
+  i=0,
+    k=0;
+  srand(512);
+  for(count=0;count<400 ;count++){
+    j=(i+1)%10;
+    e=0;
+    l(P[j],Q[j]);
+printf("main0: p.x %02x p.y %02x q.x %02x q.y %02x\n",P[j].x,P[j].y,Q[j].x,Q[j].y);
+    if(--k<=0){
+      r(&R,P[i]);
+      r(&S,Q[i ]);
+printf("main1: R.x %02x R.y %02x S.x %02x S.y %02x\n",R.x,R.y,S.x,S.y);
+      k=10;
+    }
+    d(&P[j],P[i],R);
+printf("main2: p.x %02x p.y %02x q.x %02x q.y %02x\n",P[j].x,P[j].y,Q[i].x,Q[i].y);
+    d(&Q[j],Q[i],S);
+printf("main3: p.x %02x p.y %02x q.x %02x q.y %02x\n",P[j].x,P[j].y,Q[i].x,Q[i].y);
+    i=j;
+    e=1;
+    l(P[j],Q[j]);
+printf("main4: p.x %02x p.y %02x q.x %02x q.y %02x\n",P[j].x,P[j].y,Q[i].x,Q[i].y);
+    b=83;
+if (0)
+    for (a=0; a<sizeof M; a++){
+      if(--b<=0) 
+        b=80,putchar('\n');
+      putchar(c[M[a]]);
+    }
+  }
+}
+
+
--- a/test/simp.c	Sun Nov 21 01:27:21 2004 +0900
+++ b/test/simp.c	Sun Nov 21 11:20:56 2004 +0900
@@ -26,20 +26,20 @@
 char *av[];
 {
     int i;
-    printf("#0027:%d %c\n",ac,ch);
+    printf("#0028:%d %c\n",ac,ch);
     for(i=0;i<ac;i++) {
-	printf("#0029:%s\n",&av[i][3]);
+	printf("#0030:%s\n",&av[i][3]);
     }
-    printf("#0031:%d==1\n",alpha(ch));
+    printf("#0032:%d==1\n",alpha(ch));
     return 0;
 }
 
 main1(int l)
 {
-   printf("%d\n", ((l+0)<-511||(l+0)>511));
-   if ((l+0)<-511||(l+0)>511) printf("yes\n");
+   printf("#0038:%d\n", ((l+0)<-511||(l+0)>511));
+   if ((l+0)<-511||(l+0)>511) printf("#0039:yes\n");
    l = -1;
-   printf("%d\n", l==-1? 555:333);
+   printf("#0041:%d\n", l==-1? 555:333);
 }