gcc/gcc
Jakub Jelinek e176456cfe tailc: Handle musttail noreturn calls [PR119483]
The following (first) testcase is accepted by clang (if clang::musttail)
and rejected by gcc, because we discover the call is noreturn and then bail
out because we don't want noreturn tailcalls.
The general reason not to support noreturn tail calls is for cases like
abort where we want nicer backtrace, but if user asks explicitly to
musttail a call which either is explicitly noreturn or is implicitly
determined to be noreturn, I don't see a reason why we couldn't do that.
Both for tail calls and tail recursions.

An alternative would be to keep rejecting musttail to explicit noreturn,
but not actually implicitly mark anything as noreturn if it has any musttail
calls.  But it is unclear how we could do that, such marking is I think done
typically before IPA and e.g. for LTO we won't know whether some other TU
could have musttail calls to it.  And keeping around both explicit and
implicit noreturn bits would be ugly.  Well, I guess we could differentiate
between presence of noreturn/_Noreturn attributes and just ECF_NORETURN
without those, but then tailc would still need to support it, just error out
if it was explicit.

2025-03-28  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/119483
	* tree-tailcall.cc (find_tail_calls): Handle noreturn musttail
	calls.
	(eliminate_tail_call): Likewise.
	(tree_optimize_tail_calls_1): If cfun->has_musttail and
	diag_musttail, handle also basic blocks with no successors
	with noreturn musttail calls.
	* calls.cc (can_implement_as_sibling_call_p): Allow ECF_NORETURN
	calls if they are musttail calls.

	* c-c++-common/pr119483-1.c: New test.
	* c-c++-common/pr119483-2.c: New test.
