From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16053 invoked by alias); 13 Feb 2003 16:06:23 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 16023 invoked by uid 48); 13 Feb 2003 16:06:23 -0000 Date: Thu, 13 Feb 2003 16:06:00 -0000 Message-ID: <20030213160623.16022.qmail@sources.redhat.com> To: algrant@acm.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org From: rearnsha@gcc.gnu.org Reply-To: rearnsha@gcc.gnu.org, algrant@acm.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org Subject: Re: c/7284: incorrectly simplifies leftshift followed by signed power-of-2 division X-SW-Source: 2003-02/txt/msg00570.txt.bz2 List-Id: 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