public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "tg at mirbsd dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/30477] Integer Overflow detection code optimised away, -fwrapv broken Date: Thu, 25 Jan 2007 16:09:00 -0000 [thread overview] Message-ID: <20070125160914.19844.qmail@sourceware.org> (raw) In-Reply-To: <bug-30477-13924@http.gcc.gnu.org/bugzilla/> ------- Comment #18 from tg at mirbsd dot org 2007-01-25 16:09 ------- Subject: Integer Overflow detection code optimised away, -fwrapv broken Dixi: >Commit ID: 10045B8CAF141886704 >CVSROOT: /cvs >Module name: gcc >Changes by: tg@herc.mirbsd.org 2007/01/25 15:21:11 UTC > >Modified files: > gcc : simplify-rtx.c > >Log message: > ------- Comment [100]#17 From [101]Richard Guenther 2007-01-25 14:49 ------- >Backporting the fix for [102]PR28651 should fix it I guess. Yes it does, thanks. >To generate a diff of this changeset, execute the following commands: >cvs -R rdiff -ur1.5 -r1.6 gcc/gcc/simplify-rtx.c That is: ----- cutting here may damage your screen surface ----- Index: gcc/gcc/simplify-rtx.c diff -u gcc/gcc/simplify-rtx.c:1.5 gcc/gcc/simplify-rtx.c:1.6 --- gcc/gcc/simplify-rtx.c:1.5 Thu Mar 30 19:50:29 2006 +++ gcc/gcc/simplify-rtx.c Thu Jan 25 15:21:10 2007 @@ -2686,18 +2686,18 @@ a register or a CONST_INT, this can't help; testing for these cases will prevent infinite recursion here and speed things up. - If CODE is an unsigned comparison, then we can never do this optimization, - because it gives an incorrect result if the subtraction wraps around zero. - ANSI C defines unsigned operations such that they never overflow, and - thus such cases can not be ignored. */ + We can only do this for EQ and NE comparisons as otherwise we may + lose or introduce overflow which we cannot disregard as undefined as + we do not know the signedness of the operation on either the left or + the right hand side of the comparison. */ if (INTEGRAL_MODE_P (mode) && trueop1 != const0_rtx + && (code == EQ || code == NE) && ! ((GET_CODE (op0) == REG || GET_CODE (trueop0) == CONST_INT) && (GET_CODE (op1) == REG || GET_CODE (trueop1) == CONST_INT)) && 0 != (tem = simplify_binary_operation (MINUS, mode, op0, op1)) - /* We cannot do this for == or != if tem is a nonzero address. */ - && ((code != EQ && code != NE) || ! nonzero_address_p (tem)) - && code != GTU && code != GEU && code != LTU && code != LEU) + /* We cannot do this if tem is a nonzero address. */ + && ! nonzero_address_p (tem)) return simplify_relational_operation (signed_condition (code), mode, tem, const0_rtx); ----- cutting here may damage your screen surface ----- This applies to gcc 3.4.6 - if you need other versions, YMMV. bye, //mirabile -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30477
next prev parent reply other threads:[~2007-01-25 16:09 UTC|newest] Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-01-15 23:43 [Bug c/30477] New: " tg at mirbsd dot org 2007-01-15 23:56 ` [Bug c/30477] " pinskia at gcc dot gnu dot org 2007-01-15 23:57 ` pinskia at gcc dot gnu dot org 2007-01-16 2:34 ` tg at mirbsd dot org 2007-01-16 3:04 ` pinskia at gmail dot com 2007-01-16 3:40 ` tg at mirbsd dot de 2007-01-16 3:48 ` Andrew Pinski 2007-01-16 3:49 ` pinskia at physics dot uc dot edu 2007-01-16 4:08 ` tg at mirbsd dot org 2007-01-16 10:36 ` rguenth at gcc dot gnu dot org 2007-01-16 16:56 ` tg at mirbsd dot org 2007-01-16 17:18 ` rguenth at gcc dot gnu dot org 2007-01-16 17:34 ` tg at mirbsd dot org 2007-01-16 17:49 ` tg at mirbsd dot org 2007-01-16 18:00 ` pinskia at gcc dot gnu dot org 2007-01-16 18:01 ` gdr at cs dot tamu dot edu 2007-01-22 23:54 ` tg at mirbsd dot de 2007-01-25 14:29 ` tg at mirbsd dot org 2007-01-25 14:50 ` rguenth at gcc dot gnu dot org 2007-01-25 16:09 ` tg at mirbsd dot org [this message] [not found] <bug-30477-4@http.gcc.gnu.org/bugzilla/> 2014-02-16 13:17 ` jackie.rosen at hushmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20070125160914.19844.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).