From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2620 invoked by alias); 11 Sep 2002 09:19:00 -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 2589 invoked by uid 61); 11 Sep 2002 09:19:00 -0000 Date: Wed, 11 Sep 2002 02:19:00 -0000 Message-ID: <20020911091900.2588.qmail@sources.redhat.com> To: aloeff@de.ibm.com, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org From: nathan@gcc.gnu.org Reply-To: nathan@gcc.gnu.org, aloeff@de.ibm.com, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org Subject: Re: optimization/7884: code compiled with optimization flag causes segmentation violation on powerpc X-SW-Source: 2002-09/txt/msg00185.txt.bz2 List-Id: Synopsis: code compiled with optimization flag causes segmentation violation on powerpc State-Changed-From-To: open->analyzed State-Changed-By: nathan State-Changed-When: Wed Sep 11 02:18:59 2002 State-Changed-Why: This is not a bug, but I expected a warning (which we used to give). '(char *)foo' is an rvalue. the call through to 'char *&ref' binds an rvalue to a non-const reference. That is ill-formed. It binds to a temporary copy, thus the pointer seen by the function is not the object you cast. The correct solution is the cast to an lvalue, '(char *&)foo' http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7884