Is this expected gcc behaviour?
Urs Thuermann
urs@isnogud.escape.de
Fri Aug 6 06:19:00 GMT 2004
Jay Monkman <jtm-list-crossgcc@smoothsmoothie.com> writes:
> When I compile this function:
> extern unsigned long ptr;
>
> int func(void)
> {
> unsigned long val = (unsigned long)&ptr;
>
> if (val == 0) {
> return 1;
> } else {
> return 0;
> }
> }
>
> with any optimization level > 0, I get this:
> func:
> clr.l %d0
> rts
This behavior of gcc is correct. The C standard guarantees that no
object can be located at address 0, i.e. the result of the address
operator on any object is always different from the null pointer.
urs
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list