diff options
| author | Richard Qin <richard.qin.001@gmail.com> | 2026-09-15 08:16:43 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.001@gmail.com> | 2026-09-15 08:16:43 +0800 |
| commit | 4022e5c95210631e4aceb08eaf9d9071aa5aefc4 (patch) | |
| tree | a5922559836e45fb3459a3d070367912e1035b1a /tests/sysy_lvX/fold_global_const.sy | |
| download | rcc-4022e5c95210631e4aceb08eaf9d9071aa5aefc4.tar.gz rcc-4022e5c95210631e4aceb08eaf9d9071aa5aefc4.tar.xz | |
Diffstat (limited to 'tests/sysy_lvX/fold_global_const.sy')
| -rw-r--r-- | tests/sysy_lvX/fold_global_const.sy | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/sysy_lvX/fold_global_const.sy b/tests/sysy_lvX/fold_global_const.sy new file mode 100644 index 0000000..72b2829 --- /dev/null +++ b/tests/sysy_lvX/fold_global_const.sy @@ -0,0 +1,25 @@ +int a[3][4][5] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59}; +int b[100]; +int d[100]; +int c = 50; + +void f() { + b[a[1][2][3]] = 5; + b[c] = 7; +} + +void g(int x[]) { + x[c] = 9; +} + +int main() { + putint(a[2][3][3]); putch(10); + putint(a[2][3][4]); putch(10); + putint(a[2][3][4]); putch(10); + putint(c); putch(10); + f(); + putint(b[a[1][2][3]]); putch(10); + g(d); + putint(d[c]); putch(10); + return 0; +}
\ No newline at end of file |
