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: "kazu at cs dot umass dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Mar 2004 23:34:27 -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 kazu at cs dot umass dot edu 2004-03-21 23:34 -------
Looking at the fold()'s output (the very first one), here is my guess:
fold() is given TRUTH_ANDIF_EXPR like so
(t > 0) && (t <= 2)
Without Roger's patch, fold() returns
(unsigned int) (t - 1) <= 1
With Roger's patch, fold() returns
(t - 1) <= 1.
If you plug in t = 0, the former becomes false, whereas the latter becomes true.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14669