optimization/7799: [3.2/3.3 regression] Loop bug withoptimization flag -Os in gcc
Morten Welinder
terra@diku.dk
Fri Dec 13 13:36:00 GMT 2002
I'll give it another try... Recall that all this is for i86.
1. sizeof(int) == sizeof(char) == 1. int is four bytes wide.
2. NULL represented as address 0.
3. OS support to read/write unaligned.
4. OS support to read/write wrapped, e.g., read four bytes at 0xffffffff.
(1 is not unheard of, 2 is normal, 3 is normal on i86, 4 is bizarre.)
malloc (10) can then return address 0xffffffff as the address of
10 ints.
I think assumption 1 makes impossible to do valid pointer gymnastics
to get NULL from 0xffffffff. Everything you do is going to be in
steps of four on the address level.
Morten
More information about the Gcc
mailing list