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: f891f,eac70c5fad02d925 X-Google-Attributes: gidf891f,public X-Google-Thread: 103376,eac70c5fad02d925 X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: Concerning subscript bounds checks Date: 1996/06/24 Message-ID: #1/1 X-Deja-AN: 162470181 references: <4qdj3e$btf@goanna.cs.rmit.EDU.AU> <4ql9eq$hdt@goanna.cs.rmit.EDU.AU> organization: Courant Institute of Mathematical Sciences keywords: subscripts newsgroups: comp.lang.ada,comp.lang.misc Date: 1996-06-24T00:00:00+00:00 List-Id: Richard said "The central point I was making was a very simple, very obvious, very positive one: I translated an algorithm from Fortran to Ada, and it _easily_ and _naturally_ fell out that 62 out of 66 subscripts could _obviously_ be compiled without checks using purely local information (no data flow or range analysis needed). I call that a _good_ result. (The 4 subscripts that aren't quite so obvious are executed with low frequency, and only the upper bound is not obviously safe.)" Yes, indeed for this kind of Fortran algorithm, almost all checks can be eliminated (even if we don't get the last 4, we are certainly doing well). For reasonably thorough global analysis tecniques used to optimize checks (e.g. the old Alsys technology using partial redundancy techniques), it is reasonable to estimate that the total cost of checks is of the order of 10%. Even more interesting than the range checks is the issue of getting rid of elaboration checks, and of course getting rid of overflow checks is quite hard (you really need the full machinery of range analysis for this, and even then you don't get very far). However in the Fortran world, you are dealing with floating-point, and floating-point overflow is often close to free to detect at the hardware level (e.g. by implementing IEEE infinities -- neither IEEE nor Ada requires exception traps at runtime for floating-point). So I certainly do not want to argue with Richard's "central point". It is an important one that needs repeating, I was just commenting around the edge on those remaining four checks. Richard have you actually implemented a compiler that eliinates these checks? That would be interesting if so, and it would be interesting to have the reference.