Everything
4.1.2 Undefined Behavior

This section describes behavior that is not defined by the ANSI standard.

(1)

Character set

A message is output if a source file contains a character not specified by the character set.

(2)

Lexical elements

A message is output if there is a single or double quotation mark ("/") in the last category (a delimiter or a single non-whitespace character that does not lexically match another preprocessing lexical type).

(3)

Identifiers

Since all identifier characters have meaning, there are no meaningless characters.

(4)

Identifier binding

A message is output if both internal and external binding was performed on the same identifier within a translation unit.

(5)

Compatible type and composite type

All declarations referencing the same object or function must be compatible. Otherwise, a message will be output.

(6)

Character constants

Specific non-graphical characters can be expressed by means of extended notation, consisting of a backslash (\) followed by a lower-case letter. The following are available: \a, \b, \f, \n, \r, \t, and \v. There is no other extended notation; other letters following a backslash (\) become that letter.

(7)

String literals - concatenation

When a simple string literal is adjacent to a wide string literal token, simple string concatenation is performed.

(8)

String literals - modification

Users modify string literals at their own risk. Although the string will be changed if it is allocated to RAM, it will not be changed if it is allocated to ROM.

(9)

Header names

If the following characters appear in strings between the delimiter characters < and >, or between two double quotation marks ("), then they are treated as part of the file name: characters, comma (,), double quote ("), two slashes (//), or slash-asterisk (/*). The backslash (\) is treated as a folder separator.

(10)

Floating point type and integral type

If a floating-point type is converted into an integral type, and the integer portion cannot be expressed as an integral type, then the value is truncated until it can.

(11)

lvalues and function specifiers

A message is output if an incomplete type becomes an lvalue.

(12)

Function calls - number of arguments

If there are too few arguments, then the values of the formal parameters will be undefined. If there are too many arguments, then the excess arguments will be ignored when the function is executed, and will have no effect.

A message will be output if there is a function declaration before the function call.

(13)

Function calls - types of extended parameters

If a function is defined without a function prototype, and the types of the extended arguments do not match the types of the extended formal parameters, then the values of the formal parameters will be undefined.

(14)

Function calls - incompatible types

If a function is defined with a type that is not compatible with the type specified by the expression indicating the called function, then the return value of the function will be invalid.

(15)

Function declarations - incompatible types

If a function is defined in a form that includes a function prototype, and the type of an extended argument is not compatible with that of a formal parameter, or if the function prototype ends with an ellipsis, then it will be interpreted as the type of the formal parameter.

(16)

Addresses and indirection operators

If an incorrect value is assigned to a pointer, then the behavior of the unary * operator will either obtain an undefined value or result in an illegal access, depending on the hardware design and the contents of the incorrect value.

(17)

Cast operator - function pointer casts

If a typecast pointer is used to call a function with other than the original type, then it is possible to call the function. If the parameters or return value are not compatible, then it will be invalid.

(18)

Cast operator - integral type casts

If a pointer is cast into an integral type, and the amount of storage is too small, then the storage of the cast type will be truncated.

(19)

Multiplicative operators

A message will be output if a divide by zero is detected during compilation.

During execution, a divide by zero will raise an exception. If an error-handling routine has been coded, it will be handled by this routine.

(20)

Additive operators - non-array pointers

If addition or subtraction is performed on a pointer that does other than indicate elements in an array object, the behavior will be as if the pointer indicates an array element.

(21)

Additive operators - subtracting a pointer from another array

If subtraction is performed using two pointers that do not indicate elements in the same array object, the behavior will be as if the pointers indicate array elements.

(22)

Bitwise shift operators

If the value of the right operand is negative, or greater than the bit width of the extended left operand, then the result will be the shifted value of the right operand, masked by the bit width of the left operand.

(23)

Relational operators - pointers

If the objects pointed to by the pointers being compared are not members of the same structure or union object, then the relational operation will be performed as if it were for pointers pointing to members of the same structure or union object.

(24)

Simple assignment

If a value stored in an object is accessed via another object that overlaps that object's storage area in some way, then the overlapping portion must match exactly. Furthermore, the types of the two objects must have modified or non-modified versions with compatible types. Assignment to non-matching overlapping storage could cause the value of the assignment source to become corrupted.

(25)

Structure and union specifiers

If the member declaration list does not include named members, then a message will be output warning that the list has no effect. Note, however, that the same message will be output accompanied by an error if the -Xansi option is specified.

(26)

Type modifiers - const

A message will be output if an attempt is made to modify an object defined with a const modifier, using an lvalue that is the non-const modified version. Casting is also prohibited.

(27)

Type modifiers - volatile

A message will be output if an attempt is made to modify an object defined with a volatile modifier, using an lvalue that is the non-volatile modified version.

(28)

return statements

A message will be output if a return statement without an expression is executed, and the caller uses the return value of the function, and there is a declaration. If there is no declaration, then the return value of the function will be undefined.

(29)

Function definitions

If a function taking a variable number of arguments is defined without a parameter type list that ends with an ellipsis, then the values of the formal parameters will be undefined.

(30)

Conditional inclusion

If a replacement operation generates a "defined" token, or if the usage of the "defined" unary operator before macro replacement does not match one of the two formats specified in the constraints, then it will be handled as an ordinary "defined".

(31)

Macro replacement - arguments not containing preprocessing tokens

A message is output if the arguments (before argument replacement) do not contain preprocessing tokens.

(32)

Macro replacement - arguments with preprocessing directives

A message is output if an argument list contains a preprocessor token stream that would function as a processing directive in another circumstance.

(33)

# operator

A message is output if the results of replacement are not a correct simple string literal.

(34)

## operator

A message is output if the results of replacement are not a correct simple string literal.