c/7284: incorrectly simplifies leftshift followed by signed power-of-2 division
rearnsha@gcc.gnu.org
rearnsha@gcc.gnu.org
Thu Feb 13 16:06:00 GMT 2003
Synopsis: incorrectly simplifies leftshift followed by signed power-of-2 division
State-Changed-From-To: closed->open
State-Changed-By: rearnsha
State-Changed-When: Thu Feb 13 16:06:23 2003
State-Changed-Why:
I'm re-opening this report. In c89 the text for << says
The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits are filled with zeros.
It then goes on to qualify what this means when E1 is unsigned, but says nothing about the *interpretation* for the signed context (beyond what is specified above). However, in a 2s complement environment it is possible to give a meaningful interpretation of the resulting value.
DR#081 says that the meaning in the signed context is "implementation defined", but that is clearly very different from "undefined" as we have at present.
At the very least we must document what left shift of a signed value means on our implementation.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7284
More information about the Gcc-bugs
mailing list