wolkykim / qlibc

qLibc is a simple and yet powerful C library providing generic data structures and algorithms.
http://wolkykim.github.io/qlibc
Other
984 stars 167 forks source link

test_qtreetbl.c will segfault with gcc >= 10 #94

Closed Fullaxx closed 2 years ago

Fullaxx commented 2 years ago

make test will fail when qlibc is compiled with gcc >= 10. Under this case, test_qtreetbl.c will compile but will segfault during execution. I believe that it is caused by the unused return true; of drawtree(). test_qtreetbl_gcc10.txt test_qtreetbl_gcc11.txt test_qtreetbl_gcc12.txt

Fullaxx commented 2 years ago

sorry, this isn't quite right and needs more investigation.

Fullaxx commented 2 years ago

Apparently the unused return value is not the root cause. It seems that when test_qtreetbl.c is compiled with -O2 the drawtree() will produce a segfault, When I remove the -O2 optimizations flag to get better debugging symbols, drawtree() functions normally. Commenting out the drawtree() does avoid the segfault, but I don't have a good explanation as to the root cause. If anyone has any insight here, that would be greatly appreciated.

wolkykim commented 2 years ago

Hi Thanks for the report. This is addressed by #95

Fullaxx commented 2 years ago

awesome, thanks! verified that works with gcc-12