Notes
This function is in beta test. Please help improve it in the issues
here.
================================================================= ==126053==ERROR: AddressSanitizer: stack-buffer-underflow on address 0x7fff564ddbe8 at pc 0x00000051bf01 bp 0x7fff564ddab0 sp 0x7fff564ddaa8 WRITE of size 8 at 0x7fff564ddbe8 thread T0 #0 0x51bf00 (/out/package/dlist_mem+0x51bf00) #1 0x5211ef (/out/package/dlist_mem+0x5211ef) #2 0x7f9c385acc86 (/lib/x86_64-linux-gnu/libc.so.6+0x21c86) #3 0x41da19 (/out/package/dlist_mem+0x41da19) Address 0x7fff564ddbe8 is located in stack of thread T0 at offset 8 in frame #0 0x520faf (/out/package/dlist_mem+0x520faf) This frame has 4 object(s): [32, 40) 'ref.tmp8.i' [64, 65) 'ref.tmp10.i' [80, 84) 'testnum' (line 32) [96, 100) 'ref.tmp' (line 34) HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext (longjmp and C++ exceptions *are* supported) SUMMARY: AddressSanitizer: stack-buffer-underflow (/out/package/dlist_mem+0x51bf00) Shadow bytes around the buggy add
Hints
Your answer may be identical to the JOJ answer in the first several lines.
However, the main problem you meet now is Runtime Error. And the exit code of your program is 1, which should be 0.
Please double check your code to solve this problem and try again.
Your Answer
JOJ Answer
Test success.