mirror of https://github.com/aamine/cbc
* net/loveruby/cflat/compiler/CodeGenerator.java (DereferenceNode): reduce compileLHS call.
* test/pointer4.cb: test derefering AddressNode. * test/test.sh: run it. git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@3797 1b9489fe-b721-0410-924e-b54b9192deb8
This commit is contained in:
parent
f327f73a0e
commit
6e3f520a14
|
@ -1,3 +1,12 @@
|
|||
Sat Jan 5 07:33:06 2008 Minero Aoki <aamine@loveruby.net>
|
||||
|
||||
* net/loveruby/cflat/compiler/CodeGenerator.java
|
||||
(DereferenceNode): reduce compileLHS call.
|
||||
|
||||
* test/pointer4.cb: test derefering AddressNode.
|
||||
|
||||
* test/test.sh: run it.
|
||||
|
||||
Sat Jan 5 07:21:18 2008 Minero Aoki <aamine@loveruby.net>
|
||||
|
||||
* net/loveruby/cflat/compiler/CodeGenerator.java (compileLHS):
|
||||
|
|
|
@ -414,8 +414,7 @@ static public void p(String s) { System.err.println(s); }
|
|||
}
|
||||
|
||||
public void visit(DereferenceNode node) {
|
||||
compileLHS(node.expr());
|
||||
as.movq(addr(PTRREG), reg("ax"));
|
||||
compile(node.expr());
|
||||
loadWords(node.type(), addr("ax"), "ax");
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
import stdio;
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
int i = 777;
|
||||
printf("%d\n", *&i);
|
||||
return 0;
|
||||
}
|
|
@ -167,6 +167,7 @@ assert_out "1;2;1;1;3;4;5;6;OK" ./usertype
|
|||
assert_out "5;5" ./pointer
|
||||
assert_out "777" ./pointer2
|
||||
assert_out "1;777;3;4;1;777;3;4" ./pointer3
|
||||
assert_out "777" ./pointer4
|
||||
assert_out "1;2;3;4;5;6" ./ptrmemb
|
||||
assert_compile_error deref-semcheck1.cb
|
||||
assert_compile_error deref-semcheck2.cb
|
||||
|
|
Loading…
Reference in New Issue