This is the mail archive of the gcc@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: As-if Infinitely Ranged Integer Model


On Fri, Jul 24, 2009 at 06:25:12PM +0200, Laurent GUERBY wrote:
> On Fri, 2009-07-24 at 12:03 -0400, Robert Dewar wrote:
> > Indeed an alternative approach to handling this problem in GCC would
> > be to adapt the Ada model for C and C++ which would not be too hard
> > to do I suspect. Then gcc could be improved to handle this model
> > better and more effectively with respect to optimization, and both
> > C/C++ and Ada would benefit.
> 
> IIRC the Ada rules allows to raise Constraint_Error earlier
> rather than later which is interesting for check removal in loops for
> very common patterns:
> 
>    for I in T'First .. Dynamic_N loop
>       T (I) := 0.0; -- generate check I in T'First .. T'Last
>    end loop;
> 
> =>
> 
>    if Dynamic_N >= T'First and Dynamic_N > T'Last then

Huh? I can't understand the first comparison. 

Actually Ada is not Fortran-66 and allows empty loops, no? 

>       raise Constraint_Error;
>    end if;
>    for I in T'First .. Dynamic_N loop
>       T (I) := 0.0; -- no generated check
>    end loop; 
> 
> But I might be wrong in my recollection (and I don't think GNAT
> takes advantage of that), Robert?

I don't think so. And the code quality when checking for
overflows was abysmal last time I tried.

	Regards,
	Gabriel


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