translate-c: Support compound assignment of pointer and signed int
This handles `ptr += idx` and `ptr -= idx` when `idx` is a signed integer expression.
This commit is contained in:
committed by
Veikka Tuominen
parent
874c63f89c
commit
6d69a29d75
@@ -1154,6 +1154,16 @@ pub fn addCases(cases: *tests.RunTranslatedCContext) void {
|
||||
\\ y = x - idx;
|
||||
\\ if (y != x + 1 || y != &array[6]) abort();
|
||||
\\
|
||||
\\ idx = 1;
|
||||
\\ x += idx;
|
||||
\\ if (x != &array[6]) abort();
|
||||
\\ x -= idx;
|
||||
\\ if (x != &array[5]) abort();
|
||||
\\ y = (x += idx);
|
||||
\\ if (y != x || y != &array[6]) abort();
|
||||
\\ y = (x -= idx);
|
||||
\\ if (y != x || y != &array[5]) abort();
|
||||
\\
|
||||
\\ return 0;
|
||||
\\}
|
||||
, "");
|
||||
|
||||
Reference in New Issue
Block a user