2025-03-28 10:49:40 +01:00
..
ada Daily bump. 2025-03-28 00:19:00 +00:00
analyzer Daily bump. 2025-03-15 00:17:37 +00:00
c Daily bump. 2025-03-28 00:19:00 +00:00
c-family Daily bump. 2025-03-22 09:25:44 +00:00
cobol cobol: Do not include <cmath> (no longer needed) 2025-03-28 06:51:11 +00:00
common i386: Raise deprecate warning for -mavx10.1-256/512 and -mevex512 while add -mavx10.1 back with 512 bit alias 2025-03-24 14:24:39 +08:00
config i386: Fix offset calculation in ix86_redzone_clobber 2025-03-27 21:26:09 +01:00
cp Daily bump. 2025-03-28 00:19:00 +00:00
d Daily bump. 2025-03-27 00:19:18 +00:00
doc Add prime path coverage to gcc/gcov 2025-03-26 23:37:19 +01:00
fortran Daily bump. 2025-03-27 00:19:18 +00:00
ginclude c: stddef.h C23 fixes [PR114870] 2025-02-26 19:29:12 +01:00
go libgo: bump libgo version for GCC 15 release 2025-03-04 11:43:22 -08:00
jit Daily bump. 2025-03-14 00:17:27 +00:00
lto Daily bump. 2025-03-01 13:04:00 +00:00
m2 Daily bump. 2025-03-26 00:17:07 +00:00
objc
objcp
po Daily bump. 2025-03-25 00:19:18 +00:00
rtl-ssa rtl-ssa: Avoid dangling phi uses [PR118562] 2025-01-23 13:57:02 +00:00
rust Daily bump. 2025-03-27 00:19:18 +00:00
sym-exec Fix up some further cases of missing or extraneous spaces in diagnostics 2025-03-22 08:40:56 +01:00
testsuite tailc: Handle musttail noreturn calls [PR119483] 2025-03-28 10:49:40 +01:00
text-art
ABOUT-GCC-NLS
acinclude.m4 ggc: Avoid using ATTRIBUTE_MALLOC for allocations that need finalization [PR117047] 2025-03-01 11:22:27 +01:00
aclocal.m4
addresses.h
adjust-alignment.cc
alias.cc alias: Perform offset arithmetics in poly_offset_int rather than poly_int64 [PR118819] 2025-02-27 08:48:18 +01:00
alias.h
align.h
alloc-pool.cc
alloc-pool.h
array-traits.h
asan.cc asan: Fix missing FakeStack flag cleanup 2025-01-26 19:03:46 +01:00
asan.h
attr-fnspec.h
attr-urls.def
attribs.cc
attribs.h
auto-inc-dec.cc
auto-profile.cc
auto-profile.h
avoid-store-forwarding.cc
avoid-store-forwarding.h
backend.h
BASE-VER
basic-block.h
bb-reorder.cc
bb-reorder.h
bbitmap.h
bitmap.cc
bitmap.h
btfout.cc
builtin-attrs.def Use nonnull_if_nonzero attribute rather than nonnull on various builtins [PR117023] 2025-02-24 09:20:47 +01:00
builtin-types.def OpenMP: 'interop' construct - add ME support + target-independent libgomp 2025-03-21 19:24:16 +01:00
builtins.cc Add coverage_instrumentation_p 2025-03-27 00:01:15 +01:00
builtins.def Use nonnull_if_nonzero attribute rather than nonnull on various builtins [PR117023] 2025-02-24 09:20:47 +01:00
builtins.h
caller-save.cc
calls.cc tailc: Handle musttail noreturn calls [PR119483] 2025-03-28 10:49:40 +01:00
calls.h
ccmp.cc
ccmp.h
cfg-flags.def
cfg.cc
cfg.h
cfganal.cc
cfganal.h
cfgbuild.cc
cfgbuild.h
cfgcleanup.cc
cfgcleanup.h
cfgexpand.cc
cfgexpand.h
cfghooks.cc
cfghooks.h
cfgloop.cc
cfgloop.h
cfgloopanal.cc
cfgloopmanip.cc
cfgloopmanip.h
cfgrtl.cc
cfgrtl.h
cgraph.cc ipa: Do not modify cgraph edges from thunk clones during inlining (PR116572) 2025-03-14 16:13:28 +01:00
cgraph.h
cgraphbuild.cc
cgraphclones.cc
cgraphunit.cc Put early debug generation under TV_SYMOUT 2025-03-21 08:54:44 +01:00
ChangeLog Daily bump. 2025-03-28 00:19:00 +00:00
ChangeLog-1997
ChangeLog-1998
ChangeLog-1999
ChangeLog-2000
ChangeLog-2001
ChangeLog-2002
ChangeLog-2003
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog-2016
ChangeLog-2017
ChangeLog-2018
ChangeLog-2019
ChangeLog-2020
ChangeLog-2021
ChangeLog-2022
ChangeLog-2023
ChangeLog-2024
ChangeLog.dataflow
ChangeLog.gimple-classes
ChangeLog.graphite
ChangeLog.jit
ChangeLog.lib
ChangeLog.ptr
ChangeLog.tree-ssa
ChangeLog.tuples
cif-code.def
collect-utils.cc
collect-utils.h
collect2-aix.cc
collect2-aix.h
collect2.cc Add prime path coverage to gcc/gcov 2025-03-26 23:37:19 +01:00
collect2.h
color-macros.h
combine-stack-adj.cc
combine.cc combine: Add REG_DEAD notes to the last instruction after a split [PR118914] 2025-03-20 17:09:10 -07:00
common.md
common.opt Add prime path coverage to gcc/gcov 2025-03-26 23:37:19 +01:00
common.opt.urls doc: Regenerate common.opt.urls 2025-03-17 17:14:22 +01:00
compare-elim.cc
conditions.h
config.build
config.gcc Revert "AVX10.2 ymm rounding: Support vadd{s,d,h} and vcmp{s,d,h} intrins" 2025-03-24 14:24:33 +08:00
config.host
config.in gcc, configure: When checking for basename, use the same process as libiberty [PR119250]. 2025-03-25 19:29:51 +00:00
configure gcc, configure: When checking for basename, use the same process as libiberty [PR119250]. 2025-03-25 19:29:51 +00:00
configure.ac gcc, configure: When checking for basename, use the same process as libiberty [PR119250]. 2025-03-25 19:29:51 +00:00
context.cc
context.h
convert.cc
convert.h
COPYING
COPYING.LIB
COPYING3
COPYING3.LIB
coretypes.h
coroutine-builtins.def
coroutine-passes.cc
coverage.cc
coverage.h
cppbuiltin.cc
cppbuiltin.h
cppdefault.cc
cppdefault.h
cprop.cc
crc-verification.cc
crc-verification.h
cse.cc
cselib.cc cselib: Fix up previous patch for SPARC [PR117239] 2025-02-05 14:06:42 +01:00
cselib.h
cstamp-h.in
ctfc.cc
ctfc.h
ctfout.cc
data-streamer-in.cc
data-streamer-out.cc
data-streamer.cc
data-streamer.h
DATESTAMP Daily bump. 2025-03-28 00:19:00 +00:00
dbgcnt.cc
dbgcnt.def
dbgcnt.h
dce.cc
dce.h
ddg.cc
ddg.h
debug.cc
debug.h
defaults.h
DEV-PHASE
df-core.cc
df-problems.cc df: Treat partial defs as uses in df_simulate_defs [PR116564] 2025-03-12 15:20:43 +00:00
df-scan.cc
df.h
dfp.cc
dfp.h
diagnostic-buffer.h
diagnostic-client-data-hooks.h
diagnostic-color.cc
diagnostic-color.h
diagnostic-core.h diagnostics: add comments about global_dc 2025-02-20 17:10:54 -05:00
diagnostic-diagram.h
diagnostic-event-id.h
diagnostic-format-json.cc
diagnostic-format-sarif.cc diagnostics: fix crash in urlifier with -Wfatal-errors [PR119366] 2025-03-19 15:03:42 -04:00
diagnostic-format-sarif.h
diagnostic-format-text.cc
diagnostic-format-text.h
diagnostic-format.h
diagnostic-global-context.cc
diagnostic-highlight-colors.h
diagnostic-label-effects.h
diagnostic-macro-unwinding.cc
diagnostic-macro-unwinding.h
diagnostic-metadata.h
diagnostic-output-file.h
diagnostic-path.cc
diagnostic-path.h
diagnostic-show-locus.cc
diagnostic-spec.cc
diagnostic-spec.h
diagnostic-url.h
diagnostic.cc diagnostics: fix crash in urlifier with -Wfatal-errors [PR119366] 2025-03-19 15:03:42 -04:00
diagnostic.def
diagnostic.h diagnostics: fix crash in urlifier with -Wfatal-errors [PR119366] 2025-03-19 15:03:42 -04:00
digraph.cc
digraph.h
dojump.cc
dojump.h
dominance.cc
dominance.h
domwalk.cc
domwalk.h
double-int.cc
double-int.h
dse.cc
dump-context.h
dumpfile.cc
dumpfile.h
dwarf2asm.cc
dwarf2asm.h
dwarf2cfi.cc
dwarf2codeview.cc
dwarf2codeview.h
dwarf2ctf.cc
dwarf2ctf.h
dwarf2out.cc debug/101533 - ICE with variant typedef DIE generation 2025-03-18 10:12:28 +01:00
dwarf2out.h
early-remat.cc
edit-context.cc
edit-context.h
emit-rtl.cc
emit-rtl.h
errors.cc
errors.h
escaped_string.h
et-forest.cc
et-forest.h
except.cc
except.h
exec-tool.in
explow.cc
explow.h
expmed.cc
expmed.h
expr.cc ifcvt: Fix ICE with (fix:SI (fix:DF (reg:DF))) [PR117712] 2025-02-28 12:42:27 +01:00
expr.h
ext-dce.cc Revert "[rtl-optimization/117467] Avoid unnecessarily marking things live in ext-dce" 2025-03-11 18:01:33 -06:00
fibonacci_heap.cc
fibonacci_heap.h
file-find.cc
file-find.h
file-prefix-map.cc
file-prefix-map.h
final.cc
fixed-value.cc
fixed-value.h
flag-types.h
flags.h
fold-const-call.cc
fold-const-call.h
fold-const.cc Export native_encode_real operating on REAL_VALUE_TYPE 2025-03-28 08:54:07 +01:00
fold-const.h Export native_encode_real operating on REAL_VALUE_TYPE 2025-03-28 08:54:07 +01:00
fold-mem-offsets.cc rtl-optimization/117922 - disable fold-mem-offsets for highly connected CFG 2025-02-06 09:03:49 +01:00
fp-test.cc
FSFChangeLog
FSFChangeLog.10
FSFChangeLog.11
function-abi.cc
function-abi.h
function-tests.cc
function.cc
function.h
fwprop.cc
gcc-ar.cc
gcc-attribute-urlifier.cc
gcc-main.cc
gcc-plugin.h
gcc-rich-location.cc
gcc-rich-location.h
gcc-symtab.h
gcc-urlifier.cc diagnostics: fix crash in urlifier with -Wfatal-errors [PR119366] 2025-03-19 15:03:42 -04:00
gcc-urlifier.def
gcc-urlifier.h diagnostics: fix crash in urlifier with -Wfatal-errors [PR119366] 2025-03-19 15:03:42 -04:00
gcc.cc Add prime path coverage to gcc/gcov 2025-03-26 23:37:19 +01:00
gcc.h
gcov-counter.def Add prime path coverage to gcc/gcov 2025-03-26 23:37:19 +01:00
gcov-dump.cc
gcov-io.cc
gcov-io.h Add prime path coverage to gcc/gcov 2025-03-26 23:37:19 +01:00
gcov-tool.cc
gcov.cc Add prime path coverage to gcc/gcov 2025-03-26 23:37:19 +01:00
gcse-common.cc
gcse-common.h
gcse.cc
gcse.h
gdbasan.in
gdbhooks.py
gdbinit.in
gen-pass-instances.awk
genattr-common.cc
genattr.cc
genattrtab.cc
genautomata.cc [PR middle-end/117263] Avoid unused-but-set warning in genautomata 2025-02-09 09:16:31 -07:00
gencfn-macros.cc
gencheck.cc
genchecksum.cc
gencodes.cc
genconditions.cc
genconfig.cc
genconstants.cc
genemit.cc
genenums.cc
generic-match-head.cc
generic-match.h
genextract.cc
genflags.cc
gengenrtl.cc
gengtype-lex.l
gengtype-parse.cc
gengtype-state.cc
gengtype.cc tree, gengtype: Fix up GC issue with DECL_VALUE_EXPR [PR118790] 2025-02-13 14:14:50 +01:00
gengtype.h
genhooks.cc
genmatch.cc ggc: Avoid using ATTRIBUTE_MALLOC for allocations that need finalization [PR117047] 2025-03-01 11:22:27 +01:00
genmddeps.cc
genmddump.cc
genmodes.cc
genmultilib
genopinit.cc
genoutput.cc
genpeep.cc
genpreds.cc
genrecog.cc
gensupport.cc
gensupport.h
gentarget-def.cc
genversion.cc
ggc-common.cc ggc: Fix up ggc_internal_cleared_alloc_no_dtor [PR117047] 2025-03-01 20:50:29 +01:00
ggc-internal.h
ggc-none.cc ggc: Avoid using ATTRIBUTE_MALLOC for allocations that need finalization [PR117047] 2025-03-01 11:22:27 +01:00
ggc-page.cc ggc: Avoid using ATTRIBUTE_MALLOC for allocations that need finalization [PR117047] 2025-03-01 11:22:27 +01:00
ggc-tests.cc
ggc.h ggc: Avoid using ATTRIBUTE_MALLOC for allocations that need finalization [PR117047] 2025-03-01 11:22:27 +01:00
gimple-array-bounds.cc
gimple-array-bounds.h
gimple-builder.cc
gimple-builder.h
gimple-crc-optimization.cc
gimple-expr.cc
gimple-expr.h
gimple-fold.cc gimple-fold: Fix a pasto in fold_truth_andor_for_ifcombine [PR119030] 2025-02-27 22:11:51 +01:00
gimple-fold.h
gimple-harden-conditionals.cc
gimple-harden-control-flow.cc
gimple-if-to-switch.cc
gimple-isel.cc
gimple-iterator.cc
gimple-iterator.h
gimple-laddress.cc
gimple-loop-interchange.cc
gimple-loop-jam.cc tree-optimization/117113 - ICE with unroll-and-jam 2025-02-04 10:59:55 +01:00
gimple-loop-versioning.cc
gimple-low.cc OpenMP: 'interop' construct - add ME support + target-independent libgomp 2025-03-21 19:24:16 +01:00
gimple-low.h
gimple-lower-bitint.cc
gimple-lower-bitint.h
gimple-match-exports.cc
gimple-match-head.cc
gimple-match.h
gimple-predicate-analysis.cc
gimple-predicate-analysis.h
gimple-predict.h
gimple-pretty-print.cc OpenMP: 'interop' construct - add ME support + target-independent libgomp 2025-03-21 19:24:16 +01:00
gimple-pretty-print.h
gimple-range-cache.cc
gimple-range-cache.h
gimple-range-edge.cc
gimple-range-edge.h
gimple-range-fold.cc
gimple-range-fold.h
gimple-range-gori.cc
gimple-range-gori.h
gimple-range-infer.cc
gimple-range-infer.h
gimple-range-op.cc
gimple-range-op.h
gimple-range-path.cc
gimple-range-path.h
gimple-range-phi.cc gimple-range-phi: Fix comment typo 2025-02-27 08:56:29 +01:00
gimple-range-phi.h
gimple-range-tests.cc
gimple-range-trace.cc
gimple-range-trace.h
gimple-range.cc
gimple-range.h
gimple-ssa-backprop.cc
gimple-ssa-isolate-paths.cc
gimple-ssa-nonnull-compare.cc
gimple-ssa-sccopy.cc gimple: sccopy: Don't increment i after vec::unordered_remove() 2025-03-20 13:32:43 +01:00
gimple-ssa-split-paths.cc split-path: Small fix for poor_ifcvt_pred (tsvc s258) [PR118505] 2025-01-29 05:34:54 -08:00
gimple-ssa-sprintf.cc
gimple-ssa-store-merging.cc
gimple-ssa-strength-reduction.cc
gimple-ssa-warn-access.cc gimple-ssa-warn-access: Adjust maybe_warn_nonstring_arg for nonstring multidimensional arrays [PR117178] 2025-03-10 09:31:41 +01:00
gimple-ssa-warn-access.h
gimple-ssa-warn-alloca.cc
gimple-ssa-warn-restrict.cc
gimple-ssa-warn-restrict.h
gimple-ssa.h
gimple-streamer-in.cc
gimple-streamer-out.cc
gimple-streamer.h
gimple-walk.cc
gimple-walk.h
gimple-warn-recursion.cc
gimple.cc OpenMP: 'interop' construct - add ME support + target-independent libgomp 2025-03-21 19:24:16 +01:00
gimple.def OpenMP: 'interop' construct - add ME support + target-independent libgomp 2025-03-21 19:24:16 +01:00
gimple.h OpenMP: 'interop' construct - add ME support + target-independent libgomp 2025-03-21 19:24:16 +01:00
gimplify-me.cc
gimplify-me.h
gimplify.cc OpenMP: Fix C++ template handling with append_args' prefer_type modifier 2025-03-27 14:09:20 +01:00
gimplify.h
glimits.h
godump.cc
graph.cc
graph.h
graphds.cc
graphds.h
graphite-dependences.cc
graphite-isl-ast-to-gimple.cc
graphite-optimize-isl.cc
graphite-poly.cc
graphite-scop-detection.cc
graphite-sese-to-poly.cc
graphite.cc
graphite.h
graphviz.cc
graphviz.h
gsstruct.def
gsyms.h
gsyslimits.h
gtm-builtins.def
haifa-sched.cc
hard-reg-set.h ira: Add new hooks for callee-save vs spills [PR117477] 2025-03-08 03:57:53 +08:00
hash-map-tests.cc
hash-map-traits.h
hash-map.h
hash-set-tests.cc
hash-set.h
hash-table.cc
hash-table.h
hash-traits.h
highlev-plugin-common.h
hooks.cc
hooks.h
host-default.cc
hosthooks-def.h
hosthooks.h
hw-doloop.cc
hw-doloop.h
hwint.cc
hwint.h
ifcvt.cc ifcvt: Don't speculation move inline-asm [PR102150] 2025-02-12 14:33:49 -08:00
ifcvt.h
inchash.cc
inchash.h
incpath.cc
incpath.h
init-regs.cc
input.cc input: Fix UB during self-tests [PR119052] 2025-03-01 16:09:07 +01:00
input.h input: Fix up ICEs with --param=file-cache-files=N for N > 16 [PR118860] 2025-02-27 22:10:46 +01:00
insn-addr.h
insn-notes.def
int-vector-builder.h
internal-fn.cc
internal-fn.def
internal-fn.h
intl.cc
intl.h
ipa-comdats.cc
ipa-cp.cc ipa-cp: Avoid ICE when redistributing nodes among edges to recursive clones (PR 118318) 2025-03-07 17:25:07 +01:00
ipa-cp.h
ipa-devirt.cc ipa/119067 - bogus TYPE_PRECISION check on VECTOR_TYPE 2025-03-03 11:48:42 +01:00
ipa-fnsummary.cc lto: Add an entry for cold attribute to lto_gnu_attributes 2025-02-11 16:40:33 +01:00
ipa-fnsummary.h
ipa-free-lang-data.cc lto/114501 - missed free-lang-data for CONSTRUCTOR index 2025-03-06 15:26:57 +01:00
ipa-icf-gimple.cc icf: Punt for musttail call flag differences in ICF [PR119376] 2025-03-21 12:18:35 +01:00
ipa-icf-gimple.h
ipa-icf.cc
ipa-icf.h
ipa-inline-analysis.cc
ipa-inline-transform.cc
ipa-inline.cc Add coverage_instrumentation_p 2025-03-27 00:01:15 +01:00
ipa-inline.h
ipa-modref-tree.cc
ipa-modref-tree.h
ipa-modref.cc ipa/111245 - bogus modref analysis for store in call that might throw 2025-02-28 13:37:54 +01:00
ipa-modref.h
ipa-param-manipulation.cc
ipa-param-manipulation.h
ipa-polymorphic-call.cc
ipa-predicate.cc
ipa-predicate.h
ipa-profile.cc Fix speculation_useful_p 2025-03-13 20:12:33 +01:00
ipa-prop.cc
ipa-prop.h
ipa-pure-const.cc
ipa-ref.cc
ipa-ref.h
ipa-reference.cc
ipa-reference.h
ipa-split.cc fnsplit: Set musttail call during function splitting if there are musttail calls [PR119376] 2025-03-21 12:17:45 +01:00
ipa-sra.cc ipa-sra: Don't change return type to void if there are musttail calls [PR119484] 2025-03-28 10:48:31 +01:00
ipa-strub.cc
ipa-strub.h
ipa-utils.cc
ipa-utils.h
ipa-visibility.cc
ipa.cc
ira-build.cc [rtl-optimization/116244] Don't create bogus regs in alter_subreg 2025-02-07 09:10:59 -07:00
ira-color.cc ira: Add new hooks for callee-save vs spills [PR117477] 2025-03-08 03:57:53 +08:00
ira-conflicts.cc
ira-costs.cc [PR119270][IRA]: Ignore equiv init insns for cost calculation for invariants only 2025-03-19 16:10:37 -04:00
ira-emit.cc
ira-int.h [PR118497][IRA]: Fix calculation of cost of assigning callee-saved hard reg 2025-01-24 13:17:41 -05:00
ira-lives.cc
ira.cc [PR118497][IRA]: Fix calculation of cost of assigning callee-saved hard reg 2025-01-24 13:17:41 -05:00
ira.h
is-a.h
iterator-utils.h
json-parsing.cc
json-parsing.h
json.cc
json.h
jump.cc
langhooks-def.h
langhooks.cc
langhooks.h
LANGUAGES
late-combine.cc late-combine: Tighten register class check [PR108840] 2025-02-18 11:00:57 +00:00
lazy-diagnostic-path.cc
lazy-diagnostic-path.h
lcm.cc
lcm.h
libfuncs.h
libgdiagnostics++.h sarif-replay: display annotations as labelled ranges (§3.28.6) [PR118881] 2025-02-15 08:13:06 -05:00
libgdiagnostics.cc sarif-replay: display annotations as labelled ranges (§3.28.6) [PR118881] 2025-02-15 08:13:06 -05:00
libgdiagnostics.h sarif-replay: display annotations as labelled ranges (§3.28.6) [PR118881] 2025-02-15 08:13:06 -05:00
libgdiagnostics.map sarif-replay: display annotations as labelled ranges (§3.28.6) [PR118881] 2025-02-15 08:13:06 -05:00
libsarifreplay.cc sarif-replay: improve error for unescaped braces in messages (§3.11.5) 2025-02-20 17:10:53 -05:00
libsarifreplay.h
limitx.h
limity.h
lists.cc
lock-and-run.sh
lockfile.cc
lockfile.h
logical-location.h
loop-doloop.cc
loop-init.cc
loop-invariant.cc loop-invariant: Treat inline-asm conditional trapping [PR102150] 2025-02-12 14:34:58 -08:00
loop-iv.cc loop-iv, riscv: Fix get_biv_step_1 for RISC-V [PR117506] 2025-02-06 15:39:18 +01:00
loop-unroll.cc
loop-unroll.h
lower-subreg.cc
lower-subreg.h
lra-assigns.cc [PR119021][LRA]: Fix rtl correctness check failure in LRA. 2025-02-26 11:28:52 -05:00
lra-coalesce.cc
lra-constraints.cc lra, v2: emit caller-save register spills before call insn [PR116028] 2025-03-21 20:26:00 +01:00
lra-eliminations.cc
lra-int.h [PR115458][LRA]: Run split sub-pass more times 2025-02-25 15:04:50 -05:00
lra-lives.cc
lra-remat.cc [PR115568][LRA]: Use more strict output reload check in rematerialization 2025-02-05 14:25:01 -05:00
lra-spills.cc
lra.cc lra: Handle SUBREG in lra_rtx_hash [PR119307] 2025-03-18 14:57:41 +01:00
lra.h
lto-cgraph.cc
lto-compress.cc
lto-compress.h
lto-ltrans-cache.cc
lto-ltrans-cache.h
lto-opts.cc
lto-section-in.cc
lto-section-names.h
lto-section-out.cc
lto-streamer-in.cc
lto-streamer-out.cc Make function_decl_type a scoped enum 2025-03-20 10:07:54 +01:00
lto-streamer.cc
lto-streamer.h
lto-wrapper.cc
machmode.def
machmode.h
main.cc
make-unique.h
Makefile.in Add prime path coverage to gcc/gcov 2025-03-26 23:37:19 +01:00
match.pd middle-end/118795 - fix can_vec_perm_const_p query in match.pd 2025-03-26 08:12:48 +01:00
mcf.cc
mem-stats-traits.h
mem-stats.h
memmodel.h
memory-block.cc
memory-block.h
mkconfig.sh
mode-classes.def
mode-switching.cc
modulo-sched.cc
multiple_target.cc ipa: target clone and mangling alias [PR114992] 2025-03-21 12:45:00 -04:00
mux-utils.h
obstack-utils.h
omp-api.h
omp-builtins.def OpenMP: 'interop' construct - add ME support + target-independent libgomp 2025-03-21 19:24:16 +01:00
omp-expand.cc
omp-expand.h
omp-general.cc omp-general.cc: Remove 'if' around call to always 'true' returning function [PR118627] 2025-03-25 15:02:54 +01:00
omp-general.h OpenMP: Pass a 3-way flag to omp_check_context_selector instead of a bool. 2025-02-11 17:04:48 +00:00
omp-low.cc OpenMP: 'interop' construct - add ME support + target-independent libgomp 2025-03-21 19:24:16 +01:00
omp-low.h
omp-oacc-kernels-decompose.cc
omp-oacc-neuter-broadcast.cc
omp-offload.cc
omp-offload.h
omp-selectors.h
omp-simd-clone.cc openmp: Fix up simd clone mask argument creation on x86 [PR115871] 2025-03-01 09:15:57 +01:00
omp-simd-clone.h
ONEWS
opt-functions.awk
opt-gather.awk
opt-include.awk
opt-problem.cc
opt-problem.h
opt-read.awk
opt-suggestions.cc
opt-suggestions.h
optabs-libfuncs.cc
optabs-libfuncs.h
optabs-query.cc optabs: Fix widening optabs for vec-mode -> scalar-mode [PR116926] 2025-02-04 00:19:09 -08:00
optabs-query.h
optabs-tree.cc
optabs-tree.h
optabs.cc opcodes: fix wrong code in expand_binop_directly [PR117811] 2025-03-25 10:25:54 +00:00
optabs.def
optabs.h
optc-gen.awk
optc-save-gen.awk options: Adjust cl_optimization_compare to avoid checking ICE [PR115913] 2025-02-02 10:09:25 -05:00
opth-gen.awk
optinfo-emit-json.cc
optinfo-emit-json.h
optinfo.cc
optinfo.h
options-urls-cc-gen.awk
opts-common.cc
opts-diagnostic.cc sarif output: fix alphabetization in sarif_scheme_handler::make_sink 2025-02-18 16:54:52 -05:00
opts-diagnostic.h
opts-global.cc
opts-jobserver.h
opts.cc Add -[DU]_FORTIFY_SOURCE[=n] to DW_AT_producer 2025-03-17 08:43:15 +01:00
opts.h
ordered-hash-map-tests.cc
ordered-hash-map.h
output.h
pair-fusion.cc pair-fusion: Add singleton move_range asserts [PR114492] 2025-03-06 11:37:00 +00:00
pair-fusion.h
params.opt Fix file cache tunables documentation 2025-02-04 08:43:59 -08:00
params.opt.urls
pass_manager.h
passes.cc Add coverage_instrumentation_p 2025-03-27 00:01:15 +01:00
passes.def
path-coverage.cc Add prime path coverage to gcc/gcov 2025-03-26 23:37:19 +01:00
plugin.cc jit/118780 - make sure to include dlfcn.h when plugin support is disabled 2025-02-07 16:01:46 +01:00
plugin.def
plugin.h
pointer-query.cc
pointer-query.h
poly-int-types.h
poly-int.h
postreload-gcse.cc
postreload.cc
predict.cc
predict.def
predict.h
prefix.cc
prefix.h
pretty-print-format-impl.h
pretty-print-markup.h
pretty-print-urlifier.h
pretty-print.cc
pretty-print.h
prime-paths.cc Add prime path coverage to gcc/gcov 2025-03-26 23:37:19 +01:00
print-rtl-function.cc
print-rtl.cc
print-rtl.h
print-tree.cc
print-tree.h
profile-count.cc
profile-count.h
profile.cc Add coverage_instrumentation_p 2025-03-27 00:01:15 +01:00
profile.h Add coverage_instrumentation_p 2025-03-27 00:01:15 +01:00
range-op-float.cc
range-op-mixed.h
range-op-ptr.cc
range-op.cc
range-op.h
range.cc
range.h
read-md.cc
read-md.h
read-rtl-function.cc
read-rtl-function.h
read-rtl.cc
README.Portability
real.cc
real.h
realmpfr.cc
realmpfr.h
recog.cc
recog.h
ree.cc
reg-notes.def
reg-stack.cc
regcprop.cc
regcprop.h
regenerate-attr-urls.py
regenerate-opt-urls.py
reginfo.cc
regrename.cc
regrename.h
regs.h
regset.h
regstat.cc
reload.cc
reload.h
reload1.cc
reorg.cc
resource.cc
resource.h
rtl-error.cc
rtl-error.h
rtl-iter.h
rtl-ssa.h
rtl-tests.cc
rtl.cc
rtl.def
rtl.h
rtlanal.cc PR rtl-optimization/119046: Don't mark PARALLEL RTXes with floating-point mode as trapping 2025-03-05 16:21:36 +01:00
rtlanal.h
rtlhash.cc
rtlhash.h
rtlhooks-def.h
rtlhooks.cc
rtx-vector-builder.cc
rtx-vector-builder.h
run-rtl-passes.cc
run-rtl-passes.h
sancov.cc
sanitizer.def
sanopt.cc
sarif-replay.cc
sarif-spec-urls.def
sbitmap.cc
sbitmap.h
sched-deps.cc
sched-ebb.cc
sched-int.h
sched-rgn.cc
sel-sched-dump.cc
sel-sched-dump.h
sel-sched-ir.cc
sel-sched-ir.h
sel-sched.cc
sel-sched.h
selftest-diagnostic-path.cc
selftest-diagnostic-path.h
selftest-diagnostic-show-locus.h
selftest-diagnostic.cc
selftest-diagnostic.h
selftest-json.cc
selftest-json.h
selftest-logical-location.cc
selftest-logical-location.h
selftest-rtl.cc
selftest-rtl.h
selftest-run-tests.cc Add prime path coverage to gcc/gcov 2025-03-26 23:37:19 +01:00
selftest-tree.h
selftest.cc
selftest.h Add prime path coverage to gcc/gcov 2025-03-26 23:37:19 +01:00
sese.cc Append a newline in debug_edge 2025-02-22 04:30:21 +08:00
sese.h
shortest-paths.h
shrink-wrap.cc
shrink-wrap.h
signop.h
simple-diagnostic-path.cc simple-diagnostic-path: Inline two trivial methods [PR116143] 2025-02-26 10:50:51 +01:00
simple-diagnostic-path.h simple-diagnostic-path: Inline two trivial methods [PR116143] 2025-02-26 10:50:51 +01:00
simplify-rtx.cc simplify-rtx: Fix up simplify_logical_relational_operation [PR119002] 2025-03-04 10:44:34 +00:00
sort.cc
sparseset.cc
sparseset.h
spellcheck-tree.cc
spellcheck-tree.h
spellcheck.cc
spellcheck.h
splay-tree-utils.cc
splay-tree-utils.h
splay-tree-utils.tcc
sreal.cc
sreal.h
ssa-iterators.h
ssa.h
stack-ptr-mod.cc
statistics.cc
statistics.h
stmt.cc
stmt.h
stor-layout.cc
stor-layout.h
store-motion.cc
streamer-hooks.cc
streamer-hooks.h
stringpool.cc
stringpool.h
substring-locations.cc
substring-locations.h
symbol-summary.h
symtab-clones.cc
symtab-clones.h
symtab-thunks.cc
symtab-thunks.h
symtab.cc
sync-builtins.def
system.h jit/118780 - make sure to include dlfcn.h when plugin support is disabled 2025-02-07 16:01:46 +01:00
target-def.h
target-globals.cc
target-globals.h
target-hooks-macros.h
target-insns.def
target.def ira: Add new hooks for callee-save vs spills [PR117477] 2025-03-08 03:57:53 +08:00
target.h ira: Add new hooks for callee-save vs spills [PR117477] 2025-03-08 03:57:53 +08:00
targhooks.cc ira: Add new hooks for callee-save vs spills [PR117477] 2025-03-08 03:57:53 +08:00
targhooks.h ira: Add new hooks for callee-save vs spills [PR117477] 2025-03-08 03:57:53 +08:00
text-range-label.h
timevar.cc
timevar.def
timevar.h
toplev.cc diagnostics: fix crash in urlifier with -Wfatal-errors [PR119366] 2025-03-19 15:03:42 -04:00
toplev.h
tracer.cc
tracer.h
trans-mem.cc
trans-mem.h
tree-affine.cc
tree-affine.h
tree-assume.cc tree-assume: Fix UB in assume_query [PR118605] 2025-01-23 11:47:19 +01:00
tree-call-cdce.cc
tree-cfg.cc discriminators: Fix assigning discriminators on edge [PR113546] 2025-03-16 11:46:06 -07:00
tree-cfg.h
tree-cfgcleanup.cc
tree-cfgcleanup.h
tree-chrec.cc
tree-chrec.h
tree-complex.cc complex: Don't DCE unused COMPLEX_EXPRs for -O0 [PR119190] 2025-03-11 10:57:30 +01:00
tree-core.h Make function_decl_type a scoped enum 2025-03-20 10:07:54 +01:00
tree-data-ref.cc vect: Enforce dr_with_seg_len::align precondition [PR116125] 2025-03-07 10:18:35 +00:00
tree-data-ref.h
tree-dfa.cc
tree-dfa.h
tree-diagnostic-client-data-hooks.cc
tree-diagnostic.cc
tree-diagnostic.h
tree-dump.cc
tree-dump.h
tree-eh.cc [ifcombine] avoid creating out-of-bounds BIT_FIELD_REFs [PR118514] 2025-02-07 08:30:47 -03:00
tree-eh.h [ifcombine] avoid creating out-of-bounds BIT_FIELD_REFs [PR118514] 2025-02-07 08:30:47 -03:00
tree-emutls.cc
tree-hash-traits.h
tree-hasher.h
tree-if-conv.cc
tree-if-conv.h
tree-inline.cc inliner: Silently drop musttail flag on calls during inlining unless the inlined routine was musttail called [PR119376] 2025-03-21 12:17:01 +01:00
tree-inline.h
tree-into-ssa.cc
tree-into-ssa.h
tree-iterator.cc c++: Fix up regressions caused by for/while loops with declarations [PR118822] 2025-02-13 10:21:29 +01:00
tree-iterator.h c++: Fix up regressions caused by for/while loops with declarations [PR118822] 2025-02-13 10:21:29 +01:00
tree-logical-location.cc
tree-logical-location.h
tree-loop-distribution.cc tree-optimization/112859 - add comment 2025-01-28 15:03:05 +01:00
tree-nested.cc
tree-nested.h
tree-nrv.cc
tree-object-size.cc
tree-object-size.h
tree-outof-ssa.cc tree-optimization/86270 - improve SSA coalescing for loop exit test 2025-02-20 08:38:41 +01:00
tree-outof-ssa.h
tree-parloops.cc
tree-parloops.h
tree-pass.h
tree-phinodes.cc
tree-phinodes.h
tree-predcom.cc tree-optimization/118954 - avoid UB on ref created by predcom 2025-02-21 13:05:13 +01:00
tree-pretty-print-markup.h
tree-pretty-print.cc Clarify 'OMP_CLAUSE_MAP_RUNTIME_IMPLICIT_P' in 'gcc/tree-pretty-print.cc:dump_omp_clause' 2025-01-28 11:33:28 +01:00
tree-pretty-print.h
tree-profile.cc Add coverage_instrumentation_p 2025-03-27 00:01:15 +01:00
tree-scalar-evolution.cc tree-optimization/118521 - bogus diagnostic from unreachable code 2025-02-20 15:18:11 +01:00
tree-scalar-evolution.h
tree-sra.cc
tree-sra.h
tree-ssa-address.cc
tree-ssa-address.h
tree-ssa-alias-compare.h
tree-ssa-alias.cc Fix a pasto in ao_compare::compare_ao_refs 2025-03-11 14:53:14 +01:00
tree-ssa-alias.h
tree-ssa-ccp.cc
tree-ssa-ccp.h
tree-ssa-coalesce.cc
tree-ssa-coalesce.h
tree-ssa-copy.cc
tree-ssa-dce.cc middle-end/118801 - excessive redundant DEBUG BEGIN_STMT 2025-03-07 09:59:18 +01:00
tree-ssa-dce.h
tree-ssa-dom.cc tree-optimization/87984 - hard register assignments not preserved 2025-02-28 12:38:00 +01:00
tree-ssa-dom.h
tree-ssa-dse.cc tree-ssa-dce: Avoid creating invalid BBs with no outgoing edge (PR117892) 2025-01-29 10:51:34 +01:00
tree-ssa-dse.h
tree-ssa-forwprop.cc tree-optimization/90579 - avoid STLF fail by better optimizing 2025-02-14 08:28:50 +01:00
tree-ssa-ifcombine.cc
tree-ssa-live.cc
tree-ssa-live.h
tree-ssa-loop-ch.cc
tree-ssa-loop-im.cc
tree-ssa-loop-ivcanon.cc tree-optimization/118634 - improve cunroll dump 2025-01-24 12:38:48 +01:00
tree-ssa-loop-ivopts.cc middle-end: Remove unused internal function after IVopts cleanup [PR118756] 2025-02-06 17:48:05 +00:00
tree-ssa-loop-ivopts.h
tree-ssa-loop-manip.cc vect: Move induction IV increments [PR110449] 2025-02-06 10:30:53 +00:00
tree-ssa-loop-manip.h vect: Move induction IV increments [PR110449] 2025-02-06 10:30:53 +00:00
tree-ssa-loop-niter.cc niter: Make build_cltz_expr more robust [PR118689] 2025-01-31 11:16:17 +01:00
tree-ssa-loop-niter.h
tree-ssa-loop-prefetch.cc
tree-ssa-loop-split.cc
tree-ssa-loop-unswitch.cc
tree-ssa-loop.cc
tree-ssa-loop.h
tree-ssa-math-opts.cc widening_mul: Fix up further r14-8680 widening mul issues [PR119417] 2025-03-26 14:03:50 +01:00
tree-ssa-math-opts.h
tree-ssa-operands.cc
tree-ssa-operands.h
tree-ssa-phiopt.cc phiopt: Fix value_replacement for middle bb having phi nodes [PR118922] 2025-03-09 11:28:32 -07:00
tree-ssa-phiprop.cc
tree-ssa-pre.cc tree-optimization/118817 - missed folding of PRE inserted code 2025-02-11 12:42:04 +01:00
tree-ssa-propagate.cc
tree-ssa-propagate.h
tree-ssa-reassoc.cc reassoc: Fix up optimize_range_tests_to_bit_test [PR118915] 2025-02-24 12:19:16 +01:00
tree-ssa-reassoc.h
tree-ssa-sccvn.cc tree-optimization/119389 - limit edge processing in dominated_by_p_w_unex 2025-03-20 19:08:02 +01:00
tree-ssa-sccvn.h
tree-ssa-scopedtables.cc
tree-ssa-scopedtables.h
tree-ssa-sink.cc tree-optimization/118717 - store commoning vs. abnormals 2025-02-03 11:23:22 +01:00
tree-ssa-strlen.cc
tree-ssa-strlen.h
tree-ssa-structalias.cc
tree-ssa-tail-merge.cc tree-optimization/98845 - ICE with tail-merging and DCE/DSE disabled 2025-02-18 08:55:47 +01:00
tree-ssa-ter.cc
tree-ssa-ter.h
tree-ssa-threadbackward.cc
tree-ssa-threadedge.cc
tree-ssa-threadedge.h
tree-ssa-threadupdate.cc
tree-ssa-threadupdate.h
tree-ssa-uncprop.cc
tree-ssa-uninit.cc
tree-ssa.cc
tree-ssa.h
tree-ssanames.cc
tree-ssanames.h
tree-stdarg.cc
tree-stdarg.h
tree-streamer-in.cc
tree-streamer-out.cc Make function_decl_type a scoped enum 2025-03-20 10:07:54 +01:00
tree-streamer.cc
tree-streamer.h
tree-switch-conversion.cc
tree-switch-conversion.h
tree-tailcall.cc tailc: Handle musttail noreturn calls [PR119483] 2025-03-28 10:49:40 +01:00
tree-vect-data-refs.cc vect: Fix build on MacOS 2025-03-07 16:14:18 +01:00
tree-vect-generic.cc vect: Add assert to expand_vector_conversion [PR118616] 2025-03-24 16:10:29 -07:00
tree-vect-loop-manip.cc vect: Set counts of early break exit blocks correctly [PR117790] 2025-02-12 15:03:40 +00:00
tree-vect-loop.cc vect: Fix ncopies when costing SLP reductions [PR116901] 2025-03-12 09:40:10 +00:00
tree-vect-patterns.cc vect: Use original LHS type for gather pattern [PR118950]. 2025-02-24 13:11:15 +01:00
tree-vect-slp-patterns.cc
tree-vect-slp.cc vect: Fix aarch64/pr99873_2.c ld4/st4 failure 2025-03-14 10:28:01 +00:00
tree-vect-stmts.cc Fix up some further cases of missing or extraneous spaces in diagnostics 2025-03-22 08:40:56 +01:00
tree-vector-builder.cc
tree-vector-builder.h
tree-vectorizer.cc tree-optimization/119145 - avoid stray .MASK_CALL after vectorization 2025-03-07 12:16:48 +01:00
tree-vectorizer.h middle-end: delay checking for alignment to load [PR118464] 2025-03-07 13:50:39 +00:00
tree-vrp.cc
tree-vrp.h
tree.cc tree: Improve skip_simple_arithmetic [PR119183] 2025-03-11 11:01:55 +01:00
tree.def tree.def: Improve RAW_DATA_CST documentation 2025-03-12 10:11:39 +01:00
tree.h Make function_decl_type a scoped enum 2025-03-20 10:07:54 +01:00
treestruct.def
tristate.cc
tristate.h
tsan.cc
tsan.h
tsystem.h
typeclass.h
typed-splay-tree.cc
typed-splay-tree.h
ubsan.cc
ubsan.h
unique-argv.h
valtrack.cc
valtrack.h
value-pointer-equiv.cc
value-pointer-equiv.h
value-prof.cc
value-prof.h Add coverage_instrumentation_p 2025-03-27 00:01:15 +01:00
value-query.cc
value-query.h
value-range-pretty-print.cc
value-range-pretty-print.h
value-range-storage.cc
value-range-storage.h
value-range.cc value-range: Fix up irange::union_bitmask [PR118953] 2025-03-05 14:30:35 +01:00
value-range.h
value-relation.cc
value-relation.h
var-tracking.cc
varasm.cc nvptx: In offloading compilation, special-case certain host-setup symbol aliases [PR101544] 2025-03-24 09:39:21 +01:00
varasm.h
varpool.cc
vec-perm-indices.cc
vec-perm-indices.h
vec.cc
vec.h
vector-builder.h
vmsdbg.h
vmsdbgout.cc
vr-values.cc [PR tree-optimization/98028] Use relationship between operands to simplify SUB_OVERFLOW 2025-02-15 16:49:12 -07:00
vr-values.h
vtable-verify.cc
vtable-verify.h
warning-control.cc
web.cc
wide-int-bitmask.h
wide-int-print.cc
wide-int-print.h
wide-int.cc
wide-int.h
xcoff.h

