This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [PR19351, C++] Fix heap overflow in operator new[]


On Sat, 6 Feb 2010, Richard Guenther wrote:

> Note that it doesn't touch the ABI at all as you only would use
> fixed-point types for intermediate computation.  Note that I only
> like to see saturating arithmetic used, the suggestion of using
> fixed-point types is just that they are the only ones that currently
> support that.

The saturating RTL expressions are perfectly well-defined for normal 
integer types; several targets use them to describe the semantics of 
vector operations, for example.  It just so happens that these insn 
patterns will never be matched by RTL generated from generic C, just by 
that generated from intrinsics.

I'd suggest adding corresponding tree / GIMPLE codes for saturating 
arithmetic, with fallback lowering code somewhere (RTL expansion at the 
latest, but maybe earlier) for targets not providing the required insn 
patterns; adding a code that most optimizers do not touch should not be 
hard.  If someone later wishes to detect generic C patterns for saturation 
so they can be better optimized, they can implement that (see the paper of 
Bik, Girkar, Grey and Tian which reports this helps on SPEC2000 164.gzip).  
Similarly, anyone wishing to improve code for saturating arithmetic on 
their processors (which have instructions for saturating arithmetic, 
either scalar or vector) can add the required insn patterns (and could do 
so right now - they just wouldn't be used at present).

-- 
Joseph S. Myers
joseph@codesourcery.com


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