This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I think I'm getting overly agressive optimization.
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
It looks like it's assuming a pointer can't be NULL.
This is with gcc-3.4.0 [1]. If I use gcc-3.2.3, I get the following (which I think is correct): func: move.l #ptr,%d1 sne %d0 extb.l %d0 addq.l #1,%d0 rts
It this behavior correct?
Yes. Perhaps if you gave a more realistic example, we could help a bit... - Dan
-- My technical stuff: http://kegel.com My politics: see http://www.misleader.org for examples of why I'm for regime change
------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |