public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* safety command-line options
@ 2021-05-24  8:18 Uecker, Martin
  2021-05-24 20:06 ` Martin Sebor
  0 siblings, 1 reply; 2+ messages in thread
From: Uecker, Martin @ 2021-05-24  8:18 UTC (permalink / raw)
  To: gcc



I wonder if we could get a nice short command-line option
for recommended safety/security related flags.

We have -Ox for optimization and -Wall for a useful set
of recommended warnings.

I am thinking about options such as 

-ftrapv
-fsanitize=undefined -fsanitize-undefined-trap-on-error
-fstack-protector
-D_FORTIFY_SOURCE=2
-Werror=format-security

etc.  We would need to make a selection based on
various tradeoffs, but this is not different
to -Wall or -O.


Martin

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: safety command-line options
  2021-05-24  8:18 safety command-line options Uecker, Martin
@ 2021-05-24 20:06 ` Martin Sebor
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Sebor @ 2021-05-24 20:06 UTC (permalink / raw)
  To: Uecker, Martin, gcc

On 5/24/21 2:18 AM, Uecker, Martin wrote:
> 
> 
> I wonder if we could get a nice short command-line option
> for recommended safety/security related flags.
> 
> We have -Ox for optimization and -Wall for a useful set
> of recommended warnings.
> 
> I am thinking about options such as
> 
> -ftrapv
> -fsanitize=undefined -fsanitize-undefined-trap-on-error
> -fstack-protector
> -D_FORTIFY_SOURCE=2
> -Werror=format-security
> 
> etc.  We would need to make a selection based on
> various tradeoffs, but this is not different
> to -Wall or -O.

Here's a nice article on the subject:
Recommended compiler and linker flags for GCC
https://developers.redhat.com/blog/2018/03/21/compiler-and-linker-flags-gcc

Martin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-24 20:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24  8:18 safety command-line options Uecker, Martin
2021-05-24 20:06 ` Martin Sebor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).