Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 618143 Details for
Bug 850911
g++: operator new[] overflow fix
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
new39b.C
new39b.C (text/plain), 1008 bytes, created by
Jakub Jelinek
on 2012-09-27 15:15:37 UTC
(
hide
)
Description:
new39b.C
Filename:
MIME Type:
Creator:
Jakub Jelinek
Created:
2012-09-27 15:15:37 UTC
Size:
1008 bytes
patch
obsolete
>// Testcase for overflow handling in operator new[]. >// { dg-do run } > >#include <stdlib.h> >#include <stdexcept> > >int two = 2; > >struct without_new { > char bar[256]; >}; > >struct with_new { > char bar[256]; > void *operator new[] (size_t sz) > { > if (sz == -1) > abort (); > return ::operator new[] (sz); > } >}; > >template <typename T> >inline void >test (size_t s) >{ > typedef T T1[two][2][two]; > try { > new T1[s]; > } catch (std::bad_alloc &) { > abort (); > } >} > >template <typename T> >void >test_noopt (size_t s) __attribute__((noinline)); > >template <typename T> >void >test_noopt (size_t s) >{ > __asm__ (""); > test<T> (s); >} > >template <typename T> >void >all_tests () >{ > test<T>(32); > test<T>(131); > test<T>(1024); > test_noopt<T>(32); > test_noopt<T>(131); > test_noopt<T>(1024); >} > >int >main () >{ > __asm__ volatile ("" : : : "memory"); > try { > ::operator new(size_t(-1)); > abort (); > } catch (std::bad_alloc &) { > } > all_tests<without_new> (); > all_tests<with_new> (); > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 850911
:
606350
|
608498
|
608499
|
618101
|
618142
| 618143