gcc/gcc
Mikael Morin 237380cdec fortran: Evaluate once BACK argument of MINLOC/MAXLOC with DIM [PR90608]
Evaluate the BACK argument of MINLOC/MAXLOC once before the
scalarization loops in the case where the DIM argument is present.

This is a follow-up to r15-1994-ga55d24b3cf7f4d07492bb8e6fcee557175b47ea3
which added knowledge of BACK to the scalarizer, to
r15-2701-ga10436a8404ad2f0cc5aa4d6a0cc850abe5ef49e which removed it to
handle it out of scalarization instead, and to more immediate previous
patches that added inlining support for MINLOC/MAXLOC with DIM.  The
inlining support for MINLOC/MAXLOC with DIM introduced nested loops, which
made the evaluation of BACK (removed from the scalarizer knowledge by the
forementionned commit) wrapped in a loop, so possibly executed more than
once.  This change adds BACK to the scalarization chain if MINLOC/MAXLOC
will use nested loops, so that it is evaluated by the scalarizer only once
before the outermost loop in that case.

	PR fortran/90608

gcc/fortran/ChangeLog:

	* trans-intrinsic.cc
	(walk_inline_intrinsic_minmaxloc): Add a scalar element for BACK as
	first item of the chain if BACK is present and there will be nested
	loops.
	(gfc_conv_intrinsic_minmaxloc): Evaluate BACK using an inherited
	scalarization chain if there is a nested loop.

gcc/testsuite/ChangeLog:

	* gfortran.dg/maxloc_8.f90: New test.
	* gfortran.dg/minloc_9.f90: New test.
