gcc/gcc
Roger Sayle 129feec0ba [Committed] PR target/110843: Check TARGET_AVX512VL for V2DI rotates in STV.
This patch resolves PR target/110843, an ICE caused by my enhancement to
support AVX512 DImode and SImode rotates in the scalar-to-vector (STV) pass.
Although the vprotate instructions are available on all TARGET_AVX512F
microarchitectures, the V2DI and V4SI variants are only available on the
TARGET_AVX512VL subset, leading to problems when command line options
enable AVX512 (i.e. AVX512F) but not the required AVX512VL functionality.
The simple fix is to update/correct the target checks.

2023-07-31  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
	PR target/110843
	* config/i386/i386-features.cc (compute_convert_gain): Check
	TARGET_AVX512VL (not TARGET_AVX512F) when considering V2DImode
	and V4SImode rotates in STV.
	(general_scalar_chain::convert_rotate): Likewise.

gcc/testsuite/ChangeLog
	PR target/110843
	* gcc.target/i386/pr110843.c: New test case.
2023-07-31 08:08:11 +01:00
..
ada Daily bump. 2023-07-29 00:17:43 +00:00
analyzer Daily bump. 2023-07-27 00:17:56 +00:00
c Daily bump. 2023-06-30 00:17:51 +00:00
c-family Daily bump. 2023-07-21 00:17:07 +00:00
common [PATCH 1/5] [RISC-V] Recognize Zicond extension 2023-07-26 15:10:53 -06:00
config [Committed] PR target/110843: Check TARGET_AVX512VL for V2DI rotates in STV. 2023-07-31 08:08:11 +01:00
cp Daily bump. 2023-07-29 00:17:43 +00:00
d Daily bump. 2023-07-11 00:16:56 +00:00
doc bpf: ISA V4 sign-extending move and load insns [PR110782,PR110784] 2023-07-27 15:35:52 -07:00
fortran Daily bump. 2023-07-29 00:17:43 +00:00
ginclude
go cmd/go: don't collect package CGOLDFLAGS when using gccgo 2023-07-20 12:29:11 -07:00
jit
lto Daily bump. 2023-07-06 00:17:51 +00:00
m2 Daily bump. 2023-07-26 00:17:44 +00:00
objc
objcp
po Daily bump. 2023-07-29 00:17:43 +00:00
rtl-ssa RTL_SSA: Relax PHI_MODE in phi_setup 2023-07-18 11:23:34 +08:00
rust Daily bump. 2023-07-06 00:17:51 +00:00
testsuite [Committed] PR target/110843: Check TARGET_AVX512VL for V2DI rotates in STV. 2023-07-31 08:08:11 +01:00
text-art analyzer/text-art: fix clang warnings [PR110433,PR110612] 2023-07-20 20:24:06 -04:00
ABOUT-GCC-NLS
acinclude.m4
aclocal.m4
addresses.h
adjust-alignment.cc
alias.cc
alias.h
align.h
alloc-pool.cc
alloc-pool.h
array-traits.h
asan.cc
asan.h
attr-fnspec.h
attribs.cc
attribs.h
auto-inc-dec.cc
auto-profile.cc
auto-profile.h
backend.h
BASE-VER
basic-block.h
bb-reorder.cc
bb-reorder.h
bitmap.cc
bitmap.h
btfout.cc
builtin-attrs.def
builtin-types.def
builtins.cc Add __builtin_iseqsig() 2023-07-20 10:48:17 +02:00
builtins.def Add __builtin_iseqsig() 2023-07-20 10:48:17 +02:00
builtins.h
caller-save.cc
calls.cc calls: Change return type of predicate function from int to bool 2023-06-20 19:44:14 +02:00
calls.h calls: Change return type of predicate function from int to bool 2023-06-20 19:44:14 +02:00
ccmp.cc
ccmp.h
cfg-flags.def
cfg.cc Improve dumping of profile_count 2023-07-09 15:14:54 +02:00
cfg.h updat_bb_profile_for_threading TLC 2023-07-06 16:19:15 +02:00
cfganal.cc
cfganal.h
cfgbuild.cc
cfgbuild.h
cfgcleanup.cc
cfgcleanup.h
cfgexpand.cc
cfgexpand.h
cfghooks.cc cfg+gcse: Change return type of predicate functions from int to bool 2023-07-11 18:34:39 +02:00
cfghooks.h cfg+gcse: Change return type of predicate functions from int to bool 2023-07-11 18:34:39 +02:00
cfgloop.cc Use sreal::nearest_int 2023-07-21 16:51:46 +02:00
cfgloop.h Fix profile update after RTL unrolling 2023-07-27 20:08:38 +02:00
cfgloopanal.cc Implement flat loop profile detection 2023-07-21 17:34:31 +02:00
cfgloopmanip.cc Cleanup profile updating code in unrolling and splitting 2023-07-28 19:39:19 +02:00
cfgloopmanip.h Cleanup profile updating code in unrolling and splitting 2023-07-28 19:39:19 +02:00
cfgrtl.cc Fix profile update after RTL unrolling 2023-07-27 20:08:38 +02:00
cfgrtl.h cfg+gcse: Change return type of predicate functions from int to bool 2023-07-11 18:34:39 +02:00
cgraph.cc
cgraph.h
cgraphbuild.cc
cgraphclones.cc
cgraphunit.cc
ChangeLog Daily bump. 2023-07-30 00:17:03 +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.dataflow
ChangeLog.gimple-classes
ChangeLog.graphite
ChangeLog.jit
ChangeLog.lib
ChangeLog.ptr
ChangeLog.tree-ssa
ChangeLog.tuples
cif-code.def
collect2-aix.cc
collect2-aix.h
collect2.cc
collect2.h
collect-utils.cc
collect-utils.h
color-macros.h diagnostics: add support for "text art" diagrams 2023-06-21 21:49:00 -04:00
combine-stack-adj.cc combine-stack-adj: Change return type of predicate function from int to bool 2023-07-17 22:32:57 +02:00
combine.cc Move combine over to statistics_counter_event. 2023-07-20 08:56:42 -07:00
common.md
common.opt Provide -fcf-protection=branch,return. 2023-07-21 11:06:15 +08:00
compare-elim.cc
conditions.h
config.build
config.gcc Initial Lunar Lake, Arrow Lake and Arrow Lake S Support 2023-07-17 11:24:16 +08:00
config.host
config.in Darwin: Handle linker '-demangle' option. 2023-07-21 15:47:13 +01:00
configure Darwin: Handle linker '-demangle' option. 2023-07-21 15:47:13 +01:00
configure.ac Darwin: Handle linker '-demangle' option. 2023-07-21 15:47:13 +01:00
context.cc
context.h
convert.cc
convert.h
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
coretypes.h
coroutine-builtins.def
coroutine-passes.cc
coverage.cc
coverage.h
cppbuiltin.cc
cppbuiltin.h
cppdefault.cc
cppdefault.h
cprop.cc cprop: Do not set REG_EQUAL note when simplifying paradoxical subreg [PR110206] 2023-07-14 17:16:59 +02:00
cse.cc
cselib.cc cselib+expr+bitmap: Change return type of predicate functions from int to bool 2023-06-29 17:29:47 +02:00
cselib.h cselib+expr+bitmap: Change return type of predicate functions from int to bool 2023-06-29 17:29:47 +02:00
cstamp-h.in
ctfc.cc
ctfc.h
ctfout.cc
data-streamer-in.cc Implement value/mask tracking for irange. 2023-07-07 09:55:58 +02:00
data-streamer-out.cc Implement value/mask tracking for irange. 2023-07-07 09:55:58 +02:00
data-streamer.cc
data-streamer.h
DATESTAMP Daily bump. 2023-07-31 00:16:58 +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-scan.cc
df.h
dfp.cc
dfp.h
diagnostic-client-data-hooks.h
diagnostic-color.cc
diagnostic-color.h
diagnostic-core.h
diagnostic-diagram.h diagnostics: add support for "text art" diagrams 2023-06-21 21:49:00 -04:00
diagnostic-event-id.h
diagnostic-format-json.cc diagnostics: add support for "text art" diagrams 2023-06-21 21:49:00 -04:00
diagnostic-format-sarif.cc text-art: remove explicit #include of C++ standard library headers 2023-06-23 21:18:15 -04:00
diagnostic-metadata.h
diagnostic-path.h
diagnostic-show-locus.cc
diagnostic-spec.cc
diagnostic-spec.h
diagnostic-text-art.h diagnostics: add support for "text art" diagrams 2023-06-21 21:49:00 -04:00
diagnostic-url.h
diagnostic.cc text-art: remove explicit #include of C++ standard library headers 2023-06-23 21:18:15 -04:00
diagnostic.def
diagnostic.h diagnostics: add support for "text art" diagrams 2023-06-21 21:49:00 -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 Move combine over to statistics_counter_event. 2023-07-20 08:56:42 -07:00
dumpfile.h Move combine over to statistics_counter_event. 2023-07-20 08:56:42 -07:00
dwarf2asm.cc dwarf2: Change return type of predicate functions from int to bool 2023-07-18 18:47:50 +02:00
dwarf2asm.h
dwarf2cfi.cc dwarf2: Change return type of predicate functions from int to bool 2023-07-18 18:47:50 +02:00
dwarf2ctf.cc
dwarf2ctf.h
dwarf2out.cc dwarf2: Change return type of predicate functions from int to bool 2023-07-18 18:47:50 +02: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 Use chain_next on eh_landing_pad_d for GTY (PR middle-end/110510) 2023-07-03 14:45:33 -07:00
exec-tool.in
explow.cc
explow.h
expmed.cc
expmed.h
expr.cc PR rtl-optimization/110587: Reduce useless moves in compile-time hog. 2023-07-28 09:39:46 +01:00
expr.h cselib+expr+bitmap: Change return type of predicate functions from int to bool 2023-06-29 17:29:47 +02:00
fibonacci_heap.cc
fibonacci_heap.h
file-find.cc
file-find.h
file-prefix-map.cc
file-prefix-map.h
final.cc final+varasm: Change return type of predicate functions from int to bool 2023-06-28 16:30:26 +02:00
fixed-value.cc
fixed-value.h
flag-types.h Add leafy mode for zero-call-used-regs 2023-06-28 01:28:47 -03:00
flags.h
fold-const-call.cc
fold-const-call.h
fold-const.cc c++: constexpr bit_cast with empty field 2023-07-18 11:47:08 -04:00
fold-const.h fold-const+optabs: Change return type of predicate functions from int to bool 2023-06-30 16:04:02 +02:00
fp-test.cc
FSFChangeLog
FSFChangeLog.10
FSFChangeLog.11
function-abi.cc
function-abi.h
function-tests.cc
function.cc Add leafy mode for zero-call-used-regs 2023-06-28 01:28:47 -03:00
function.h function: Change return type of predicate function from int to bool 2023-06-21 21:56:14 +02:00
fwprop.cc cprop: Do not set REG_EQUAL note when simplifying paradoxical subreg [PR110206] 2023-07-14 17:16:59 +02:00
gcc-ar.cc
gcc-main.cc
gcc-plugin.h
gcc-rich-location.cc
gcc-rich-location.h
gcc-symtab.h
gcc.cc diagnostics: add support for "text art" diagrams 2023-06-21 21:49:00 -04:00
gcc.h
gcov-counter.def
gcov-dump.cc
gcov-io.cc
gcov-io.h
gcov-tool.cc
gcov.cc
gcse-common.cc
gcse-common.h
gcse.cc GCSE: Export 'insert_insn_end_basic_block' as global function 2023-07-10 22:16:50 +08:00
gcse.h GCSE: Export 'insert_insn_end_basic_block' as global function 2023-07-10 22:16:50 +08:00
gdbasan.in
gdbhooks.py
gdbinit.in
gen-pass-instances.awk
genattr-common.cc
genattr.cc
genattrtab.cc
genautomata.cc
gencfn-macros.cc
gencheck.cc
genchecksum.cc
gencodes.cc
genconditions.cc
genconfig.cc
genconstants.cc
genemit.cc
genenums.cc
generic-match-head.cc tree-optimization/91838 - fix FAIL of g++.dg/opt/pr91838.C 2023-07-27 15:55:18 +02:00
generic-match.h
genextract.cc
genflags.cc
gengenrtl.cc
gengtype-lex.l
gengtype-parse.cc GTY: Clean up obsolete parametrized structs remnants 2023-07-06 11:59:08 +02:00
gengtype-state.cc
gengtype.cc GTY: Clean up obsolete parametrized structs remnants 2023-07-06 11:59:08 +02:00
gengtype.h GTY: Clean up obsolete parametrized structs remnants 2023-07-06 11:59:08 +02:00
genhooks.cc
genmatch.cc SSA MATH: Support COND_LEN_FMA for floating-point math optimization 2023-07-13 21:46:58 +08:00
genmddeps.cc
genmddump.cc
genmodes.cc
genmultilib
genopinit.cc cleanup: Change LEN_MASK into MASK_LEN 2023-07-21 16:33:51 +08:00
genoutput.cc
genpeep.cc
genpreds.cc
genrecog.cc
gensupport.cc genopinit: Allow more than 256 modes. 2023-07-12 13:57:17 +02:00
gensupport.h
gentarget-def.cc
genversion.cc
ggc-common.cc GGC, GTY: Tighten up a few things re 'reorder' option and strings 2023-07-06 11:59:08 +02:00
ggc-internal.h GGC: Remove unused 'bool is_string' arguments to 'ggc_pch_{count,alloc,write}_object' 2023-07-06 11:59:07 +02:00
ggc-none.cc
ggc-page.cc GGC: Remove unused 'bool is_string' arguments to 'ggc_pch_{count,alloc,write}_object' 2023-07-06 11:59:07 +02:00
ggc-tests.cc
ggc.h tree+ggc: Change return type of predicate functions from int to bool 2023-07-03 16:33:11 +02:00
gimple-array-bounds.cc
gimple-array-bounds.h
gimple-builder.cc
gimple-builder.h
gimple-expr.cc
gimple-expr.h
gimple-fold.cc cleanup: Change LEN_MASK into MASK_LEN 2023-07-21 16:33:51 +08:00
gimple-fold.h
gimple-harden-conditionals.cc
gimple-if-to-switch.cc
gimple-isel.cc middle-end/105715 - missed RTL if-conversion with COND_EXPR expansion 2023-07-18 15:42:52 +02:00
gimple-iterator.cc
gimple-iterator.h
gimple-laddress.cc
gimple-loop-interchange.cc
gimple-loop-jam.cc
gimple-loop-versioning.cc
gimple-low.cc
gimple-low.h
gimple-match-exports.cc
gimple-match-head.cc tree-optimization/91838 - fix FAIL of g++.dg/opt/pr91838.C 2023-07-27 15:55:18 +02:00
gimple-match.h
gimple-predicate-analysis.cc tree-optimization/110392 - ICE with predicate analysis 2023-06-26 12:59:06 +02:00
gimple-predicate-analysis.h
gimple-predict.h
gimple-pretty-print.cc
gimple-pretty-print.h
gimple-range-cache.cc Add a merge_range to ssa_cache and use it. add empty_p and param tweaks. 2023-07-28 16:32:12 -04:00
gimple-range-cache.h Add a merge_range to ssa_cache and use it. add empty_p and param tweaks. 2023-07-28 16:32:12 -04:00
gimple-range-edge.cc
gimple-range-edge.h
gimple-range-fold.cc
gimple-range-fold.h
gimple-range-gori.cc Make compute_operand_range a tail call. 2023-07-05 19:06:31 -04:00
gimple-range-gori.h Make compute_operand2_range a leaf call. 2023-07-05 19:06:30 -04:00
gimple-range-infer.cc
gimple-range-infer.h
gimple-range-op.cc [range-op] Take known set bits into account in popcount [PR107053] 2023-07-12 23:15:52 +02:00
gimple-range-op.h
gimple-range-path.cc
gimple-range-path.h
gimple-range-phi.cc
gimple-range-phi.h
gimple-range-tests.cc
gimple-range-trace.cc
gimple-range-trace.h
gimple-range.cc Add a merge_range to ssa_cache and use it. add empty_p and param tweaks. 2023-07-28 16:32:12 -04:00
gimple-range.h
gimple-ssa-backprop.cc
gimple-ssa-isolate-paths.cc
gimple-ssa-nonnull-compare.cc
gimple-ssa-split-paths.cc
gimple-ssa-sprintf.cc
gimple-ssa-store-merging.cc tree-optimization/110496 - TYPE_PRECISION issue with store-merging 2023-06-30 12:59:36 +02:00
gimple-ssa-strength-reduction.cc
gimple-ssa-warn-access.cc
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
gimple.def
gimple.h Provide extra checking for phi argument access from edge 2023-07-14 10:35:41 +02:00
gimplify-me.cc
gimplify-me.h
gimplify.cc PR c/110699: Defend against error_mark_node in gimplify.cc. 2023-07-21 20:37:59 +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 RA+sched: Change TRUE/FALSE to true/false 2023-07-13 17:47:49 +02:00
hard-reg-set.h
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: Change return type of predicate functions from int to bool 2023-07-12 16:30:41 +02:00
ifcvt.h
inchash.cc
inchash.h
incpath.cc
incpath.h
init-regs.cc
input.cc
input.h
insn-addr.h
insn-notes.def
int-vector-builder.h
internal-fn.cc cleanup: make all cond_len_* and mask_len_* consistent on the order of mask and len 2023-07-21 16:34:45 +08:00
internal-fn.def cleanup: Change LEN_MASK into MASK_LEN 2023-07-21 16:33:51 +08:00
internal-fn.h SSA MATH: Support COND_LEN_FMA for floating-point math optimization 2023-07-13 21:46:58 +08:00
intl.cc
intl.h
ipa-comdats.cc
ipa-cp.cc Convert remaining uses of value_range in ipa-*.cc to Value_Range. 2023-06-27 11:25:48 +02:00
ipa-devirt.cc LTO: Capture 'lto_file_decl_data *file_data' in 'class lto_input_block' 2023-07-04 14:10:54 +02:00
ipa-fnsummary.cc LTO: Capture 'lto_file_decl_data *file_data' in 'class lto_input_block' 2023-07-04 14:10:54 +02:00
ipa-fnsummary.h Enable early inlining into always_inline functions 2023-06-28 23:06:18 +02:00
ipa-free-lang-data.cc
ipa-icf-gimple.cc
ipa-icf-gimple.h
ipa-icf.cc LTO: Capture 'lto_file_decl_data *file_data' in 'class lto_input_block' 2023-07-04 14:10:54 +02:00
ipa-icf.h
ipa-inline-analysis.cc
ipa-inline-transform.cc
ipa-inline.cc Enable early inlining into always_inline functions 2023-06-28 23:06:18 +02:00
ipa-inline.h
ipa-modref-tree.cc
ipa-modref-tree.h
ipa-modref.cc LTO: Capture 'lto_file_decl_data *file_data' in 'class lto_input_block' 2023-07-04 14:10:54 +02: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
ipa-prop.cc Export value/mask known bits from IPA. 2023-07-17 12:03:36 +02:00
ipa-prop.h Convert ipa_jump_func to use ipa_vr instead of a value_range. 2023-06-27 11:25:48 +02:00
ipa-pure-const.cc
ipa-ref.cc
ipa-ref.h
ipa-reference.cc
ipa-reference.h
ipa-split.cc
ipa-sra.cc LTO: Capture 'lto_file_decl_data *file_data' in 'class lto_input_block' 2023-07-04 14:10:54 +02:00
ipa-utils.cc Enable early inlining into always_inline functions 2023-06-28 23:06:18 +02:00
ipa-utils.h
ipa-visibility.cc
ipa.cc
ira-build.cc
ira-color.cc
ira-conflicts.cc
ira-costs.cc
ira-emit.cc
ira-int.h
ira-lives.cc
ira.cc ira: Skip empty regclass when setting up reg class relations 2023-07-17 20:20:56 +05:30
ira.h
is-a.h
iterator-utils.h
json.cc
json.h
jump.cc
langhooks-def.h
langhooks.cc
langhooks.h
LANGUAGES
lcm.cc
lcm.h
libfuncs.h
limitx.h
limity.h
lists.cc
lock-and-run.sh
logical-location.h
loop-doloop.cc
loop-init.cc
loop-invariant.cc
loop-iv.cc
loop-unroll.cc Cleanup profile updating code in unrolling and splitting 2023-07-28 19:39:19 +02:00
loop-unroll.h
lower-subreg.cc
lower-subreg.h
lra-assigns.cc RA+sched: Change TRUE/FALSE to true/false 2023-07-13 17:47:49 +02:00
lra-coalesce.cc
lra-constraints.cc [LRA]: Exclude reloading of frame pointer in subreg for some cases 2023-07-20 14:42:58 -04:00
lra-eliminations.cc [LRA]: Fix sparc bootstrap after recent patch for fp elimination for avr LRA port 2023-07-21 20:29:55 -04:00
lra-int.h [LRA]: Check and update frame to stack pointer elimination after stack slot allocation 2023-07-19 13:53:29 -04:00
lra-lives.cc
lra-remat.cc
lra-spills.cc [LRA]: Check and update frame to stack pointer elimination after stack slot allocation 2023-07-19 13:53:29 -04:00
lra.cc [RA][PR109520]: Catch error when there are no enough registers for asm insn 2023-07-13 10:47:59 -04:00
lra.h
lto-cgraph.cc LTO: Capture 'lto_file_decl_data *file_data' in 'class lto_input_block' 2023-07-04 14:10:54 +02:00
lto-compress.cc
lto-compress.h
lto-opts.cc
lto-section-in.cc LTO: Capture 'lto_file_decl_data *file_data' in 'class lto_input_block' 2023-07-04 14:10:54 +02:00
lto-section-names.h
lto-section-out.cc
lto-streamer-in.cc Streamer: Fix out of range memory access of machine mode 2023-07-04 14:10:54 +02:00
lto-streamer-out.cc Streamer: Fix out of range memory access of machine mode 2023-07-04 14:10:54 +02:00
lto-streamer.cc
lto-streamer.h Streamer: Fix out of range memory access of machine mode 2023-07-04 14:10:54 +02:00
lto-wrapper.cc
machmode.def
machmode.h
main.cc
make-unique.h
Makefile.in analyzer: add symbol base class, moving region id to there [PR104940] 2023-07-26 10:31:31 -04:00
match.pd tree-optimization/91838 - fix FAIL of g++.dg/opt/pr91838.C 2023-07-27 15:55:18 +02: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 sched: Change return type of predicate functions from int to bool 2023-07-05 16:58:17 +02:00
multiple_target.cc
mux-utils.h
obstack-utils.h
omp-builtins.def
omp-expand.cc
omp-expand.h
omp-general.cc
omp-general.h
omp-low.cc
omp-low.h
omp-oacc-kernels-decompose.cc
omp-oacc-neuter-broadcast.cc
omp-offload.cc
omp-offload.h
omp-simd-clone.cc
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 cleanup: Change LEN_MASK into MASK_LEN 2023-07-21 16:33:51 +08:00
optabs-query.h genopinit: Allow more than 256 modes. 2023-07-12 13:57:17 +02:00
optabs-tree.cc cleanup: Change LEN_MASK into MASK_LEN 2023-07-21 16:33:51 +08:00
optabs-tree.h VECT: Apply LEN_MASK_{LOAD,STORE} into vectorizer 2023-06-24 08:49:29 +08:00
optabs.cc middle-end/61747 - conditional move expansion and constants 2023-07-20 09:50:43 +02:00
optabs.def cleanup: Change LEN_MASK into MASK_LEN 2023-07-21 16:33:51 +08:00
optabs.h gimple-isel: Recognize vec_extract pattern. 2023-07-05 16:57:05 +02:00
optc-gen.awk
optc-save-gen.awk
opth-gen.awk
optinfo-emit-json.cc
optinfo-emit-json.h
optinfo.cc
optinfo.h
opts-common.cc diagnostics: add support for "text art" diagrams 2023-06-21 21:49:00 -04:00
opts-diagnostic.h
opts-global.cc
opts-jobserver.h
opts.cc Add leafy mode for zero-call-used-regs 2023-06-28 01:28:47 -03:00
opts.h
ordered-hash-map-tests.cc
ordered-hash-map.h
output.h final+varasm: Change return type of predicate functions from int to bool 2023-06-28 16:30:26 +02:00
params.opt
pass_manager.h
passes.cc Move combine over to statistics_counter_event. 2023-07-20 08:56:42 -07:00
passes.def Turn TODO_rebuild_frequencies to a pass 2023-07-14 17:14:15 +02:00
plugin.cc
plugin.def
plugin.h
pointer-query.cc
pointer-query.h
poly-int-types.h
poly-int.h
postreload-gcse.cc cfg+gcse: Change return type of predicate functions from int to bool 2023-07-11 18:34:39 +02:00
postreload.cc
predict.cc Fix profile update in tree_transform_and_unroll_loop 2023-07-27 16:17:59 +02:00
predict.def Fix handling of __builtin_expect_with_probability and improve first-match heuristics 2023-06-30 16:27:27 +02:00
predict.h Fix profile update in tree_transform_and_unroll_loop 2023-07-27 16:17:59 +02:00
prefix.cc
prefix.h
pretty-print.cc diagnostics: add support for "text art" diagrams 2023-06-21 21:49:00 -04:00
pretty-print.h diagnostics: add support for "text art" diagrams 2023-06-21 21:49:00 -04:00
print-rtl-function.cc
print-rtl.cc
print-rtl.h
print-tree.cc Introduce IR bit TYPE_INCLUDES_FLEXARRAY for the GCC extension 2023-06-29 17:13:09 +00:00
print-tree.h
profile-count.cc Fix profile update after vectorize loop versioning 2023-07-29 08:18:18 +02:00
profile-count.h Fix profile update after vectorize loop versioning 2023-07-29 08:18:18 +02:00
profile.cc Use sreal::nearest_int 2023-07-21 16:51:46 +02:00
profile.h
range-op-float.cc range-op-float: Fix up -frounding-math frange_arithmetic +- handling [PR110755] 2023-07-26 10:50:50 +02:00
range-op-mixed.h Fix some warnings 2023-07-28 16:23:07 -04:00
range-op-ptr.cc
range-op.cc Fix some warnings 2023-07-28 16:23:07 -04:00
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 cprop_hardreg: fix ORIGINAL_REGNO/REG_ATTRS/REG_POINTER handling 2023-06-28 16:05:55 +02:00
regcprop.h
reginfo.cc
regrename.cc
regrename.h
regs.h
regset.h
regstat.cc
reload1.cc
reload.cc
reload.h
reorg.cc reorg: Change return type of predicate functions from int to bool 2023-07-10 21:52:54 +02:00
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 Fix alpha building 2023-07-22 20:53:57 +00:00
rtlanal.cc cprop: Do not set REG_EQUAL note when simplifying paradoxical subreg [PR110206] 2023-07-14 17:16:59 +02:00
rtlanal.h cprop: Do not set REG_EQUAL note when simplifying paradoxical subreg [PR110206] 2023-07-14 17:16:59 +02:00
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
sbitmap.cc cselib+expr+bitmap: Change return type of predicate functions from int to bool 2023-06-29 17:29:47 +02:00
sbitmap.h cselib+expr+bitmap: Change return type of predicate functions from int to bool 2023-06-29 17:29:47 +02:00
sched-deps.cc sched: Change return type of predicate functions from int to bool 2023-07-05 16:58:17 +02:00
sched-ebb.cc sched: Change return type of predicate functions from int to bool 2023-07-05 16:58:17 +02:00
sched-int.h sched: Change return type of predicate functions from int to bool 2023-07-05 16:58:17 +02:00
sched-rgn.cc sched: Change return type of predicate functions from int to bool 2023-07-05 16:58:17 +02:00
sel-sched-dump.cc
sel-sched-dump.h
sel-sched-ir.cc
sel-sched-ir.h
sel-sched.cc RA+sched: Change TRUE/FALSE to true/false 2023-07-13 17:47:49 +02:00
sel-sched.h
selftest-diagnostic.cc
selftest-diagnostic.h
selftest-rtl.cc
selftest-rtl.h
selftest-run-tests.cc diagnostics: add support for "text art" diagrams 2023-06-21 21:49:00 -04:00
selftest.cc
selftest.h
sese.cc
sese.h
shortest-paths.h
shrink-wrap.cc
shrink-wrap.h
signop.h
simplify-rtx.cc Change MODE_BITSIZE to MODE_PRECISION for MODE_VECTOR_BOOL. 2023-07-05 11:36:39 +02: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 Fix sreal::to_int and implement sreal::to_nearest_int 2023-07-21 16:44:01 +02:00
sreal.h Fix sreal::to_int and implement sreal::to_nearest_int 2023-07-21 16:44:01 +02:00
ssa-iterators.h
ssa.h
stack-ptr-mod.cc
statistics.cc middle-end/110489 - avoid useless work on statistics 2023-06-30 10:38:14 +02:00
statistics.h
stmt.cc
stmt.h
stor-layout.cc
stor-layout.h
store-motion.cc
streamer-hooks.cc
streamer-hooks.h
stringpool.cc GGC, GTY: Tighten up a few things re 'reorder' option and strings 2023-07-06 11:59:08 +02:00
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
target-def.h
target-globals.cc
target-globals.h
target-hooks-macros.h
target-insns.def
target.def
target.h
targhooks.cc
targhooks.h
timevar.cc
timevar.def
timevar.h
toplev.cc
toplev.h
tracer.cc
tracer.h
trans-mem.cc c-family: implement -ffp-contract=on 2023-06-21 21:31:25 +03:00
trans-mem.h
tree-affine.cc
tree-affine.h
tree-call-cdce.cc
tree-cfg.cc Implement flat loop profile detection 2023-07-21 17:34:31 +02:00
tree-cfg.h Break out profile updating code from gimple_duplicate_sese_region 2023-07-13 01:29:17 +02:00
tree-cfgcleanup.cc
tree-cfgcleanup.h
tree-chrec.cc
tree-chrec.h
tree-complex.cc
tree-core.h Introduce IR bit TYPE_INCLUDES_FLEXARRAY for the GCC extension 2023-06-29 17:13:09 +00:00
tree-data-ref.cc
tree-data-ref.h
tree-dfa.cc
tree-dfa.h
tree-diagnostic-client-data-hooks.cc
tree-diagnostic-path.cc
tree-diagnostic.cc
tree-diagnostic.h
tree-dump.cc
tree-dump.h
tree-eh.cc
tree-eh.h
tree-emutls.cc
tree-hash-traits.h
tree-hasher.h
tree-if-conv.cc Fix bootstrap failure (with g++ 4.8.5) in tree-if-conv.cc. 2023-07-17 07:35:08 +01:00
tree-if-conv.h
tree-inline.cc Turn TODO_rebuild_frequencies to a pass 2023-07-14 17:14:15 +02:00
tree-inline.h
tree-into-ssa.cc
tree-into-ssa.h
tree-iterator.cc
tree-iterator.h
tree-logical-location.cc
tree-logical-location.h
tree-loop-distribution.cc Hide IVOPTs strip_offset 2023-06-21 13:38:02 +02:00
tree-nested.cc
tree-nested.h
tree-nrv.cc tree-optimization/110434 - avoid <retval> ={v} {CLOBBER} from NRV 2023-06-28 15:52:16 +02:00
tree-object-size.cc Use TYPE_INCLUDES_FLEXARRAY in __builtin_object_size [PR tree-optimization/101832] 2023-06-30 18:24:34 +00:00
tree-object-size.h
tree-outof-ssa.cc
tree-outof-ssa.h
tree-parloops.cc
tree-parloops.h
tree-pass.h Turn TODO_rebuild_frequencies to a pass 2023-07-14 17:14:15 +02:00
tree-phinodes.cc
tree-phinodes.h Provide extra checking for phi argument access from edge 2023-07-14 10:35:41 +02:00
tree-predcom.cc
tree-pretty-print.cc
tree-pretty-print.h
tree-profile.cc
tree-scalar-evolution.cc tree-optimization/110766 - missing PHI location check 2023-07-24 09:50:32 +02: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 cleanup: Change LEN_MASK into MASK_LEN 2023-07-21 16:33:51 +08:00
tree-ssa-alias.h
tree-ssa-ccp.cc Initialize value in bit_value_unop. 2023-07-26 10:37:24 +02:00
tree-ssa-ccp.h
tree-ssa-coalesce.cc
tree-ssa-coalesce.h
tree-ssa-copy.cc
tree-ssa-dce.cc Fix profile of forwarders produced by cd-dce 2023-06-26 18:29:39 +02:00
tree-ssa-dce.h
tree-ssa-dom.cc Move maybe_set_nonzero_bits() to its only user. 2023-06-29 18:49:27 +02:00
tree-ssa-dom.h
tree-ssa-dse.cc cleanup: Change LEN_MASK into MASK_LEN 2023-07-21 16:33:51 +08:00
tree-ssa-dse.h
tree-ssa-forwprop.cc
tree-ssa-ifcombine.cc tree-optimization/110228 - avoid undefs in ifcombine more thoroughly 2023-07-04 11:11:45 +02:00
tree-ssa-live.cc
tree-ssa-live.h
tree-ssa-loop-ch.cc loop-ch improvements, part 5 2023-07-21 14:57:10 +02:00
tree-ssa-loop-im.cc Fix profile update in tree-ssa-loop-im.cc 2023-07-27 15:58:52 +02:00
tree-ssa-loop-ivcanon.cc Restore bootstrap by removing unused variable in tree-ssa-loop-ivcanon.cc 2023-07-17 14:22:29 +02:00
tree-ssa-loop-ivopts.cc cleanup: Change LEN_MASK into MASK_LEN 2023-07-21 16:33:51 +08:00
tree-ssa-loop-ivopts.h Fix profile update after RTL unrolling 2023-07-27 20:08:38 +02:00
tree-ssa-loop-manip.cc Cleanup profile updating code in unrolling and splitting 2023-07-28 19:39:19 +02:00
tree-ssa-loop-manip.h
tree-ssa-loop-niter.cc Use sreal::nearest_int 2023-07-21 16:51:46 +02:00
tree-ssa-loop-niter.h
tree-ssa-loop-prefetch.cc
tree-ssa-loop-split.cc Cleanup profile updating code in unrolling and splitting 2023-07-28 19:39:19 +02:00
tree-ssa-loop-unswitch.cc
tree-ssa-loop.cc Remove unused tree-vectorizer.h include 2023-07-24 15:32:00 +02:00
tree-ssa-loop.h
tree-ssa-math-opts.cc SSA MATH: Support COND_LEN_FMA for floating-point math optimization 2023-07-13 21:46:58 +08:00
tree-ssa-math-opts.h
tree-ssa-operands.cc
tree-ssa-operands.h Provide extra checking for phi argument access from edge 2023-07-14 10:35:41 +02:00
tree-ssa-phiopt.cc tree-optimization/88540 - FP x > y ? x : y if-conversion without -ffast-math 2023-07-21 09:35:29 +02:00
tree-ssa-phiprop.cc Tiny phiprop compile time optimization 2023-06-23 18:45:42 +02:00
tree-ssa-pre.cc tree-optimization/110799 - fix bug in code hoisting 2023-07-26 11:41:31 +02:00
tree-ssa-propagate.cc Remove value_query, push into sub&fold class 2023-07-28 16:28:20 -04:00
tree-ssa-propagate.h Remove value_query, push into sub&fold class 2023-07-28 16:28:20 -04:00
tree-ssa-reassoc.cc Avoid adding loop-carried ops to long chains 2023-06-29 09:30:19 +00:00
tree-ssa-reassoc.h
tree-ssa-sccvn.cc tree-optimization/110777 - abnormals and recent PRE optimization 2023-07-24 09:50:33 +02:00
tree-ssa-sccvn.h
tree-ssa-scopedtables.cc Fix TYPE_PRECISION use in hashable_expr_equal_p 2023-06-26 13:02:35 +02:00
tree-ssa-scopedtables.h
tree-ssa-sink.cc Remove recursive post-dominator traversal in sinking 2023-07-27 11:31:37 +02:00
tree-ssa-strlen.cc
tree-ssa-strlen.h
tree-ssa-structalias.cc
tree-ssa-tail-merge.cc tree-optimization/110556 - tail merging still pre-tuples 2023-07-06 15:24:42 +02: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 Use mark_ssa_maybe_undefs in PHI-OPT 2023-07-04 12:32:56 +02:00
tree-ssa.h Use mark_ssa_maybe_undefs in PHI-OPT 2023-07-04 12:32:56 +02:00
tree-ssanames.cc Add flow_sensitive_info_storage and use it in gimple-fold. 2023-07-19 09:17:02 -07:00
tree-ssanames.h Add flow_sensitive_info_storage and use it in gimple-fold. 2023-07-19 09:17:02 -07:00
tree-stdarg.cc
tree-stdarg.h
tree-streamer-in.cc Introduce IR bit TYPE_INCLUDES_FLEXARRAY for the GCC extension 2023-06-29 17:13:09 +00:00
tree-streamer-out.cc Introduce IR bit TYPE_INCLUDES_FLEXARRAY for the GCC extension 2023-06-29 17:13:09 +00:00
tree-streamer.cc Streamer: Fix out of range memory access of machine mode 2023-07-04 14:10:54 +02:00
tree-streamer.h Streamer: Fix out of range memory access of machine mode 2023-07-04 14:10:54 +02:00
tree-switch-conversion.cc
tree-switch-conversion.h tree-switch-conversion: Fix a comment typo 2023-07-19 13:51:44 +02:00
tree-tailcall.cc
tree-vect-data-refs.cc cleanup: Change LEN_MASK into MASK_LEN 2023-07-21 16:33:51 +08:00
tree-vect-generic.cc Fix PR 110554: vec lowering introduces scalar signed-boolean:32 comparisons 2023-07-05 23:19:51 -07:00
tree-vect-loop-manip.cc Fix profile update after vectorize loop versioning 2023-07-29 08:18:18 +02:00
tree-vect-loop.cc Make store likely in optimize_mask_stores 2023-07-27 20:14:19 +02:00
tree-vect-patterns.cc cleanup: Change LEN_MASK into MASK_LEN 2023-07-21 16:33:51 +08:00
tree-vect-slp-patterns.cc
tree-vect-slp.cc tree-optimization/106081 - elide redundant permute 2023-07-26 15:27:24 +02:00
tree-vect-stmts.cc vect: Treat VMAT_ELEMENTWISE as scalar load in costing [PR110776] 2023-07-26 21:43:09 -05:00
tree-vector-builder.cc
tree-vector-builder.h
tree-vectorizer.cc
tree-vectorizer.h Remove SLP_TREE_VEC_STMTS in favor of SLP_TREE_VEC_DEFS 2023-07-24 15:32:00 +02:00
tree-vrp.cc Move maybe_set_nonzero_bits() to its only user. 2023-06-29 18:49:27 +02:00
tree-vrp.h Move maybe_set_nonzero_bits() to its only user. 2023-06-29 18:49:27 +02:00
tree.cc Change MODE_BITSIZE to MODE_PRECISION for MODE_VECTOR_BOOL. 2023-07-05 11:36:39 +02:00
tree.def middle-end/110541 - VEC_PERM_EXPR documentation is off 2023-07-05 09:44:24 +02:00
tree.h tree: Hide wi::from_mpz from GENERATOR_FILE 2023-07-12 23:12:15 -05: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
valtrack.cc
valtrack.h
value-pointer-equiv.cc
value-pointer-equiv.h
value-prof.cc value-prof.cc: Correct edge prob calculation. 2023-07-05 17:36:02 +02:00
value-prof.h
value-query.cc Remove value_query, push into sub&fold class 2023-07-28 16:28:20 -04:00
value-query.h Remove value_query, push into sub&fold class 2023-07-28 16:28:20 -04:00
value-range-pretty-print.cc Implement value/mask tracking for irange. 2023-07-07 09:55:58 +02:00
value-range-pretty-print.h
value-range-storage.cc Implement value/mask tracking for irange. 2023-07-07 09:55:58 +02:00
value-range-storage.h Implement value/mask tracking for irange. 2023-07-07 09:55:58 +02:00
value-range.cc Normalize irange_bitmask before union/intersect. 2023-07-17 09:17:59 +02:00
value-range.h Normalize irange_bitmask before union/intersect. 2023-07-17 09:17:59 +02:00
value-relation.cc
value-relation.h
var-tracking.cc
varasm.cc Change MODE_BITSIZE to MODE_PRECISION for MODE_VECTOR_BOOL. 2023-07-05 11:36:39 +02:00
varasm.h final+varasm: Change return type of predicate functions from int to bool 2023-06-28 16:30:26 +02:00
varpool.cc
vec-perm-indices.cc
vec-perm-indices.h
vec.cc
vec.h A couple of va_gc_atomic tweaks 2023-06-29 08:48:17 +01:00
vector-builder.h
vmsdbg.h
vmsdbgout.cc
vr-values.cc
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: Fix up wi::divmod_internal [PR110731] 2023-07-19 13:48:53 +02:00
wide-int.h
xcoff.h

Copyright (C) 2000-2023 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.