http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54214
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |DUPLICATE Severity|enhancement |normal --- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-08-18 22:18:28 UTC --- This line contains a bug: strcpy(SQL1,"select id, ' ', regexp_replace(str_last_name,' ','') as lastname, ' ', regexp_replace(str_first_name,' ','') as firstname, ' ', age(dt_birth) as age from tbl_owners_individual;"); SQL1 only has capacity for 150 chars, but you write more than 170 to it. This is a serious bug in your program (not in GCC or postgresql). When you use the "order by" clause you write even more characters to the array, which is still a bug. Either learn to use dynamically-allocated memory or ensure your arrays are big enough to hold the strings you write to them. This is the same issue as PR 54180 *** This bug has been marked as a duplicate of bug 54180 ***