https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116637
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This sounds like going to past the bounds of the calloc. Try using valgrind or -fsanitize=address one of those two will catch where your bug is.