From 85dd953b70c5f607769016bbf2a0aa3de7e41b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sun, 30 Apr 2023 23:15:33 +0100 Subject: [PATCH] Add padding when loading global ints on 64-bit arches. --- cc_core.c | 8 ++++++++ test/test.answers | 14 +++++++------- test/test1000/proof.answer | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/cc_core.c b/cc_core.c index f493eb4..67c205e 100644 --- a/cc_core.c +++ b/cc_core.c @@ -2737,10 +2737,18 @@ void global_assignment() globals_list = emit("\n", globals_list); global_token = global_token->next; require(NULL != global_token, "Global locals value in assignment\n"); + unsigned padding_zeroes; if(in_set(global_token->s[0], "0123456789")) { /* Assume Int */ globals_list = emit("%", globals_list); globals_list = emit(global_token->s, globals_list); + padding_zeroes = register_size / 4 - 1; + while(padding_zeroes > 0) + { + /* Assume positive Int */ + globals_list = emit(" %0", globals_list); + padding_zeroes = padding_zeroes - 1; + } globals_list = emit("\n", globals_list); } else if(('"' == global_token->s[0])) diff --git a/test/test.answers b/test/test.answers index 02597c1..716ac64 100644 --- a/test/test.answers +++ b/test/test.answers @@ -280,10 +280,10 @@ fe06db794391e8a9bcc7751a8b20120b8402aeaba4adf59e9274ee6f0751518e test/results/t 67aa68a06be6d18f1187a06c36c6955c7a16d47b50b464a71ea1459cd5673a59 test/results/test0106-riscv32-binary a66c6cee11e9b59affe6dd953f84887a68ad57efe9f089cabb19d0c4c4626648 test/results/test0106-riscv64-binary 5e5d011745862a5726473e762d057c95fffeb44d317a0ebe90ef67040157e2ec test/results/test0106-x86-binary -af1280d10115502a9784453f91b1ce488d1d29b7a184203e84293c20f227c1d6 test/results/test1000-aarch64-binary -b7b1d0fbacbd6f033fb6305197c985740143e4fb245c249414c6ff974b8ba71a test/results/test1000-amd64-binary -5c54b07b575c77c4225997e2d2198795ed0e9bb05b5750ef47f618735a12c617 test/results/test1000-armv7l-binary -f03a0a974f878cd26599f204c7336aaff361ee91e47e8017e2f59065d4a36296 test/results/test1000-knight-posix-binary -e2d11b969fd64ff6d5860d22dedd530ecd0952ebed7bbf5dbb7c8dc52be36963 test/results/test1000-riscv32-binary -ca274ebcf1d1f289de73a76661d1c3ff6c0512037099c667f541605667f2e366 test/results/test1000-riscv64-binary -0110686077423a446f8ed733550020f6e1e105b0d7418a12f16378f5a0a27621 test/results/test1000-x86-binary +e8b60d7bb0c6e09fc248601ceacea64b93e288ec7bf68144ed7f8c59fc632cb9 test/results/test1000-aarch64-binary +8aed2794e9b07dfd900fe0a6b91cd004a10259bd05debd0caf2f139de2b2f631 test/results/test1000-amd64-binary +b3479ffc8ac398458ccca614a9a63d94de066e3726133c7937903d8b9dbe8666 test/results/test1000-armv7l-binary +62b958a16dcad2d79efc092afac421a1450193958ac724c38b28ccef774726a1 test/results/test1000-knight-posix-binary +37f72135babbe8c29baf6c98846ba336a3f28e30ae30ce86d4cdcad6ba3a9e64 test/results/test1000-riscv32-binary +512e83b3b930b0b09fa65b508f90fcb4bd973dbbe55738a053fe23a917398dcd test/results/test1000-riscv64-binary +0f6c93378651b59df933aefa311bdfa518ad2d75c4add37d0550f483e096a228 test/results/test1000-x86-binary diff --git a/test/test1000/proof.answer b/test/test1000/proof.answer index f1161cb..24f19f5 100644 --- a/test/test1000/proof.answer +++ b/test/test1000/proof.answer @@ -1 +1 @@ -f198af470bea2b00d99539a44fb6fb6c99aaddfb95bb137f9d5d3a0fc7175b59 test/test1000/proof +e324cd48664a7563af5f49faaa3d8c6ceb33e2c6201f60424a5029ecec84a86a test/test1000/proof -- 2.45.2