gcc/gcc
Jakub Jelinek 73049af5fa re PR tree-optimization/63464 (compare one character to many: faster)
PR tree-optimization/63464
	* gimple.h (gimple_seq_discard): New prototype.
	* gimple.c: Include stringpool.h and tree-ssanames.h.
	(gimple_seq_discard): New function.
	* optabs.h (lshift_cheap_p): New prototype.
	* optabs.c (lshift_cheap_p): New function, moved from...
	* tree-switch-conversion.c (lshift_cheap_p): ... here.
	* tree-ssa-reassoc.c: Include gimplify.h and optabs.h.
	(reassoc_branch_fixups): New variable.
	(update_range_test): Add otherrangep and seq arguments.
	Unshare exp.  If otherrange is NULL, use for other ranges
	array of pointers pointed by otherrangep instead.
	Emit seq before gimplified statements for tem.
	(optimize_range_tests_diff): Adjust update_range_test
	caller.
	(optimize_range_tests_xor): Likewise.  Fix up comment.
	(extract_bit_test_mask, optimize_range_tests_to_bit_test): New
	functions.
	(optimize_range_tests): Adjust update_range_test caller.
	Call optimize_range_tests_to_bit_test.
	(branch_fixup): New function.
	(execute_reassoc): Call branch_fixup.

	* gcc.dg/torture/pr63464.c: New test.
	* gcc.dg/tree-ssa/reassoc-37.c: New test.
	* gcc.dg/tree-ssa/reassoc-38.c: New test.

