xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/doc/implement-c.texi (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
1*8feb0f0bSmrg@c Copyright (C) 2001-2020 Free Software Foundation, Inc.
21debfc3dSmrg@c This is part of the GCC manual.
31debfc3dSmrg@c For copying conditions, see the file gcc.texi.
41debfc3dSmrg
51debfc3dSmrg@node C Implementation
61debfc3dSmrg@chapter C Implementation-Defined Behavior
71debfc3dSmrg@cindex implementation-defined behavior, C language
81debfc3dSmrg
91debfc3dSmrgA conforming implementation of ISO C is required to document its
101debfc3dSmrgchoice of behavior in each of the areas that are designated
111debfc3dSmrg``implementation defined''.  The following lists all such areas,
121debfc3dSmrgalong with the section numbers from the ISO/IEC 9899:1990, ISO/IEC
131debfc3dSmrg9899:1999 and ISO/IEC 9899:2011 standards.  Some areas are only
141debfc3dSmrgimplementation-defined in one version of the standard.
151debfc3dSmrg
161debfc3dSmrgSome choices depend on the externally determined ABI for the platform
171debfc3dSmrg(including standard character encodings) which GCC follows; these are
181debfc3dSmrglisted as ``determined by ABI'' below.  @xref{Compatibility, , Binary
191debfc3dSmrgCompatibility}, and @uref{http://gcc.gnu.org/readings.html}.  Some
201debfc3dSmrgchoices are documented in the preprocessor manual.
211debfc3dSmrg@xref{Implementation-defined behavior, , Implementation-defined
221debfc3dSmrgbehavior, cpp, The C Preprocessor}.  Some choices are made by the
231debfc3dSmrglibrary and operating system (or other environment when compiling for
241debfc3dSmrga freestanding environment); refer to their documentation for details.
251debfc3dSmrg
261debfc3dSmrg@menu
271debfc3dSmrg* Translation implementation::
281debfc3dSmrg* Environment implementation::
291debfc3dSmrg* Identifiers implementation::
301debfc3dSmrg* Characters implementation::
311debfc3dSmrg* Integers implementation::
321debfc3dSmrg* Floating point implementation::
331debfc3dSmrg* Arrays and pointers implementation::
341debfc3dSmrg* Hints implementation::
351debfc3dSmrg* Structures unions enumerations and bit-fields implementation::
361debfc3dSmrg* Qualifiers implementation::
371debfc3dSmrg* Declarators implementation::
381debfc3dSmrg* Statements implementation::
391debfc3dSmrg* Preprocessing directives implementation::
401debfc3dSmrg* Library functions implementation::
411debfc3dSmrg* Architecture implementation::
421debfc3dSmrg* Locale-specific behavior implementation::
431debfc3dSmrg@end menu
441debfc3dSmrg
451debfc3dSmrg@node Translation implementation
461debfc3dSmrg@section Translation
471debfc3dSmrg
481debfc3dSmrg@itemize @bullet
491debfc3dSmrg@item
501debfc3dSmrg@cite{How a diagnostic is identified (C90 3.7, C99 and C11 3.10, C90,
511debfc3dSmrgC99 and C11 5.1.1.3).}
521debfc3dSmrg
531debfc3dSmrgDiagnostics consist of all the output sent to stderr by GCC@.
541debfc3dSmrg
551debfc3dSmrg@item
561debfc3dSmrg@cite{Whether each nonempty sequence of white-space characters other than
571debfc3dSmrgnew-line is retained or replaced by one space character in translation
581debfc3dSmrgphase 3 (C90, C99 and C11 5.1.1.2).}
591debfc3dSmrg
601debfc3dSmrg@xref{Implementation-defined behavior, , Implementation-defined
611debfc3dSmrgbehavior, cpp, The C Preprocessor}.
621debfc3dSmrg
631debfc3dSmrg@end itemize
641debfc3dSmrg
651debfc3dSmrg@node Environment implementation
661debfc3dSmrg@section Environment
671debfc3dSmrg
681debfc3dSmrgThe behavior of most of these points are dependent on the implementation
691debfc3dSmrgof the C library, and are not defined by GCC itself.
701debfc3dSmrg
711debfc3dSmrg@itemize @bullet
721debfc3dSmrg@item
731debfc3dSmrg@cite{The mapping between physical source file multibyte characters
741debfc3dSmrgand the source character set in translation phase 1 (C90, C99 and C11
751debfc3dSmrg5.1.1.2).}
761debfc3dSmrg
771debfc3dSmrg@xref{Implementation-defined behavior, , Implementation-defined
781debfc3dSmrgbehavior, cpp, The C Preprocessor}.
791debfc3dSmrg
801debfc3dSmrg@end itemize
811debfc3dSmrg
821debfc3dSmrg@node Identifiers implementation
831debfc3dSmrg@section Identifiers
841debfc3dSmrg
851debfc3dSmrg@itemize @bullet
861debfc3dSmrg@item
871debfc3dSmrg@cite{Which additional multibyte characters may appear in identifiers
881debfc3dSmrgand their correspondence to universal character names (C99 and C11 6.4.2).}
891debfc3dSmrg
901debfc3dSmrg@xref{Implementation-defined behavior, , Implementation-defined
911debfc3dSmrgbehavior, cpp, The C Preprocessor}.
921debfc3dSmrg
931debfc3dSmrg@item
941debfc3dSmrg@cite{The number of significant initial characters in an identifier
951debfc3dSmrg(C90 6.1.2, C90, C99 and C11 5.2.4.1, C99 and C11 6.4.2).}
961debfc3dSmrg
971debfc3dSmrgFor internal names, all characters are significant.  For external names,
981debfc3dSmrgthe number of significant characters are defined by the linker; for
991debfc3dSmrgalmost all targets, all characters are significant.
1001debfc3dSmrg
1011debfc3dSmrg@item
1021debfc3dSmrg@cite{Whether case distinctions are significant in an identifier with
1031debfc3dSmrgexternal linkage (C90 6.1.2).}
1041debfc3dSmrg
1051debfc3dSmrgThis is a property of the linker.  C99 and C11 require that case distinctions
1061debfc3dSmrgare always significant in identifiers with external linkage and
1071debfc3dSmrgsystems without this property are not supported by GCC@.
1081debfc3dSmrg
1091debfc3dSmrg@end itemize
1101debfc3dSmrg
1111debfc3dSmrg@node Characters implementation
1121debfc3dSmrg@section Characters
1131debfc3dSmrg
1141debfc3dSmrg@itemize @bullet
1151debfc3dSmrg@item
1161debfc3dSmrg@cite{The number of bits in a byte (C90 3.4, C99 and C11 3.6).}
1171debfc3dSmrg
1181debfc3dSmrgDetermined by ABI@.
1191debfc3dSmrg
1201debfc3dSmrg@item
1211debfc3dSmrg@cite{The values of the members of the execution character set (C90,
1221debfc3dSmrgC99 and C11 5.2.1).}
1231debfc3dSmrg
1241debfc3dSmrgDetermined by ABI@.
1251debfc3dSmrg
1261debfc3dSmrg@item
1271debfc3dSmrg@cite{The unique value of the member of the execution character set produced
1281debfc3dSmrgfor each of the standard alphabetic escape sequences (C90, C99 and C11
1291debfc3dSmrg5.2.2).}
1301debfc3dSmrg
1311debfc3dSmrgDetermined by ABI@.
1321debfc3dSmrg
1331debfc3dSmrg@item
1341debfc3dSmrg@cite{The value of a @code{char} object into which has been stored any
1351debfc3dSmrgcharacter other than a member of the basic execution character set
1361debfc3dSmrg(C90 6.1.2.5, C99 and C11 6.2.5).}
1371debfc3dSmrg
1381debfc3dSmrgDetermined by ABI@.
1391debfc3dSmrg
1401debfc3dSmrg@item
1411debfc3dSmrg@cite{Which of @code{signed char} or @code{unsigned char} has the same
1421debfc3dSmrgrange, representation, and behavior as ``plain'' @code{char} (C90
1431debfc3dSmrg6.1.2.5, C90 6.2.1.1, C99 and C11 6.2.5, C99 and C11 6.3.1.1).}
1441debfc3dSmrg
1451debfc3dSmrg@opindex fsigned-char
1461debfc3dSmrg@opindex funsigned-char
1471debfc3dSmrgDetermined by ABI@.  The options @option{-funsigned-char} and
1481debfc3dSmrg@option{-fsigned-char} change the default.  @xref{C Dialect Options, ,
1491debfc3dSmrgOptions Controlling C Dialect}.
1501debfc3dSmrg
1511debfc3dSmrg@item
1521debfc3dSmrg@cite{The mapping of members of the source character set (in character
1531debfc3dSmrgconstants and string literals) to members of the execution character
1541debfc3dSmrgset (C90 6.1.3.4, C99 and C11 6.4.4.4, C90, C99 and C11 5.1.1.2).}
1551debfc3dSmrg
1561debfc3dSmrgDetermined by ABI@.
1571debfc3dSmrg
1581debfc3dSmrg@item
1591debfc3dSmrg@cite{The value of an integer character constant containing more than one
1601debfc3dSmrgcharacter or containing a character or escape sequence that does not map
1611debfc3dSmrgto a single-byte execution character (C90 6.1.3.4, C99 and C11 6.4.4.4).}
1621debfc3dSmrg
1631debfc3dSmrg@xref{Implementation-defined behavior, , Implementation-defined
1641debfc3dSmrgbehavior, cpp, The C Preprocessor}.
1651debfc3dSmrg
1661debfc3dSmrg@item
1671debfc3dSmrg@cite{The value of a wide character constant containing more than one
1681debfc3dSmrgmultibyte character or a single multibyte character that maps to
1691debfc3dSmrgmultiple members of the extended execution character set, or
1701debfc3dSmrgcontaining a multibyte character or escape sequence not represented in
1711debfc3dSmrgthe extended execution character set (C90 6.1.3.4, C99 and C11
1721debfc3dSmrg6.4.4.4).}
1731debfc3dSmrg
1741debfc3dSmrg@xref{Implementation-defined behavior, , Implementation-defined
1751debfc3dSmrgbehavior, cpp, The C Preprocessor}.
1761debfc3dSmrg
1771debfc3dSmrg@item
1781debfc3dSmrg@cite{The current locale used to convert a wide character constant consisting
1791debfc3dSmrgof a single multibyte character that maps to a member of the extended
1801debfc3dSmrgexecution character set into a corresponding wide character code (C90
1811debfc3dSmrg6.1.3.4, C99 and C11 6.4.4.4).}
1821debfc3dSmrg
1831debfc3dSmrg@xref{Implementation-defined behavior, , Implementation-defined
1841debfc3dSmrgbehavior, cpp, The C Preprocessor}.
1851debfc3dSmrg
1861debfc3dSmrg@item
1871debfc3dSmrg@cite{Whether differently-prefixed wide string literal tokens can be
1881debfc3dSmrgconcatenated and, if so, the treatment of the resulting multibyte
1891debfc3dSmrgcharacter sequence (C11 6.4.5).}
1901debfc3dSmrg
1911debfc3dSmrgSuch tokens may not be concatenated.
1921debfc3dSmrg
1931debfc3dSmrg@item
1941debfc3dSmrg@cite{The current locale used to convert a wide string literal into
1951debfc3dSmrgcorresponding wide character codes (C90 6.1.4, C99 and C11 6.4.5).}
1961debfc3dSmrg
1971debfc3dSmrg@xref{Implementation-defined behavior, , Implementation-defined
1981debfc3dSmrgbehavior, cpp, The C Preprocessor}.
1991debfc3dSmrg
2001debfc3dSmrg@item
2011debfc3dSmrg@cite{The value of a string literal containing a multibyte character or escape
2021debfc3dSmrgsequence not represented in the execution character set (C90 6.1.4,
2031debfc3dSmrgC99 and C11 6.4.5).}
2041debfc3dSmrg
2051debfc3dSmrg@xref{Implementation-defined behavior, , Implementation-defined
2061debfc3dSmrgbehavior, cpp, The C Preprocessor}.
2071debfc3dSmrg
2081debfc3dSmrg@item
2091debfc3dSmrg@cite{The encoding of any of @code{wchar_t}, @code{char16_t}, and
2101debfc3dSmrg@code{char32_t} where the corresponding standard encoding macro
2111debfc3dSmrg(@code{__STDC_ISO_10646__}, @code{__STDC_UTF_16__}, or
2121debfc3dSmrg@code{__STDC_UTF_32__}) is not defined (C11 6.10.8.2).}
2131debfc3dSmrg
2141debfc3dSmrg@xref{Implementation-defined behavior, , Implementation-defined
2151debfc3dSmrgbehavior, cpp, The C Preprocessor}.  @code{char16_t} and
2161debfc3dSmrg@code{char32_t} literals are always encoded in UTF-16 and UTF-32
2171debfc3dSmrgrespectively.
2181debfc3dSmrg
2191debfc3dSmrg@end itemize
2201debfc3dSmrg
2211debfc3dSmrg@node Integers implementation
2221debfc3dSmrg@section Integers
2231debfc3dSmrg
2241debfc3dSmrg@itemize @bullet
2251debfc3dSmrg@item
2261debfc3dSmrg@cite{Any extended integer types that exist in the implementation (C99
2271debfc3dSmrgand C11 6.2.5).}
2281debfc3dSmrg
2291debfc3dSmrgGCC does not support any extended integer types.
2301debfc3dSmrg@c The __mode__ attribute might create types of precisions not
2311debfc3dSmrg@c otherwise supported, but the syntax isn't right for use everywhere
2321debfc3dSmrg@c the standard type names might be used.  Predefined typedefs should
2331debfc3dSmrg@c be used if any extended integer types are to be defined.  The
2341debfc3dSmrg@c __int128_t and __uint128_t typedefs are not extended integer types
2351debfc3dSmrg@c as they are generally longer than the ABI-specified intmax_t.
2361debfc3dSmrg
2371debfc3dSmrg@item
2381debfc3dSmrg@cite{Whether signed integer types are represented using sign and magnitude,
2391debfc3dSmrgtwo's complement, or one's complement, and whether the extraordinary value
2401debfc3dSmrgis a trap representation or an ordinary value (C99 and C11 6.2.6.2).}
2411debfc3dSmrg
2421debfc3dSmrgGCC supports only two's complement integer types, and all bit patterns
2431debfc3dSmrgare ordinary values.
2441debfc3dSmrg
2451debfc3dSmrg@item
2461debfc3dSmrg@cite{The rank of any extended integer type relative to another extended
2471debfc3dSmrginteger type with the same precision (C99 and C11 6.3.1.1).}
2481debfc3dSmrg
2491debfc3dSmrgGCC does not support any extended integer types.
2501debfc3dSmrg@c If it did, there would only be one of each precision and signedness.
2511debfc3dSmrg
2521debfc3dSmrg@item
2531debfc3dSmrg@cite{The result of, or the signal raised by, converting an integer to a
2541debfc3dSmrgsigned integer type when the value cannot be represented in an object of
2551debfc3dSmrgthat type (C90 6.2.1.2, C99 and C11 6.3.1.3).}
2561debfc3dSmrg
2571debfc3dSmrgFor conversion to a type of width @math{N}, the value is reduced
2581debfc3dSmrgmodulo @math{2^N} to be within range of the type; no signal is raised.
2591debfc3dSmrg
2601debfc3dSmrg@item
2611debfc3dSmrg@cite{The results of some bitwise operations on signed integers (C90
2621debfc3dSmrg6.3, C99 and C11 6.5).}
2631debfc3dSmrg
2641debfc3dSmrgBitwise operators act on the representation of the value including
2651debfc3dSmrgboth the sign and value bits, where the sign bit is considered
2661debfc3dSmrgimmediately above the highest-value value bit.  Signed @samp{>>} acts
2671debfc3dSmrgon negative numbers by sign extension.
2681debfc3dSmrg
2691debfc3dSmrgAs an extension to the C language, GCC does not use the latitude given in
2701debfc3dSmrgC99 and C11 only to treat certain aspects of signed @samp{<<} as undefined.
2711debfc3dSmrgHowever, @option{-fsanitize=shift} (and @option{-fsanitize=undefined}) will
2721debfc3dSmrgdiagnose such cases.  They are also diagnosed where constant
2731debfc3dSmrgexpressions are required.
2741debfc3dSmrg
2751debfc3dSmrg@item
2761debfc3dSmrg@cite{The sign of the remainder on integer division (C90 6.3.5).}
2771debfc3dSmrg
2781debfc3dSmrgGCC always follows the C99 and C11 requirement that the result of division is
2791debfc3dSmrgtruncated towards zero.
2801debfc3dSmrg
2811debfc3dSmrg@end itemize
2821debfc3dSmrg
2831debfc3dSmrg@node Floating point implementation
2841debfc3dSmrg@section Floating Point
2851debfc3dSmrg
2861debfc3dSmrg@itemize @bullet
2871debfc3dSmrg@item
2881debfc3dSmrg@cite{The accuracy of the floating-point operations and of the library
2891debfc3dSmrgfunctions in @code{<math.h>} and @code{<complex.h>} that return floating-point
2901debfc3dSmrgresults (C90, C99 and C11 5.2.4.2.2).}
2911debfc3dSmrg
2921debfc3dSmrgThe accuracy is unknown.
2931debfc3dSmrg
2941debfc3dSmrg@item
2951debfc3dSmrg@cite{The rounding behaviors characterized by non-standard values
2961debfc3dSmrgof @code{FLT_ROUNDS} @gol
2971debfc3dSmrg(C90, C99 and C11 5.2.4.2.2).}
2981debfc3dSmrg
2991debfc3dSmrgGCC does not use such values.
3001debfc3dSmrg
3011debfc3dSmrg@item
3021debfc3dSmrg@cite{The evaluation methods characterized by non-standard negative
3031debfc3dSmrgvalues of @code{FLT_EVAL_METHOD} (C99 and C11 5.2.4.2.2).}
3041debfc3dSmrg
3051debfc3dSmrgGCC does not use such values.
3061debfc3dSmrg
3071debfc3dSmrg@item
3081debfc3dSmrg@cite{The direction of rounding when an integer is converted to a
3091debfc3dSmrgfloating-point number that cannot exactly represent the original
3101debfc3dSmrgvalue (C90 6.2.1.3, C99 and C11 6.3.1.4).}
3111debfc3dSmrg
3121debfc3dSmrgC99 Annex F is followed.
3131debfc3dSmrg
3141debfc3dSmrg@item
3151debfc3dSmrg@cite{The direction of rounding when a floating-point number is
3161debfc3dSmrgconverted to a narrower floating-point number (C90 6.2.1.4, C99 and C11
3171debfc3dSmrg6.3.1.5).}
3181debfc3dSmrg
3191debfc3dSmrgC99 Annex F is followed.
3201debfc3dSmrg
3211debfc3dSmrg@item
3221debfc3dSmrg@cite{How the nearest representable value or the larger or smaller
3231debfc3dSmrgrepresentable value immediately adjacent to the nearest representable
3241debfc3dSmrgvalue is chosen for certain floating constants (C90 6.1.3.1, C99 and C11
3251debfc3dSmrg6.4.4.2).}
3261debfc3dSmrg
3271debfc3dSmrgC99 Annex F is followed.
3281debfc3dSmrg
3291debfc3dSmrg@item
3301debfc3dSmrg@cite{Whether and how floating expressions are contracted when not
3311debfc3dSmrgdisallowed by the @code{FP_CONTRACT} pragma (C99 and C11 6.5).}
3321debfc3dSmrg
3331debfc3dSmrgExpressions are currently only contracted if @option{-ffp-contract=fast},
3341debfc3dSmrg@option{-funsafe-math-optimizations} or @option{-ffast-math} are used.
3351debfc3dSmrgThis is subject to change.
3361debfc3dSmrg
3371debfc3dSmrg@item
3381debfc3dSmrg@cite{The default state for the @code{FENV_ACCESS} pragma (C99 and C11
3391debfc3dSmrg7.6.1).}
3401debfc3dSmrg
3411debfc3dSmrgThis pragma is not implemented, but the default is to ``off'' unless
3421debfc3dSmrg@option{-frounding-math} is used in which case it is ``on''.
3431debfc3dSmrg
3441debfc3dSmrg@item
3451debfc3dSmrg@cite{Additional floating-point exceptions, rounding modes, environments,
3461debfc3dSmrgand classifications, and their macro names (C99 and C11 7.6, C99 and
3471debfc3dSmrgC11 7.12).}
3481debfc3dSmrg
3491debfc3dSmrgThis is dependent on the implementation of the C library, and is not
3501debfc3dSmrgdefined by GCC itself.
3511debfc3dSmrg
3521debfc3dSmrg@item
3531debfc3dSmrg@cite{The default state for the @code{FP_CONTRACT} pragma (C99 and C11
3541debfc3dSmrg7.12.2).}
3551debfc3dSmrg
3561debfc3dSmrgThis pragma is not implemented.  Expressions are currently only
3571debfc3dSmrgcontracted if @option{-ffp-contract=fast},
3581debfc3dSmrg@option{-funsafe-math-optimizations} or @option{-ffast-math} are used.
3591debfc3dSmrgThis is subject to change.
3601debfc3dSmrg
3611debfc3dSmrg@item
3621debfc3dSmrg@cite{Whether the ``inexact'' floating-point exception can be raised
3631debfc3dSmrgwhen the rounded result actually does equal the mathematical result
3641debfc3dSmrgin an IEC 60559 conformant implementation (C99 F.9).}
3651debfc3dSmrg
3661debfc3dSmrgThis is dependent on the implementation of the C library, and is not
3671debfc3dSmrgdefined by GCC itself.
3681debfc3dSmrg
3691debfc3dSmrg@item
3701debfc3dSmrg@cite{Whether the ``underflow'' (and ``inexact'') floating-point
3711debfc3dSmrgexception can be raised when a result is tiny but not inexact in an
3721debfc3dSmrgIEC 60559 conformant implementation (C99 F.9).}
3731debfc3dSmrg
3741debfc3dSmrgThis is dependent on the implementation of the C library, and is not
3751debfc3dSmrgdefined by GCC itself.
3761debfc3dSmrg
3771debfc3dSmrg@end itemize
3781debfc3dSmrg
3791debfc3dSmrg@node Arrays and pointers implementation
3801debfc3dSmrg@section Arrays and Pointers
3811debfc3dSmrg
3821debfc3dSmrg@itemize @bullet
3831debfc3dSmrg@item
3841debfc3dSmrg@cite{The result of converting a pointer to an integer or
3851debfc3dSmrgvice versa (C90 6.3.4, C99 and C11 6.3.2.3).}
3861debfc3dSmrg
3871debfc3dSmrgA cast from pointer to integer discards most-significant bits if the
3881debfc3dSmrgpointer representation is larger than the integer type,
3891debfc3dSmrgsign-extends@footnote{Future versions of GCC may zero-extend, or use
3901debfc3dSmrga target-defined @code{ptr_extend} pattern.  Do not rely on sign extension.}
3911debfc3dSmrgif the pointer representation is smaller than the integer type, otherwise
3921debfc3dSmrgthe bits are unchanged.
3931debfc3dSmrg@c ??? We've always claimed that pointers were unsigned entities.
3941debfc3dSmrg@c Shouldn't we therefore be doing zero-extension?  If so, the bug
3951debfc3dSmrg@c is in convert_to_integer, where we call type_for_size and request
3961debfc3dSmrg@c a signed integral type.  On the other hand, it might be most useful
3971debfc3dSmrg@c for the target if we extend according to POINTERS_EXTEND_UNSIGNED.
3981debfc3dSmrg
3991debfc3dSmrgA cast from integer to pointer discards most-significant bits if the
4001debfc3dSmrgpointer representation is smaller than the integer type, extends according
4011debfc3dSmrgto the signedness of the integer type if the pointer representation
4021debfc3dSmrgis larger than the integer type, otherwise the bits are unchanged.
4031debfc3dSmrg
4041debfc3dSmrgWhen casting from pointer to integer and back again, the resulting
4051debfc3dSmrgpointer must reference the same object as the original pointer, otherwise
4061debfc3dSmrgthe behavior is undefined.  That is, one may not use integer arithmetic to
4071debfc3dSmrgavoid the undefined behavior of pointer arithmetic as proscribed in
4081debfc3dSmrgC99 and C11 6.5.6/8.
4091debfc3dSmrg
4101debfc3dSmrg@item
4111debfc3dSmrg@cite{The size of the result of subtracting two pointers to elements
4121debfc3dSmrgof the same array (C90 6.3.6, C99 and C11 6.5.6).}
4131debfc3dSmrg
4141debfc3dSmrgThe value is as specified in the standard and the type is determined
4151debfc3dSmrgby the ABI@.
4161debfc3dSmrg
4171debfc3dSmrg@end itemize
4181debfc3dSmrg
4191debfc3dSmrg@node Hints implementation
4201debfc3dSmrg@section Hints
4211debfc3dSmrg
4221debfc3dSmrg@itemize @bullet
4231debfc3dSmrg@item
4241debfc3dSmrg@cite{The extent to which suggestions made by using the @code{register}
4251debfc3dSmrgstorage-class specifier are effective (C90 6.5.1, C99 and C11 6.7.1).}
4261debfc3dSmrg
4271debfc3dSmrgThe @code{register} specifier affects code generation only in these ways:
4281debfc3dSmrg
4291debfc3dSmrg@itemize @bullet
4301debfc3dSmrg@item
4311debfc3dSmrgWhen used as part of the register variable extension, see
4321debfc3dSmrg@ref{Explicit Register Variables}.
4331debfc3dSmrg
4341debfc3dSmrg@item
4351debfc3dSmrgWhen @option{-O0} is in use, the compiler allocates distinct stack
4361debfc3dSmrgmemory for all variables that do not have the @code{register}
4371debfc3dSmrgstorage-class specifier; if @code{register} is specified, the variable
4381debfc3dSmrgmay have a shorter lifespan than the code would indicate and may never
4391debfc3dSmrgbe placed in memory.
4401debfc3dSmrg
4411debfc3dSmrg@item
4421debfc3dSmrgOn some rare x86 targets, @code{setjmp} doesn't save the registers in
4431debfc3dSmrgall circumstances.  In those cases, GCC doesn't allocate any variables
4441debfc3dSmrgin registers unless they are marked @code{register}.
4451debfc3dSmrg
4461debfc3dSmrg@end itemize
4471debfc3dSmrg
4481debfc3dSmrg@item
4491debfc3dSmrg@cite{The extent to which suggestions made by using the inline function
4501debfc3dSmrgspecifier are effective (C99 and C11 6.7.4).}
4511debfc3dSmrg
4521debfc3dSmrgGCC will not inline any functions if the @option{-fno-inline} option is
4531debfc3dSmrgused or if @option{-O0} is used.  Otherwise, GCC may still be unable to
4541debfc3dSmrginline a function for many reasons; the @option{-Winline} option may be
4551debfc3dSmrgused to determine if a function has not been inlined and why not.
4561debfc3dSmrg
4571debfc3dSmrg@end itemize
4581debfc3dSmrg
4591debfc3dSmrg@node Structures unions enumerations and bit-fields implementation
4601debfc3dSmrg@section Structures, Unions, Enumerations, and Bit-Fields
4611debfc3dSmrg
4621debfc3dSmrg@itemize @bullet
4631debfc3dSmrg@item
4641debfc3dSmrg@cite{A member of a union object is accessed using a member of a
4651debfc3dSmrgdifferent type (C90 6.3.2.3).}
4661debfc3dSmrg
4671debfc3dSmrgThe relevant bytes of the representation of the object are treated as
4681debfc3dSmrgan object of the type used for the access.  @xref{Type-punning}.  This
4691debfc3dSmrgmay be a trap representation.
4701debfc3dSmrg
4711debfc3dSmrg@item
4721debfc3dSmrg@cite{Whether a ``plain'' @code{int} bit-field is treated as a
4731debfc3dSmrg@code{signed int} bit-field or as an @code{unsigned int} bit-field
4741debfc3dSmrg(C90 6.5.2, C90 6.5.2.1, C99 and C11 6.7.2, C99 and C11 6.7.2.1).}
4751debfc3dSmrg
4761debfc3dSmrg@opindex funsigned-bitfields
4771debfc3dSmrgBy default it is treated as @code{signed int} but this may be changed
4781debfc3dSmrgby the @option{-funsigned-bitfields} option.
4791debfc3dSmrg
4801debfc3dSmrg@item
4811debfc3dSmrg@cite{Allowable bit-field types other than @code{_Bool}, @code{signed int},
4821debfc3dSmrgand @code{unsigned int} (C99 and C11 6.7.2.1).}
4831debfc3dSmrg
4841debfc3dSmrgOther integer types, such as @code{long int}, and enumerated types are
4851debfc3dSmrgpermitted even in strictly conforming mode.
4861debfc3dSmrg
4871debfc3dSmrg@item
4881debfc3dSmrg@cite{Whether atomic types are permitted for bit-fields (C11 6.7.2.1).}
4891debfc3dSmrg
4901debfc3dSmrgAtomic types are not permitted for bit-fields.
4911debfc3dSmrg
4921debfc3dSmrg@item
4931debfc3dSmrg@cite{Whether a bit-field can straddle a storage-unit boundary (C90
4941debfc3dSmrg6.5.2.1, C99 and C11 6.7.2.1).}
4951debfc3dSmrg
4961debfc3dSmrgDetermined by ABI@.
4971debfc3dSmrg
4981debfc3dSmrg@item
4991debfc3dSmrg@cite{The order of allocation of bit-fields within a unit (C90
5001debfc3dSmrg6.5.2.1, C99 and C11 6.7.2.1).}
5011debfc3dSmrg
5021debfc3dSmrgDetermined by ABI@.
5031debfc3dSmrg
5041debfc3dSmrg@item
5051debfc3dSmrg@cite{The alignment of non-bit-field members of structures (C90
5061debfc3dSmrg6.5.2.1, C99 and C11 6.7.2.1).}
5071debfc3dSmrg
5081debfc3dSmrgDetermined by ABI@.
5091debfc3dSmrg
5101debfc3dSmrg@item
5111debfc3dSmrg@cite{The integer type compatible with each enumerated type (C90
5121debfc3dSmrg6.5.2.2, C99 and C11 6.7.2.2).}
5131debfc3dSmrg
5141debfc3dSmrg@opindex fshort-enums
5151debfc3dSmrgNormally, the type is @code{unsigned int} if there are no negative
5161debfc3dSmrgvalues in the enumeration, otherwise @code{int}.  If
5171debfc3dSmrg@option{-fshort-enums} is specified, then if there are negative values
5181debfc3dSmrgit is the first of @code{signed char}, @code{short} and @code{int}
5191debfc3dSmrgthat can represent all the values, otherwise it is the first of
5201debfc3dSmrg@code{unsigned char}, @code{unsigned short} and @code{unsigned int}
5211debfc3dSmrgthat can represent all the values.
5221debfc3dSmrg@c On a few unusual targets with 64-bit int, this doesn't agree with
5231debfc3dSmrg@c the code and one of the types accessed via mode attributes (which
5241debfc3dSmrg@c are not currently considered extended integer types) may be used.
5251debfc3dSmrg@c If these types are made extended integer types, it would still be
5261debfc3dSmrg@c the case that -fshort-enums stops the implementation from
5271debfc3dSmrg@c conforming to C90 on those targets.
5281debfc3dSmrg
5291debfc3dSmrgOn some targets, @option{-fshort-enums} is the default; this is
5301debfc3dSmrgdetermined by the ABI@.
5311debfc3dSmrg
5321debfc3dSmrg@end itemize
5331debfc3dSmrg
5341debfc3dSmrg@node Qualifiers implementation
5351debfc3dSmrg@section Qualifiers
5361debfc3dSmrg
5371debfc3dSmrg@itemize @bullet
5381debfc3dSmrg@item
5391debfc3dSmrg@cite{What constitutes an access to an object that has volatile-qualified
5401debfc3dSmrgtype (C90 6.5.3, C99 and C11 6.7.3).}
5411debfc3dSmrg
5421debfc3dSmrgSuch an object is normally accessed by pointers and used for accessing
5431debfc3dSmrghardware.  In most expressions, it is intuitively obvious what is a read
5441debfc3dSmrgand what is a write.  For example
5451debfc3dSmrg
5461debfc3dSmrg@smallexample
5471debfc3dSmrgvolatile int *dst = @var{somevalue};
5481debfc3dSmrgvolatile int *src = @var{someothervalue};
5491debfc3dSmrg*dst = *src;
5501debfc3dSmrg@end smallexample
5511debfc3dSmrg
5521debfc3dSmrg@noindent
5531debfc3dSmrgwill cause a read of the volatile object pointed to by @var{src} and store the
5541debfc3dSmrgvalue into the volatile object pointed to by @var{dst}.  There is no
5551debfc3dSmrgguarantee that these reads and writes are atomic, especially for objects
5561debfc3dSmrglarger than @code{int}.
5571debfc3dSmrg
5581debfc3dSmrgHowever, if the volatile storage is not being modified, and the value of
5591debfc3dSmrgthe volatile storage is not used, then the situation is less obvious.
5601debfc3dSmrgFor example
5611debfc3dSmrg
5621debfc3dSmrg@smallexample
5631debfc3dSmrgvolatile int *src = @var{somevalue};
5641debfc3dSmrg*src;
5651debfc3dSmrg@end smallexample
5661debfc3dSmrg
5671debfc3dSmrgAccording to the C standard, such an expression is an rvalue whose type
568c0a68be4Smrgis the unqualified version of its original type, i.e.@: @code{int}.  Whether
5691debfc3dSmrgGCC interprets this as a read of the volatile object being pointed to or
570a2dc1f3fSmrgonly as a request to evaluate the expression for its side effects depends
5711debfc3dSmrgon this type.
5721debfc3dSmrg
5731debfc3dSmrgIf it is a scalar type, or on most targets an aggregate type whose only
5741debfc3dSmrgmember object is of a scalar type, or a union type whose member objects
5751debfc3dSmrgare of scalar types, the expression is interpreted by GCC as a read of
5761debfc3dSmrgthe volatile object; in the other cases, the expression is only evaluated
577a2dc1f3fSmrgfor its side effects.
5781debfc3dSmrg
579*8feb0f0bSmrgWhen an object of an aggregate type, with the same size and alignment as a
580*8feb0f0bSmrgscalar type @code{S}, is the subject of a volatile access by an assignment
581*8feb0f0bSmrgexpression or an atomic function, the access to it is performed as if the
582*8feb0f0bSmrgobject's declared type were @code{volatile S}.
583*8feb0f0bSmrg
5841debfc3dSmrg@end itemize
5851debfc3dSmrg
5861debfc3dSmrg@node Declarators implementation
5871debfc3dSmrg@section Declarators
5881debfc3dSmrg
5891debfc3dSmrg@itemize @bullet
5901debfc3dSmrg@item
5911debfc3dSmrg@cite{The maximum number of declarators that may modify an arithmetic,
5921debfc3dSmrgstructure or union type (C90 6.5.4).}
5931debfc3dSmrg
5941debfc3dSmrgGCC is only limited by available memory.
5951debfc3dSmrg
5961debfc3dSmrg@end itemize
5971debfc3dSmrg
5981debfc3dSmrg@node Statements implementation
5991debfc3dSmrg@section Statements
6001debfc3dSmrg
6011debfc3dSmrg@itemize @bullet
6021debfc3dSmrg@item
6031debfc3dSmrg@cite{The maximum number of @code{case} values in a @code{switch}
6041debfc3dSmrgstatement (C90 6.6.4.2).}
6051debfc3dSmrg
6061debfc3dSmrgGCC is only limited by available memory.
6071debfc3dSmrg
6081debfc3dSmrg@end itemize
6091debfc3dSmrg
6101debfc3dSmrg@node Preprocessing directives implementation
6111debfc3dSmrg@section Preprocessing Directives
6121debfc3dSmrg
6131debfc3dSmrg@xref{Implementation-defined behavior, , Implementation-defined
6141debfc3dSmrgbehavior, cpp, The C Preprocessor}, for details of these aspects of
6151debfc3dSmrgimplementation-defined behavior.
6161debfc3dSmrg
6171debfc3dSmrg@itemize @bullet
6181debfc3dSmrg@item
6191debfc3dSmrg@cite{The locations within @code{#pragma} directives where header name
6201debfc3dSmrgpreprocessing tokens are recognized (C11 6.4, C11 6.4.7).}
6211debfc3dSmrg
6221debfc3dSmrg@item
6231debfc3dSmrg@cite{How sequences in both forms of header names are mapped to headers
6241debfc3dSmrgor external source file names (C90 6.1.7, C99 and C11 6.4.7).}
6251debfc3dSmrg
6261debfc3dSmrg@item
6271debfc3dSmrg@cite{Whether the value of a character constant in a constant expression
6281debfc3dSmrgthat controls conditional inclusion matches the value of the same character
6291debfc3dSmrgconstant in the execution character set (C90 6.8.1, C99 and C11 6.10.1).}
6301debfc3dSmrg
6311debfc3dSmrg@item
6321debfc3dSmrg@cite{Whether the value of a single-character character constant in a
6331debfc3dSmrgconstant expression that controls conditional inclusion may have a
6341debfc3dSmrgnegative value (C90 6.8.1, C99 and C11 6.10.1).}
6351debfc3dSmrg
6361debfc3dSmrg@item
6371debfc3dSmrg@cite{The places that are searched for an included @samp{<>} delimited
6381debfc3dSmrgheader, and how the places are specified or the header is
6391debfc3dSmrgidentified (C90 6.8.2, C99 and C11 6.10.2).}
6401debfc3dSmrg
6411debfc3dSmrg@item
6421debfc3dSmrg@cite{How the named source file is searched for in an included @samp{""}
6431debfc3dSmrgdelimited header (C90 6.8.2, C99 and C11 6.10.2).}
6441debfc3dSmrg
6451debfc3dSmrg@item
6461debfc3dSmrg@cite{The method by which preprocessing tokens (possibly resulting from
6471debfc3dSmrgmacro expansion) in a @code{#include} directive are combined into a header
6481debfc3dSmrgname (C90 6.8.2, C99 and C11 6.10.2).}
6491debfc3dSmrg
6501debfc3dSmrg@item
6511debfc3dSmrg@cite{The nesting limit for @code{#include} processing (C90 6.8.2, C99
6521debfc3dSmrgand C11 6.10.2).}
6531debfc3dSmrg
6541debfc3dSmrg@item
6551debfc3dSmrg@cite{Whether the @samp{#} operator inserts a @samp{\} character before
6561debfc3dSmrgthe @samp{\} character that begins a universal character name in a
6571debfc3dSmrgcharacter constant or string literal (C99 and C11 6.10.3.2).}
6581debfc3dSmrg
6591debfc3dSmrg@item
6601debfc3dSmrg@cite{The behavior on each recognized non-@code{STDC #pragma}
6611debfc3dSmrgdirective (C90 6.8.6, C99 and C11 6.10.6).}
6621debfc3dSmrg
6631debfc3dSmrg@xref{Pragmas, , Pragmas, cpp, The C Preprocessor}, for details of
6641debfc3dSmrgpragmas accepted by GCC on all targets.  @xref{Pragmas, , Pragmas
6651debfc3dSmrgAccepted by GCC}, for details of target-specific pragmas.
6661debfc3dSmrg
6671debfc3dSmrg@item
6681debfc3dSmrg@cite{The definitions for @code{__DATE__} and @code{__TIME__} when
6691debfc3dSmrgrespectively, the date and time of translation are not available (C90
6701debfc3dSmrg6.8.8, C99 6.10.8, C11 6.10.8.1).}
6711debfc3dSmrg
6721debfc3dSmrg@end itemize
6731debfc3dSmrg
6741debfc3dSmrg@node Library functions implementation
6751debfc3dSmrg@section Library Functions
6761debfc3dSmrg
6771debfc3dSmrgThe behavior of most of these points are dependent on the implementation
6781debfc3dSmrgof the C library, and are not defined by GCC itself.
6791debfc3dSmrg
6801debfc3dSmrg@itemize @bullet
6811debfc3dSmrg@item
6821debfc3dSmrg@cite{The null pointer constant to which the macro @code{NULL} expands
6831debfc3dSmrg(C90 7.1.6, C99 7.17, C11 7.19).}
6841debfc3dSmrg
6851debfc3dSmrgIn @code{<stddef.h>}, @code{NULL} expands to @code{((void *)0)}.  GCC
6861debfc3dSmrgdoes not provide the other headers which define @code{NULL} and some
6871debfc3dSmrglibrary implementations may use other definitions in those headers.
6881debfc3dSmrg
6891debfc3dSmrg@end itemize
6901debfc3dSmrg
6911debfc3dSmrg@node Architecture implementation
6921debfc3dSmrg@section Architecture
6931debfc3dSmrg
6941debfc3dSmrg@itemize @bullet
6951debfc3dSmrg@item
6961debfc3dSmrg@cite{The values or expressions assigned to the macros specified in the
6971debfc3dSmrgheaders @code{<float.h>}, @code{<limits.h>}, and @code{<stdint.h>}
6981debfc3dSmrg(C90, C99 and C11 5.2.4.2, C99 7.18.2, C99 7.18.3, C11 7.20.2, C11 7.20.3).}
6991debfc3dSmrg
7001debfc3dSmrgDetermined by ABI@.
7011debfc3dSmrg
7021debfc3dSmrg@item
7031debfc3dSmrg@cite{The result of attempting to indirectly access an object with
7041debfc3dSmrgautomatic or thread storage duration from a thread other than the one
7051debfc3dSmrgwith which it is associated (C11 6.2.4).}
7061debfc3dSmrg
7071debfc3dSmrgSuch accesses are supported, subject to the same requirements for
7081debfc3dSmrgsynchronization for concurrent accesses as for concurrent accesses to
7091debfc3dSmrgany object.
7101debfc3dSmrg
7111debfc3dSmrg@item
7121debfc3dSmrg@cite{The number, order, and encoding of bytes in any object
7131debfc3dSmrg(when not explicitly specified in this International Standard) (C99
7141debfc3dSmrgand C11 6.2.6.1).}
7151debfc3dSmrg
7161debfc3dSmrgDetermined by ABI@.
7171debfc3dSmrg
7181debfc3dSmrg@item
7191debfc3dSmrg@cite{Whether any extended alignments are supported and the contexts
7201debfc3dSmrgin which they are supported (C11 6.2.8).}
7211debfc3dSmrg
7221debfc3dSmrgExtended alignments up to @math{2^{28}} (bytes) are supported for
7231debfc3dSmrgobjects of automatic storage duration.  Alignments supported for
7241debfc3dSmrgobjects of static and thread storage duration are determined by the
7251debfc3dSmrgABI.
7261debfc3dSmrg
7271debfc3dSmrg@item
7281debfc3dSmrg@cite{Valid alignment values other than those returned by an _Alignof
7291debfc3dSmrgexpression for fundamental types, if any (C11 6.2.8).}
7301debfc3dSmrg
7311debfc3dSmrgValid alignments are powers of 2 up to and including @math{2^{28}}.
7321debfc3dSmrg
7331debfc3dSmrg@item
7341debfc3dSmrg@cite{The value of the result of the @code{sizeof} and @code{_Alignof}
7351debfc3dSmrgoperators (C90 6.3.3.4, C99 and C11 6.5.3.4).}
7361debfc3dSmrg
7371debfc3dSmrgDetermined by ABI@.
7381debfc3dSmrg
7391debfc3dSmrg@end itemize
7401debfc3dSmrg
7411debfc3dSmrg@node Locale-specific behavior implementation
7421debfc3dSmrg@section Locale-Specific Behavior
7431debfc3dSmrg
7441debfc3dSmrgThe behavior of these points are dependent on the implementation
7451debfc3dSmrgof the C library, and are not defined by GCC itself.
746