This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 3.3.2 mips/ppc compiler bug?


Martin Rivers <rivers@lexmark.com> writes:

> the 3.3.2 compiler for both ppc and mips effectively leaves the
> value received as cmdxy as input and the value passed as y to subr2
> identical which I don't believe is right.
>
> void subr( char *dest, int cmdxy, struct blah *blah, int destw )
> {
>    y = (cmdxy<<18)/(1<<18);

gcc is right, because y can only differ from cmdxy in case of
overflow, which is undefined for signed types. That this appears to
"work" for shift is an optimizer weakness (at least for C99).

-- 
	Falk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]