1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>AARM95 - Classification of Errors</TITLE>
<META NAME="Author" CONTENT="JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor">
<META NAME="GENERATOR" CONTENT="Arm_Form.Exe, Ada Reference Manual generator">
<STYLE type="text/css">
DIV.paranum {position: absolute; font-family: Arial, Helvetica, sans-serif; left: 0.5 em; top: auto}
TT {font-family: "Courier New", monospace}
DT {display: compact}
DIV.Normal {font-family: "Times New Roman", Times, serif; margin-bottom: 0.6em}
DIV.Wide {font-family: "Times New Roman", Times, serif; margin-top: 0.6em; margin-bottom: 0.6em}
DIV.Annotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
DIV.WideAnnotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0.6em; margin-bottom: 0.6em}
DIV.Index {font-family: "Times New Roman", Times, serif}
DIV.SyntaxSummary {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
DIV.Notes {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.6em}
DIV.NotesHeader {font-family: "Times New Roman", Times, serif; margin-left: 2.0em}
DIV.SyntaxIndented {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
DIV.Indented {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-bottom: 0.6em}
DIV.CodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
DIV.SmallIndented {font-family: "Times New Roman", Times, serif; margin-left: 10.0em; margin-bottom: 0.6em}
DIV.SmallCodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-bottom: 0.6em}
DIV.Examples {font-family: "Courier New", monospace; margin-left: 2.0em; margin-bottom: 0.6em}
DIV.SmallExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 7.5em; margin-bottom: 0.6em}
DIV.IndentedExamples {font-family: "Courier New", monospace; margin-left: 8.0em; margin-bottom: 0.6em}
DIV.SmallIndentedExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 15.0em; margin-bottom: 0.6em}
UL.Bulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.SmallBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.NestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.SmallNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.IndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.CodeIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.CodeIndentedNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.SyntaxIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.NotesBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
UL.NotesNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
DL.Hanging {font-family: "Times New Roman", Times, serif; margin-top: 0em; margin-bottom: 0.6em}
DD.Hanging {margin-left: 6.0em}
DL.IndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
DD.IndentedHanging {margin-left: 2.0em}
DL.HangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.HangingInBulleted {margin-left: 4.0em}
DL.SmallHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
DD.SmallHanging {margin-left: 7.5em}
DL.SmallIndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-top: 0em; margin-bottom: 0.6em}
DD.SmallIndentedHanging {margin-left: 2.0em}
DL.SmallHangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.SmallHangingInBulleted {margin-left: 5.0em}
DL.Enumerated {font-family: "Times New Roman", Times, serif; margin-right: 0.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.Enumerated {margin-left: 2.0em}
DL.SmallEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
DD.SmallEnumerated {margin-left: 2.5em}
DL.NestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
DL.SmallNestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
</STYLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFF0" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<P><A HREF="AA-TOC.html">Contents</A> <A HREF="AA-0-29.html">Index</A> <A HREF="AA-1-1-4.html">Previous</A> <A HREF="AA-1-2.html">Next</A></P>
<HR>
<H1> 1.1.5 Classification of Errors</H1>
<H4 ALIGN=CENTER>Implementation Requirements</H4>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> The language definition
classifies errors into several different categories: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>Errors that are required to be detected prior to run time
by every Ada implementation;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<UL Class="Bulleted">These errors correspond to any violation of a rule
given in this International Standard, other than those listed below.
In particular, violation of any rule that uses the terms shall, allowed,
permitted, legal, or illegal belongs to this category. Any program that
contains such an error is not a legal Ada program; on the other hand,
the fact that a program is legal does not mean, <I>per se</I>, that the
program is free from other forms of error.</UL>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<UL Class="Bulleted"><A NAME="I1084"></A><A NAME="I1085"></A><A NAME="I1086"></A><A NAME="I1087"></A>The
rules are further classified as either compile time rules, or post compilation
rules, depending on whether a violation has to be detected at the time
a compilation unit is submitted to the compiler, or may be postponed
until the time a compilation unit is incorporated into a partition of
a program. </UL>
<DIV Class="Paranum"><FONT SIZE=-2>4.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>See, for
example, <A HREF="AA-10-1-3.html">10.1.3</A>, ``<A HREF="AA-10-1-3.html">Subunits
of Compilation Units</A>'', for some errors that are detected only after
compilation. Implementations are allowed, but not required, to detect
post compilation rules at compile time when possible. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>Errors that are required to be detected at run time by
the execution of an Ada program;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<UL Class="Bulleted"><A NAME="I1088"></A><A NAME="I1089"></A>The corresponding
error situations are associated with the names of the predefined exceptions.
Every Ada compiler is required to generate code that raises the corresponding
exception if such an error situation arises during program execution.
[If such an error situation is certain to arise in every execution of
a construct, then an implementation is allowed (although not required)
to report this fact at compilation time.]</UL>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>Bounded errors;</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<UL Class="Bulleted">The language rules define certain kinds of errors
that need not be detected either prior to or during run time, but if
not detected, the range of possible effects shall be bounded. <A NAME="I1090"></A>The
errors of this category are called <I>bounded errors</I>. <A NAME="I1091"></A>The
possible effects of a given bounded error are specified for each such
error, but in any case one possible effect of a bounded error is the
raising of the exception Program_Error.</UL>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>Erroneous execution.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<UL Class="Bulleted"><A NAME="I1092"></A>In addition to bounded errors,
the language rules define certain kinds of errors as leading to <I>erroneous
execution</I>. Like bounded errors, the implementation need not detect
such errors either prior to or during run time. Unlike bounded errors,
there is no language-specified bound on the possible effect of erroneous
execution; the effect is in general not predictable. </UL>
<DIV Class="Paranum"><FONT SIZE=-2>10.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>Executions
are erroneous, not programs or parts of programs. Once something erroneous
happens, the execution of the entire program is erroneous from that point
on, and potentially before given possible reorderings permitted by <A HREF="AA-11-6.html">11.6</A>
and elsewhere. We cannot limit it to just one partition, since partitions
are not required to live in separate address spaces. (But implementations
are encouraged to limit it as much as possible.)</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Suppose a program contains a pair
of things that will be executed ``in an arbitrary order.'' It is possible
that one order will result in something sensible, whereas the other order
will result in erroneous execution. If the implementation happens to
choose the first order, then the execution is not erroneous. This may
seem odd, but it is not harmful.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Saying that something is erroneous
is semantically equivalent to saying that the behavior is unspecified.
However, ``erroneous'' has a slightly more disapproving flavor. </FONT></DIV>
<H4 ALIGN=CENTER>Implementation Permissions</H4>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<DIV Class="Normal"> [<A NAME="I1093"></A> <A NAME="I1094"></A>An
implementation may provide <I>nonstandard modes</I> of operation. Typically
these modes would be selected by a <FONT FACE="Arial, Helvetica">pragma</FONT>
or by a command line switch when the compiler is invoked. When operating
in a nonstandard mode, the implementation may reject <FONT FACE="Arial, Helvetica">compilation_unit</FONT>s
that do not conform to additional requirements associated with the mode,
such as an excessive number of warnings or violation of coding style
guidelines. Similarly, in a nonstandard mode, the implementation may
apply special optimizations or alternative algorithms that are only meaningful
for programs that satisfy certain criteria specified by the implementation.
<A NAME="I1095"></A><A NAME="I1096"></A>In any case, an implementation
shall support a <I>standard</I> mode that conforms to the requirements
of this International Standard; in particular, in the standard mode,
all legal <FONT FACE="Arial, Helvetica">compilation_unit</FONT>s shall
be accepted.] </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>These permissions
are designed to authorize explicitly the support for alternative modes.
Of course, nothing we say can prevent them anyway, but this (redundant)
paragraph is designed to indicate that such alternative modes are in
some sense ``approved'' and even encouraged where they serve the specialized
needs of a given user community, so long as the standard mode, designed
to foster maximum portability, is always available. </FONT></DIV>
<H4 ALIGN=CENTER>Implementation Advice</H4>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<DIV Class="Normal"> <A NAME="I1097"></A>If an implementation detects
a bounded error or erroneous execution, it should raise Program_Error.
</DIV>
<H4 ALIGN=CENTER>Wording Changes from Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>12.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Some situations that are erroneous
in Ada 83 are no longer errors at all. For example, depending on the
parameter passing mechanism when unspecified is possibly non-portable,
but not erroneous.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>12.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Other situations that are erroneous
in Ada 83 are changed to be bounded errors. In particular, evaluating
an uninitialized scalar variable is a bounded error. <A NAME="I1098"></A>The
possible results are to raise Program_Error (as always), or to produce
a machine-representable value (which might not be in the subtype of the
variable). <A NAME="I1099"></A>Violating a Range_Check or Overflow_Check
raises Constraint_Error, even if the value came from an uninitialized
variable. This means that optimizers can no longer ``assume'' that all
variables are initialized within their subtype's range. Violating a check
that is suppressed remains erroneous.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>12.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The ``incorrect order dependences''
category of errors is removed. All such situations are simply considered
potential non-portabilities. This category was removed due to the difficulty
of defining what it means for two executions to have a ``different effect.''
For example, if a function with a side-effect is called twice in a single
expression, it is not in principle possible for the compiler to decide
whether the correctness of the resulting program depends on the order
of execution of the two function calls. A compile time warning might
be appropriate, but raising of Program_Error at run time would not be.
</FONT></DIV>
<HR>
<P><A HREF="AA-TOC.html">Contents</A> <A HREF="AA-0-29.html">Index</A> <A HREF="AA-1-1-4.html">Previous</A> <A HREF="AA-1-2.html">Next</A> <A HREF="AA-TTL.html">Legal</A></P>
</BODY>
</HTML>
|