[Bug tree-optimization/39870] VRP can't see through cast to unsigned

2021-06-02 Thread pinskia at gcc dot gnu.org via Gcc-bugs
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

[Bug tree-optimization/39870] VRP can't see through cast to unsigned

2011-08-09 Thread rguenth at gcc dot gnu.org
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.

[Bug tree-optimization/39870] VRP can't see through cast to unsigned

2009-04-24 Thread rguenth at gcc dot gnu dot org
--- 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

[Bug tree-optimization/39870] VRP can't see through cast to unsigned

2009-04-24 Thread rguenth at gcc dot gnu dot org
--- 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

[Bug tree-optimization/39870] VRP can't see through cast to unsigned

2009-04-24 Thread ebotcazou at gcc dot gnu dot org
--- 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

[Bug tree-optimization/39870] VRP can't see through cast to unsigned

2009-04-24 Thread rguenth at gcc dot gnu dot org
-- rguenth at gcc dot gnu dot org changed: What|Removed |Added Severity|normal |enhancement Keywords||missed-op

[Bug tree-optimization/39870] VRP can't see through cast to unsigned

2009-04-24 Thread rguenth at gcc dot gnu dot org
--- 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 --

[Bug tree-optimization/39870] VRP can't see through cast to unsigned

2009-04-23 Thread ebotcazou at gcc dot gnu dot org
--- 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

[Bug tree-optimization/39870] VRP can't see through cast to unsigned

2009-04-23 Thread aph at gcc dot gnu dot org
--- 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

[Bug tree-optimization/39870] VRP can't see through cast to unsigned

2009-04-23 Thread bonzini at gnu dot org
--- 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->

[Bug tree-optimization/39870] VRP can't see through cast to unsigned

2009-04-23 Thread bonzini at gnu dot org
--- 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

[Bug tree-optimization/39870] VRP can't see through cast to unsigned

2009-04-23 Thread paolo dot carlini at oracle dot com
--- 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

[Bug tree-optimization/39870] VRP can't see through cast to unsigned

2009-04-23 Thread ebotcazou at gcc dot gnu dot org
--- 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

[Bug tree-optimization/39870] VRP can't see through cast to unsigned

2009-04-23 Thread paolo dot carlini at oracle dot com
--- 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

[Bug tree-optimization/39870] VRP can't see through cast to unsigned

2009-04-23 Thread aph at gcc dot gnu dot org
--- 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

[Bug tree-optimization/39870] VRP can't see through cast to unsigned

2009-04-23 Thread aph at gcc dot gnu dot org
--- 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

[Bug tree-optimization/39870] VRP can't see through cast to unsigned

2009-04-23 Thread aph at gcc dot gnu dot org
--- 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