From-SVN: r216393
2014-10-17 12:54:54 +02:00
..
ada [multiple changes] 2014-10-17 11:20:50 +02:00
c Fix misplaced changelog entry 2014-10-17 07:06:40 +00:00
c-family function.h: Flatten file. 2014-10-16 16:37:19 +00:00
common remove score-* support 2014-10-04 14:53:41 +00:00
config cpuid.h (__cpuid): Remove definitions that handle %ebx register in a special way. 2014-10-17 08:00:58 +02:00
cp Fix pr61848, linux kernel miscompile 2014-10-17 05:10:07 +00:00
doc IPA ICF pass, part 3/5 2014-10-16 10:47:55 +00:00
fortran function.h: Flatten file. 2014-10-16 16:37:19 +00:00
ginclude
go compiler: Method names must be non-blank. 2014-10-16 19:55:28 +00:00
java function.h: Flatten file. 2014-10-16 16:37:19 +00:00
lto lto-object.c (lto_obj_begin_section): In the event that pointer sizes aren't powers of two... 2014-10-16 17:06:34 -04:00
objc function.h: Flatten file. 2014-10-16 16:37:19 +00:00
objcp
po
testsuite re PR tree-optimization/63464 (compare one character to many: faster) 2014-10-17 12:54:54 +02:00
ABOUT-GCC-NLS
acinclude.m4
aclocal.m4
addresses.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
alias.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
alias.h
alloc-pool.c tree-ssa-ccp.c (prop_value_d): Rename to ... 2014-09-22 19:39:44 +00:00
alloc-pool.h
asan.c asan.c (instrument_derefs): BIT_FIELD_REF added. 2014-10-13 10:44:45 +00:00
asan.h
attribs.c
attribs.h
auto-inc-dec.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
BASE-VER
basic-block.h function.h: Flatten file. 2014-10-16 16:37:19 +00:00
bb-reorder.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
bb-reorder.h
bitmap.c tree-ssa-ccp.c (prop_value_d): Rename to ... 2014-09-22 19:39:44 +00:00
bitmap.h
bt-load.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
builtin-attrs.def
builtin-types.def machmode.h (int_n_data_t): New. 2014-10-14 15:44:36 -04:00
builtins.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
builtins.def
builtins.h
caller-save.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
calls.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
calls.h
cfg-flags.def
cfg.c
cfganal.c
cfgbuild.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
cfgcleanup.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
cfgexpand.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
cfgexpand.h
cfghooks.c re PR tree-optimization/63168 (loop header copying fails - not vectorized: latch block not empty) 2014-10-16 10:13:52 +00:00
cfghooks.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
cfgloop.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
cfgloop.h function.h: Flatten file. 2014-10-16 16:37:19 +00:00
cfgloopanal.c
cfgloopmanip.c
cfgrtl.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
cgraph.c IPA ICF pass, part 3/5 2014-10-16 10:47:55 +00:00
cgraph.h function.h: Flatten file. 2014-10-16 16:37:19 +00:00
cgraphbuild.c
cgraphclones.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
cgraphunit.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
ChangeLog re PR tree-optimization/63464 (compare one character to many: faster) 2014-10-17 12:54:54 +02: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.dataflow
ChangeLog.graphite
ChangeLog.lib
ChangeLog.ptr
ChangeLog.tree-ssa
ChangeLog.tuples
cif-code.def
cilk-builtins.def
cilk-common.c
cilk.h
cilkplus.def
collect2-aix.c
collect2-aix.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
collect2.c
collect2.h
collect-utils.c
collect-utils.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
combine-stack-adj.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
combine.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
common.md
common.opt IPA ICF pass, part 3/5 2014-10-16 10:47:55 +00:00
compare-elim.c
conditions.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
config.build
config.gcc linux64.h: Remove. 2014-10-08 16:14:11 +00:00
config.host
config.in
configure [AArch64] Add --enable-fix-cortex-a53-835769 configure-time option 2014-10-10 12:31:51 +00:00
configure.ac [AArch64] Add --enable-fix-cortex-a53-835769 configure-time option 2014-10-10 12:31:51 +00:00
context.c
context.h
convert.c convert.c (convert_to_integer): Do not introduce useless conversions between integral types. 2014-10-03 10:28:50 +00:00
convert.h
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
coretypes.h
coverage.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
coverage.h
cppbuiltin.c
cppbuiltin.h
cppdefault.c
cppdefault.h
cprop.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
cse.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
cselib.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
cselib.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
cstamp-h.in
data-streamer-in.c
data-streamer-out.c
data-streamer.c Fix signed integer overflow in data-streamer.c 2014-09-30 07:07:55 +00:00
data-streamer.h
DATESTAMP Daily bump. 2014-10-17 00:16:15 +00:00
dbgcnt.c
dbgcnt.def
dbgcnt.h
dbxout.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
dbxout.h
dce.c
dce.h
ddg.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
ddg.h
debug.c
debug.h
defaults.h
DEV-PHASE
df-core.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
df-problems.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
df-scan.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
df.h
dfp.c
dfp.h
diagnostic-color.c
diagnostic-color.h
diagnostic-core.h diagnostic.c (warning_n): New function. 2014-09-20 03:06:26 +00:00
diagnostic.c diagnostic.c (warning_n): New function. 2014-09-20 03:06:26 +00:00
diagnostic.def
diagnostic.h
dojump.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
dominance.c
domwalk.c
domwalk.h
double-int.c
double-int.h
dse.c tree-ssa-ccp.c (prop_value_d): Rename to ... 2014-09-22 19:39:44 +00:00
dumpfile.c
dumpfile.h
dwarf2asm.c
dwarf2asm.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
dwarf2cfi.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
dwarf2out.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
dwarf2out.h
emit-rtl.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
emit-rtl.h
errors.c
errors.h
et-forest.c
et-forest.h
except.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
except.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
exec-tool.in
explow.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
expmed.c
expmed.h
expr.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
expr.h function.h: Flatten file. 2014-10-16 16:37:19 +00:00
file-find.c
file-find.h
final.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
fixed-value.c
fixed-value.h
flag-types.h flag-types.h (sanitize_code): Don't assume targets have 32-bit integers. 2014-10-16 16:58:16 -04:00
flags.h
fold-const.c Workaround following [PATCH] Pul all constants last in tree_swap_operands_p 2014-09-22 14:20:16 +00:00
fold-const.h
fp-test.c
FSFChangeLog
FSFChangeLog.10
FSFChangeLog.11
function.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
function.h function.h: Flatten file. 2014-10-16 16:37:19 +00:00
fwprop.c
gcc-ar.c
gcc-plugin.h
gcc-symtab.h
gcc.c Fix build breakage on darwin introduced by me in r215861 2014-10-03 20:25:30 +00:00
gcc.h
gcov-counter.def Makefile.in: Fix dependence. 2014-10-07 04:02:31 +00:00
gcov-dump.c
gcov-io.c
gcov-io.h Makefile.in: Fix dependence. 2014-10-07 04:02:31 +00:00
gcov-iov.c
gcov-tool.c Add overlap functionality to gcov-tool. 2014-10-08 21:51:41 +00:00
gcov.c
gcse.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
gcse.h
gdbasan.in
gdbhooks.py
gdbinit.in
gen-pass-instances.awk
genattr-common.c
genattr.c
genattrtab.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
genautomata.c lra.c (lra_set_insn_recog_data): Fix typo in comment. 2014-09-25 10:34:03 -06:00
gencheck.c
genchecksum.c
gencodes.c
genconditions.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
genconfig.c
genconstants.c
genemit.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
genenums.c
genextract.c
genflags.c
gengenrtl.c
gengtype-lex.l
gengtype-parse.c
gengtype-state.c
gengtype.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
gengtype.h
genhooks.c
genmddeps.c
genmddump.c
genmodes.c machmode.h (int_n_data_t): New. 2014-10-14 15:44:36 -04:00
genmultilib
genopinit.c
genoutput.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
genpeep.c
genpreds.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
genrecog.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
gensupport.c
gensupport.h
ggc-common.c tree-ssa-ccp.c (prop_value_d): Rename to ... 2014-09-22 19:39:44 +00:00
ggc-internal.h
ggc-none.c
ggc-page.c tree-ssa-ccp.c (prop_value_d): Rename to ... 2014-09-22 19:39:44 +00:00
ggc.h move many gc hashtab to hash_table 2014-10-12 22:22:53 +00:00
gimple-builder.c
gimple-builder.h
gimple-expr.c
gimple-expr.h
gimple-fold.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
gimple-fold.h re PR c++/63419 (verify_gimple failed: "vector CONSTRUCTOR element is not a GIMPLE value") 2014-10-13 07:58:05 +00:00
gimple-iterator.c
gimple-iterator.h
gimple-low.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
gimple-low.h
gimple-pretty-print.c tree-pretty-print.c (dump_location): Make it extern. 2014-10-03 21:22:10 +00:00
gimple-pretty-print.h
gimple-ssa-isolate-paths.c
gimple-ssa-strength-reduction.c
gimple-ssa.h move many gc hashtab to hash_table 2014-10-12 22:22:53 +00:00
gimple-streamer-in.c
gimple-streamer-out.c
gimple-streamer.h function.h: Flatten file. 2014-10-16 16:37:19 +00:00
gimple-walk.c
gimple-walk.h
gimple.c re PR tree-optimization/63464 (compare one character to many: faster) 2014-10-17 12:54:54 +02:00
gimple.def
gimple.h re PR tree-optimization/63464 (compare one character to many: faster) 2014-10-17 12:54:54 +02:00
gimplify-me.c
gimplify-me.h
gimplify.c tree-pretty-print.c (dump_location): Make it extern. 2014-10-03 21:22:10 +00:00
gimplify.h
glimits.h
godump.c
graph.c
graph.h
graphds.c
graphds.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
graphite-blocking.c
graphite-clast-to-gimple.c
graphite-clast-to-gimple.h
graphite-dependences.c
graphite-htab.h
graphite-interchange.c
graphite-isl-ast-to-gimple.c
graphite-isl-ast-to-gimple.h
graphite-optimize-isl.c
graphite-poly.c
graphite-poly.h
graphite-scop-detection.c
graphite-scop-detection.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
graphite-sese-to-poly.c
graphite-sese-to-poly.h
graphite.c
gsstruct.def
gstab.h
gsyms.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
gsyslimits.h
gtm-builtins.def
haifa-sched.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
hard-reg-set.h hard-reg-set.h: Include hash-table.h. 2014-09-22 07:38:12 +00:00
hash-map.h move many gc hashtab to hash_table 2014-10-12 22:22:53 +00:00
hash-set.h
hash-table.c hash-table.c: Include bconfig.h if building for the host. 2014-10-15 09:55:19 +00:00
hash-table.h hash-table.c: Include bconfig.h if building for the host. 2014-10-15 09:55:19 +00:00
highlev-plugin-common.h
hooks.c
hooks.h
host-default.c
hosthooks-def.h
hosthooks.h
hw-doloop.c
hw-doloop.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
hwint.c
hwint.h
ifcvt.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
inchash.c
inchash.h
incpath.c
incpath.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
init-regs.c re PR target/8340 (ICE on x86 inline asm w/ -fPIC) 2014-10-13 17:26:49 +00:00
input.c
input.h
insn-addr.h
insn-notes.def
internal-fn.c asan.c (pass_sanopt::execute): Handle IFN_UBSAN_OBJECT_SIZE. 2014-10-10 17:19:25 +00:00
internal-fn.def asan.c (pass_sanopt::execute): Handle IFN_UBSAN_OBJECT_SIZE. 2014-10-10 17:19:25 +00:00
internal-fn.h
intl.c
intl.h
ipa-comdats.c
ipa-cp.c ipa-polymorphic-call.c (walk_ssa_copies): Recognize NULL pointer checks. 2014-10-05 05:02:19 +00:00
ipa-devirt.c ipa-prop.h (ipa_get_controlled_uses): Add hack to avoid ICE when speculation is added. 2014-10-02 07:03:15 +00:00
ipa-icf-gimple.c IPA ICF pass, part 3/5 2014-10-16 10:47:55 +00:00
ipa-icf-gimple.h IPA ICF pass, part 3/5 2014-10-16 10:47:55 +00:00
ipa-icf.c Temporary fix for PR63566. 2014-10-17 09:37:35 +00:00
ipa-icf.h IPA ICF pass, part 3/5 2014-10-16 10:47:55 +00:00
ipa-inline-analysis.c
ipa-inline-transform.c
ipa-inline.c cgraph.h (cgraph_node::get_fun): Declare. 2014-10-07 09:18:37 +00:00
ipa-inline.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
ipa-polymorphic-call.c re PR bootstrap/63496 (../../gcc/ipa-polymorphic-call.c:2117:1: error: assuming signed overflow does not occur when assuming that (X + c) < X is always false [-Werror=strict-overflow]) 2014-10-13 12:44:00 +00:00
ipa-profile.c
ipa-prop.c ipa-prop.c (try_make_edge_direct_virtual_call): Remove overactive sanity check. 2014-10-05 19:51:39 +00:00
ipa-prop.h ipa-prop.h (ipa_get_controlled_uses): Add hack to avoid ICE when speculation is added. 2014-10-02 07:03:15 +00:00
ipa-pure-const.c re PR c/61405 (Not emitting "enumeration value not handled in switch" warning for bit-field enums) 2014-09-24 17:23:56 +00:00
ipa-ref.c
ipa-ref.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
ipa-reference.c
ipa-reference.h
ipa-split.c tree-ssa-ccp.c (prop_value_d): Rename to ... 2014-09-22 19:39:44 +00:00
ipa-utils.c
ipa-utils.h ipa-prop.h (ipa_get_controlled_uses): Add hack to avoid ICE when speculation is added. 2014-10-02 07:03:15 +00:00
ipa-visibility.c Add an no_reorder attribute for LTO 2014-09-24 03:29:24 +00:00
ipa.c ipa.c (walk_polymorphic_call_targets): Avoid ICE when dumping during WPA. 2014-10-02 05:49:32 +00:00
ira-build.c ira.c: Fix typo in comment. 2014-10-14 13:13:33 -06:00
ira-color.c ira.c: Fix typo in comment. 2014-10-14 13:13:33 -06:00
ira-conflicts.c ira-int.h (ira_allocno): Add "wmode" field. 2014-09-30 08:04:32 +00:00
ira-costs.c ira.c: Fix typo in comment. 2014-10-14 13:13:33 -06:00
ira-emit.c ira.c: Fix typo in comment. 2014-10-14 13:13:33 -06:00
ira-int.h ira.c: Fix typo in comment. 2014-10-14 13:13:33 -06:00
ira-lives.c ira.c: Fix typo in comment. 2014-10-14 13:13:33 -06:00
ira.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
ira.h ira.c: Fix typo in comment. 2014-10-14 13:13:33 -06:00
is-a.h
jump.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
langhooks-def.h PR debug/63239 Add DWARF representation for C++11 deleted member function. 2014-10-05 15:25:03 +00:00
langhooks.c
langhooks.h PR debug/63239 Add DWARF representation for C++11 deleted member function. 2014-10-05 15:25:03 +00:00
LANGUAGES
lcm.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
libfuncs.h move many gc hashtab to hash_table 2014-10-12 22:22:53 +00:00
limitx.h
limity.h
lists.c
lock-and-run.sh
loop-doloop.c
loop-init.c loop-unroll.c: (decide_unrolling_and_peeling): Rename to 2014-10-15 08:02:06 +00:00
loop-invariant.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
loop-iv.c
loop-unroll.c loop-unroll.c: (decide_unrolling_and_peeling): Rename to 2014-10-15 08:02:06 +00:00
lower-subreg.c
lower-subreg.h
lra-assigns.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
lra-coalesce.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
lra-constraints.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
lra-eliminations.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
lra-int.h re PR rtl-optimization/63448 (ICE when compiling atlas 3.10.2) 2014-10-15 15:48:33 +00:00
lra-lives.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
lra-spills.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
lra.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
lra.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
lto-cgraph.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
lto-compress.c
lto-compress.h
lto-opts.c lto-opts.c (lto_write_options): Handle -fmath-errno, -fsigned-zeros and -ftrapping-math. 2014-10-07 07:56:43 +00:00
lto-section-in.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
lto-section-names.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
lto-section-out.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
lto-streamer-in.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
lto-streamer-out.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
lto-streamer.c
lto-streamer.h IPA ICF pass, part 3/5 2014-10-16 10:47:55 +00:00
lto-wrapper.c lto-opts.c (lto_write_options): Handle -fmath-errno, -fsigned-zeros and -ftrapping-math. 2014-10-07 07:56:43 +00:00
machmode.def machmode.h (int_n_data_t): New. 2014-10-14 15:44:36 -04:00
machmode.h machmode.h (int_n_data_t): New. 2014-10-14 15:44:36 -04:00
main.c
Makefile.in IPA ICF pass, part 3/5 2014-10-16 10:47:55 +00:00
mcf.c
mkconfig.sh
mode-classes.def
mode-switching.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
modulo-sched.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
omega.c
omega.h
omp-builtins.def
omp-low.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
omp-low.h
ONEWS
opt-functions.awk
opt-gather.awk
opt-include.awk
opt-read.awk
optabs.c re PR tree-optimization/63464 (compare one character to many: faster) 2014-10-17 12:54:54 +02:00
optabs.def
optabs.h re PR tree-optimization/63464 (compare one character to many: faster) 2014-10-17 12:54:54 +02:00
optc-gen.awk
optc-save-gen.awk
opth-gen.awk
opts-common.c
opts-diagnostic.h
opts-global.c
opts.c Temporary fix for PR63566. 2014-10-17 09:37:35 +00:00
opts.h
output.h move many gc hashtab to hash_table 2014-10-12 22:22:53 +00:00
params.c
params.def params.def (PARAM_INDIR_CALL_TOPN_PROFILE): New param. 2014-10-07 04:06:12 +00:00
params.h
pass_manager.h
passes.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
passes.def IPA ICF pass, part 3/5 2014-10-16 10:47:55 +00:00
plugin.c
plugin.def
plugin.h
postreload-gcse.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
postreload.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
predict.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
predict.def
predict.h function.h: Flatten file. 2014-10-16 16:37:19 +00:00
prefix.c
prefix.h
pretty-print.c
pretty-print.h
print-rtl.c
print-rtl.h
print-tree.c cgraph.h, [...]: Rename all instances of DECL_ABSTRACT to DECL_ABSTRACT_P. 2014-09-24 19:50:24 +00:00
print-tree.h
profile.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
profile.h tree-ssa-ccp.c (prop_value_d): Rename to ... 2014-09-22 19:39:44 +00:00
read-md.c
read-md.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
read-rtl.c
README.Portability
real.c
real.h
realmpfr.c
realmpfr.h
recog.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
recog.h
ree.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
reg-notes.def
reg-stack.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
regcprop.c Use fuse-caller-save info in cprop-hardreg 2014-10-17 06:36:45 +00:00
regcprop.h
reginfo.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
regrename.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
regrename.h
regs.h
regset.h
regstat.c
reload1.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
reload.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
reload.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
reorg.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
resource.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
resource.h
rtl-error.c
rtl-error.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
rtl-iter.h
rtl.c
rtl.def
rtl.h function.h: Flatten file. 2014-10-16 16:37:19 +00:00
rtlanal.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
rtlhash.c
rtlhash.h
rtlhooks-def.h
rtlhooks.c
sanitizer.def [libsanitizer merge from upstream r218156] 2014-09-23 17:59:53 +00:00
sbitmap.c
sbitmap.h
sched-deps.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
sched-ebb.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
sched-int.h
sched-rgn.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
sched-vis.c
sdbout.c
sdbout.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
sel-sched-dump.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
sel-sched-dump.h
sel-sched-ir.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
sel-sched-ir.h
sel-sched.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
sel-sched.h
sese.c move many gc hashtab to hash_table 2014-10-12 22:22:53 +00:00
sese.h
shrink-wrap.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
shrink-wrap.h function.h: Flatten file. 2014-10-16 16:37:19 +00:00
signop.h
simplify-rtx.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
sparseset.c
sparseset.h
sreal.c
sreal.h
ssa-iterators.h
stab.def
stack-ptr-mod.c
statistics.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
statistics.h
stmt.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
stmt.h
stor-layout.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
stor-layout.h
store-motion.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
streamer-hooks.c
streamer-hooks.h
stringpool.c
stringpool.h
symtab.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
sync-builtins.def
system.h Remove LIBGCC2_LONG_DOUBLE_TYPE_SIZE target macro. 2014-09-23 01:48:46 +01:00
target-def.h
target-globals.c re PR bootstrap/63280 (Double free in GCC compiled with LTO and -O3.) 2014-09-23 14:47:45 +00:00
target-globals.h
target-hooks-macros.h
target.def re PR target/8340 (ICE on x86 inline asm w/ -fPIC) 2014-10-13 17:26:49 +00:00
target.h
targhooks.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
targhooks.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
timevar.c
timevar.def IPA ICF pass, part 3/5 2014-10-16 10:47:55 +00:00
timevar.h timevar.h: Add an auto_timevar class 2014-10-15 21:26:02 +00:00
tlink.c
toplev.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
toplev.h
tracer.c
trans-mem.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
trans-mem.h
tree-affine.c
tree-affine.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
tree-browser.c
tree-browser.def
tree-call-cdce.c
tree-cfg.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-cfg.h
tree-cfgcleanup.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-cfgcleanup.h
tree-chrec.c
tree-chrec.h
tree-complex.c
tree-core.h tree-core.h: Fix comment to not assume pointers are multiples of bytes. 2014-10-16 01:03:32 -04:00
tree-data-ref.c
tree-data-ref.h
tree-dfa.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-dfa.h
tree-diagnostic.c
tree-diagnostic.h
tree-dump.c
tree-dump.h
tree-eh.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-eh.h
tree-emutls.c
tree-hasher.h
tree-if-conv.c
tree-inline.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-inline.h
tree-into-ssa.c tree-into-ssa.c (is_old_name): Replace "new" with "old". 2014-10-17 08:26:33 +00:00
tree-into-ssa.h
tree-iterator.c
tree-iterator.h
tree-loop-distribution.c
tree-nested.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-nested.h
tree-nrv.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-object-size.c
tree-object-size.h
tree-outof-ssa.c
tree-outof-ssa.h
tree-parloops.c
tree-parloops.h
tree-pass.h IPA ICF pass, part 3/5 2014-10-16 10:47:55 +00:00
tree-phinodes.c
tree-phinodes.h
tree-predcom.c
tree-pretty-print.c tree-pretty-print.c (dump_location): Make it extern. 2014-10-03 21:22:10 +00:00
tree-pretty-print.h tree-pretty-print.c (dump_location): Make it extern. 2014-10-03 21:22:10 +00:00
tree-profile.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-scalar-evolution.c
tree-scalar-evolution.h
tree-sra.c re PR rtl-optimization/63375 (reordering of reads across fences) 2014-10-02 18:49:14 +02:00
tree-ssa-address.c
tree-ssa-address.h
tree-ssa-alias.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-ssa-alias.h cgraph.c (cgraph_node::release_body): New argument keep_arguments introduced. 2014-09-26 10:37:44 +00:00
tree-ssa-ccp.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-ssa-coalesce.c
tree-ssa-coalesce.h
tree-ssa-copy.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-ssa-copyrename.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-ssa-dce.c
tree-ssa-dom.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-ssa-dom.h
tree-ssa-dse.c
tree-ssa-forwprop.c
tree-ssa-ifcombine.c
tree-ssa-live.c
tree-ssa-live.h
tree-ssa-loop-ch.c
tree-ssa-loop-im.c tree-ssa-ccp.c (prop_value_d): Rename to ... 2014-09-22 19:41:02 +00:00
tree-ssa-loop-ivcanon.c loop-unroll.c: (decide_unrolling_and_peeling): Rename to 2014-10-15 08:02:06 +00:00
tree-ssa-loop-ivopts.c
tree-ssa-loop-ivopts.h
tree-ssa-loop-manip.c
tree-ssa-loop-manip.h
tree-ssa-loop-niter.c
tree-ssa-loop-niter.h
tree-ssa-loop-prefetch.c
tree-ssa-loop-unswitch.c
tree-ssa-loop.c
tree-ssa-loop.h
tree-ssa-math-opts.c re PR tree-optimization/63266 (Test regression: gcc.target/sh/pr53568-1.c) 2014-09-24 08:27:21 +00:00
tree-ssa-operands.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-ssa-operands.h
tree-ssa-phiopt.c
tree-ssa-phiprop.c
tree-ssa-pre.c re PR tree-optimization/63512 (ICE: error: virtual use of statement not up-to-date) 2014-10-14 07:36:02 +00:00
tree-ssa-propagate.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-ssa-propagate.h
tree-ssa-reassoc.c re PR tree-optimization/63464 (compare one character to many: faster) 2014-10-17 12:54:54 +02:00
tree-ssa-sccvn.c
tree-ssa-sccvn.h
tree-ssa-sink.c
tree-ssa-strlen.c
tree-ssa-structalias.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-ssa-tail-merge.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-ssa-ter.c
tree-ssa-ter.h
tree-ssa-threadedge.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-ssa-threadedge.h
tree-ssa-threadupdate.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-ssa-threadupdate.h
tree-ssa-uncprop.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-ssa-uninit.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-ssa.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-ssa.h
tree-ssanames.c
tree-ssanames.h
tree-stdarg.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-stdarg.h
tree-streamer-in.c cgraph.h, [...]: Rename all instances of DECL_ABSTRACT to DECL_ABSTRACT_P. 2014-09-24 19:50:24 +00:00
tree-streamer-out.c cgraph.h, [...]: Rename all instances of DECL_ABSTRACT to DECL_ABSTRACT_P. 2014-09-24 19:50:24 +00:00
tree-streamer.c
tree-streamer.h
tree-switch-conversion.c re PR tree-optimization/63464 (compare one character to many: faster) 2014-10-17 12:54:54 +02:00
tree-tailcall.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree-vect-data-refs.c tree-vect-data-refs.c (vect_permute_load_chain, [...]): Fix a typo in temporary var names, suffle3 to shuffle3. 2014-10-03 10:15:03 +02:00
tree-vect-generic.c
tree-vect-loop-manip.c
tree-vect-loop.c
tree-vect-patterns.c
tree-vect-slp.c re PR tree-optimization/63379 (Incorrect vectorization when enabling SSE and O3, initialises loop with wrong value) 2014-10-10 11:17:13 +00:00
tree-vect-stmts.c re PR tree-optimization/63341 (Vectorization miscompilation with -mcpu=power7) 2014-09-25 10:12:49 +02:00
tree-vectorizer.c
tree-vectorizer.h re PR tree-optimization/63341 (Vectorization miscompilation with -mcpu=power7) 2014-09-25 10:12:49 +02:00
tree-vrp.c re PR tree-optimization/63445 (request: make -Wstrict-overflow avoid a class of false positives) 2014-10-09 08:20:53 +00:00
tree.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tree.def
tree.h machmode.h (int_n_data_t): New. 2014-10-14 15:44:36 -04:00
treestruct.def
tsan.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
tsan.h
tsystem.h
typeclass.h
ubsan.c asan.c (pass_sanopt::execute): Handle IFN_UBSAN_OBJECT_SIZE. 2014-10-10 17:19:25 +00:00
ubsan.h asan.c (pass_sanopt::execute): Handle IFN_UBSAN_OBJECT_SIZE. 2014-10-10 17:19:25 +00:00
valtrack.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
valtrack.h
value-prof.c params.def (PARAM_INDIR_CALL_TOPN_PROFILE): New param. 2014-10-07 04:06:12 +00:00
value-prof.h params.def (PARAM_INDIR_CALL_TOPN_PROFILE): New param. 2014-10-07 04:06:12 +00:00
var-tracking.c
varasm.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
varasm.h function.h: Flatten file. 2014-10-16 16:37:19 +00:00
varpool.c cgraph.h, [...]: Rename all instances of DECL_ABSTRACT to DECL_ABSTRACT_P. 2014-09-24 19:50:24 +00:00
vec.c
vec.h
version.c
version.h
vmsdbg.h
vmsdbgout.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
vtable-verify.c
vtable-verify.h
web.c function.h: Flatten file. 2014-10-16 16:37:19 +00:00
wide-int-print.cc
wide-int-print.h
wide-int.cc
wide-int.h
xcoff.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00
xcoffout.c
xcoffout.h Add header guard to several header files. 2014-09-18 23:34:23 +01:00

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

Irix6 "cc -n32" and OSF4 "cc" have problems with constant string
initializers with parens around it, e.g.

const char string[] = ("A string");

This is unfortunate since this is what the GNU gettext macro N_
produces.  You need to find a different way to code it.

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.