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]

fwd: operator& narrowing bug


This seems to be caused by doing the & in the narrowest suitable mode; 0xf0
becomes (signed char)-16 with overflow set, so the result is 0 with
overflow, which doesn't satisfy integer_zerop.

------- Start of forwarded message -------
From: "John H. Spicer" <jhs@edg.com>
To: brendan@cygnus.com
Subject: g++/gcc bug
Date: Fri, 28 Jan 2000 09:46:55 -0500 (EST)
Message-Id: <200001281446.JAA03862@edg3.edg.com>

I'm not sure how one goes about reporting gcc/g++ bugs, so I thought I'd
pass this one along to you.

On Intel, 2.95.2 computes "i" as 7 instead of 8.  The sparc version, and
earlier version on Intel produced the right result (8).

If there is someplace else that you would prefer I send this, please let
me know.

Thanks!

John.

#ifdef __cplusplus
extern "C"
#endif
int printf(char *, ...);

int main()
{
	int i;
	(i=7)&0xf0 || ++i;
	if (i != 8) {
		printf("i=%d\n", i);
		return 1;
	}
}

------- End of forwarded message -------

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