# HG changeset patch # User kono # Date 1134312807 -32400 # Node ID 77cab9687d3f496ac73d8d369f6dcf36e10f287c # Parent 8370ba6e8557bbd4b907516da9c8a05ff9cd8c6f *** empty log message *** diff -r 8370ba6e8557 -r 77cab9687d3f Changes --- a/Changes Sun Dec 11 23:23:18 2005 +0900 +++ b/Changes Sun Dec 11 23:53:27 2005 +0900 @@ -7354,6 +7354,20 @@ attribute は変数にしかつかない。関数の型にconstを入れるとすれば、 ANSI-Cとの互換性を考えても type system に入れるべきでしょう。 - - - +int a0(); +int a5(); + +#define TYPE double + +TYPE addrs[]={ + (TYPE)&a0, + (TYPE)&a5, + (TYPE)a0, + (TYPE)a5, + 0, +}; + +なるほど、long long ではエラーを出して良いらしい。 + + + diff -r 8370ba6e8557 -r 77cab9687d3f mc-codegen.c --- a/mc-codegen.c Sun Dec 11 23:23:18 2005 +0900 +++ b/mc-codegen.c Sun Dec 11 23:53:27 2005 +0900 @@ -2885,23 +2885,25 @@ emit_space(cadr(e)); return; case CHAR: case UCHAR: + if (car(e)!=CONST) error(INERR); emit_char(cadr(e)); data_alignment++; return; case SHORT: case USHORT: + if (car(e)!=CONST) error(INERR); emit_short(cadr(e)); data_alignment++; return; - case ENUM: - emit_int(cadr(e)); - return; case LONGLONG: case ULONGLONG: + if (car(e)!=LCONST&&car(e)!=CONST) error(INERR); emit_longlong(e); return; case DOUBLE: + if (car(e)!=DCONST&&car(e)!=FCONST) error(INERR); emit_double(e); return; case FLOAT: + if (car(e)!=DCONST&&car(e)!=FCONST) error(INERR); emit_float(e); data_alignment++; return; @@ -2913,7 +2915,8 @@ return; } if (car(t)!=POINTER&&car(t)!=ARRAY) error(-1); - case INT: case UNSIGNED: + case INT: case UNSIGNED: /* including address case */ + case ENUM: switch(car(e)) { case CONST: emit_int(cadr(e)); diff -r 8370ba6e8557 -r 77cab9687d3f test/call.c --- a/test/call.c Sun Dec 11 23:23:18 2005 +0900 +++ b/test/call.c Sun Dec 11 23:53:27 2005 +0900 @@ -62,7 +62,7 @@ }; - +int main(int ac,char *av[]) { int j,k; conv = a0;