This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/9872: temporary destructor not called?


>Number:         9872
>Category:       c++
>Synopsis:       temporary destructor not called?
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 27 04:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Sandor Kovacs
>Release:        gcc 3.2
>Organization:
>Environment:
intel linux suse 8.1, kernel 2.4.20-ck2, qt 3.1
>Description:

Temporary object is not properly destructed (see test prg. below which eats the memory up):

#include <qstring.h>

void tester(QString str) {
}

int main(int argc, char** argv) {
    QString str("bug");
    while (true) tester("ops: " + str);
}

Compiled as:

gcc -I/usr/lib/qt3/include -c bug.cpp
gcc -L/usr/lib/qt3/lib -lqt-mt bug.o -o bug

If you specify -fno-elide-constructors it works properly (that's why I believe it is not a qt-bug)

There was already a fix for this/similar bug hopefully I'm not reporting it twice (couldn't find this bug on the bug list), see 
http://sources.redhat.com/ml/cygwin/2001-10/msg00467.html.

If you think it is a QT bug please let me know and in this case I'll drop Trolltech a line.

Thanks: Sandor
>How-To-Repeat:
compile, run the sample program
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-c++src; name="bug.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bug.cpp"

LyoqCiAqIENvbXBpbGU6CiAqIGdjYyAtSS91c3IvbGliL3F0My9pbmNsdWRlIC1jIGJ1Zy5jcHAK
ICogZ2NjIC1ML3Vzci9saWIvcXQzL2xpYiAtbHF0LW10IGJ1Zy5vIC1vIGJ1ZwogKi8KCiNpbmNs
dWRlIDxxc3RyaW5nLmg+Cgp2b2lkIHRlc3RlcihRU3RyaW5nIHN0cikgewp9CgppbnQgbWFpbihp
bnQgYXJnYywgY2hhcioqIGFyZ3YpIHsKICAgIFFTdHJpbmcgc3RyKCJidWciKTsKICAgIHdoaWxl
ICh0cnVlKSB0ZXN0ZXIoIm9wczogIiArIHN0cik7Cn0K


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]