Copyright (C) 2000-2025 Free Software Foundation, Inc.

This file is intended to contain a few notes about writing C code
within GCC so that it compiles without error on the full range of
compilers GCC needs to be able to compile on.

The problem is that many ISO-standard constructs are not accepted by
either old or buggy compilers, and we keep getting bitten by them.
This knowledge until now has been sparsely spread around, so I
thought I'd collect it in one useful place.  Please add and correct
any problems as you come across them.

I'm going to start from a base of the ISO C90 standard, since that is
probably what most people code to naturally.  Obviously using
constructs introduced after that is not a good idea.

For the complete coding style conventions used in GCC, please read
http://gcc.gnu.org/codingconventions.html


String literals
---------------

Some compilers like MSVC++ have fairly low limits on the maximum
length of a string literal; 509 is the lowest we've come across.  You
may need to break up a long printf statement into many smaller ones.


Empty macro arguments
---------------------

ISO C (6.8.3 in the 1990 standard) specifies the following:

If (before argument substitution) any argument consists of no
preprocessing tokens, the behavior is undefined.

This was relaxed by ISO C99, but some older compilers emit an error,
so code like

#define foo(x, y) x y
foo (bar, )

needs to be coded in some other way.


Avoid unnecessary test before free
----------------------------------

Since SunOS 4 stopped being a reasonable portability target,
(which happened around 2007) there has been no need to guard
against "free (NULL)".  Thus, any guard like the following
constitutes a redundant test:

  if (P)
    free (P);

