From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12574 invoked by alias); 12 Jul 2002 17:16:02 -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 12539 invoked by uid 71); 12 Jul 2002 17:16:01 -0000 Date: Fri, 12 Jul 2002 10:16:00 -0000 Message-ID: <20020712171601.12533.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: "Al Grant" Subject: Re: Re: c/7284: incorrectly simplifies leftshift followed by signed power-of-2 division Reply-To: "Al Grant" X-SW-Source: 2002-07/txt/msg00384.txt.bz2 List-Id: The following reply was made to PR c/7284; it has been noted by GNATS. From: "Al Grant" To: nathan@compsci.bristol.ac.uk Cc: falk.hueffner@student.uni-tuebingen.de, nathan@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: Re: c/7284: incorrectly simplifies leftshift followed by signed power-of-2 division Date: Fri, 12 Jul 2002 17:06:44 +0000 >you need to read more carefully. >KnR 2 A7.8 says the same as C99, You need to read more carefully. K&R2 says something quite different from = C99. It says that in the absence of overflow, the operation is equivalen= t to a multiplication. It does _not_ say that if the multiplication overflows the= result of the shift is undefined, let alone that program behavior is und= efined. >C++ says [5]/5 that if the result is not in the range >of representable va= lues, >the behaviour is undefined. But left-shift is an operation on the representation, i.e. the bit pattern.= For signed left-shift (in C89 and C++) it is not defined any other way.= How is it meaningful to talk about the representability of operations o= n the representation, and say that the result of such an operation might = be unrepresentable? Representability is a property of the integers as numbers. It might be meaningful to think about the result of such an operation havin= g a representation that did not correspond to any value (e.g. was a trap = representation) but a non-valued representation is a totally different c= oncept from a non-representable value. Besides, there are no such intege= r representations on the platform for which I reported the bug.