Wiki Markup |
---|
According to Appendix J of \[[ISO/IEC 9899:1999|AA. C References#ISO/IEC 9899-1999]\], the behavior a program is [undefined | BB. Definitions#undefined behavior] in the circumstances outlined the following circumstances:table below. The *Rules* column in the table references the rule(s) and/or recommendation(s) that address the specific case of undefined behavior. |
# | Description | Rules | ||||||
---|---|---|---|---|---|---|---|---|
1
| A ââshallââ or ââshall notââ requirement that appears outside of a constraint is violated (clause 4). |
| ||||||
2
| A nonempty source file does not end in a new-line character which is not immediately preceded by a backslash character or ends in a partial preprocessing token or comment (5.1.1.2). |
| ||||||
3
| Token concatenation produces a character sequence matching the syntax of a universal character name (5.1.1.2). |
| ||||||
4
| A program in a hosted environment does not define a function named main using one of the specified forms (5.1.2.2.1). |
| ||||||
5
| A character not in the basic source character set is encountered in a source file, except in an identifier, a character constant, a string literal, a header name, a comment, or a preprocessing token that is never converted to a token (5.2.1). |
| ||||||
6
| An identifier, comment, string literal, character constant, or header name contains an invalid multibyte character or does not begin and end in the initial shift state (5.2.1.2). |
| ||||||
7
| The same identifier has both internal and external linkage in the same translation unit (6.2.2). |
| ||||||
8
| An object is referred to outside of its lifetime (6.2.4). | |||||||
9
| The value of a pointer to an object whose lifetime has ended is used (6.2.4). |
| ||||||
10
| The value of an object with automatic storage duration is used while it is indeterminate (6.2.4, 6.7.8, 6.8). |
| ||||||
11
| A trap representation is read by an lvalue expression that does not have character type (6.2.6.1). |
| ||||||
12
| A trap representation is produced by a side effect that modifies any part of the object using an lvalue expression that does not have character type (6.2.6.1). |
| ||||||
13
| The arguments to certain operators are such that could produce a negative zero result, but the implementation does not support negative zeros (6.2.6.2). |
| ||||||
14
| Two declarations of the same object or function specify types that are not compatible (6.2.7). |
| ||||||
15
| Conversion to or from an integer type produces a value outside the range that can be represented (6.3.1.4). |
| ||||||
16
| Demotion of one real floating type to another produces a value outside the range that can be represented (6.3.1.5). |
| ||||||
17
| An lvalue does not designate an object when evaluated (6.3.2.1). |
| ||||||
18
| A non-array lvalue with an incomplete type is used in a context that requires the value of the designated object (6.3.2.1). |
| ||||||
19
| An lvalue having array type is converted to a pointer to the initial element of the array, and the array object has register storage class (6.3.2.1). |
| ||||||
20
| An attempt is made to use the value of a void expression, or an implicit or explicit conversion (except to void) is applied to a void expression (6.3.2.2). |
| ||||||
21
| Conversion of a pointer to an integer type produces a value outside the range that can be represented (6.3.2.3). |
| ||||||
22
| Conversion between two pointer types produces a result that is incorrectly aligned (6.3.2.3). |
| ||||||
23
| A pointer is used to call a function whose type is not compatible with the pointed-to type (6.3.2.3). |
| ||||||
24
| An unmatched ' or " character is encountered on a logical source line during tokenization (6.4). |
| ||||||
25
| A reserved keyword token is used in translation phase 7 or 8 for some purpose other than as a keyword (6.4.1). |
| ||||||
26
| A universal character name in an identifier does not designate a character whose encoding falls into one of the specified ranges (6.4.2.1). |
| ||||||
27
| The initial character of an identifier is a universal character name designating a digit (6.4.2.1). |
| ||||||
28
| Two identifiers differ only in nonsignificant characters (6.4.2.1). |
| ||||||
29
| The identifier |
| ||||||
30
| The program attempts to modify a string literal (6.4.5). |
| ||||||
31
| The characters |
| ||||||
32
| Between two sequence points, an object is modified more than once, or is modified and the prior value is read other than to determine the value to be stored (6.5). |
| ||||||
33
| An exceptional condition occurs during the evaluation of an expression (6.5). |
| ||||||
34
| An object has its stored value accessed other than by an lvalue of an allowable type (6.5). |
| ||||||
35
| An attempt is made to modify the result of a function call, a conditional operator, an assignment operator, or a comma operator, or to access it after the next sequence point (6.5.2.2, 6.5.15, 6.5.16, 6.5.17). |
| ||||||
36
| For a call to a function without a function prototype in scope, the number of arguments does not equal the number of parameters (6.5.2.2). |
| ||||||
37
| For call to a function without a function prototype in scope where the function is defined with a function prototype, either the prototype ends with an ellipsis or the types of the arguments after promotion are not compatible with the types of the parameters (6.5.2.2). |
| ||||||
38
| For a call to a function without a function prototype in scope where the function is not defined with a function prototype, the types of the arguments after promotion are not compatible with those of the parameters after promotion (with certain exceptions) (6.5.2.2). |
| ||||||
39
| A function is defined with a type that is not compatible with the type (of the expression) pointed to by the expression that denotes the called function (6.5.2.2). |
| ||||||
40
| The operand of the unary |
| ||||||
41
| A pointer is converted to other than an integer or pointer type (6.5.4). |
| ||||||
42
| The value of the second operand of the |
| ||||||
43
| Addition or subtraction of a pointer into, or just beyond, an array object and an integer type produces a result that does not point into, or just beyond, the same array object (6.5.6). |
| ||||||
44
| Addition or subtraction of a pointer into, or just beyond, an array object and an integer type produces a result that points just beyond the array object and is used as the operand of a unary * operator that is evaluated (6.5.6). |
| ||||||
45
| Pointers that do not point into, or just beyond, the same array object are subtracted (6.5.6). |
...
|
<ac:structured-macro |
...
ac:name=" |
...
unmigrated-wiki-markup" |
...
ac:schema-version="1" |
...
ac:macro-id=" |
...
0f631f81- |
...
a3dd- |
...
44cb- |
...
a98a- |
...
7b71969ff8af"><ac: |
...
plain-text-body><![CDATA[ | 46
| An array subscript is out of range, even if an object is apparently accessible with the given subscript (as in the lvalue expression a[1][7] given the declaration int a[4][5]) (6.5.6). |
| ]]></ac:plain-text-body></ac:structured-macro> | ||||||
47
| The result of subtracting two pointers is not representable in an object of type |
| ||||||||
48
| An expression is shifted by a negative number or by an amount greater than or equal to the width of the promoted expression (6.5.7). |
| ||||||||
49
| An expression having signed promoted type is left-shifted and either the value of the expression is negative or the result of shifting would be not be representable in the promoted type (6.5.7). |
| ||||||||
50
| Pointers that do not point to the same aggregate or union (nor just beyond the same array object) are compared using relational operators (6.5.8). |
| ||||||||
51
| An object is assigned to an inexactly overlapping object or to an exactly overlapping object with incompatible type (6.5.16.1). |
| ||||||||
52
| An expression that is required to be an integer constant expression does not have an integer type; has operands that are not integer constants, enumeration constants, character constants, |
| ||||||||
53
| A constant expression in an initializer is not, or does not evaluate to, one of the following: an arithmetic constant expression, a null pointer constant, an address constant, or an address constant for an object type plus or minus an integer constant expression (6.6). |
| ||||||||
54
| An arithmetic constant expression does not have arithmetic type; has operands that are not integer constants, floating constants, enumeration constants, character constants, or |
...
|
<ac:structured-macro |
...
ac:name=" |
...
unmigrated-wiki-markup" |
...
ac:schema-version="1" |
...
ac:macro-id=" |
...
4ab23d52- |
...
4b53- |
...
4c58- |
...
b8a7- |
...
6fa94c90abc8"><ac: |
...
plain-text-body><![CDATA[ | 55
| The value of an object is accessed by an array-subscript |
| ]]></ac:plain-text-body></ac:structured-macro> | ||||||
56
| An identifier for an object is declared with no linkage and the type of the object is incomplete after its declarator, or after its init-declarator if it has an initializer (6.7). |
| ||||||||
57
| A function is declared at block scope with an explicit storage-class specifier other than extern (6.7.1). |
| ||||||||
58
| A structure or union is defined as containing no named members (6.7.2.1). |
| ||||||||
59
| An attempt is made to access, or generate a pointer to just past, a flexible array member of a structure when the referenced object provides no elements for that array (6.7.2.1). |
| ||||||||
60
| When the complete type is needed, an incomplete structure or union type is not completed in the same scope by another declaration of the tag that defines the content (6.7.2.3). |
| ||||||||
61
| An attempt is made to modify an object defined with a const-qualified type through use of an lvalue with non-const-qualified type (6.7.3). |
| ||||||||
62
| An attempt is made to refer to an object defined with a volatile-qualified type through use of an lvalue with non-volatile-qualified type (6.7.3). |
| ||||||||
63
| The specification of a function type includes any type qualifiers (6.7.3). |
| ||||||||
64
| Two qualified types that are required to be compatible do not have the identically qualified version of a compatible type (6.7.3). |
| ||||||||
65
| An object which has been modified is accessed through a restrict-qualified pointer to a const-qualified type, or through a restrict-qualified pointer and another pointer that are not both based on the same object (6.7.3.1). | |||||||||
66
| A restrict-qualified pointer is assigned a value based on another restricted pointer whose associated block neither began execution before the block associated with this pointer, nor ended before the assignment (6.7.3.1). |
| ||||||||
67
| A function with external linkage is declared with an inline function specifier, but is not also defined in the same translation unit (6.7.4). |
| ||||||||
68
| Two pointer types that are required to be compatible are not identically qualified, or are not pointers to compatible types (6.7.5.1). |
...
| ||||||||
69
| The size expression in an array declaration is not a constant expression and evaluates at program execution time to a nonpositive value (6.7.5.2). |
| ||||||
70
| In a context requiring two array types to be compatible, they do not have compatible element types, or their size specifiers evaluate to unequal values (6.7.5.2). |
...
|
<ac:structured-macro |
...
ac:name=" |
...
unmigrated-wiki-markup" |
...
ac:schema-version="1" |
...
ac:macro-id=" |
...
67665791- |
...
6aa3- |
...
4725- |
...
822d- |
...
82ff338ce2ce"><ac: |
...
plain-text-body><![CDATA[ | 71
| A declaration of an array parameter includes the keyword static within the [ and ] and the corresponding argument does not provide access to the first element of an array with at least the specified number of elements (6.7.5.3). |
| ]]></ac:plain-text-body></ac:structured-macro> | ||||||
72
| A storage-class specifier or type qualifier modifies the keyword void as a function parameter type list (6.7.5.3). |
| ||||||||
73
| In a context requiring two function types to be compatible, they do not have compatible return types, or their parameters disagree in use of the ellipsis terminator or the number and type of parameters (after default argument promotion, when there is no parameter type list or when one type is specified by a function definition with an identifier list) (6.7.5.3). |
| ||||||||
74
| The value of an unnamed member of a structure or union is used (6.7.8). |
| ||||||||
75
| The initializer for a scalar is neither a single expression nor a single expression enclosed in braces (6.7.8). |
| ||||||||
76
| The initializer for a structure or union object that has automatic storage duration is neither an initializer list nor a single expression that has compatible structure or union type (6.7.8). |
| ||||||||
77
| The initializer for an aggregate or union, other than an array initialized by a string literal, is not a brace-enclosed list of initializers for its elements or members (6.7.8). |
| ||||||||
78
| An identifier with external linkage is used, but in the program there does not exist exactly one external definition for the identifier, or the identifier is not used and there exist multiple external definitions for the identifier (6.9). |
| ||||||||
79
| A function definition includes an identifier list, but the types of the parameters are not declared in a following declaration list (6.9.1). |
| ||||||||
80
| An adjusted parameter type in a function definition is not an object type (6.9.1). |
| ||||||||
81
| A function that accepts a variable number of arguments is defined without a parameter type list that ends with the ellipsis notation (6.9.1). |
| ||||||||
82
| The |
| ||||||||
83
| An identifier for an object with internal linkage and an incomplete type is declared with a tentative definition (6.9.2). |
| ||||||||
84
| The token defined is generated during the expansion of a |
| ||||||||
85
| The |
| ||||||||
86
| The character sequence in an |
| ||||||||
87
| There are sequences of preprocessing tokens within the list of macro arguments that would otherwise act as preprocessing directives (6.10.3). |
| ||||||||
88
| The result of the preprocessing operator |
| ||||||||
89
| The result of the preprocessing operator |
| ||||||||
90
| The |
| ||||||||
91
| A non-STDC |
| ||||||||
92
| A |
| ||||||||
93
| The name of a predefined macro, or the identifier defined, is the subject of a |
| ||||||||
94
| |
| ||||||||
95
| An attempt is made to copy an object to an overlapping object by use of a library function, other than as explicitly allowed (e.g., |
| ||||||||
96
| A file with the same name as one of the standard headers, not provided as part of the implementation, is placed in any of the standard places that are searched for included source files (7.1.2). |
| ||||||||
97
| A header is included within an external declaration or definition (7.1.2). |
| ||||||||
98
| A function, object, type, or macro that is specified as being declared or defined by some standard header is used before any header that declares or defines it is included (7.1.2). |
| ||||||||
99
| A standard header is included while a macro is defined with the same name as a keyword (7.1.2). |
| ||||||||
100
| The program attempts to declare a library function itself, rather than via a standard header, but the declaration does not have external linkage (7.1.2). |
| ||||||||
101
| The program declares or defines a reserved identifier, other than as allowed by 7.1.4 (7.1.3). | |||||||||
102
| The program removes the definition of a macro whose name begins with an underscore and either an uppercase letter or another underscore (7.1.3). |
| ||||||||
103
| An argument to a library function has an invalid value or a type not expected by a function with variable number of arguments (7.1.4). |
| ||||||||
104
| The pointer passed to a library function array parameter does not have a value such that all address computations and object accesses are valid (7.1.4). |
| ||||||||
105
| The macro definition of |
| ||||||||
106
| The argument to the |
| ||||||||
107
| The |
| ||||||||
108
| The value of an argument to a character handling function is neither equal to the value of |
| ||||||||
109
| A macro definition of errno is suppressed in order to access an actual object, or the program defines an identifier with the name errno (7.5). |
| ||||||||
110
| Part of the program tests floating-point status flags, sets floating-point control modes, or runs under non-default mode settings, but was translated with the state for the FENV_ACCESS pragma ââoffââ (7.6.1). |
| ||||||||
111
| The exception-mask argument for one of the functions that provide access to the floating-point status flags has a nonzero value not obtained by bitwise OR of the floating-point exception macros (7.6.2). |
| ||||||||
112
| The fesetexceptflag function is used to set floating-point status flags that were not specified in the call to the fegetexceptflag function that provided the value of the corresponding fexcept_t object (7.6.2.4). |
| ||||||||
113
| The argument to fesetenv or feupdateenv is neither an object set by a call to fegetenv or feholdexcept, nor is it an environment macro (7.6.4.3, 7.6.4.4). |
| ||||||||
114
| The value of the result of an integer arithmetic or conversion function cannot be represented (7.8.2.1, 7.8.2.2, 7.8.2.3, 7.8.2.4, 7.20.6.1, 7.20.6.2, 7.20.1). |
| ||||||||
115
| The program modifies the string pointed to by the value returned by the |
| ||||||||
116
| The program modifies the structure pointed to by the value returned by the |
| ||||||||
117
| A macro definition of math_errhandling is suppressed or the program defines an identifier with the name math_errhandling (7.12). |
| ||||||||
118
| An argument to a floating-point classification or comparison macro is not of real floating type (7.12.3, 7.12.14). |
| ||||||||
119
| A macro definition of |
| ||||||||
120
| An inv ocation of the |
| ||||||||
121
| The |
| ||||||||
122
| After a |
| ||||||||
123
| The program specifies an invalid pointer to a signal handler function (7.14.1.1). |
| ||||||||
124
| A signal handler returns when the signal corresponded to a computational exception (7.14.1.1). |
| ||||||||
125
| A signal occurs as the result of calling the |
| ||||||||
126
| A signal occurs other than as the result of calling the |
| ||||||||
127
| The value of errno is referred to after a signal occurred other than as the result of calling the |
| ||||||||
128
| A signal is generated by an asynchronous signal handler (7.14.1.1). |
| ||||||||
129
| A function with a variable number of arguments attempts to access its varying arguments other than through a properly declared and initialized |
| ||||||||
130
| The macro va_arg is invoked using the parameter ap that was passed to a function that invoked the macro va_arg with the same parameter (7.15). |
| ||||||||
131
| A macro definition of |
| ||||||||
132
| The |
| ||||||||
133
| The type parameter to the va_arg macro is not such that a pointer to an object of that type can be obtained simply by postfixing a * (7.15.1.1). |
| ||||||||
134
| The va_arg macro is invoked when there is no actual next argument, or with a specified type that is not compatible with the promoted type of the actual next argument, with certain exceptions (7.15.1.1). |
| ||||||||
135
| The |
| ||||||||
136
| The parameter parmN of a |
| ||||||||
137
| The member designator parameter of an offsetof macro is an invalid right operand of the |
| ||||||||
138
| The argument in an instance of one of the integer-constant macros is not a decimal, octal, or hexadecimal constant, or it has a value that exceeds the limits for the corresponding type (7.18.4). |
| ||||||||
139
| A byte input/output function is applied to a wide-oriented stream, or a wide character input/output function is applied to a byte-oriented stream (7.19.2). |
| ||||||||
140
| Use is made of any portion of a file beyond the most recent wide character written to a wide-oriented stream (7.19.2). |
| ||||||||
141
| The value of a pointer to a |
| ||||||||
142
| The stream for the |
| ||||||||
143
| The string pointed to by the mode argument in a call to the |
| ||||||||
144
| An output operation on an update stream is followed by an input operation without an intervening call to the |
| ||||||||
145
| An attempt is made to use the contents of the array that was supplied in a call to the |
| ||||||||
146
| There are insufficient arguments for the format in a call to one of the formatted input/output functions, or an argument does not have an appropriate type (7.19.6.1, 7.19.6.2, 7.24.2.1, 7.24.2.2). |
| ||||||||
147
| The format in a call to one of the formatted input/output functions or to the |
| ||||||||
148
| In a call to one of the formatted output functions, a precision appears with a conversion specifier other than those described (7.19.6.1, 7.24.2.1). |
| ||||||||
149
| A conversion specification for a formatted output function uses an asterisk to denote an argument-supplied field width or precision, but the corresponding argument is not provided (7.19.6.1, 7.24.2.1). |
| ||||||||
150
| A conversion specification for a formatted output function uses a |
| ||||||||
151
| A conversion specification for one of the formatted input/output functions uses a length modifier with a conversion specifier other than those described (7.19.6.1, 7.19.6.2, 7.24.2.1, 7.24.2.2). |
| ||||||||
152
| An s conversion specifier is encountered by one of the formatted output functions, and the argument is missing the null terminator (unless a precision is specified that does not require null termination) (7.19.6.1, 7.24.2.1). |
| ||||||||
153
| Annconversion specification for one of the formatted input/output functions includes any flags, an assignment-suppressing character, a field width, or a precision (7.19.6.1, 7.19.6.2, 7.24.2.1, 7.24.2.2). |
| ||||||||
154
| A |
| ||||||||
155
| An inv alid conversion specification is found in the format for one of the formatted input/output functions, or the |
| ||||||||
156
| The number of characters transmitted by a formatted output function is greater than |
| ||||||||
157
| The result of a conversion by one of the formatted input functions cannot be represented in the corresponding object, or the receiving object does not have an appropriate type (7.19.6.2, 7.24.2.2). |
...
|
<ac:structured-macro |
...
ac:name=" |
...
unmigrated-wiki-markup" |
...
ac:schema-version="1" |
...
ac:macro-id=" |
...
bf7267f8- |
...
d7b9- |
...
4010- |
...
aa17- |
...
b3493cdf08ca"><ac: |
...
plain-text-body><![CDATA[ | 158
| A c, s, or [ conversion specifier is encountered by one of the formatted input functions, and the array pointed to by the corresponding argument is not large enough to accept the input sequence (and a null terminator if the conversion specifier is s or [) (7.19.6.2, |
...
7.24.2.2). |
...
| ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro |
...
ac:name=" |
...
unmigrated-wiki-markup" |
...
ac:schema-version="1" |
...
ac:macro-id=" |
...
f0f3804f- |
...
b6bd- |
...
4c53- |
...
9aa3- |
...
37e729b96ac5"><ac: |
...
plain-text-body><![CDATA[ | 159
| A c, s, or [ conversion specifier with an l qualifier is encountered by one of the formatted input functions, but the input is not a valid multibyte character sequence that begins in the initial shift state (7.19.6.2, |
...
7.24.2.2). |
| ]]></ac:plain-text-body></ac:structured-macro> | ||||||
160
| The input item for a %p conversion by one of the formatted input functions is not a value converted earlier during the same program execution (7.19.6.2, 7.24.2.2). |
| ||||||
161
| The |
| ||||||
162
| The contents of the array supplied in a call to the |
| ||||||
163
| The file position indicator for a binary stream is used after a call to the |
| ||||||
164
| The file position indicator for a stream is used after an error occurred during a call to the fread or |
| ||||||
165
| A partial element read by a call to the |
| ||||||
166
| The |
| ||||||
167
| The |
...
). |
| |||||||
168
| A non-null pointer returned by a call to the calloc, malloc, or |
| ||||||
169
| The value of a pointer that refers to space deallocated by a call to the free or |
| ||||||
170
| The pointer argument to the free or |
| ||||||
171
| The value of the object allocated by the |
| ||||||
172
| The value of any bytes in a new object allocated by the |
| ||||||
173
| The program executes more than one call to the exit function (7.20.4.3). |
| ||||||
174
| During the call to a function registered with the |
| ||||||
175
| The string set up by the |
| ||||||
176
| A command is executed through the |
| ||||||
177
| A searching or sorting utility function is called with an invalid pointer argument, even if the number of elements is zero (7.20.5). |
| ||||||
178
| The comparison function called by a searching or sorting utility function alters the contents of the array being searched or sorted, or returns ordering values inconsistently (7.20.5). |
| ||||||
179
| The array being searched by the |
| ||||||
180
| The current conversion state is used by a multibyte/wide character conversion function after changing the |
| ||||||
181
| A string or wide string utility function is instructed to access an array beyond the end of an object (7.21.1, 7.24.4). |
| ||||||
182
| A string or wide string utility function is called with an invalid pointer argument, even if the length is zero (7.21.1, 7.24.4). |
| ||||||
183
| The contents of the destination array are used after a call to the |
| ||||||
184
| The first argument in the very first call to the |
| ||||||
185
| The type of an argument to a type-generic macro is not compatible with the type of the corresponding parameter of the selected function (7.22). |
| ||||||
186
| A complex argument is supplied for a generic parameter of a type-generic macro that has no corresponding complex function (7.22). |
| ||||||
187
| The argument corresponding to an s specifier without an l qualifier in a call to the |
| ||||||
188
| In a call to the |
| ||||||
189
| An |
| ||||||
190
| The value of an argument of type |
| ||||||
191
| The |
| ||||||
192
| The |
|