public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/7430: if method signature lies "I return SomeClass by value" but actually there is no 'return' then construct-destruct asymmetry results!
@ 2002-09-30 10:40 nathan
  0 siblings, 0 replies; 2+ messages in thread
From: nathan @ 2002-09-30 10:40 UTC (permalink / raw)
  To: dh, gcc-bugs, gcc-prs, nobody

Synopsis: if method signature lies "I return SomeClass by value" but actually there is no 'return' then construct-destruct asymmetry results!

State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Mon Sep 30 10:40:33 2002
State-Changed-Why:
    fixed in CVS
    7430.ii: In member function `X C::MightReturnCheese()':
    7430.ii:15: warning: no return statement in function returning non-void
    7430.ii:15: warning: control reaches end of non-void function

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7430


^ permalink raw reply	[flat|nested] 2+ messages in thread

* c++/7430: if method signature lies "I return SomeClass by value" but actually there is no 'return' then construct-destruct asymmetry results!
@ 2002-07-29  4:06 dh
  0 siblings, 0 replies; 2+ messages in thread
From: dh @ 2002-07-29  4:06 UTC (permalink / raw)
  To: gcc-gnats


>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:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-09-30 17:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-30 10:40 c++/7430: if method signature lies "I return SomeClass by value" but actually there is no 'return' then construct-destruct asymmetry results! nathan
  -- strict thread matches above, loose matches on Subject: below --
2002-07-29  4:06 dh

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).