diff --git a/module/language/c99/compiler.mes b/module/language/c99/compiler.mes index cbc7ca92..c64429b7 100644 --- a/module/language/c99/compiler.mes +++ b/module/language/c99/compiler.mes @@ -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))) diff --git a/scaffold/tests/76-pointer-arithmetic.c b/scaffold/tests/76-pointer-arithmetic.c index 2edb00a4..39469d43 100644 --- a/scaffold/tests/76-pointer-arithmetic.c +++ b/scaffold/tests/76-pointer-arithmetic.c @@ -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; }