2024-11-20 13:59:51 +01:00
..
ada Daily bump. 2024-11-20 00:19:59 +00:00
analyzer Daily bump. 2024-11-14 17:20:15 +00:00
c c: Fix ICE for integer constexpr initializers of wrong type [PR115515] 2024-11-20 01:39:06 +00:00
c-family Daily bump. 2024-11-20 00:19:59 +00:00
common RISC-V: Add the mini support for SiFive extensions. 2024-11-20 12:02:25 +08:00
config i386: Remove workaround for Solaris ld 64-bit TLS IE limitation 2024-11-20 12:57:25 +01:00
cp Daily bump. 2024-11-20 00:19:59 +00:00
d Daily bump. 2024-10-30 00:19:35 +00:00
doc libdiagnostics: add a "sarif-replay" command-line tool [PR96032] 2024-11-18 17:08:37 -05:00
fortran fortran: Evaluate once BACK argument of MINLOC/MAXLOC with DIM [PR90608] 2024-11-20 13:59:51 +01:00
ginclude c: Add _Decimal64x support 2024-11-15 08:43:48 +01:00
go syscall: don't define syscall stub on Hurd 2024-10-30 11:33:07 -07:00
jit Daily bump. 2024-11-05 00:19:52 +00:00
lto
m2 Daily bump. 2024-11-19 00:19:52 +00:00
objc
objcp
po
rtl-ssa Avoid repeated calls to temporarily_undo_changes [PR117297] 2024-11-19 10:19:24 +00:00
rust Daily bump. 2024-11-02 00:19:21 +00:00
testsuite fortran: Evaluate once BACK argument of MINLOC/MAXLOC with DIM [PR90608] 2024-11-20 13:59:51 +01:00
text-art
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 Introduce TARGET_CLONES_ATTR_SEPARATOR for RISC-V 2024-11-13 17:01:41 +08:00
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
bbitmap.h
bitmap.cc
bitmap.h
btfout.cc btf: check hash maps are non-null before emptying 2024-11-07 09:57:25 -08:00
builtin-attrs.def
builtin-types.def c: Add _Decimal64x support 2024-11-15 08:43:48 +01:00
builtins.cc c: Add _Decimal64x support 2024-11-15 08:43:48 +01:00
builtins.def c: Add _Decimal64x support 2024-11-15 08:43:48 +01:00
builtins.h
caller-save.cc
calls.cc
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: Skip doing conflicts if there is only 1 variable 2024-11-14 00:37:34 -08:00
cfgexpand.h
cfghooks.cc
cfghooks.h
cfgloop.cc
cfgloop.h
cfgloopanal.cc
cfgloopmanip.cc
cfgloopmanip.h
cfgrtl.cc
cfgrtl.h
cgraph.cc
cgraph.h
cgraphbuild.cc
cgraphclones.cc
cgraphunit.cc
ChangeLog Daily bump. 2024-11-20 00:19:59 +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.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
combine-stack-adj.cc
combine.cc
common.md
common.opt Remove allocations which are used only for NULL pointer check and free 2024-11-14 17:07:06 +01:00
common.opt.urls Fix common.opt.urls 2024-11-14 17:29:14 +01:00
compare-elim.cc
conditions.h
config.build
config.gcc aarch64: Add minimal C++ support 2024-11-19 14:27:33 +01:00
config.host
config.in Add autoconf check for clock_gettime 2024-10-31 10:25:06 -07:00
configure libdiagnostics: add a "sarif-replay" command-line tool [PR96032] 2024-11-18 17:08:37 -05:00
configure.ac libdiagnostics: add a "sarif-replay" command-line tool [PR96032] 2024-11-18 17:08:37 -05: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
cse.cc
cselib.cc
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. 2024-11-20 00:19:59 +00:00
dbgcnt.cc
dbgcnt.def
dbgcnt.h
dce.cc
dce.h
ddg.cc
ddg.h
debug.cc
debug.h
defaults.h Introduce TARGET_CLONES_ATTR_SEPARATOR for RISC-V 2024-11-13 17:01:41 +08:00
DEV-PHASE
df-core.cc
df-problems.cc
df-scan.cc
df.h
dfp.cc
dfp.h
diagnostic-buffer.h diagnostics: support multiple output formats simultaneously [PR116613] 2024-10-29 19:12:02 -04:00
diagnostic-client-data-hooks.h
diagnostic-color.cc
diagnostic-color.h
diagnostic-core.h diagnostics: add support for nested diagnostics [PR116253] 2024-11-18 14:20:17 -05:00
diagnostic-diagram.h
diagnostic-event-id.h
diagnostic-format-json.cc diagnostics: support multiple output formats simultaneously [PR116613] 2024-10-29 19:12:02 -04:00
diagnostic-format-sarif.cc diagnostics: add support for nested diagnostics [PR116253] 2024-11-18 14:20:17 -05:00
diagnostic-format-sarif.h diagnostics: support multiple output formats simultaneously [PR116613] 2024-10-29 19:12:02 -04:00
diagnostic-format-text.cc diagnostics: add support for nested diagnostics [PR116253] 2024-11-18 14:20:17 -05:00
diagnostic-format-text.h Add libdiagnostics (v4) 2024-11-18 17:08:36 -05:00
diagnostic-format.h diagnostics: support multiple output formats simultaneously [PR116613] 2024-10-29 19:12:02 -04:00
diagnostic-global-context.cc diagnostics: add support for nested diagnostics [PR116253] 2024-11-18 14:20:17 -05:00
diagnostic-highlight-colors.h
diagnostic-label-effects.h
diagnostic-macro-unwinding.cc
diagnostic-macro-unwinding.h
diagnostic-metadata.h
diagnostic-output-file.h diagnostics: support multiple output formats simultaneously [PR116613] 2024-10-29 19:12:02 -04:00
diagnostic-path.cc diagnostics: avoid using global_dc in path-printing 2024-11-13 08:26:58 -05:00
diagnostic-path.h diagnostics: avoid using global_dc in path-printing 2024-11-13 08:26:58 -05:00
diagnostic-show-locus.cc diagnostics: add support for nested diagnostics [PR116253] 2024-11-18 14:20:17 -05:00
diagnostic-spec.cc
diagnostic-spec.h
diagnostic-url.h
diagnostic.cc diagnostics: add support for nested diagnostics [PR116253] 2024-11-18 14:20:17 -05:00
diagnostic.def
diagnostic.h diagnostics: add support for nested diagnostics [PR116253] 2024-11-18 14:20:17 -05: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 Flatten anonymous structs in CodeView types 2024-11-19 01:06:38 +00:00
dwarf2codeview.h Handle T_HRESULT types in CodeView records 2024-11-05 00:47:41 +00:00
dwarf2ctf.cc
dwarf2ctf.h
dwarf2out.cc
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 aarch64: Optimize vector rotates as vector permutes where possible 2024-11-04 09:41:09 +01:00
expmed.h aarch64: Optimize vector rotates as vector permutes where possible 2024-11-04 09:41:09 +01:00
expr.cc expand: Fix up ICE on VCE from _Complex types to _BitInt [PR117458] 2024-11-19 10:26:44 +01:00
expr.h
ext-dce.cc Improve ext-dce's ability to eliminate more extensions 2024-11-17 21:44:50 -07: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 c: Add _Decimal64x support 2024-11-15 08:43:48 +01:00
fold-const-call.h
fold-const.cc fold: Remove (rrotate (rrotate A CST) CST) folding [PR117492] 2024-11-09 08:21:25 -08:00
fold-const.h
fold-mem-offsets.cc
fp-test.cc
FSFChangeLog
FSFChangeLog.10
FSFChangeLog.11
function-abi.cc
function-abi.h
function-tests.cc
function.cc Add push/pop_function_decl 2024-11-11 12:32:13 +00:00
function.h Add push/pop_function_decl 2024-11-11 12:32:13 +00:00
fwprop.cc Avoid repeated calls to temporarily_undo_changes [PR117297] 2024-11-19 10:19:24 +00:00
gcc-ar.cc
gcc-main.cc
gcc-plugin.h
gcc-rich-location.cc
gcc-rich-location.h
gcc-symtab.h
gcc-urlifier.cc
gcc-urlifier.def
gcc-urlifier.h
gcc.cc diagnostics: support multiple output formats simultaneously [PR116613] 2024-10-29 19:12:02 -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.h
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
generic-match.h
genextract.cc
genflags.cc
gengenrtl.cc
gengtype-lex.l
gengtype-parse.cc
gengtype-state.cc
gengtype.cc
gengtype.h
genhooks.cc
genmatch.cc genmatch: Fix build on hppa64-hpux [PR117348] 2024-10-30 09:58:26 +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-internal.h
ggc-none.cc
ggc-page.cc
ggc-tests.cc
ggc.h
gimple-array-bounds.cc
gimple-array-bounds.h
gimple-builder.cc
gimple-builder.h
gimple-expr.cc
gimple-expr.h
gimple-fold.cc
gimple-fold.h
gimple-harden-conditionals.cc
gimple-harden-control-flow.cc
gimple-if-to-switch.cc Only do switch bit test clustering when multiple labels point to same bb 2024-10-29 15:08:11 -07:00
gimple-isel.cc Remove dead code related to VEC_COND_EXPR expansion from ISEL 2024-11-15 13:42:03 +01:00
gimple-iterator.cc
gimple-iterator.h
gimple-laddress.cc
gimple-loop-interchange.cc
gimple-loop-jam.cc
gimple-loop-versioning.cc openmp: Tune omp_max_vf for offload targets 2024-11-06 16:26:24 +00:00
gimple-low.cc
gimple-low.h
gimple-lower-bitint.cc bitintlower: Handle PAREN_EXPR [PR117459] 2024-11-19 10:25:57 +01:00
gimple-lower-bitint.h
gimple-match-exports.cc gimple: Remove special handling of COND_EXPR for COMPARISON_CLASS_P [PR116949, PR114785] 2024-10-30 18:07:24 -07:00
gimple-match-head.cc
gimple-match.h
gimple-predicate-analysis.cc
gimple-predicate-analysis.h
gimple-predict.h
gimple-pretty-print.cc
gimple-pretty-print.h
gimple-range-cache.cc
gimple-range-cache.h
gimple-range-edge.cc Don't call invert on VARYING. 2024-11-04 09:58:03 -05:00
gimple-range-edge.h
gimple-range-fold.cc Make fur_edge accessible. 2024-11-01 15:24:09 -04:00
gimple-range-fold.h Make fur_edge accessible. 2024-11-01 15:24:09 -04:00
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.h
gimple-range-tests.cc
gimple-range-trace.cc
gimple-range-trace.h
gimple-range.cc Reimplement 'assume' processing pass. 2024-11-01 15:24:09 -04:00
gimple-range.h Reimplement 'assume' processing pass. 2024-11-01 15:24:09 -04:00
gimple-ssa-backprop.cc
gimple-ssa-isolate-paths.cc
gimple-ssa-nonnull-compare.cc
gimple-ssa-sccopy.cc
gimple-ssa-split-paths.cc
gimple-ssa-sprintf.cc
gimple-ssa-store-merging.cc store-merging: Apply --param=store-merging-max-size= in more spots [PR117439] 2024-11-06 10:22:13 +01: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: Remove special handling of COND_EXPR for COMPARISON_CLASS_P [PR116949, PR114785] 2024-10-30 18:07:24 -07:00
gimple-walk.h
gimple-warn-recursion.cc
gimple.cc gimple: Remove special handling of COND_EXPR for COMPARISON_CLASS_P [PR116949, PR114785] 2024-10-30 18:07:24 -07:00
gimple.def
gimple.h
gimplify-me.cc
gimplify-me.h
gimplify.cc gimplify: Fix up RAW_DATA_CST related ICE [PR117384] 2024-11-02 18:47:27 +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
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.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 ifn: Add else-operand handling. 2024-11-18 11:48:41 +01:00
internal-fn.def aarch64: Optimise calls to ldexp with SVE FSCALE instruction [PR111733] 2024-11-13 10:20:14 +05:30
internal-fn.h ifn: Add else-operand handling. 2024-11-18 11:48:41 +01:00
intl.cc
intl.h
ipa-comdats.cc
ipa-cp.cc ipa: Rationalize IPA-VR computations across pass-through jump functions 2024-11-14 20:55:22 +01:00
ipa-cp.h
ipa-devirt.cc
ipa-fnsummary.cc Mark asm statements as necessary in ipa-fnsummary 2024-11-17 15:48:29 +01:00
ipa-fnsummary.h
ipa-free-lang-data.cc
ipa-icf-gimple.cc
ipa-icf-gimple.h
ipa-icf.cc
ipa-icf.h
ipa-inline-analysis.cc
ipa-inline-transform.cc
ipa-inline.cc
ipa-inline.h
ipa-modref-tree.cc
ipa-modref-tree.h
ipa-modref.cc ipa-modref bits for unsequenced and reproducible 2024-11-17 11:54:10 +01:00
ipa-modref.h Avoid expicit builtion list in tree-ssa-dce 2024-11-16 23:45:57 +01:00
ipa-param-manipulation.cc
ipa-param-manipulation.h
ipa-polymorphic-call.cc
ipa-predicate.cc
ipa-predicate.h
ipa-profile.cc
ipa-prop.cc ipa: Introduce a one jump function dumping function 2024-11-14 14:43:21 +01:00
ipa-prop.h ipa: Introduce a one jump function dumping function 2024-11-14 14:43:21 +01:00
ipa-pure-const.cc
ipa-ref.cc
ipa-ref.h
ipa-reference.cc
ipa-reference.h
ipa-split.cc
ipa-sra.cc
ipa-strub.cc
ipa-strub.h
ipa-utils.cc
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.h
is-a.h
iterator-utils.h
json-parsing.cc json: add json parsing support 2024-11-18 17:08:36 -05:00
json-parsing.h json: add json parsing support 2024-11-18 17:08:36 -05:00
json.cc json: add json parsing support 2024-11-18 17:08:36 -05:00
json.h json: add json parsing support 2024-11-18 17:08:36 -05:00
jump.cc
langhooks-def.h
langhooks.cc
langhooks.h
LANGUAGES
late-combine.cc Add a timevar for late combine 2024-11-18 19:33:58 +00:00
lazy-diagnostic-path.cc diagnostics: avoid using global_dc in path-printing 2024-11-13 08:26:58 -05:00
lazy-diagnostic-path.h diagnostics: add class lazy_diagnostic_path 2024-10-31 12:25:36 -04:00
lcm.cc
lcm.h
libdiagnostics.cc Add libdiagnostics (v4) 2024-11-18 17:08:36 -05:00
libdiagnostics.h Add libdiagnostics (v4) 2024-11-18 17:08:36 -05:00
libdiagnostics.map Add libdiagnostics (v4) 2024-11-18 17:08:36 -05:00
libdiagnostics++.h Add libdiagnostics (v4) 2024-11-18 17:08:36 -05:00
libfuncs.h
libsarifreplay.cc libdiagnostics: add a "sarif-replay" command-line tool [PR96032] 2024-11-18 17:08:37 -05:00
libsarifreplay.h libdiagnostics: add a "sarif-replay" command-line tool [PR96032] 2024-11-18 17:08:37 -05:00
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
loop-unroll.h
lower-subreg.cc
lower-subreg.h
lra-assigns.cc
lra-coalesce.cc
lra-constraints.cc
lra-eliminations.cc
lra-int.h
lra-lives.cc
lra-remat.cc
lra-spills.cc The fix for PR117191 2024-11-15 00:50:36 +04:00
lra.cc
lra.h
lto-cgraph.cc ipcp don't propagate where not needed 2024-11-06 13:40:59 +01:00
lto-compress.cc
lto-compress.h
lto-opts.cc
lto-section-in.cc
lto-section-names.h
lto-section-out.cc
lto-streamer-in.cc
lto-streamer-out.cc
lto-streamer.cc
lto-streamer.h ipcp don't propagate where not needed 2024-11-06 13:40:59 +01:00
lto-wrapper.cc
machmode.def
machmode.h Extend expand_absneg_bit to vector modes 2024-11-20 10:04:46 +00:00
main.cc
make-unique.h
Makefile.in libdiagnostics: add a "sarif-replay" command-line tool [PR96032] 2024-11-18 17:08:37 -05:00
match.pd match: Fix the max<a,b>==0 pattern for pointers [PR117646] 2024-11-18 00:50:26 -08: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 Introduce TARGET_CLONES_ATTR_SEPARATOR for RISC-V 2024-11-13 17:01:41 +08:00
mux-utils.h
obstack-utils.h
omp-api.h
omp-builtins.def
omp-expand.cc openmp: Add IFN_GOMP_MAX_VF 2024-11-06 16:26:24 +00:00
omp-expand.h
omp-general.cc openmp: Fix signed/unsigned warning 2024-11-06 17:50:00 +00:00
omp-general.h openmp: Tune omp_max_vf for offload targets 2024-11-06 16:26:24 +00:00
omp-low.cc openmp: Tune omp_max_vf for offload targets 2024-11-06 16:26:24 +00:00
omp-low.h
omp-oacc-kernels-decompose.cc
omp-oacc-neuter-broadcast.cc
omp-offload.cc openmp: Add IFN_GOMP_MAX_VF 2024-11-06 16:26:24 +00:00
omp-offload.h
omp-selectors.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 Extend expand_absneg_bit to vector modes 2024-11-20 10:04:46 +00:00
optabs-query.h Extend expand_absneg_bit to vector modes 2024-11-20 10:04:46 +00:00
optabs-tree.cc Add helpers to test whether an optab can be implemented 2024-11-20 10:04:45 +00:00
optabs-tree.h vect: Add maskload else value support. 2024-11-18 11:48:42 +01:00
optabs.cc Extend expand_absneg_bit to vector modes 2024-11-20 10:04:46 +00:00
optabs.def Internal-fn: Introduce new IFN MASK_LEN_STRIDED_LOAD{STORE} 2024-10-29 22:19:19 +08:00
optabs.h Remove unused vcond{,u,eq} expander infrastructure 2024-11-15 15:05:36 +01:00
optc-gen.awk
optc-save-gen.awk
opth-gen.awk
optinfo-emit-json.cc
optinfo-emit-json.h
optinfo.cc
optinfo.h
options-urls-cc-gen.awk
opts-common.cc opts: fix narrowing warning 2024-11-11 17:30:21 -05:00
opts-diagnostic.cc diagnostics: add support for nested diagnostics [PR116253] 2024-11-18 14:20:17 -05:00
opts-diagnostic.h diagnostics: support multiple output formats simultaneously [PR116613] 2024-10-29 19:12:02 -04:00
opts-global.cc diagnostics: support multiple output formats simultaneously [PR116613] 2024-10-29 19:12:02 -04:00
opts-jobserver.h
opts.cc diagnostics: support multiple output formats simultaneously [PR116613] 2024-10-29 19:12:02 -04:00
opts.h opts: fix narrowing warning 2024-11-11 17:30:21 -05:00
ordered-hash-map-tests.cc
ordered-hash-map.h
output.h
pair-fusion.cc
pair-fusion.h
params.opt Flip vectorization to forced SLP 2024-11-16 14:13:28 +01:00
params.opt.urls
pass_manager.h
passes.cc
passes.def
plugin.cc
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 genmatch: Add selftests to genmatch for diag_vfprintf 2024-10-27 16:44:35 +01:00
pretty-print.h
print-rtl-function.cc
print-rtl.cc
print-rtl.h
print-tree.cc
print-tree.h
profile-count.cc
profile-count.h
profile.cc
profile.h
range-op-float.cc
range-op-mixed.h
range-op-ptr.cc Fix bitwise_or logic for prange. 2024-10-28 12:46:55 -04:00
range-op.cc Update bitwise_or op_range. 2024-11-01 15:24:10 -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 Avoid repeated calls to temporarily_undo_changes [PR117297] 2024-11-19 10:19:24 +00:00
recog.h Avoid repeated calls to temporarily_undo_changes [PR117297] 2024-11-19 10:19:24 +00:00
ree.cc
reg-notes.def
reg-stack.cc
regcprop.cc
regcprop.h
regenerate-opt-urls.py
reginfo.cc
regrename.cc
regrename.h
regs.h
regset.h
regstat.cc
reload1.cc
reload.cc
reload.h
reorg.cc Fix miscompilation of function containing __builtin_unreachable 2024-10-29 21:43:59 +01: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
rtlanal.cc rtl: Validate subreg info when optimizing vec_select. 2024-11-12 15:19:34 +05:30
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 libdiagnostics: add a "sarif-replay" command-line tool [PR96032] 2024-11-18 17:08:37 -05:00
sarif-spec-urls.def libdiagnostics: add a "sarif-replay" command-line tool [PR96032] 2024-11-18 17:08:37 -05:00
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 diagnostics: add class lazy_diagnostic_path 2024-10-31 12:25:36 -04:00
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 json: add json parsing support 2024-11-18 17:08:36 -05:00
selftest-tree.h
selftest.cc
selftest.h json: add json parsing support 2024-11-18 17:08:36 -05:00
sese.cc
sese.h
shortest-paths.h
shrink-wrap.cc
shrink-wrap.h
signop.h
simple-diagnostic-path.cc diagnostics: avoid using global_dc in path-printing 2024-11-13 08:26:58 -05:00
simple-diagnostic-path.h
simplify-rtx.cc Revert "Reapply "[PATCH v2] RISC-V: zero_extend(not) -> xor optimization [PR112398]"" 2024-11-14 09:26:11 -07: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
target-def.h
target-globals.cc
target-globals.h
target-hooks-macros.h
target-insns.def
target.def
target.h
targhooks.cc
targhooks.h
text-range-label.h
timevar.cc Add autoconf check for clock_gettime 2024-10-31 10:25:06 -07:00
timevar.def Add a timevar for late combine 2024-11-18 19:33:58 +00:00
timevar.h Remove sys/user time in -ftime-report 2024-10-30 09:05:18 -07:00
toplev.cc diagnostics: support multiple output formats simultaneously [PR116613] 2024-10-29 19:12:02 -04:00
toplev.h
tracer.cc
tracer.h
trans-mem.cc trans-mem: Fix ICE caused by expand_assign_tm 2024-11-09 11:42:30 +01:00
trans-mem.h
tree-affine.cc
tree-affine.h
tree-assume.cc Add details output for assume processing. 2024-11-06 08:51:21 -05:00
tree-call-cdce.cc
tree-cfg.cc
tree-cfg.h
tree-cfgcleanup.cc
tree-cfgcleanup.h
tree-chrec.cc
tree-chrec.h
tree-complex.cc
tree-core.h c: Add _Decimal64x support 2024-11-15 08:43:48 +01:00
tree-data-ref.cc tree-optimization/117333 - ICE with NULL access size DR 2024-10-29 11:25:07 +01:00
tree-data-ref.h
tree-dfa.cc
tree-dfa.h
tree-diagnostic-client-data-hooks.cc
tree-diagnostic.cc diagnostics: support multiple output formats simultaneously [PR116613] 2024-10-29 19:12:02 -04:00
tree-diagnostic.h diagnostics: support multiple output formats simultaneously [PR116613] 2024-10-29 19:12:02 -04:00
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 tree-ifcvt: Add zero maskload else value. 2024-11-18 11:48:41 +01:00
tree-if-conv.h
tree-inline.cc
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
tree-nested.cc tree-nested: Do not inline or clone functions with nested functions with VM return type [PR117164] 2024-11-15 14:08:42 +00:00
tree-nested.h
tree-nrv.cc
tree-object-size.cc
tree-object-size.h
tree-outof-ssa.cc
tree-outof-ssa.h
tree-parloops.cc
tree-parloops.h
tree-pass.h
tree-phinodes.cc
tree-phinodes.h
tree-predcom.cc
tree-pretty-print-markup.h
tree-pretty-print.cc
tree-pretty-print.h
tree-profile.cc
tree-scalar-evolution.cc
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
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 Avoid expicit builtion list in tree-ssa-dce 2024-11-16 23:45:57 +01:00
tree-ssa-dce.h
tree-ssa-dom.cc
tree-ssa-dom.h
tree-ssa-dse.cc
tree-ssa-dse.h
tree-ssa-forwprop.cc tree-optimization/117417 - ICE with complex load optimization 2024-11-12 13:03:39 +01:00
tree-ssa-ifcombine.cc ifcombine: For short circuit case, allow 2 convert defining statements [PR85605] 2024-11-07 08:51:55 -08:00
tree-ssa-live.cc
tree-ssa-live.h
tree-ssa-loop-ch.cc
tree-ssa-loop-im.cc
tree-ssa-loop-ivcanon.cc
tree-ssa-loop-ivopts.cc
tree-ssa-loop-ivopts.h
tree-ssa-loop-manip.cc
tree-ssa-loop-manip.h
tree-ssa-loop-niter.cc tree-optimization/117574 - bougs niter lt-to-ne 2024-11-20 11:24:26 +01:00
tree-ssa-loop-niter.h
tree-ssa-loop-prefetch.cc
tree-ssa-loop-split.cc
tree-ssa-loop-unswitch.cc tree-optimization/117510 - fix guard hoisting validity check 2024-11-11 13:03:16 +01:00
tree-ssa-loop.cc
tree-ssa-loop.h
tree-ssa-math-opts.cc Match:Support signed imm SAT_ADD form1 2024-11-07 01:51:34 +00:00
tree-ssa-math-opts.h
tree-ssa-operands.cc
tree-ssa-operands.h
tree-ssa-phiopt.cc phiopt: Move check for maybe_undef_p slightly earlier 2024-10-28 01:17:01 -07:00
tree-ssa-phiprop.cc
tree-ssa-pre.cc
tree-ssa-propagate.cc
tree-ssa-propagate.h
tree-ssa-reassoc.cc
tree-ssa-reassoc.h
tree-ssa-sccvn.cc VN: Don't recurse on for the same value of a | b [PR117496] 2024-11-09 08:20:33 -08:00
tree-ssa-sccvn.h
tree-ssa-scopedtables.cc
tree-ssa-scopedtables.h
tree-ssa-sink.cc
tree-ssa-strlen.cc
tree-ssa-strlen.h
tree-ssa-structalias.cc
tree-ssa-tail-merge.cc
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
tree-streamer.cc
tree-streamer.h
tree-switch-conversion.cc Revert "Simplify switch bit test clustering algorithm" 2024-10-29 16:41:57 -07:00
tree-switch-conversion.h Only do switch bit test clustering when multiple labels point to same bb 2024-10-29 15:08:11 -07:00
tree-tailcall.cc
tree-vect-data-refs.cc Use can_implement_p in the vectoriser 2024-11-20 10:04:45 +00:00
tree-vect-generic.cc Use can_implement_p in the vectoriser 2024-11-20 10:04:45 +00:00
tree-vect-loop-manip.cc Add LOOP_VINFO_MAIN_LOOP_INFO 2024-11-07 13:50:49 +01:00
tree-vect-loop.cc Use can_implement_p in the vectoriser 2024-11-20 10:04:45 +00:00
tree-vect-patterns.cc Use can_implement_p in the vectoriser 2024-11-20 10:04:45 +00:00
tree-vect-slp-patterns.cc tree-optimization/117484 - issue with SLP discovery of permuted .MASK_LOAD 2024-11-12 08:33:58 +01:00
tree-vect-slp.cc vect: Add maskload else value support. 2024-11-18 11:48:42 +01:00
tree-vect-stmts.cc Use can_implement_p in the vectoriser 2024-11-20 10:04:45 +00:00
tree-vector-builder.cc
tree-vector-builder.h
tree-vectorizer.cc [PATCH] Fix SLP when ifcvt versioned loop is not vectorized 2024-10-31 07:23:16 +11:00
tree-vectorizer.h vect: Add maskload else value support. 2024-11-18 11:48:42 +01:00
tree-vrp.cc Reimplement 'assume' processing pass. 2024-11-01 15:24:09 -04:00
tree-vrp.h
tree.cc c: Add _Decimal64x support 2024-11-15 08:43:48 +01:00
tree.def
tree.h c: Add _Decimal64x support 2024-11-15 08:43:48 +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
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.h
value-relation.cc
value-relation.h
var-tracking.cc
varasm.cc Report the section name in case of section type conflicts 2024-11-15 12:00:47 +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
vr-values.h
vtable-verify.cc
vtable-verify.h
warning-control.cc c++: reduce redundant deprecated warnings 2024-11-19 15:36:27 +01:00
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-2024 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.