keith-packard / snek

Snek programming language for tiny systems
GNU General Public License v3.0
293 stars 30 forks source link

gcc warning with -flto etc #14

Closed rofl0r closed 5 years ago

rofl0r commented 5 years ago
~/snek/posix[fix-musl*]$ CFLAGS="-Os -flto -fwhole-program -s" sh build.sh 
../snek-memory.c: In function 'snek_poly_move':
../snek.h:665:12: warning: array subscript is below array bounds [-Warray-bound]
  return &((&_snek_mems[-1])[type]);
            ^
../snek-memory.c: In function 'snek_poly_mark':
../snek.h:665:12: warning: array subscript is below array bounds [-Warray-bound]
  return &((&_snek_mems[-1])[type]);
            ^
keith-packard commented 5 years ago

Thanks for the report; I'd discovered this independently a few hours ago and already have pushed a fix. Let me know if it's still broken!