It is better to avoid the test.[*]
Instead, simply free P, regardless of whether it is NULL.

[*] However, if your profiling exposes a test like this in a
performance-critical loop, say where P is nearly always NULL, and
the cost of calling free on a NULL pointer would be prohibitively
high, consider using __builtin_expect, e.g., like this:

  if (__builtin_expect (ptr != NULL, 0))
    free (ptr);



Trigraphs
---------

You weren't going to use them anyway, but some otherwise ISO C
compliant compilers do not accept trigraphs.


Suffixes on Integer Constants
-----------------------------

You should never use a 'l' suffix on integer constants ('L' is fine),
since it can easily be confused with the number '1'.


			Common Coding Pitfalls
			======================

errno
-----

errno might be declared as a macro.


Implicit int
------------

In C, the 'int' keyword can often be omitted from type declarations.
For instance, you can write

  unsigned variable;

as shorthand for

  unsigned int variable;

There are several places where this can cause trouble.  First, suppose
'variable' is a long; then you might think

  (unsigned) variable

would convert it to unsigned long.  It does not.  It converts to
unsigned int.  This mostly causes problems on 64-bit platforms, where
long and int are not the same size.

Second, if you write a function definition with no return type at
all:

  operate (int a, int b)
  {
    ...
  }

that function is expected to return int, *not* void.  GCC will warn
about this.

