public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/10269: ncurses function in class causes malloc() syscall to loop infinitly
@ 2003-03-30 12:16 fr33z3, at
  0 siblings, 0 replies; 2+ messages in thread
From: fr33z3, at @ 2003-03-30 12:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         10269
>Category:       c++
>Synopsis:       ncurses function in class causes malloc() syscall to loop infinitly
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 30 11:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Tam
>Release:        gcc version 2.95.4 20011002 (Debian prerelease) and also 3.2.3 20030309 (Debian prerelease)
>Organization:
>Environment:
Debian sarge on i686 AMD Athlon(tm) XP 2000+
Libs:
libform.so.5 => /usr/lib/libform.so.5 (0x4001c000)
libncurses.so.5 => /lib/libncurses.so.5 (0x40028000)
libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3 (0x40067000)
libm.so.6 => /lib/libm.so.6 (0x400b0000)
libc.so.6 => /lib/libc.so.6 (0x400d1000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
>Description:
The Syscall malloc() loops infinitly when it should allocate lets say.. more than 512b of memory (on my system) but allocating only a few bytes works well. It also ran on a similar system to mine using the libncurses.so.4 - so it's either an error in gcc or in libcurses - I don't know for sure...

For further Infos and strange things have a look at the comments in the short c++ source code.
>How-To-Repeat:
g++ -lform -lcurses -o ncursesInClass ncursesInClass.cpp
and run the binary

you can use g++ 2.95 or 3.2 as well to compile.
>Fix:
no idea...
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-c++src; name="ncursesInClass.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="ncursesInClass.cpp"

I2luY2x1ZGUgPGZvcm0uaD4KI2luY2x1ZGUgPGN1cnNlcy5oPgoKLyoqKiogY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zZXRf
Zm9ybV9zdWIobV9mb3JtLCBkZXJ3aW4obV93aW4sIDEsIDMyLCAxLCAxMSkpOwoJZnJlZV9mb3Jt
KG1fZm9ybSk7IC8vIE5vIHByb2JsZW0gd2l0aCB0aGF0IGluIGEgc2ltcGxlIGZ1bmN0aW9uCglm
cmVlX2ZpZWxkKG1fZmllbGRzWzBdKTsKCWRlbHdpbihtX3dpbik7CgllbmR3aW4oKTsKfQoKLyoq
KiogbWFpbiAqKioqLwoKaW50IG1haW4oKQp7CgkvLyBubyBpZigpIC0gbm8gbG9vcGluZywgZXZl
biBpZiBmcmVlX2Zvcm0oKSBpbiBjbGFzcyBpcyB1c2VkCglpZiAoMSkgewkKCQkKCS8vIG1hc2tm
dW5jdGlvbigpOyAvLyB3b3JrcyBmaW5lIHdpdGhvdXQgYW4gb2JqZWN0CgltYXNrIG9tYXNrOwoJ
b21hc2sufm1hc2soKTsKCX0KCQoJY2hhciAqYXJyPSBuZXcgY2hhclsxMDI0XTsJLy8gVGhpcyBp
cyB0aGUgcG9pbnQgd2hlcmUgdGhlIGxvb3BpbmcgYmVnaW5zCgkJCQkJCQkJLy8gdGhlIG1hbGxv
YygpIHN5c2NhbGwgY2F1c2VzIGl0IC0gZHVubm8gd2h5CQkJCQkJCQkJCgkKCWRlbGV0ZSBhcnI7
CglyZXR1cm4gMDsKfQo=


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

* Re: c++/10269: ncurses function in class causes malloc() syscall to loop infinitly
@ 2003-03-31 15:52 bangerth
  0 siblings, 0 replies; 2+ messages in thread
From: bangerth @ 2003-03-31 15:52 UTC (permalink / raw)
  To: fr33z3, gcc-bugs, gcc-prs, gmx.net, nobody

Synopsis: ncurses function in class causes malloc() syscall to loop infinitly

State-Changed-From-To: open->feedback
State-Changed-By: bangerth
State-Changed-When: Mon Mar 31 15:41:58 2003
State-Changed-Why:
    I don't have the necessary libraries and header files 
    installed on my system, so can't test. However, I think
    it's a bug in your code: in this part of your code
      if (1) {	
        mask omask;
        omask.~mask();
      }
    The destructor of omask is called twice. Since you do
    some memory deallocation there, I would not be entirely
    surprised if that would lead to strange effects later on.
    
    Can you say what happens if you fix this?
    
    W.

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


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

end of thread, other threads:[~2003-03-31 15:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-30 12:16 c++/10269: ncurses function in class causes malloc() syscall to loop infinitly fr33z3, at
2003-03-31 15:52 bangerth

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