From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6a9844368dd0a842 X-Google-Attributes: gid103376,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: seperate keyword and seperate compilation with Gnat? Date: 1996/07/17 Message-ID: #1/1 X-Deja-AN: 169296438 distribution: world references: <31D95D93.28D8D15B@jinx.sckans.edu> <4rckva$dj1@Starbase.NeoSoft.COM> organization: The Mitre Corp., Bedford, MA. newsgroups: comp.lang.ada Date: 1996-07-17T00:00:00+00:00 List-Id: Someone asked: > For example, suppose someone starts worrying whether it is valid to > compute a + b as (4 * a + b - 3 * a), which could raise intermediate > overflow. Lets look at this from a practical point of view. Assume that 4 * a + b was computed earlier and is available in a register. The compiler can save one load of b this way, so it could be a "worthwhile" optimization. Multiplying a by 3 can't cause an overflow when 4 * a won't, so if you are in the same exception handler scope, it looks like a valid optimization, even if for other reasons, the computation of 4 * a + b didn't overflow. (Perhaps 2 * a + b was in a register, and b is a large negative number.) So I think it is legal unless it could cause an exception in a different handler scope, again assuming that there was a partial lying around. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...