https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39870
Andrew Pinski changed:
What|Removed |Added
Last reconfirmed|2009-04-23 15:54:45 |2021-6-2
--- Comment #16 from Andrew Pin
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39870
--- Comment #15 from Richard Guenther 2011-08-09
14:58:53 UTC ---
VRP optimizes the testcase form comment #12, it doesn't optimize the original
one because there we deal with symbolic ranges.
--- Comment #14 from rguenth at gcc dot gnu dot org 2009-04-24 16:47
---
May be worth fixing this simple case without fully fixing PR30318. Like with
Index: tree-vrp.c
===
--- tree-vrp.c (revision 146590)
+++ tree-vrp.c
--- Comment #13 from rguenth at gcc dot gnu dot org 2009-04-24 16:41
---
:
x_11 = ASSERT_EXPR ;
x.0_3 = (unsigned int) x_11;
D.1241_4 = x.0_3 + 0x0;
if (D.1241_4 > 9)
x.0_3: [1, 10]
D.1241_4: [0, +INF]
so it's only only the usual case of not handling overflow properly
--- Comment #12 from ebotcazou at gcc dot gnu dot org 2009-04-24 16:15
---
> The folded a >= C1 && a <= C2 case is correctly handled by VRP btw (I added
> that long time ago).
e...@atlantis:~/build/gcc/native32> cat t.c
extern void link_failure (void);
static int __attribute__ ((noinl
--
rguenth at gcc dot gnu dot org changed:
What|Removed |Added
Severity|normal |enhancement
Keywords||missed-op
--- Comment #11 from rguenth at gcc dot gnu dot org 2009-04-24 09:21
---
The folded a >= C1 && a <= C2 case is correctly handled by VRP btw (I added
that long time ago).
--
rguenth at gcc dot gnu dot org changed:
What|Removed |Added
--
--- Comment #10 from ebotcazou at gcc dot gnu dot org 2009-04-23 16:49
---
> Eric, fold only does it for constant C1 and C2 in "a >= C1 && a <= C2", not
> for
> variable C1 and C2.
Yes, but this fools VRP the same way.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39870
--- Comment #9 from aph at gcc dot gnu dot org 2009-04-23 16:16 ---
2 reasons:
1. Habit.
2. The original test case is written in Java: no unsigned types!
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39870
--- Comment #8 from bonzini at gnu dot org 2009-04-23 16:10 ---
Eric, fold only does it for constant C1 and C2 in "a >= C1 && a <= C2", not for
variable C1 and C2. in fact, in the other case it would be illegal to do the
transformation. the front-end can do it because it knows that m->
--- Comment #7 from bonzini at gnu dot org 2009-04-23 16:09 ---
Eric, fold only does it for a >= C1 && a <= C2, not for variable C1 and C2. in
fact, in this case it would be illegal to do the transformation if the
front-end did not know that m->length is positive.
--
http://gcc.gnu
--- Comment #6 from paolo dot carlini at oracle dot com 2009-04-23 15:56
---
:(
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39870
--- Comment #5 from ebotcazou at gcc dot gnu dot org 2009-04-23 15:54
---
> The problem is that this is such a common idiom that it will affect many
> programs.
Even worse: the folder synthesizes the problematic form from the original one.
--
ebotcazou at gcc dot gnu dot org change
--- Comment #4 from paolo dot carlini at oracle dot com 2009-04-23 15:51
---
Interesting. Out of curiosity, why people don't naturally use an unsigned type
for an index?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39870
--- Comment #3 from aph at gcc dot gnu dot org 2009-04-23 15:49 ---
-DBORKED on the left
foo: foo:
.LFB0: .LFB0:
.cfi_startproc .cfi_startproc
subq$8, %rsp <
.cfi_def_cfa_offset 1
--- Comment #2 from aph at gcc dot gnu dot org 2009-04-23 15:47 ---
typedef struct
{
int length;
int data[];
} t_m;
t_m *m;
int foo()
{
int val = 0;
int i;
for (i = 0; i < m->length; i++)
{
#ifdef BORKED
if ((unsigned int)i >= (unsigned int)m->length)
#else
i
--- Comment #1 from aph at gcc dot gnu dot org 2009-04-23 15:46 ---
Sorry, typo'd the first expression. Should be
if ((unsigned)i >= (unsigned)length)
abort();
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39870
17 matches
Mail list logo