public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/60613] New: Invalid signed subtraction ubsan diagnostics
@ 2014-03-21 14:44 jakub at gcc dot gnu.org
2014-03-21 14:49 ` [Bug sanitizer/60613] " mpolacek at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-03-21 14:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60613
Bug ID: 60613
Summary: Invalid signed subtraction ubsan diagnostics
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: sanitizer
Assignee: jakub at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org
On x86_64-linux with -O2 -m32 -fsanitize=undefined on:
__attribute__((noinline, noclone)) long long
foo (long long y)
{
asm ("");
return 8LL - y;
}
int
main ()
{
foo (1);
return 0;
}
we get invalid diagnostics:
runtime error: signed integer overflow: 8 - 1 cannot be represented in type
'long long int'
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug sanitizer/60613] Invalid signed subtraction ubsan diagnostics
2014-03-21 14:44 [Bug sanitizer/60613] New: Invalid signed subtraction ubsan diagnostics jakub at gcc dot gnu.org
@ 2014-03-21 14:49 ` mpolacek at gcc dot gnu.org
2014-03-21 15:28 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-03-21 14:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60613
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-03-21
CC| |mpolacek at gcc dot gnu.org
Target Milestone|--- |4.9.0
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug sanitizer/60613] Invalid signed subtraction ubsan diagnostics
2014-03-21 14:44 [Bug sanitizer/60613] New: Invalid signed subtraction ubsan diagnostics jakub at gcc dot gnu.org
2014-03-21 14:49 ` [Bug sanitizer/60613] " mpolacek at gcc dot gnu.org
@ 2014-03-21 15:28 ` jakub at gcc dot gnu.org
2014-03-22 16:26 ` jakub at gcc dot gnu.org
2014-03-22 16:27 ` jakub at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-03-21 15:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60613
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 32423
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32423&action=edit
gcc49-pr60613.patch
Untested fix.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug sanitizer/60613] Invalid signed subtraction ubsan diagnostics
2014-03-21 14:44 [Bug sanitizer/60613] New: Invalid signed subtraction ubsan diagnostics jakub at gcc dot gnu.org
2014-03-21 14:49 ` [Bug sanitizer/60613] " mpolacek at gcc dot gnu.org
2014-03-21 15:28 ` jakub at gcc dot gnu.org
@ 2014-03-22 16:26 ` jakub at gcc dot gnu.org
2014-03-22 16:27 ` jakub at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-03-22 16:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60613
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Sat Mar 22 16:25:50 2014
New Revision: 208766
URL: http://gcc.gnu.org/viewcvs?rev=208766&root=gcc&view=rev
Log:
PR sanitizer/60613
* internal-fn.c (ubsan_expand_si_overflow_addsub_check): For
code == MINUS_EXPR, never swap op0 with op1.
* c-c++-common/ubsan/pr60613-1.c: New test.
* c-c++-common/ubsan/pr60613-2.c: New test.
Added:
trunk/gcc/testsuite/c-c++-common/ubsan/pr60613-1.c
trunk/gcc/testsuite/c-c++-common/ubsan/pr60613-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/internal-fn.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug sanitizer/60613] Invalid signed subtraction ubsan diagnostics
2014-03-21 14:44 [Bug sanitizer/60613] New: Invalid signed subtraction ubsan diagnostics jakub at gcc dot gnu.org
` (2 preceding siblings ...)
2014-03-22 16:26 ` jakub at gcc dot gnu.org
@ 2014-03-22 16:27 ` jakub at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-03-22 16:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60613
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-03-22 16:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-21 14:44 [Bug sanitizer/60613] New: Invalid signed subtraction ubsan diagnostics jakub at gcc dot gnu.org
2014-03-21 14:49 ` [Bug sanitizer/60613] " mpolacek at gcc dot gnu.org
2014-03-21 15:28 ` jakub at gcc dot gnu.org
2014-03-22 16:26 ` jakub at gcc dot gnu.org
2014-03-22 16:27 ` jakub at gcc dot gnu.org
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).