D_FORTIFY_SOURCE=2 option does not work for me

1.1k Views Asked by At

I saw that GCC 4.5 and above versions should support –D_FORTIFY_SOURCE=2 option. But it does not work for me, it has been ignred and it does not report issues when i used.

Compiler version used is "g++.c4.5.3-p0", Will it ignore the option?

1

There are 1 best solutions below

1
MestreLion On

In most systems, –D_FORTIFY_SOURCE=2 is only activated when also using -O2, ie, GCC compiler optimizations level 2 (or more). Try to use -O2 –D_FORTIFY_SOURCE=2 to see if it works.