From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18425 invoked by alias); 29 Jul 2002 11:06: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 18403 invoked by uid 71); 29 Jul 2002 11:06:01 -0000 Resent-Date: 29 Jul 2002 11:06:01 -0000 Resent-Message-ID: <20020729110601.18402.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, dh@digitalbrain.com Received: (qmail 5632 invoked by uid 61); 29 Jul 2002 10:57:21 -0000 Message-Id: <20020729105721.5631.qmail@sources.redhat.com> Date: Mon, 29 Jul 2002 04:06:00 -0000 From: dh@digitalbrain.com Reply-To: dh@digitalbrain.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/7430: if method signature lies "I return SomeClass by value" but actually there is no 'return' then construct-destruct asymmetry results! X-SW-Source: 2002-07/txt/msg00761.txt.bz2 List-Id: >Number: 7430 >Category: c++ >Synopsis: if method signature lies "I return SomeClass by value" but actually there is no 'return' then construct-destruct asymmetry results! >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Mon Jul 29 04:06:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: dh@digitalbrain.com >Release: unknown-1.0 >Organization: >Environment: // BUG IN THIS VERSION OF GCC: // Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs // gcc version 2.95.4 20011002 (Debian prerelease) // RUNNING UNDER: // Linux fee 2.4.18 #1 SMP Tue May 21 10:16:05 BST 2002 i686 unknown >Description: see How-To-Repeat >How-To-Repeat: try this prog: // BUG IN THIS VERSION OF GCC: // Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs // gcc version 2.95.4 20011002 (Debian prerelease) // RUNNING UNDER: // Linux fee 2.4.18 #1 SMP Tue May 21 10:16:05 BST 2002 i686 unknown struct X { char* m_; X() : m_(new char[5]) {} ~X() { delete[] m_; } }; struct C { X MightReturnCheese() { // // INSTRUCTIONS: // comment-out the following line and get // no compiler error/warning - just a program that // returns uninitted-RAM as an "instance" of X. Scary. return X(); } void CallIt() { MightReturnCheese(); } }; int main() { C c; c.CallIt(); return 0; } >Fix: none known (though you can pick up the resulting dangerous code that's generated using something like valgrind) >Release-Note: >Audit-Trail: >Unformatted: