]>
Commit | Line | Data |
---|---|---|
23a5b65a | 1 | @c Copyright (C) 2001-2014 Free Software Foundation, Inc. |
d592f1c3 JM |
2 | @c This is part of the GCC manual. |
3 | @c For copying conditions, see the file gcc.texi. | |
4 | ||
5 | @node C Implementation | |
6 | @chapter C Implementation-defined behavior | |
7 | @cindex implementation-defined behavior, C language | |
8 | ||
9 | A conforming implementation of ISO C is required to document its | |
10 | choice of behavior in each of the areas that are designated | |
d78aa55c | 11 | ``implementation defined''. The following lists all such areas, |
b76f5d16 JM |
12 | along with the section numbers from the ISO/IEC 9899:1990, ISO/IEC |
13 | 9899:1999 and ISO/IEC 9899:2011 standards. Some areas are only | |
14 | implementation-defined in one version of the standard. | |
9d6e0be1 JM |
15 | |
16 | Some choices depend on the externally determined ABI for the platform | |
17 | (including standard character encodings) which GCC follows; these are | |
18 | listed as ``determined by ABI'' below. @xref{Compatibility, , Binary | |
19 | Compatibility}, and @uref{http://gcc.gnu.org/readings.html}. Some | |
20 | choices are documented in the preprocessor manual. | |
21 | @xref{Implementation-defined behavior, , Implementation-defined | |
22 | behavior, cpp, The C Preprocessor}. Some choices are made by the | |
23 | library and operating system (or other environment when compiling for | |
24 | a freestanding environment); refer to their documentation for details. | |
d592f1c3 JM |
25 | |
26 | @menu | |
27 | * Translation implementation:: | |
28 | * Environment implementation:: | |
29 | * Identifiers implementation:: | |
30 | * Characters implementation:: | |
31 | * Integers implementation:: | |
32 | * Floating point implementation:: | |
33 | * Arrays and pointers implementation:: | |
34 | * Hints implementation:: | |
35 | * Structures unions enumerations and bit-fields implementation:: | |
36 | * Qualifiers implementation:: | |
9d6e0be1 JM |
37 | * Declarators implementation:: |
38 | * Statements implementation:: | |
d592f1c3 JM |
39 | * Preprocessing directives implementation:: |
40 | * Library functions implementation:: | |
41 | * Architecture implementation:: | |
42 | * Locale-specific behavior implementation:: | |
43 | @end menu | |
44 | ||
45 | @node Translation implementation | |
46 | @section Translation | |
47 | ||
48 | @itemize @bullet | |
49 | @item | |
b76f5d16 JM |
50 | @cite{How a diagnostic is identified (C90 3.7, C99 and C11 3.10, C90, |
51 | C99 and C11 5.1.1.3).} | |
d592f1c3 | 52 | |
8a36672b | 53 | Diagnostics consist of all the output sent to stderr by GCC@. |
d592f1c3 JM |
54 | |
55 | @item | |
56 | @cite{Whether each nonempty sequence of white-space characters other than | |
57 | new-line is retained or replaced by one space character in translation | |
b76f5d16 | 58 | phase 3 (C90, C99 and C11 5.1.1.2).} |
9d6e0be1 JM |
59 | |
60 | @xref{Implementation-defined behavior, , Implementation-defined | |
61 | behavior, cpp, The C Preprocessor}. | |
62 | ||
d592f1c3 JM |
63 | @end itemize |
64 | ||
65 | @node Environment implementation | |
66 | @section Environment | |
67 | ||
9d6e0be1 | 68 | The behavior of most of these points are dependent on the implementation |
d592f1c3 JM |
69 | of the C library, and are not defined by GCC itself. |
70 | ||
9d6e0be1 JM |
71 | @itemize @bullet |
72 | @item | |
73 | @cite{The mapping between physical source file multibyte characters | |
b76f5d16 JM |
74 | and the source character set in translation phase 1 (C90, C99 and C11 |
75 | 5.1.1.2).} | |
9d6e0be1 JM |
76 | |
77 | @xref{Implementation-defined behavior, , Implementation-defined | |
78 | behavior, cpp, The C Preprocessor}. | |
79 | ||
80 | @end itemize | |
81 | ||
d592f1c3 JM |
82 | @node Identifiers implementation |
83 | @section Identifiers | |
84 | ||
85 | @itemize @bullet | |
86 | @item | |
87 | @cite{Which additional multibyte characters may appear in identifiers | |
b76f5d16 | 88 | and their correspondence to universal character names (C99 and C11 6.4.2).} |
9d6e0be1 JM |
89 | |
90 | @xref{Implementation-defined behavior, , Implementation-defined | |
91 | behavior, cpp, The C Preprocessor}. | |
d592f1c3 JM |
92 | |
93 | @item | |
94 | @cite{The number of significant initial characters in an identifier | |
b76f5d16 | 95 | (C90 6.1.2, C90, C99 and C11 5.2.4.1, C99 and C11 6.4.2).} |
d592f1c3 JM |
96 | |
97 | For internal names, all characters are significant. For external names, | |
98 | the number of significant characters are defined by the linker; for | |
99 | almost all targets, all characters are significant. | |
100 | ||
9d6e0be1 JM |
101 | @item |
102 | @cite{Whether case distinctions are significant in an identifier with | |
103 | external linkage (C90 6.1.2).} | |
104 | ||
b76f5d16 | 105 | This is a property of the linker. C99 and C11 require that case distinctions |
9d6e0be1 JM |
106 | are always significant in identifiers with external linkage and |
107 | systems without this property are not supported by GCC@. | |
108 | ||
d592f1c3 JM |
109 | @end itemize |
110 | ||
111 | @node Characters implementation | |
112 | @section Characters | |
113 | ||
114 | @itemize @bullet | |
115 | @item | |
b76f5d16 | 116 | @cite{The number of bits in a byte (C90 3.4, C99 and C11 3.6).} |
9d6e0be1 JM |
117 | |
118 | Determined by ABI@. | |
d592f1c3 JM |
119 | |
120 | @item | |
b76f5d16 JM |
121 | @cite{The values of the members of the execution character set (C90, |
122 | C99 and C11 5.2.1).} | |
9d6e0be1 JM |
123 | |
124 | Determined by ABI@. | |
d592f1c3 JM |
125 | |
126 | @item | |
127 | @cite{The unique value of the member of the execution character set produced | |
b76f5d16 JM |
128 | for each of the standard alphabetic escape sequences (C90, C99 and C11 |
129 | 5.2.2).} | |
9d6e0be1 JM |
130 | |
131 | Determined by ABI@. | |
d592f1c3 JM |
132 | |
133 | @item | |
134 | @cite{The value of a @code{char} object into which has been stored any | |
9d6e0be1 | 135 | character other than a member of the basic execution character set |
b76f5d16 | 136 | (C90 6.1.2.5, C99 and C11 6.2.5).} |
9d6e0be1 JM |
137 | |
138 | Determined by ABI@. | |
d592f1c3 JM |
139 | |
140 | @item | |
9d6e0be1 JM |
141 | @cite{Which of @code{signed char} or @code{unsigned char} has the same |
142 | range, representation, and behavior as ``plain'' @code{char} (C90 | |
b76f5d16 | 143 | 6.1.2.5, C90 6.2.1.1, C99 and C11 6.2.5, C99 and C11 6.3.1.1).} |
9d6e0be1 JM |
144 | |
145 | @opindex fsigned-char | |
146 | @opindex funsigned-char | |
147 | Determined by ABI@. The options @option{-funsigned-char} and | |
148 | @option{-fsigned-char} change the default. @xref{C Dialect Options, , | |
149 | Options Controlling C Dialect}. | |
d592f1c3 JM |
150 | |
151 | @item | |
152 | @cite{The mapping of members of the source character set (in character | |
153 | constants and string literals) to members of the execution character | |
b76f5d16 | 154 | set (C90 6.1.3.4, C99 and C11 6.4.4.4, C90, C99 and C11 5.1.1.2).} |
9d6e0be1 JM |
155 | |
156 | Determined by ABI@. | |
d592f1c3 JM |
157 | |
158 | @item | |
159 | @cite{The value of an integer character constant containing more than one | |
160 | character or containing a character or escape sequence that does not map | |
b76f5d16 | 161 | to a single-byte execution character (C90 6.1.3.4, C99 and C11 6.4.4.4).} |
9d6e0be1 JM |
162 | |
163 | @xref{Implementation-defined behavior, , Implementation-defined | |
164 | behavior, cpp, The C Preprocessor}. | |
d592f1c3 JM |
165 | |
166 | @item | |
167 | @cite{The value of a wide character constant containing more than one | |
b76f5d16 JM |
168 | multibyte character or a single multibyte character that maps to |
169 | multiple members of the extended execution character set, or | |
170 | containing a multibyte character or escape sequence not represented in | |
171 | the extended execution character set (C90 6.1.3.4, C99 and C11 | |
172 | 6.4.4.4).} | |
9d6e0be1 JM |
173 | |
174 | @xref{Implementation-defined behavior, , Implementation-defined | |
175 | behavior, cpp, The C Preprocessor}. | |
d592f1c3 JM |
176 | |
177 | @item | |
178 | @cite{The current locale used to convert a wide character constant consisting | |
179 | of a single multibyte character that maps to a member of the extended | |
9d6e0be1 | 180 | execution character set into a corresponding wide character code (C90 |
b76f5d16 | 181 | 6.1.3.4, C99 and C11 6.4.4.4).} |
9d6e0be1 JM |
182 | |
183 | @xref{Implementation-defined behavior, , Implementation-defined | |
184 | behavior, cpp, The C Preprocessor}. | |
d592f1c3 | 185 | |
b76f5d16 JM |
186 | @item |
187 | @cite{Whether differently-prefixed wide string literal tokens can be | |
188 | concatenated and, if so, the treatment of the resulting multibyte | |
189 | character sequence (C11 6.4.5).} | |
190 | ||
191 | Such tokens may not be concatenated. | |
192 | ||
d592f1c3 JM |
193 | @item |
194 | @cite{The current locale used to convert a wide string literal into | |
b76f5d16 | 195 | corresponding wide character codes (C90 6.1.4, C99 and C11 6.4.5).} |
9d6e0be1 JM |
196 | |
197 | @xref{Implementation-defined behavior, , Implementation-defined | |
198 | behavior, cpp, The C Preprocessor}. | |
d592f1c3 JM |
199 | |
200 | @item | |
201 | @cite{The value of a string literal containing a multibyte character or escape | |
b76f5d16 JM |
202 | sequence not represented in the execution character set (C90 6.1.4, |
203 | C99 and C11 6.4.5).} | |
9d6e0be1 JM |
204 | |
205 | @xref{Implementation-defined behavior, , Implementation-defined | |
206 | behavior, cpp, The C Preprocessor}. | |
b76f5d16 JM |
207 | |
208 | @item | |
209 | @cite{The encoding of any of @code{wchar_t}, @code{char16_t}, and | |
210 | @code{char32_t} where the corresponding standard encoding macro | |
211 | (@code{__STDC_ISO_10646__}, @code{__STDC_UTF_16__}, or | |
212 | @code{__STDC_UTF_32__}) is not defined (C11 6.10.8.2).} | |
213 | ||
214 | @xref{Implementation-defined behavior, , Implementation-defined | |
215 | behavior, cpp, The C Preprocessor}. @code{char16_t} and | |
216 | @code{char32_t} literals are always encoded in UTF-16 and UTF-32 | |
217 | respectively. | |
218 | ||
d592f1c3 JM |
219 | @end itemize |
220 | ||
221 | @node Integers implementation | |
222 | @section Integers | |
223 | ||
224 | @itemize @bullet | |
225 | @item | |
b76f5d16 JM |
226 | @cite{Any extended integer types that exist in the implementation (C99 |
227 | and C11 6.2.5).} | |
9d6e0be1 JM |
228 | |
229 | GCC does not support any extended integer types. | |
230 | @c The __mode__ attribute might create types of precisions not | |
231 | @c otherwise supported, but the syntax isn't right for use everywhere | |
232 | @c the standard type names might be used. Predefined typedefs should | |
233 | @c be used if any extended integer types are to be defined. The | |
234 | @c __int128_t and __uint128_t typedefs are not extended integer types | |
235 | @c as they are generally longer than the ABI-specified intmax_t. | |
d592f1c3 JM |
236 | |
237 | @item | |
238 | @cite{Whether signed integer types are represented using sign and magnitude, | |
239 | two's complement, or one's complement, and whether the extraordinary value | |
b76f5d16 | 240 | is a trap representation or an ordinary value (C99 and C11 6.2.6.2).} |
d592f1c3 JM |
241 | |
242 | GCC supports only two's complement integer types, and all bit patterns | |
243 | are ordinary values. | |
244 | ||
245 | @item | |
246 | @cite{The rank of any extended integer type relative to another extended | |
b76f5d16 | 247 | integer type with the same precision (C99 and C11 6.3.1.1).} |
9d6e0be1 JM |
248 | |
249 | GCC does not support any extended integer types. | |
250 | @c If it did, there would only be one of each precision and signedness. | |
d592f1c3 JM |
251 | |
252 | @item | |
253 | @cite{The result of, or the signal raised by, converting an integer to a | |
254 | signed integer type when the value cannot be represented in an object of | |
b76f5d16 | 255 | that type (C90 6.2.1.2, C99 and C11 6.3.1.3).} |
9d6e0be1 JM |
256 | |
257 | For conversion to a type of width @math{N}, the value is reduced | |
258 | modulo @math{2^N} to be within range of the type; no signal is raised. | |
d592f1c3 JM |
259 | |
260 | @item | |
9d6e0be1 | 261 | @cite{The results of some bitwise operations on signed integers (C90 |
b76f5d16 | 262 | 6.3, C99 and C11 6.5).} |
9d6e0be1 JM |
263 | |
264 | Bitwise operators act on the representation of the value including | |
265 | both the sign and value bits, where the sign bit is considered | |
266 | immediately above the highest-value value bit. Signed @samp{>>} acts | |
267 | on negative numbers by sign extension. | |
268 | ||
b76f5d16 | 269 | GCC does not use the latitude given in C99 and C11 only to treat certain |
9d6e0be1 JM |
270 | aspects of signed @samp{<<} as undefined, but this is subject to |
271 | change. | |
272 | ||
273 | @item | |
274 | @cite{The sign of the remainder on integer division (C90 6.3.5).} | |
275 | ||
b76f5d16 | 276 | GCC always follows the C99 and C11 requirement that the result of division is |
9d6e0be1 JM |
277 | truncated towards zero. |
278 | ||
d592f1c3 JM |
279 | @end itemize |
280 | ||
281 | @node Floating point implementation | |
282 | @section Floating point | |
283 | ||
284 | @itemize @bullet | |
285 | @item | |
286 | @cite{The accuracy of the floating-point operations and of the library | |
287 | functions in @code{<math.h>} and @code{<complex.h>} that return floating-point | |
b76f5d16 | 288 | results (C90, C99 and C11 5.2.4.2.2).} |
9d6e0be1 JM |
289 | |
290 | The accuracy is unknown. | |
d592f1c3 JM |
291 | |
292 | @item | |
293 | @cite{The rounding behaviors characterized by non-standard values | |
294 | of @code{FLT_ROUNDS} @gol | |
b76f5d16 | 295 | (C90, C99 and C11 5.2.4.2.2).} |
9d6e0be1 JM |
296 | |
297 | GCC does not use such values. | |
d592f1c3 JM |
298 | |
299 | @item | |
300 | @cite{The evaluation methods characterized by non-standard negative | |
b76f5d16 | 301 | values of @code{FLT_EVAL_METHOD} (C99 and C11 5.2.4.2.2).} |
9d6e0be1 JM |
302 | |
303 | GCC does not use such values. | |
d592f1c3 JM |
304 | |
305 | @item | |
306 | @cite{The direction of rounding when an integer is converted to a | |
307 | floating-point number that cannot exactly represent the original | |
b76f5d16 | 308 | value (C90 6.2.1.3, C99 and C11 6.3.1.4).} |
9d6e0be1 JM |
309 | |
310 | C99 Annex F is followed. | |
d592f1c3 JM |
311 | |
312 | @item | |
313 | @cite{The direction of rounding when a floating-point number is | |
b76f5d16 | 314 | converted to a narrower floating-point number (C90 6.2.1.4, C99 and C11 |
9d6e0be1 JM |
315 | 6.3.1.5).} |
316 | ||
317 | C99 Annex F is followed. | |
d592f1c3 JM |
318 | |
319 | @item | |
320 | @cite{How the nearest representable value or the larger or smaller | |
321 | representable value immediately adjacent to the nearest representable | |
b76f5d16 | 322 | value is chosen for certain floating constants (C90 6.1.3.1, C99 and C11 |
9d6e0be1 JM |
323 | 6.4.4.2).} |
324 | ||
325 | C99 Annex F is followed. | |
d592f1c3 JM |
326 | |
327 | @item | |
328 | @cite{Whether and how floating expressions are contracted when not | |
b76f5d16 | 329 | disallowed by the @code{FP_CONTRACT} pragma (C99 and C11 6.5).} |
9d6e0be1 | 330 | |
b76f5d16 | 331 | Expressions are currently only contracted if @option{-ffp-contract=fast}, |
9d6e0be1 JM |
332 | @option{-funsafe-math-optimizations} or @option{-ffast-math} are used. |
333 | This is subject to change. | |
d592f1c3 JM |
334 | |
335 | @item | |
b76f5d16 JM |
336 | @cite{The default state for the @code{FENV_ACCESS} pragma (C99 and C11 |
337 | 7.6.1).} | |
9d6e0be1 JM |
338 | |
339 | This pragma is not implemented, but the default is to ``off'' unless | |
340 | @option{-frounding-math} is used in which case it is ``on''. | |
d592f1c3 JM |
341 | |
342 | @item | |
343 | @cite{Additional floating-point exceptions, rounding modes, environments, | |
b76f5d16 JM |
344 | and classifications, and their macro names (C99 and C11 7.6, C99 and |
345 | C11 7.12).} | |
9d6e0be1 JM |
346 | |
347 | This is dependent on the implementation of the C library, and is not | |
348 | defined by GCC itself. | |
d592f1c3 JM |
349 | |
350 | @item | |
b76f5d16 JM |
351 | @cite{The default state for the @code{FP_CONTRACT} pragma (C99 and C11 |
352 | 7.12.2).} | |
9d6e0be1 JM |
353 | |
354 | This pragma is not implemented. Expressions are currently only | |
b76f5d16 JM |
355 | contracted if @option{-ffp-contract=fast}, |
356 | @option{-funsafe-math-optimizations} or @option{-ffast-math} are used. | |
357 | This is subject to change. | |
d592f1c3 JM |
358 | |
359 | @item | |
360 | @cite{Whether the ``inexact'' floating-point exception can be raised | |
361 | when the rounded result actually does equal the mathematical result | |
9d6e0be1 JM |
362 | in an IEC 60559 conformant implementation (C99 F.9).} |
363 | ||
364 | This is dependent on the implementation of the C library, and is not | |
365 | defined by GCC itself. | |
d592f1c3 JM |
366 | |
367 | @item | |
368 | @cite{Whether the ``underflow'' (and ``inexact'') floating-point | |
369 | exception can be raised when a result is tiny but not inexact in an | |
9d6e0be1 JM |
370 | IEC 60559 conformant implementation (C99 F.9).} |
371 | ||
372 | This is dependent on the implementation of the C library, and is not | |
373 | defined by GCC itself. | |
d592f1c3 JM |
374 | |
375 | @end itemize | |
376 | ||
377 | @node Arrays and pointers implementation | |
378 | @section Arrays and pointers | |
379 | ||
380 | @itemize @bullet | |
381 | @item | |
382 | @cite{The result of converting a pointer to an integer or | |
b76f5d16 | 383 | vice versa (C90 6.3.4, C99 and C11 6.3.2.3).} |
d592f1c3 JM |
384 | |
385 | A cast from pointer to integer discards most-significant bits if the | |
386 | pointer representation is larger than the integer type, | |
387 | sign-extends@footnote{Future versions of GCC may zero-extend, or use | |
388 | a target-defined @code{ptr_extend} pattern. Do not rely on sign extension.} | |
389 | if the pointer representation is smaller than the integer type, otherwise | |
390 | the bits are unchanged. | |
391 | @c ??? We've always claimed that pointers were unsigned entities. | |
392 | @c Shouldn't we therefore be doing zero-extension? If so, the bug | |
393 | @c is in convert_to_integer, where we call type_for_size and request | |
394 | @c a signed integral type. On the other hand, it might be most useful | |
395 | @c for the target if we extend according to POINTERS_EXTEND_UNSIGNED. | |
396 | ||
397 | A cast from integer to pointer discards most-significant bits if the | |
398 | pointer representation is smaller than the integer type, extends according | |
399 | to the signedness of the integer type if the pointer representation | |
400 | is larger than the integer type, otherwise the bits are unchanged. | |
401 | ||
402 | When casting from pointer to integer and back again, the resulting | |
403 | pointer must reference the same object as the original pointer, otherwise | |
404 | the behavior is undefined. That is, one may not use integer arithmetic to | |
9d6e0be1 | 405 | avoid the undefined behavior of pointer arithmetic as proscribed in |
b76f5d16 | 406 | C99 and C11 6.5.6/8. |
d592f1c3 JM |
407 | |
408 | @item | |
409 | @cite{The size of the result of subtracting two pointers to elements | |
b76f5d16 | 410 | of the same array (C90 6.3.6, C99 and C11 6.5.6).} |
9d6e0be1 JM |
411 | |
412 | The value is as specified in the standard and the type is determined | |
413 | by the ABI@. | |
d592f1c3 JM |
414 | |
415 | @end itemize | |
416 | ||
417 | @node Hints implementation | |
418 | @section Hints | |
419 | ||
420 | @itemize @bullet | |
421 | @item | |
422 | @cite{The extent to which suggestions made by using the @code{register} | |
b76f5d16 | 423 | storage-class specifier are effective (C90 6.5.1, C99 and C11 6.7.1).} |
d592f1c3 JM |
424 | |
425 | The @code{register} specifier affects code generation only in these ways: | |
426 | ||
427 | @itemize @bullet | |
428 | @item | |
429 | When used as part of the register variable extension, see | |
430 | @ref{Explicit Reg Vars}. | |
431 | ||
432 | @item | |
433 | When @option{-O0} is in use, the compiler allocates distinct stack | |
434 | memory for all variables that do not have the @code{register} | |
435 | storage-class specifier; if @code{register} is specified, the variable | |
436 | may have a shorter lifespan than the code would indicate and may never | |
437 | be placed in memory. | |
438 | ||
439 | @item | |
440 | On some rare x86 targets, @code{setjmp} doesn't save the registers in | |
441 | all circumstances. In those cases, GCC doesn't allocate any variables | |
442 | in registers unless they are marked @code{register}. | |
443 | ||
444 | @end itemize | |
445 | ||
446 | @item | |
447 | @cite{The extent to which suggestions made by using the inline function | |
b76f5d16 | 448 | specifier are effective (C99 and C11 6.7.4).} |
d592f1c3 JM |
449 | |
450 | GCC will not inline any functions if the @option{-fno-inline} option is | |
451 | used or if @option{-O0} is used. Otherwise, GCC may still be unable to | |
452 | inline a function for many reasons; the @option{-Winline} option may be | |
453 | used to determine if a function has not been inlined and why not. | |
454 | ||
455 | @end itemize | |
456 | ||
457 | @node Structures unions enumerations and bit-fields implementation | |
458 | @section Structures, unions, enumerations, and bit-fields | |
459 | ||
460 | @itemize @bullet | |
461 | @item | |
9d6e0be1 JM |
462 | @cite{A member of a union object is accessed using a member of a |
463 | different type (C90 6.3.2.3).} | |
464 | ||
465 | The relevant bytes of the representation of the object are treated as | |
917db97b HPN |
466 | an object of the type used for the access. @xref{Type-punning}. This |
467 | may be a trap representation. | |
9d6e0be1 JM |
468 | |
469 | @item | |
470 | @cite{Whether a ``plain'' @code{int} bit-field is treated as a | |
471 | @code{signed int} bit-field or as an @code{unsigned int} bit-field | |
b76f5d16 | 472 | (C90 6.5.2, C90 6.5.2.1, C99 and C11 6.7.2, C99 and C11 6.7.2.1).} |
9d6e0be1 JM |
473 | |
474 | @opindex funsigned-bitfields | |
475 | By default it is treated as @code{signed int} but this may be changed | |
476 | by the @option{-funsigned-bitfields} option. | |
d592f1c3 JM |
477 | |
478 | @item | |
479 | @cite{Allowable bit-field types other than @code{_Bool}, @code{signed int}, | |
b76f5d16 | 480 | and @code{unsigned int} (C99 and C11 6.7.2.1).} |
9d6e0be1 | 481 | |
96066ce1 MP |
482 | Other integer types, such as @code{long int}, and enumerated types are |
483 | permitted even in strictly conforming mode. | |
b76f5d16 JM |
484 | |
485 | @item | |
486 | @cite{Whether atomic types are permitted for bit-fields (C11 6.7.2.1).} | |
487 | ||
488 | Atomic types are not permitted for bit-fields. | |
d592f1c3 JM |
489 | |
490 | @item | |
9d6e0be1 | 491 | @cite{Whether a bit-field can straddle a storage-unit boundary (C90 |
b76f5d16 | 492 | 6.5.2.1, C99 and C11 6.7.2.1).} |
9d6e0be1 JM |
493 | |
494 | Determined by ABI@. | |
d592f1c3 JM |
495 | |
496 | @item | |
9d6e0be1 | 497 | @cite{The order of allocation of bit-fields within a unit (C90 |
b76f5d16 | 498 | 6.5.2.1, C99 and C11 6.7.2.1).} |
9d6e0be1 JM |
499 | |
500 | Determined by ABI@. | |
d592f1c3 JM |
501 | |
502 | @item | |
9d6e0be1 | 503 | @cite{The alignment of non-bit-field members of structures (C90 |
b76f5d16 | 504 | 6.5.2.1, C99 and C11 6.7.2.1).} |
9d6e0be1 JM |
505 | |
506 | Determined by ABI@. | |
d592f1c3 JM |
507 | |
508 | @item | |
9d6e0be1 | 509 | @cite{The integer type compatible with each enumerated type (C90 |
b76f5d16 | 510 | 6.5.2.2, C99 and C11 6.7.2.2).} |
9d6e0be1 JM |
511 | |
512 | @opindex fshort-enums | |
513 | Normally, the type is @code{unsigned int} if there are no negative | |
514 | values in the enumeration, otherwise @code{int}. If | |
515 | @option{-fshort-enums} is specified, then if there are negative values | |
516 | it is the first of @code{signed char}, @code{short} and @code{int} | |
517 | that can represent all the values, otherwise it is the first of | |
518 | @code{unsigned char}, @code{unsigned short} and @code{unsigned int} | |
519 | that can represent all the values. | |
520 | @c On a few unusual targets with 64-bit int, this doesn't agree with | |
521 | @c the code and one of the types accessed via mode attributes (which | |
522 | @c are not currently considered extended integer types) may be used. | |
523 | @c If these types are made extended integer types, it would still be | |
524 | @c the case that -fshort-enums stops the implementation from | |
525 | @c conforming to C90 on those targets. | |
526 | ||
527 | On some targets, @option{-fshort-enums} is the default; this is | |
528 | determined by the ABI@. | |
d592f1c3 JM |
529 | |
530 | @end itemize | |
531 | ||
532 | @node Qualifiers implementation | |
533 | @section Qualifiers | |
534 | ||
535 | @itemize @bullet | |
536 | @item | |
537 | @cite{What constitutes an access to an object that has volatile-qualified | |
b76f5d16 | 538 | type (C90 6.5.3, C99 and C11 6.7.3).} |
9d6e0be1 | 539 | |
a9e64c63 EB |
540 | Such an object is normally accessed by pointers and used for accessing |
541 | hardware. In most expressions, it is intuitively obvious what is a read | |
542 | and what is a write. For example | |
543 | ||
544 | @smallexample | |
545 | volatile int *dst = @var{somevalue}; | |
546 | volatile int *src = @var{someothervalue}; | |
547 | *dst = *src; | |
548 | @end smallexample | |
549 | ||
550 | @noindent | |
551 | will cause a read of the volatile object pointed to by @var{src} and store the | |
552 | value into the volatile object pointed to by @var{dst}. There is no | |
553 | guarantee that these reads and writes are atomic, especially for objects | |
554 | larger than @code{int}. | |
555 | ||
556 | However, if the volatile storage is not being modified, and the value of | |
557 | the volatile storage is not used, then the situation is less obvious. | |
558 | For example | |
559 | ||
560 | @smallexample | |
561 | volatile int *src = @var{somevalue}; | |
562 | *src; | |
563 | @end smallexample | |
564 | ||
565 | According to the C standard, such an expression is an rvalue whose type | |
566 | is the unqualified version of its original type, i.e. @code{int}. Whether | |
567 | GCC interprets this as a read of the volatile object being pointed to or | |
568 | only as a request to evaluate the expression for its side-effects depends | |
569 | on this type. | |
570 | ||
571 | If it is a scalar type, or on most targets an aggregate type whose only | |
572 | member object is of a scalar type, or a union type whose member objects | |
573 | are of scalar types, the expression is interpreted by GCC as a read of | |
574 | the volatile object; in the other cases, the expression is only evaluated | |
575 | for its side-effects. | |
9d6e0be1 JM |
576 | |
577 | @end itemize | |
578 | ||
579 | @node Declarators implementation | |
580 | @section Declarators | |
581 | ||
582 | @itemize @bullet | |
583 | @item | |
584 | @cite{The maximum number of declarators that may modify an arithmetic, | |
585 | structure or union type (C90 6.5.4).} | |
586 | ||
587 | GCC is only limited by available memory. | |
588 | ||
589 | @end itemize | |
590 | ||
591 | @node Statements implementation | |
592 | @section Statements | |
593 | ||
594 | @itemize @bullet | |
595 | @item | |
596 | @cite{The maximum number of @code{case} values in a @code{switch} | |
597 | statement (C90 6.6.4.2).} | |
598 | ||
599 | GCC is only limited by available memory. | |
d592f1c3 JM |
600 | |
601 | @end itemize | |
602 | ||
603 | @node Preprocessing directives implementation | |
604 | @section Preprocessing directives | |
605 | ||
9d6e0be1 JM |
606 | @xref{Implementation-defined behavior, , Implementation-defined |
607 | behavior, cpp, The C Preprocessor}, for details of these aspects of | |
608 | implementation-defined behavior. | |
609 | ||
d592f1c3 | 610 | @itemize @bullet |
b76f5d16 JM |
611 | @item |
612 | @cite{The locations within @code{#pragma} directives where header name | |
613 | preprocessing tokens are recognized (C11 6.4, C11 6.4.7).} | |
614 | ||
d592f1c3 JM |
615 | @item |
616 | @cite{How sequences in both forms of header names are mapped to headers | |
b76f5d16 | 617 | or external source file names (C90 6.1.7, C99 and C11 6.4.7).} |
d592f1c3 JM |
618 | |
619 | @item | |
620 | @cite{Whether the value of a character constant in a constant expression | |
621 | that controls conditional inclusion matches the value of the same character | |
b76f5d16 | 622 | constant in the execution character set (C90 6.8.1, C99 and C11 6.10.1).} |
d592f1c3 JM |
623 | |
624 | @item | |
625 | @cite{Whether the value of a single-character character constant in a | |
626 | constant expression that controls conditional inclusion may have a | |
b76f5d16 | 627 | negative value (C90 6.8.1, C99 and C11 6.10.1).} |
d592f1c3 JM |
628 | |
629 | @item | |
630 | @cite{The places that are searched for an included @samp{<>} delimited | |
631 | header, and how the places are specified or the header is | |
b76f5d16 | 632 | identified (C90 6.8.2, C99 and C11 6.10.2).} |
d592f1c3 JM |
633 | |
634 | @item | |
635 | @cite{How the named source file is searched for in an included @samp{""} | |
b76f5d16 | 636 | delimited header (C90 6.8.2, C99 and C11 6.10.2).} |
d592f1c3 JM |
637 | |
638 | @item | |
639 | @cite{The method by which preprocessing tokens (possibly resulting from | |
640 | macro expansion) in a @code{#include} directive are combined into a header | |
b76f5d16 | 641 | name (C90 6.8.2, C99 and C11 6.10.2).} |
d592f1c3 JM |
642 | |
643 | @item | |
9d6e0be1 | 644 | @cite{The nesting limit for @code{#include} processing (C90 6.8.2, C99 |
b76f5d16 | 645 | and C11 6.10.2).} |
d592f1c3 JM |
646 | |
647 | @item | |
648 | @cite{Whether the @samp{#} operator inserts a @samp{\} character before | |
649 | the @samp{\} character that begins a universal character name in a | |
b76f5d16 | 650 | character constant or string literal (C99 and C11 6.10.3.2).} |
d592f1c3 JM |
651 | |
652 | @item | |
653 | @cite{The behavior on each recognized non-@code{STDC #pragma} | |
b76f5d16 | 654 | directive (C90 6.8.6, C99 and C11 6.10.6).} |
9d6e0be1 JM |
655 | |
656 | @xref{Pragmas, , Pragmas, cpp, The C Preprocessor}, for details of | |
657 | pragmas accepted by GCC on all targets. @xref{Pragmas, , Pragmas | |
658 | Accepted by GCC}, for details of target-specific pragmas. | |
d592f1c3 JM |
659 | |
660 | @item | |
661 | @cite{The definitions for @code{__DATE__} and @code{__TIME__} when | |
9d6e0be1 | 662 | respectively, the date and time of translation are not available (C90 |
b76f5d16 | 663 | 6.8.8, C99 6.10.8, C11 6.10.8.1).} |
d592f1c3 JM |
664 | |
665 | @end itemize | |
666 | ||
667 | @node Library functions implementation | |
668 | @section Library functions | |
669 | ||
9d6e0be1 | 670 | The behavior of most of these points are dependent on the implementation |
d592f1c3 JM |
671 | of the C library, and are not defined by GCC itself. |
672 | ||
9d6e0be1 JM |
673 | @itemize @bullet |
674 | @item | |
675 | @cite{The null pointer constant to which the macro @code{NULL} expands | |
b76f5d16 | 676 | (C90 7.1.6, C99 7.17, C11 7.19).} |
9d6e0be1 JM |
677 | |
678 | In @code{<stddef.h>}, @code{NULL} expands to @code{((void *)0)}. GCC | |
679 | does not provide the other headers which define @code{NULL} and some | |
680 | library implementations may use other definitions in those headers. | |
681 | ||
682 | @end itemize | |
683 | ||
d592f1c3 JM |
684 | @node Architecture implementation |
685 | @section Architecture | |
686 | ||
687 | @itemize @bullet | |
688 | @item | |
689 | @cite{The values or expressions assigned to the macros specified in the | |
690 | headers @code{<float.h>}, @code{<limits.h>}, and @code{<stdint.h>} | |
b76f5d16 | 691 | (C90, C99 and C11 5.2.4.2, C99 7.18.2, C99 7.18.3, C11 7.20.2, C11 7.20.3).} |
9d6e0be1 JM |
692 | |
693 | Determined by ABI@. | |
d592f1c3 | 694 | |
b76f5d16 JM |
695 | @item |
696 | @cite{The result of attempting to indirectly access an object with | |
697 | automatic or thread storage duration from a thread other than the one | |
698 | with which it is associated (C11 6.2.4).} | |
699 | ||
700 | Such accesses are supported, subject to the same requirements for | |
701 | synchronization for concurrent accesses as for concurrent accesses to | |
702 | any object. | |
703 | ||
d592f1c3 JM |
704 | @item |
705 | @cite{The number, order, and encoding of bytes in any object | |
b76f5d16 JM |
706 | (when not explicitly specified in this International Standard) (C99 |
707 | and C11 6.2.6.1).} | |
9d6e0be1 JM |
708 | |
709 | Determined by ABI@. | |
d592f1c3 JM |
710 | |
711 | @item | |
b76f5d16 JM |
712 | @cite{Whether any extended alignments are supported and the contexts |
713 | in which they are supported (C11 6.2.8).} | |
714 | ||
715 | Extended alignments up to @math{2^{28}} (bytes) are supported for | |
716 | objects of automatic storage duration. Alignments supported for | |
717 | objects of static and thread storage duration are determined by the | |
718 | ABI. | |
719 | ||
720 | @item | |
721 | @cite{Valid alignment values other than those returned by an _Alignof | |
722 | expression for fundamental types, if any (C11 6.2.8).} | |
723 | ||
724 | Valid alignments are powers of 2 up to and including @math{2^{28}}. | |
725 | ||
726 | @item | |
727 | @cite{The value of the result of the @code{sizeof} and @code{_Alignof} | |
728 | operators (C90 6.3.3.4, C99 and C11 6.5.3.4).} | |
9d6e0be1 JM |
729 | |
730 | Determined by ABI@. | |
d592f1c3 JM |
731 | |
732 | @end itemize | |
733 | ||
734 | @node Locale-specific behavior implementation | |
735 | @section Locale-specific behavior | |
736 | ||
737 | The behavior of these points are dependent on the implementation | |
738 | of the C library, and are not defined by GCC itself. |