From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9606 invoked by alias); 20 May 2003 12:36:06 -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 9367 invoked by uid 71); 20 May 2003 12:36:01 -0000 Resent-Date: 20 May 2003 12:36:01 -0000 Resent-Message-ID: <20030520123601.9366.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, dirkjan@magma-da.com Received: (qmail 22590 invoked by uid 48); 20 May 2003 12:27:28 -0000 Message-Id: <20030520122728.22589.qmail@sources.redhat.com> Date: Tue, 20 May 2003 12:36:00 -0000 From: dirkjan@magma-da.com Reply-To: dirkjan@magma-da.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/10882: passing and return by reference of char pointer corrupted on x86_64 X-SW-Source: 2003-05/txt/msg02164.txt.bz2 List-Id: >Number: 10882 >Category: c++ >Synopsis: passing and return by reference of char pointer corrupted on x86_64 >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Tue May 20 12:36:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: dirkjan@magma-da.com >Release: gcc-3.2.2 and gcc-3.3 >Organization: >Environment: Reading specs from /home/dirkjan/compiler/opteron/gcc-3.2.2/lib/gcc-lib/x86_64-u nknown-linux-gnu/3.2.2/specs Configured with: ./configure --prefix=/home/dirkjan/compiler/opteron/gcc-3.2.2 - -disable-multilib --enable-languages=c,c++ Thread model: posix gcc version 3.2.2 >Description: compilation of the following source results in overwriting the char pointer of name. using the second_function there is no problem as well after interchanging the order of the two statements in get_string include using namespace std; char* name; char* ret_string="returned string"; void* first_function(void **data) { *data=ret_string; } void* second_function(int *data) { data=0; } void* third_function(void **data) { *data=0; } void get_string(){ char* popped_name; int number; first_function((void**)&popped_name); //second_function(&number); third_function((void**)&number); name=popped_name; } main() { cout<<"start test"<How-To-Repeat: this does only fail on the opteron/x86_64 compilation and run will show the last cout not printing name >Fix: >Release-Note: >Audit-Trail: >Unformatted: