Closed Yandong23 closed 1 year ago
I can not reproduce the error in ubuntu22.04. Which version of NEMU do you use?
I clone the code from Yanyan's wiki--2020年秋季《计算机系统基础》 The NEMU was cloned by following code in PA0---Getting Source code for PAs
git clone -b 2020 https://github.com/NJU-ProjectN/ics-pa.git ics2020 git branch -m master bash init.sh nemu bash init.sh abstract-machine
I'm not sure about the version of this NEMU
We recommend using the 2022 version. See https://nju-projectn.github.io/ics-pa-gitbook/ics2022/ for more details.
Thanks!
This error is raised after i upgraded my system from ubuntu 20.04 to 22.04. The whole error log is as follows:
~~~~~~~src/protocol.c:80:12: error: array subscript ‘struct gdb_conn[0]’ is partly outside array bounds of ‘unsigned char[8]’ [-Werror=array-bounds] 80 | conn->in = fdopen(fd, "rb"); |~~~^~~~src/protocol.c:68:27: note: referencing an object of size 8 allocated by ‘calloc’ 68 | struct gdb_conn conn = calloc(1, sizeof(struct gdb_conn )); | ^~~~~~~~src/protocol.c:85:13: error: array subscript ‘struct gdb_conn[0]’ is partly outside array bounds of ‘unsigned char[8]’ [-Werror=array-bounds] 85 | conn->out = fdopen(fd2, "wb"); |~~^~~~~~~ src/protocol.c:68:27: note: referencing an object of size 8 allocated by ‘calloc’ 68 | struct gdb_conn conn = calloc(1, sizeof(struct gdb_conn )); | ^~~~~~~~src/protocol.c:91:3: error: array subscript ‘struct gdb_conn[0]’ is partly outside array bounds of ‘unsigned char[8]’ [-Werror=array-bounds] 91 | fflush(conn->out); | ^~~~~ src/protocol.c:68:27: note: referencing an object of size 8 allocated by ‘calloc’ 68 | struct gdb_conn conn = calloc(1, sizeof(struct gdb_conn )); | ^~~~~~~~cc1: all warnings being treated as errors make[1]: *** [Makefile:33: build/obj-riscv32/protocol.o] Error 1i try to fix this issue by disabling the "Werror=array-bounds" check by following codes added in the makefile: CFLAGS += -Wno-array-bounds
Then i successfully "make ISA=riscv run", and start nemu.
So could you help to check if these codes have some bug with ubuntu 22.04, or there may have some other ways to fix it. Thanks