Home | Contact | Pricing | News | Partners | Mailing List | Site Map

Developer Center

[GNAT] Avoid intermediate overflow for type conversion

Friday April 11, 2008

For an expression such as Integer (A + B), where A and B are Short_Integer and the result of the addition exceeds Short_Integer, it is allowed to get a constraint_error even though the result would fit in type Integer. This seems undesirable in this case, and the RM specifically allows for the possibility of not raising the exception if the right result is given. The compiler now takes advantage of this and does not raise CE in this case.

 

Posted by Posted in Development Log, GNAT Compilation System