From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9895 invoked by alias); 2 Mar 2003 16:26:01 -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 9764 invoked by uid 71); 2 Mar 2003 16:26:00 -0000 Resent-Date: 2 Mar 2003 16:26:00 -0000 Resent-Message-ID: <20030302162600.9762.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, gennadi.f@corigin.com Received: (qmail 8220 invoked by uid 48); 2 Mar 2003 16:23:37 -0000 Message-Id: <20030302162337.8219.qmail@sources.redhat.com> Date: Sun, 02 Mar 2003 16:26:00 -0000 From: gennadi.f@corigin.com Reply-To: gennadi.f@corigin.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c/9902: optimization level -O2/3 doesn't work correctly. X-SW-Source: 2003-03/txt/msg00038.txt.bz2 List-Id: >Number: 9902 >Category: c >Synopsis: optimization level -O2/3 doesn't work correctly. >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Sun Mar 02 16:26:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: gennadi.f@corigin.com >Release: 3.2.2 >Organization: >Environment: sunOS 2.8 sparc >Description: #include #include #include int main() { char *page,*p; page=calloc(1,4); page+=4; p=page; if (page) { // if we change "page" here to "1", the result will be correct *((char **)page-1)=page; // save the address in its previous 4 bytes. (*((char ***)page-1))++; // add 4 to the saved address. } page=*((char **)page-1); //"page" should be assigned to the new value. printf("page=%08X p=%08X\n",page,p); // with the optimization level -O2/3, the value of page i s not changed. return 0; } >How-To-Repeat: compile with and without O3/O2 options. >Fix: >Release-Note: >Audit-Trail: >Unformatted: