mescc: Tinycc support: pointer arithmetic with &variable.
* module/language/c99/compiler.mes (expr->pointer): Handle ref. * scaffold/tests/76-pointer-arithmetic.c: Test it.
This commit is contained in:
parent
0875ce655a
commit
8649f7a923
|
@ -1736,6 +1736,7 @@
|
|||
((pre-dec ,a) (expr->pointer info a))
|
||||
((post-inc ,a) (expr->pointer info a))
|
||||
((post-dec ,a) (expr->pointer info a))
|
||||
((ref-to ,expr) (1+ (expr->pointer info expr)))
|
||||
((array-ref ,index ,array)
|
||||
(1- (expr->pointer info array)))
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ test ()
|
|||
if (pfoo != 12) return 17;
|
||||
|
||||
int one = 1;
|
||||
int two = 2;
|
||||
pfoo = pfoo - one;
|
||||
eputs ("pfoo="); eputs (itoa (pfoo)); eputs ("\n");
|
||||
if (pfoo) return 18;
|
||||
|
@ -91,5 +92,7 @@ test ()
|
|||
eputs ("pfoo="); eputs (itoa (pfoo)); eputs ("\n");
|
||||
if (pfoo != 12) return 21;
|
||||
|
||||
if (&one - 1 != &two) return 22;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue