This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/19723] [4.0 Regression] A side effect is missed in 0 % a++.
- From: "rth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Feb 2005 06:36:49 -0000
- Subject: [Bug tree-optimization/19723] [4.0 Regression] A side effect is missed in 0 % a++.
- References: <20050131134136.19723.kazu@cs.umass.edu>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From rth at gcc dot gnu dot org 2005-02-01 06:36 -------
Subject: Re: [4.0 Regression] A side effect is missed in 0 % a++.
On Mon, Jan 31, 2005 at 08:45:34PM -0700, Jeffrey A Law wrote:
> + /* X % 0, return X % 0 unchanged so that we can get the
> + proper warnings and errors. */
> if (integer_zerop (arg1))
> return t;
>
> + /* 0 % X is always zero, but be sure to preserve any side
> + effects in X. Place this after checking for X == 0. */
> + if (integer_zerop (arg0))
> + return omit_one_operand (type, integer_zero_node, arg1);
Not ok yet. You have to *know* that arg1 is not zero. Otherwise
you're still potentially removing a division-by-zero.
The only check you have at this level for this is integer_nonzerop.
r~
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19723