https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111394
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- N could be -1 which then would access out of bounds .. I suspect if you add a check for n being negative in memoized_cut_rod the warning will go away and a security issue is solved too.