This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/14669] [3.4/3.5 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
- From: "roger at eyesopen dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Mar 2004 14:20:06 -0000
- Subject: [Bug optimization/14669] [3.4/3.5 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
- References: <20040321141018.14669.wanderer@rsu.ru>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From roger at eyesopen dot com 2004-03-23 14:19 -------
Many thanks to Eric Botcazou for analyzing ACATS' cxa3003, which demonstrates
that the signedness recovery optimization below is unsafe. The example is:
unsigned char i;
if ((long long) i <= 127)
which isn't equivalent to
if ((signed char) i <= 127)
Hence, I'll approve and commit to mainline Kazu's orignal fix, which is attached
to comment #14. I've confirmed this resolves this PR, and introduces no new
testsuite failures on i686-pc-linux-gnu after a full bootstrap. I'll also post
the patch as committed to gcc-patches explaining the check-in.
Ok for 3.4? I need to check whether this is latent on the gcc-3_3-branch.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14669