public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: dirkjan@magma-da.com To: gcc-gnats@gcc.gnu.org Subject: c++/10882: passing and return by reference of char pointer corrupted on x86_64 Date: Tue, 20 May 2003 12:36:00 -0000 [thread overview] Message-ID: <20030520122728.22589.qmail@sources.redhat.com> (raw) >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 <iostream> 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"<<endl; name="initial_name"; cout<<"name is "<<name<<endl; get_string(); cout<<"name is after functions "<<name<<endl; } >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:
next reply other threads:[~2003-05-20 12:36 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-05-20 12:36 dirkjan [this message] 2003-05-20 13:07 aj
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030520122728.22589.qmail@sources.redhat.com \ --to=dirkjan@magma-da.com \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).