Implicit function declarations always have return type int.  So if you
correct the above definition to

  void
  operate (int a, int b)
  ...

but operate() is called above its definition, you will get an error
about a "type mismatch with previous implicit declaration".  The cure
is to prototype all functions at the top of the file, or in an
appropriate header.

Char vs unsigned char vs int
----------------------------

In C, unqualified 'char' may be either signed or unsigned; it is the
implementation's choice.  When you are processing 7-bit ASCII, it does
not matter.  But when your program must handle arbitrary binary data,
or fully 8-bit character sets, you have a problem.  The most obvious
issue is if you have a look-up table indexed by characters.

For instance, the character '\341' in ISO Latin 1 is SMALL LETTER A
WITH ACUTE ACCENT.  In the proper locale, isalpha('\341') will be
true.  But if you read '\341' from a file and store it in a plain
char, isalpha(c) may look up character 225, or it may look up
character -31.  And the ctype table has no entry at offset -31, so
your program will crash.  (If you're lucky.)

It is wise to use unsigned char everywhere you possibly can.  This
avoids all these problems.  Unfortunately, the routines in <string.h>
take plain char arguments, so you have to remember to cast them back
and forth - or avoid the use of strxxx() functions, which is probably
a good idea anyway.

Another common mistake is to use either char or unsigned char to
receive the result of getc() or related stdio functions.  They may
return EOF, which is outside the range of values representable by
char.  If you use char, some legal character value may be confused
with EOF, such as '\377' (SMALL LETTER Y WITH UMLAUT, in Latin-1).
The correct choice is int.

A more subtle version of the same mistake might look like this:

  unsigned char pushback[NPUSHBACK];
  int pbidx;
  #define unget(c) (assert(pbidx < NPUSHBACK), pushback[pbidx++] = (c))
  #define get(c) (pbidx ? pushback[--pbidx] : getchar())
  ...
  unget(EOF);

which will mysteriously turn a pushed-back EOF into a SMALL LETTER Y
WITH UMLAUT.


Other common pitfalls
---------------------

o Expecting 'plain' char to be either sign or unsigned extending.

o Shifting an item by a negative amount or by greater than or equal to
  the number of bits in a type (expecting shifts by 32 to be sensible
  has caused quite a number of bugs at least in the early days).

o Expecting ints shifted right to be sign extended.

o Modifying the same value twice within one sequence point.

o Host vs. target floating point representation, including emitting NaNs
  and Infinities in a form that the assembler handles.

o qsort being an unstable sort function (unstable in the sense that
  multiple items that sort the same may be sorted in different orders
  by different qsort functions).

o Passing incorrect types to fprintf and friends.

o Adding a function declaration for a module declared in another file to
  a .c file instead of to a .h file.