This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C as intermediate language, signed integer overflow and -ftrapv
- From: Marek Polacek <polacek at redhat dot com>
- To: Thomas Mertes <thomas dot mertes at gmx dot at>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 24 Jul 2014 10:50:13 +0200
- Subject: Re: C as intermediate language, signed integer overflow and -ftrapv
- Authentication-results: sourceware.org; auth=none
- References: <trinity-ef56f8a7-8da6-40a9-aea6-658df9967fbc-1406127365897 at 3capp-gmx-bs23>
On Wed, Jul 23, 2014 at 04:56:06PM +0200, Thomas Mertes wrote:
> A sanitizer such as ubsan is good as tool to find errors in C
> programs. But I don't think that ubsan is well suited to do overflow
> detection with maximum performance. Is just not the goal of this
> tool.
That's true. But if you only use
-fsanitize=signed-integer-overflow, then the overhead shouldn't be
that bad, especially on x86_64 where we try to make use of jo (jump if
overflow) instruction. Perhaps use that option together with
-fsanitize-undefined-trap-on-error, so it doesn't call libubsan
routines at all.
Marek