summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/operator-new.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Reverting r216675. This breaks some bots. Before this can be committed ↵Aaron Ballman2014-08-281-44/+11
| | | | | | again, I have to explore runtime ABI requirements with libc++abi. llvm-svn: 216677
* Throw a std::bad_array_new_length exception when the expression (or ↵Aaron Ballman2014-08-281-11/+44
| | | | | | constant-expression) passed to operator new[] results in overflow in conformance with [expr.new]p7. Fixes PR11644. llvm-svn: 216675
* Abstract IR generation of array cookies into the C++ ABI class andJohn McCall2010-09-021-5/+5
| | | | | | | | | | | | | | implement ARM array cookies. Also fix a few unfortunate bugs: - throwing dtors in deletes prevented the allocation from being deleted - adding the cookie to the new[] size was not being considered for overflow (and, more seriously, was screwing up the earlier checks) - deleting an array via a pointer to array of class type was not causing any destructors to be run and was passing the unadjusted pointer to the deallocator - lots of address-space problems, in case anyone wants to support free store in a variant address space :) llvm-svn: 112814
* don't demand names to be on IR.Chris Lattner2010-07-201-3/+2
| | | | llvm-svn: 108937
* Follow the implementation approach suggested by PR6687,Chris Lattner2010-07-201-4/+3
| | | | | | | | | | | | | | | | | | | | | | which generates more efficient and more obviously conformant code. We now test for overflow of the multiply then force the result to -1 if so. On X86, this generates nice code like this: __Z4testl: ## @_Z4testl ## BB#0: ## %entry subl $12, %esp movl $4, %eax mull 16(%esp) testl %edx, %edx movl $-1, %ecx cmovel %eax, %ecx movl %ecx, (%esp) call __Znam addl $12, %esp ret llvm-svn: 108927
* implement rdar://5739832 - operator new should check for overflow in multiply,Chris Lattner2010-07-201-2/+16
| | | | | | | | | | | | | | | | | | | | causing clang to compile this code into something that correctly throws a length error, fixing a potential integer overflow security attack: void *test(long N) { return new int[N]; } int main() { test(1L << 62); } We do this even when exceptions are disabled, because it is better for the code to abort than for the attack to succeed. This is heavily based on a patch that Fariborz wrote. llvm-svn: 108915
* Turn access control on by default in -cc1.John McCall2010-04-091-0/+1
| | | | | | | | Remove -faccess-control from -cc1; add -fno-access-control. Make the driver pass -fno-access-control by default. Update a bunch of tests to be correct under access control. llvm-svn: 100880
* revert part of my last patch, and mark only the c++ global new operator as ↵Nuno Lopes2009-12-171-7/+2
| | | | | | noalias. the rest will be infered by llvm optz llvm-svn: 91600
* implement PR5654: add -fassume-sane-operator-new, which is enabled by ↵Nuno Lopes2009-12-161-0/+21
default, and adds the malloc attribute to the global function new() and to the overloaded new operators. feel free to chage the name to this lengthy argument llvm-svn: 91543
OpenPOWER on IntegriCloud