assignment 3 main.s/read_matrix

102 views
Skip to first unread message

brandon

unread,
Oct 27, 2020, 12:20:52 AM10/27/20
to cmpt-295-sfu
# Question templates
SFU ID: 301358970
Github username: bla118
Github: Link to github repo (your assignment repos are private so these links are only accessible to TAs and Instructor)
Line and file: main.s, read_matrix.s
Expected behavior:
Observed behavior: Exited error code 1
Question: When testing main.s, calling read_matrix returns an error in the freed parts. I tested read_matrix and it worked. Need help figuring out whether main.s or read_matrix.s is wrong. Thanks

ali sedaghati

unread,
Oct 27, 2020, 12:40:42 AM10/27/20
to cmpt-295-sfu
In main.s, you're moving a1 to s4. It means that, at first, (*s4) is argv[0], which is the program name. So, you have to add an offset to reach other input arguments.

brandon

unread,
Oct 27, 2020, 12:59:54 AM10/27/20
to cmpt-295-sfu
Ok I have fixed that but it's still returning an error. Starting to think there's something wrong with my read_matrix.s..

ali sedaghati

unread,
Oct 27, 2020, 1:17:32 AM10/27/20
to cmpt-295-sfu
In main.s, in line 75 you're overwriting s4.
Using print_int_array is helpful for printing matrices and finding the reason for the bug.  For example, by inserting print_int_array after reading each input matrix, you can find out that the first two are okay but the third one is causing the error.

brandon

unread,
Oct 27, 2020, 2:03:53 AM10/27/20
to cmpt-295-sfu
Hi Ali, 
I have fixed the register for getting argv[] but the 3rd read still isn't working. Is there something else I'm missing? Thanks

ali sedaghati

unread,
Oct 27, 2020, 12:44:35 PM10/27/20
to cmpt-295-sfu
Put a screenshot of command and error here. Make sure that you're printing each step's result to make debugging easier.
Reply all
Reply to author
Forward
0 new messages