[Bug tree-optimization/43089] Optimizer ignores type in a conversion

2010-02-17 Thread pinskia at gcc dot gnu dot org
--- Comment #13 from pinskia at gcc dot gnu dot org 2010-02-17 18:12 --- Use -fwrapv if you want signed integer overflow being defined the way you want it being defined. That is the whole point of that flag. The reason why GCC acts the way it acts by default is to allow more optimizat

[Bug tree-optimization/43089] Optimizer ignores type in a conversion

2010-02-17 Thread paolo dot carlini at oracle dot com
--- Comment #12 from paolo dot carlini at oracle dot com 2010-02-17 17:58 --- . -- paolo dot carlini at oracle dot com changed: What|Removed |Added Status|UN

[Bug tree-optimization/43089] Optimizer ignores type in a conversion

2010-02-17 Thread 0xe2 dot 0x9a dot 0x9b at gmail dot com
--- Comment #11 from 0xe2 dot 0x9a dot 0x9b at gmail dot com 2010-02-17 17:52 --- (In reply to comment #10) > Please stop reopening. 6.3.1.3 is about casts between integer types. > Signed integer overflow is even mentioned as an example of undefined behavior > in 3.4.3. Well, look, ma

[Bug tree-optimization/43089] Optimizer ignores type in a conversion

2010-02-17 Thread jakub at gcc dot gnu dot org
--- Comment #10 from jakub at gcc dot gnu dot org 2010-02-17 14:41 --- Please stop reopening. 6.3.1.3 is about casts between integer types. Signed integer overflow is even mentioned as an example of undefined behavior in 3.4.3. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43089

[Bug tree-optimization/43089] Optimizer ignores type in a conversion

2010-02-17 Thread paolo dot carlini at oracle dot com
--- Comment #9 from paolo dot carlini at oracle dot com 2010-02-17 14:39 --- . -- paolo dot carlini at oracle dot com changed: What|Removed |Added Status|UNC

[Bug tree-optimization/43089] Optimizer ignores type in a conversion

2010-02-17 Thread 0xe2 dot 0x9a dot 0x9b at gmail dot com
--- Comment #8 from 0xe2 dot 0x9a dot 0x9b at gmail dot com 2010-02-17 14:16 --- (In reply to comment #7) > Where the compiler always chooses some particular implementation is > implementation defined behavior, not undefined behavior. Undefined behavior > is > always just that, undefi

[Bug tree-optimization/43089] Optimizer ignores type in a conversion

2010-02-16 Thread jakub at gcc dot gnu dot org
--- Comment #7 from jakub at gcc dot gnu dot org 2010-02-16 18:26 --- Where the compiler always chooses some particular implementation is implementation defined behavior, not undefined behavior. Undefined behavior is always just that, undefined. -- jakub at gcc dot gnu dot org chang

[Bug tree-optimization/43089] Optimizer ignores type in a conversion

2010-02-16 Thread pinskia at gmail dot com
--- Comment #6 from pinskia at gmail dot com 2010-02-16 17:51 --- Subject: Re: Optimizer ignores type in a conversion Sent from my iPhone On Feb 16, 2010, at 9:37 AM, "0xe2 dot 0x9a dot 0x9b at gmail dot com" wrote: > > > --- Comment #5 from 0xe2 dot 0x9a dot 0x9b at gmail d

Re: [Bug tree-optimization/43089] Optimizer ignores type in a conversion

2010-02-16 Thread Andrew Pinski
Sent from my iPhone On Feb 16, 2010, at 9:37 AM, "0xe2 dot 0x9a dot 0x9b at gmail dot com" wrote: --- Comment #5 from 0xe2 dot 0x9a dot 0x9b at gmail dot com 2010-02-16 17:37 --- (In reply to comment #4) There is nothing to fix. Your program triggers undefined behavior.

[Bug tree-optimization/43089] Optimizer ignores type in a conversion

2010-02-16 Thread 0xe2 dot 0x9a dot 0x9b at gmail dot com
--- Comment #5 from 0xe2 dot 0x9a dot 0x9b at gmail dot com 2010-02-16 17:37 --- (In reply to comment #4) > There is nothing to fix. Your program triggers undefined behavior. It can do > anything, which can include something you'd expect, or something completely > different and it can

[Bug tree-optimization/43089] Optimizer ignores type in a conversion

2010-02-16 Thread jakub at gcc dot gnu dot org
--- Comment #4 from jakub at gcc dot gnu dot org 2010-02-16 11:56 --- There is nothing to fix. Your program triggers undefined behavior. It can do anything, which can include something you'd expect, or something completely different and it can depend on compiler options, position of st

[Bug tree-optimization/43089] Optimizer ignores type in a conversion

2010-02-16 Thread 0xe2 dot 0x9a dot 0x9b at gmail dot com
--- Comment #3 from 0xe2 dot 0x9a dot 0x9b at gmail dot com 2010-02-16 11:23 --- (In reply to comment #2) > > If I were to modify the test case like this: > > int i = ab.b; > b2 = i + i; > > I would be ALSO triggering undefined behavior. But the modified test-case > would > succeed

[Bug tree-optimization/43089] Optimizer ignores type in a conversion

2010-02-16 Thread 0xe2 dot 0x9a dot 0x9b at gmail dot com
--- Comment #2 from 0xe2 dot 0x9a dot 0x9b at gmail dot com 2010-02-16 10:59 --- (In reply to comment #1) > 0x7fff + 1 overflows. Signed overflow invokes undefined behavior. Like so what? Is this your way of saying "I am not going to fix it"? Do you find it convenient to hide your

[Bug tree-optimization/43089] Optimizer ignores type in a conversion

2010-02-16 Thread rguenth at gcc dot gnu dot org
--- Comment #1 from rguenth at gcc dot gnu dot org 2010-02-16 10:16 --- 0x7fff + 1 overflows. Signed overflow invokes undefined behavior. Use -fwrapv if you want wrapping signed overflow. -- rguenth at gcc dot gnu dot org changed: What|Removed