My program crashes with the message "*** buffer overflow detected ***: program_name terminated", and I suspect it may be related to the compiler option "_FORTIFY_SOURCE=2" that I use (source: difference between gcc -D_FORTIFY_SOURCE=1 and -D_FORTIFY_SOURCE=2).
In general, how to find the program point that generates such error?
it looks to me some extra code added by the compiler
This is like exactly whatFORTIFY_SOURCE
does, it adds extra code by the compiler that exits under specific conditions.