Re: Integer overflow in operator new. Solved?

2007-04-09 Thread Joe Buck
On Mon, Apr 09, 2007 at 09:47:07AM -0700, Andrew Pinski wrote: On 4/9/07, J.C. Pizarro [EMAIL PROTECTED] wrote: #include stddef.h void *__allocate_array_OptionA(size_t num, size_t size) { // 1st best unsigned long long tmp = (unsigned long long)size * num; if (tmp =

Re: Integer overflow in operator new. Solved?

2007-04-09 Thread J.C. Pizarro
2007/4/9, Joe Buck [EMAIL PROTECTED]: On Mon, Apr 09, 2007 at 09:47:07AM -0700, Andrew Pinski wrote: On 4/9/07, J.C. Pizarro [EMAIL PROTECTED] wrote: #include stddef.h void *__allocate_array_OptionA(size_t num, size_t size) { // 1st best unsigned long long tmp = (unsigned long long)size

Re: Integer overflow in operator new. Solved?

2007-04-09 Thread J.C. Pizarro
4. Conditional moves (cmov).

Re: Integer overflow in operator new. Solved?

2007-04-09 Thread Ian Lance Taylor
J.C. Pizarro [EMAIL PROTECTED] writes: To optimize even more the x86, it still has to use: 1. Use imul instead of mul because it's little bit faster in cycles. 2. Use jns/js (sign's conditional jump) instead of jnc/jc (carry's conditional jump). 3. To modify the C-preprocessor and/or C/C++

Re: Integer overflow in operator new. Solved?

2007-04-09 Thread J.C. Pizarro
2007/4/9, Andrew Pinski [EMAIL PROTECTED]: On 4/9/07, J.C. Pizarro [EMAIL PROTECTED] wrote: 3. To modify the C-preprocessor and/or C/C++ compiler for: #if argument X is a constant then use this code specific of constant X #else if argument Y is not a constant then

Re: Integer overflow in operator new. Solved?

2007-04-09 Thread Mike Stump
On Apr 9, 2007, at 12:14 PM, J.C. Pizarro wrote: How many code's species are they? One for every problem... 7. Code for IPA??? - i don't know this weird language. Is it with attributes?. 8. Code for GIMPLE??? - i don't know this weird language. 9. Code for RTL??? - i don't know this weird

Re: Integer overflow in operator new. Solved?

2007-04-09 Thread Andrew Pinski
On 4/9/07, J.C. Pizarro [EMAIL PROTECTED] wrote: Of course, i'm a novice because i like and i don't like the GCC development's model. Of course the user manual explains all what I have mentioned in my previous email so it sounds like you like 95% of the other people who don't read the manual

Re: Integer overflow in operator new. Solved? Experimental i686 code.

2007-04-09 Thread J.C. Pizarro
#include stddef.h // by J.C. Pîzarro ... // See http://www.cs.sjsu.edu/~kirchher/CS047/multDiv.html // One-operand imul: Unsigned mul: // warning: 32 bit, i686, possible risk of -x * -y = valid x * y, ... // warning: it's made quick dirty, possible to give clobbered situations. //

Re: Integer overflow in operator new. Solved? Experimental i686 code.

2007-04-09 Thread J.C. Pizarro
#include stddef.h // by J.C. Pîzarro ... // This function doesn't touch the ECX register that is touched by OptionC. __volatile__ static const int minus_one = -1; void *__allocate_array_OptionD(size_t num, size_t size) { register unsigned int result; __asm__ __volatile__ (