This is the mail archive of the gcc-prs@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]

c++/517: New causes seg fault while malloc correctly return null



>Number:         517
>Category:       c++
>Synopsis:       New causes seg fault while malloc correctly return null
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 08 09:36:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Jonathan Reichhold
>Release:        unknown-1.0
>Organization:
>Environment:
Redhat linux 6.1, Redhat linux 6.2, Mandrake 6.0
>Description:
A simple test which exhausts memory by creating 1440 byte char[] does not report out of memory error.  Instead causes a seg fault and core dump.
Using malloc a null pointer is correctly passed back.

Code compiled with gcc -O t2new.cpp -o t2new.o
>How-To-Repeat:
Compile and run	
>Fix:
correct implementaion of new so that it returns std::bad_alloc or a null pointer.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="t2new.cpp.gz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="t2new.cpp.gz"

H4sICHUTuTkAA3QybmV3LmNwcACFkstOwzAQRdf2VwythBIKUSt11dcG8QWIFWJhOVNikYwr26EP
1H9n7IY2RUhkZd2594zHk6EhXbclwgKdI1tUKzk8S8b64FA1fQ13GjfBWFqBlK039A6kGvQbpRF8
KOcSpA8qGA2GAjRq92wOCEsYz6U8KYayXH5JoS35kFz+wIbJdMIeUVtGatuyfAqJtXXZRehqC5iO
09cJo1EuBUOFrpS7g09Vt8g0Edw+qiIJDCDcQrS8+sNbrB9jRAVdZefJbgHzlGEwN1rA4Mk562AQ
z1hsKxWyPJ2prK8ZRVH8ir7QB9ktAfYQvZhZZzfpan92VHVtGRwfucHGuv39adhl4nQPcQH+G+/6
x00n22yWhLjlGMhS5Wo04TC0juBhch70p8cj/xoBS7i+ywCwxgYp+P6sR15jR+KVMkZ+A0B0QDh5
AgAA

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