[Bug tree-optimization/65752] Too strong optimizations int -> pointer casts
ch3root at openwall dot com
gcc-bugzilla@gcc.gnu.org
Sun Nov 15 21:53:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65752
--- Comment #42 from Alexander Cherepanov <ch3root at openwall dot com> ---
On 2015-11-16 00:48, pinskia at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65752
>
> --- Comment #41 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> (In reply to Alexander Cherepanov from comment #40)
>> Ok, this program:
>>
>> #include <stdint.h>
>> #include <stdio.h>
>>
>> int main() {
>> int y, x = 0;
>> int *volatile v = &x;
>> int *xp = v;
>> int *i = &y + 1;
>>
>> if (xp != i) {
>> printf("hello\n");
>> xp = i;
>> }
>>
>> printf("%d\n", xp == &x);
>> }
Small correction: it prints 0 and doesn't print "hello" even though it
should print 1 without "hello" or an unspecified value with "hello".
> Still undefined as &x and &y + 1 are not comparable.
They cannot be compared with the relational operators ("<" etc.) but you
can compare any pointers with the equality operators ("==" and "!=").
More information about the Gcc-bugs
mailing list