powturbo / TurboBench

Compression Benchmark
326 stars 34 forks source link

Segmentation fault in turbobench.c:249 stackpeak #34

Closed milahu closed 1 year ago

milahu commented 1 year ago

version 2023-03 fails on linux, with compiler gcc (GCC) 12.2.0

$ gdb --args turbobench test-files.tar 
(gdb) r
   15.66  3_01
Program received signal SIGSEGV, Segmentation fault.
stackpeak (_sp=_sp@entry=0x0) at turbobench.c:249
249       for(sp = _sp - STACK_SIZE; *sp == STACK_MAGIC; sp++);
(gdb) bt
#0  stackpeak (_sp=_sp@entry=0x0) at turbobench.c:249
#1  0x0000000000576cff in plugfile (plug=plug@entry=0x6e8940 <plug>, finame=finame@entry=0x7fffffff9989 "test-files.tar", filenmax=filenmax@entry=1073741824, bsize=bsize@entry=1073741824, plugr=plugr@entry=0x6db980 <plugr>, tid=<optimized out>, krep=0) at turbobench.c:1249
#2  0x0000000000403365 in main (argc=2, argv=<optimized out>) at turbobench.c:1510

https://github.com/powturbo/TurboBench/blob/51e296184bdb450ad3a99f678c22b2c515c37f5f/turbobench.c#L238-L251

fix

replace -O3 with -O1

powturbo commented 1 year ago

Thanks for reporting. You can also build turbobench with "make NMEMSIZE=1"