aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Bergner <bergner@vnet.ibm.com>2007-08-31 01:27:57 +0000
committerPeter Bergner <bergner@vnet.ibm.com>2007-08-31 01:27:57 +0000
commit9083c7d2a7289e6ebf10b2f1698bf196136a69da (patch)
tree12715292a8239d1b0e5b775620124ad2c93e34a6
parent9abf6f33c53841539c944712a490a3e99a592e21 (diff)
Merged revisions 127676-127677,127680-127682,127684,127689,127691-127692,127694-127697,127712-127948 via svnmerge from ra-improvements
svn+ssh://gcc.gnu.org/svn/gcc/trunk git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ra-improvements@127949 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog15
-rw-r--r--MAINTAINERS4
-rwxr-xr-xconfig.guess6
-rwxr-xr-xconfig.sub6
-rw-r--r--config/ChangeLog5
-rw-r--r--contrib/ChangeLog4
-rwxr-xr-xcontrib/gcc_update5
-rw-r--r--gcc/ChangeLog1286
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in14
-rw-r--r--gcc/alias.c15
-rw-r--r--gcc/basic-block.h4
-rw-r--r--gcc/bb-reorder.c4
-rw-r--r--gcc/builtin-types.def2
-rw-r--r--gcc/builtins.c80
-rw-r--r--gcc/builtins.def1
-rw-r--r--gcc/c-common.c15
-rw-r--r--gcc/c-common.h12
-rw-r--r--gcc/c-decl.c20
-rw-r--r--gcc/c-dump.c2
-rw-r--r--gcc/c-lex.c130
-rw-r--r--gcc/c-objc-common.c47
-rw-r--r--gcc/c-pretty-print.c7
-rw-r--r--gcc/c-tree.h2
-rw-r--r--gcc/c-typeck.c44
-rw-r--r--gcc/calls.c4
-rw-r--r--gcc/cfg.c2
-rw-r--r--gcc/cfghooks.c12
-rw-r--r--gcc/cfghooks.h24
-rw-r--r--gcc/cfglayout.c4
-rw-r--r--gcc/cfgloopanal.c1
-rw-r--r--gcc/cfgrtl.c29
-rw-r--r--gcc/cgraphunit.c4
-rw-r--r--gcc/config.gcc7
-rw-r--r--gcc/config/alpha/alpha-protos.h2
-rw-r--r--gcc/config/alpha/alpha.c26
-rw-r--r--gcc/config/alpha/alpha.md10
-rw-r--r--gcc/config/alpha/sync.md2
-rw-r--r--gcc/config/arc/arc-protos.h2
-rw-r--r--gcc/config/arc/arc.c14
-rw-r--r--gcc/config/arm/arm-protos.h8
-rw-r--r--gcc/config/arm/arm.c32
-rw-r--r--gcc/config/arm/arm.h2
-rw-r--r--gcc/config/arm/arm.md4
-rw-r--r--gcc/config/arm/iwmmxt.md4
-rw-r--r--gcc/config/arm/neon.md62
-rw-r--r--gcc/config/arm/pe.c27
-rw-r--r--gcc/config/arm/vec-common.md8
-rw-r--r--gcc/config/avr/avr-protos.h2
-rw-r--r--gcc/config/avr/avr.c10
-rw-r--r--gcc/config/bfin/bfin-protos.h2
-rw-r--r--gcc/config/bfin/bfin.c187
-rw-r--r--gcc/config/bfin/bfin.h8
-rw-r--r--gcc/config/bfin/bfin.md4
-rw-r--r--gcc/config/bfin/bfin.opt8
-rw-r--r--gcc/config/bfin/linux.h3
-rw-r--r--gcc/config/c4x/c4x-c.c23
-rw-r--r--gcc/config/cris/cris.c11
-rw-r--r--gcc/config/cris/cris.md18
-rw-r--r--gcc/config/crx/crx.c4
-rw-r--r--gcc/config/crx/crx.md20
-rw-r--r--gcc/config/darwin-protos.h2
-rw-r--r--gcc/config/darwin.c7
-rw-r--r--gcc/config/fr30/fr30.c6
-rw-r--r--gcc/config/frv/frv.c16
-rw-r--r--gcc/config/frv/frv.md2
-rw-r--r--gcc/config/h8300/h8300.c2
-rw-r--r--gcc/config/i386/i386-protos.h8
-rw-r--r--gcc/config/i386/i386.c213
-rw-r--r--gcc/config/i386/i386.h5
-rw-r--r--gcc/config/i386/i386.md145
-rw-r--r--gcc/config/i386/i386.opt4
-rw-r--r--gcc/config/i386/mmx.md8
-rw-r--r--gcc/config/i386/sse.md101
-rw-r--r--gcc/config/i386/sync.md38
-rw-r--r--gcc/config/i386/winnt.c4
-rw-r--r--gcc/config/ia64/div.md2
-rw-r--r--gcc/config/ia64/ia64-protos.h4
-rw-r--r--gcc/config/ia64/ia64.c51
-rw-r--r--gcc/config/ia64/ia64.md4
-rw-r--r--gcc/config/ia64/sync.md8
-rw-r--r--gcc/config/ia64/vect.md6
-rw-r--r--gcc/config/iq2000/iq2000-protos.h4
-rw-r--r--gcc/config/iq2000/iq2000.c21
-rw-r--r--gcc/config/iq2000/iq2000.h3
-rw-r--r--gcc/config/m32c/blkmov.md2
-rw-r--r--gcc/config/m32c/m32c-protos.h4
-rw-r--r--gcc/config/m32c/m32c.c20
-rw-r--r--gcc/config/m32c/m32c.md14
-rw-r--r--gcc/config/m32r/m32r.c18
-rw-r--r--gcc/config/m68hc11/m68hc11-protos.h2
-rw-r--r--gcc/config/m68hc11/m68hc11.c6
-rw-r--r--gcc/config/m68hc11/m68hc11.h1
-rw-r--r--gcc/config/m68k/linux.h2
-rw-r--r--gcc/config/m68k/m68k-protos.h2
-rw-r--r--gcc/config/m68k/m68k.c67
-rw-r--r--gcc/config/m68k/m68k.h1
-rw-r--r--gcc/config/m68k/m68k.md2
-rw-r--r--gcc/config/mcore/mcore-protos.h4
-rw-r--r--gcc/config/mcore/mcore.c20
-rw-r--r--gcc/config/mips/mips-dsp.md24
-rw-r--r--gcc/config/mips/mips-protos.h4
-rw-r--r--gcc/config/mips/mips.c66
-rw-r--r--gcc/config/mips/mips.h53
-rw-r--r--gcc/config/mips/mips.md50
-rw-r--r--gcc/config/mips/mips.opt2
-rw-r--r--gcc/config/mmix/mmix-protos.h2
-rw-r--r--gcc/config/mmix/mmix.c14
-rw-r--r--gcc/config/mn10300/mn10300-protos.h2
-rw-r--r--gcc/config/mn10300/mn10300.c12
-rw-r--r--gcc/config/mn10300/mn10300.h2
-rw-r--r--gcc/config/mt/mt-protos.h2
-rw-r--r--gcc/config/mt/mt.c12
-rw-r--r--gcc/config/pa/pa-protos.h6
-rw-r--r--gcc/config/pa/pa.c18
-rw-r--r--gcc/config/pdp11/pdp11.c19
-rw-r--r--gcc/config/pdp11/pdp11.h2
-rw-r--r--gcc/config/rs6000/altivec.md10
-rw-r--r--gcc/config/rs6000/ppu_intrinsics.h729
-rw-r--r--gcc/config/rs6000/predicates.md8
-rw-r--r--gcc/config/rs6000/rs6000-protos.h6
-rw-r--r--gcc/config/rs6000/rs6000.c134
-rw-r--r--gcc/config/rs6000/rs6000.md30
-rw-r--r--gcc/config/rs6000/spe.md6
-rw-r--r--gcc/config/rs6000/sync.md2
-rw-r--r--gcc/config/s390/s390-protos.h2
-rw-r--r--gcc/config/s390/s390.c22
-rw-r--r--gcc/config/s390/s390.h7
-rw-r--r--gcc/config/s390/s390.md169
-rw-r--r--gcc/config/score/score-protos.h5
-rw-r--r--gcc/config/score/score.c26
-rw-r--r--gcc/config/score/score.h2
-rw-r--r--gcc/config/sh/sh-protos.h4
-rw-r--r--gcc/config/sh/sh.c34
-rw-r--r--gcc/config/sh/sh.h2
-rw-r--r--gcc/config/sparc/sparc-protos.h4
-rw-r--r--gcc/config/sparc/sparc.c44
-rw-r--r--gcc/config/sparc/sparc.md10
-rw-r--r--gcc/config/sparc/sync.md6
-rw-r--r--gcc/config/spu/spu-protos.h2
-rw-r--r--gcc/config/spu/spu.c16
-rw-r--r--gcc/config/spu/spu.md74
-rw-r--r--gcc/config/stormy16/stormy16-protos.h2
-rw-r--r--gcc/config/stormy16/stormy16.c14
-rw-r--r--gcc/config/v850/v850.c10
-rw-r--r--gcc/config/vax/vax.c2
-rw-r--r--gcc/config/vax/vax.md6
-rw-r--r--gcc/config/xtensa/xtensa.c16
-rw-r--r--gcc/config/xtensa/xtensa.md28
-rwxr-xr-xgcc/configure15
-rw-r--r--gcc/configure.ac15
-rw-r--r--gcc/cp/ChangeLog146
-rw-r--r--gcc/cp/call.c2
-rw-r--r--gcc/cp/class.c2
-rw-r--r--gcc/cp/cp-gimplify.c4
-rw-r--r--gcc/cp/cp-objcp-common.c3
-rw-r--r--gcc/cp/cp-objcp-common.h3
-rw-r--r--gcc/cp/cp-tree.def11
-rw-r--r--gcc/cp/cp-tree.h124
-rw-r--r--gcc/cp/cxx-pretty-print.c2
-rw-r--r--gcc/cp/decl.c147
-rw-r--r--gcc/cp/error.c41
-rw-r--r--gcc/cp/except.c2
-rw-r--r--gcc/cp/lex.c4
-rw-r--r--gcc/cp/method.c4
-rw-r--r--gcc/cp/name-lookup.c11
-rw-r--r--gcc/cp/name-lookup.h3
-rw-r--r--gcc/cp/pt.c144
-rw-r--r--gcc/cp/repo.c2
-rw-r--r--gcc/cp/semantics.c21
-rw-r--r--gcc/cp/tree.c89
-rw-r--r--gcc/cp/typeck.c42
-rw-r--r--gcc/crtstuff.c5
-rw-r--r--gcc/cse.c14
-rw-r--r--gcc/cselib.c12
-rw-r--r--gcc/dbxout.c4
-rw-r--r--gcc/dce.c13
-rw-r--r--gcc/ddg.c10
-rw-r--r--gcc/debug.c4
-rw-r--r--gcc/debug.h4
-rw-r--r--gcc/df-core.c29
-rw-r--r--gcc/df-scan.c1
-rw-r--r--gcc/df.h1
-rw-r--r--gcc/doc/extend.texi33
-rw-r--r--gcc/doc/install.texi3
-rw-r--r--gcc/doc/invoke.texi28
-rw-r--r--gcc/doc/md.texi90
-rw-r--r--gcc/doc/rtl.texi76
-rw-r--r--gcc/doc/tm.texi26
-rw-r--r--gcc/dwarf2out.c137
-rw-r--r--gcc/emit-rtl.c499
-rw-r--r--gcc/except.h4
-rw-r--r--gcc/explow.c6
-rw-r--r--gcc/expr.c112
-rw-r--r--gcc/expr.h27
-rw-r--r--gcc/final.c12
-rw-r--r--gcc/fortran/ChangeLog214
-rw-r--r--gcc/fortran/Make-lang.in2
-rw-r--r--gcc/fortran/check.c22
-rw-r--r--gcc/fortran/decl.c40
-rw-r--r--gcc/fortran/f95-lang.c6
-rw-r--r--gcc/fortran/gfortran.h6
-rw-r--r--gcc/fortran/interface.c17
-rw-r--r--gcc/fortran/intrinsic.c53
-rw-r--r--gcc/fortran/intrinsic.h5
-rw-r--r--gcc/fortran/intrinsic.texi226
-rw-r--r--gcc/fortran/invoke.texi26
-rw-r--r--gcc/fortran/iresolve.c81
-rw-r--r--gcc/fortran/lang.opt6
-rw-r--r--gcc/fortran/match.c262
-rw-r--r--gcc/fortran/mathbuiltins.def2
-rw-r--r--gcc/fortran/module.c50
-rw-r--r--gcc/fortran/options.c42
-rw-r--r--gcc/fortran/parse.c10
-rw-r--r--gcc/fortran/resolve.c241
-rw-r--r--gcc/fortran/simplify.c40
-rw-r--r--gcc/fortran/trans-array.c143
-rw-r--r--gcc/fortran/trans-decl.c54
-rw-r--r--gcc/fortran/trans-expr.c48
-rw-r--r--gcc/fortran/trans-intrinsic.c91
-rw-r--r--gcc/fortran/trans-openmp.c2
-rw-r--r--gcc/fortran/trans-stmt.c15
-rw-r--r--gcc/fortran/trans-types.c21
-rw-r--r--gcc/fortran/trans.c373
-rw-r--r--gcc/fortran/trans.h20
-rw-r--r--gcc/function.c6
-rw-r--r--gcc/gcse.c5
-rw-r--r--gcc/genemit.c1
-rw-r--r--gcc/gengenrtl.c3
-rw-r--r--gcc/ggc-common.c14
-rw-r--r--gcc/gimplify.c18
-rw-r--r--gcc/haifa-sched.c14
-rw-r--r--gcc/hooks.c56
-rw-r--r--gcc/hooks.h35
-rw-r--r--gcc/ifcvt.c7
-rw-r--r--gcc/integrate.c6
-rw-r--r--gcc/integrate.h2
-rw-r--r--gcc/ipa-inline.c2
-rw-r--r--gcc/java/ChangeLog8
-rw-r--r--gcc/java/Make-lang.in2
-rw-r--r--gcc/java/lang.c4
-rw-r--r--gcc/jump.c17
-rw-r--r--gcc/langhooks-def.h8
-rw-r--r--gcc/langhooks.c19
-rw-r--r--gcc/langhooks.h5
-rw-r--r--gcc/local-alloc.c3
-rw-r--r--gcc/loop-doloop.c82
-rw-r--r--gcc/loop-invariant.c4
-rw-r--r--gcc/loop-iv.c2
-rw-r--r--gcc/modulo-sched.c148
-rw-r--r--gcc/optabs.c4
-rw-r--r--gcc/optabs.h2
-rw-r--r--gcc/output.h10
-rw-r--r--gcc/passes.c2
-rw-r--r--gcc/postreload-gcse.c1
-rw-r--r--gcc/predict.c4
-rw-r--r--gcc/print-rtl.c12
-rw-r--r--gcc/read-rtl.c249
-rw-r--r--gcc/reg-stack.c6
-rw-r--r--gcc/regclass.c122
-rw-r--r--gcc/regrename.c1
-rw-r--r--gcc/reload.c2
-rw-r--r--gcc/reload1.c6
-rw-r--r--gcc/resource.c2
-rw-r--r--gcc/rtl.c4
-rw-r--r--gcc/rtl.def49
-rw-r--r--gcc/rtl.h59
-rw-r--r--gcc/rtlanal.c94
-rw-r--r--gcc/sched-deps.c25
-rw-r--r--gcc/sched-int.h14
-rw-r--r--gcc/sched-vis.c4
-rw-r--r--gcc/sdbout.c6
-rw-r--r--gcc/simplify-rtx.c146
-rw-r--r--gcc/system.h9
-rw-r--r--gcc/target-def.h36
-rw-r--r--gcc/target.h69
-rw-r--r--gcc/targhooks.c29
-rw-r--r--gcc/targhooks.h20
-rw-r--r--gcc/testsuite/ChangeLog427
-rw-r--r--gcc/testsuite/g++.dg/debug/const3.C3
-rw-r--r--gcc/testsuite/g++.dg/debug/const4.C2
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/const1.C6
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/const2.C6
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/const2b.C6
-rw-r--r--gcc/testsuite/g++.dg/ext/attrib28.C12
-rw-r--r--gcc/testsuite/g++.dg/ext/gnu-inline-anon-namespace.C11
-rw-r--r--gcc/testsuite/g++.dg/ext/gnu-inline-class-static.C20
-rw-r--r--gcc/testsuite/g++.dg/ext/gnu-inline-class.C19
-rw-r--r--gcc/testsuite/g++.dg/ext/gnu-inline-common.h24
-rw-r--r--gcc/testsuite/g++.dg/ext/gnu-inline-global-reject.C55
-rw-r--r--gcc/testsuite/g++.dg/ext/gnu-inline-global.C50
-rw-r--r--gcc/testsuite/g++.dg/ext/gnu-inline-namespace.C11
-rw-r--r--gcc/testsuite/g++.dg/ext/gnu-inline-template-class.C22
-rw-r--r--gcc/testsuite/g++.dg/ext/gnu-inline-template-func.C17
-rw-r--r--gcc/testsuite/g++.dg/ext/stmtexpr11.C15
-rw-r--r--gcc/testsuite/g++.dg/ext/stmtexpr12.C7
-rw-r--r--gcc/testsuite/g++.dg/ext/visibility/anon5.C8
-rw-r--r--gcc/testsuite/g++.dg/lookup/exception1.C2
-rw-r--r--gcc/testsuite/g++.dg/lookup/ns3.C5
-rw-r--r--gcc/testsuite/g++.dg/opt/inline11.C28
-rw-r--r--gcc/testsuite/g++.dg/other/canon-33194.C21
-rw-r--r--gcc/testsuite/g++.dg/parse/crash36.C11
-rw-r--r--gcc/testsuite/g++.dg/parse/crash37.C15
-rw-r--r--gcc/testsuite/g++.dg/template/error29.C5
-rw-r--r--gcc/testsuite/g++.old-deja/g++.law/profile1.C2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20070827-1.c20
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/limits-blockid.c4
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/limits-enumconst.c4
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr33166.c10
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr33173.c102
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr23135.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/simd-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/simd-4.x7
-rw-r--r--gcc/testsuite/gcc.dg/20021014-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/20050111-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/20050503-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/20060801-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/20061127-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/arm-asm.c2
-rw-r--r--gcc/testsuite/gcc.dg/array-init-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/array-init-2.c51
-rw-r--r--gcc/testsuite/gcc.dg/attr-alloc_size.c4
-rw-r--r--gcc/testsuite/gcc.dg/attr-isr-trap_exit.c2
-rw-r--r--gcc/testsuite/gcc.dg/c99-tgmath-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/c99-tgmath-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/c99-tgmath-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/cast-lvalue-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/cleanup-11.c2
-rw-r--r--gcc/testsuite/gcc.dg/cleanup-12.c69
-rw-r--r--gcc/testsuite/gcc.dg/cleanup-8.c2
-rw-r--r--gcc/testsuite/gcc.dg/cleanup-9.c2
-rw-r--r--gcc/testsuite/gcc.dg/const-float128-ped.c2
-rw-r--r--gcc/testsuite/gcc.dg/const-float128.c2
-rw-r--r--gcc/testsuite/gcc.dg/cpp/empty-include.c2
-rw-r--r--gcc/testsuite/gcc.dg/dfp/pr31344.c (renamed from gcc/testsuite/gcc.dg/pr31344.c)2
-rw-r--r--gcc/testsuite/gcc.dg/dfp/pr31385.c30
-rw-r--r--gcc/testsuite/gcc.dg/fold-eqandshift-1.c14
-rw-r--r--gcc/testsuite/gcc.dg/h8300-ice2.c2
-rw-r--r--gcc/testsuite/gcc.dg/ifelse-2.c34
-rw-r--r--gcc/testsuite/gcc.dg/inline-24.c28
-rw-r--r--gcc/testsuite/gcc.dg/nest.c2
-rw-r--r--gcc/testsuite/gcc.dg/nested-func-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr30744-1.c9
-rw-r--r--gcc/testsuite/gcc.dg/pr32328.c17
-rw-r--r--gcc/testsuite/gcc.dg/pr32370.c24
-rw-r--r--gcc/testsuite/gcc.dg/pr32450.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr32573.c30
-rw-r--r--gcc/testsuite/gcc.dg/pr32721.c2
-rw-r--r--gcc/testsuite/gcc.dg/pragma-isr-trap_exit.c2
-rw-r--r--gcc/testsuite/gcc.dg/pragma-isr.c2
-rw-r--r--gcc/testsuite/gcc.dg/pragma-isr2.c2
-rw-r--r--gcc/testsuite/gcc.dg/sibcall-6.c4
-rw-r--r--gcc/testsuite/gcc.dg/sms-1.c38
-rw-r--r--gcc/testsuite/gcc.dg/sync-2.c6
-rw-r--r--gcc/testsuite/gcc.dg/sync-3.c10
-rw-r--r--gcc/testsuite/gcc.dg/tls/opt-5.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-chk-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-chk-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-vfprintf-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-vprintf-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-vprintf-chk-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/foldaddr-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/loadpre6.c3
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr26421.c2
-rw-r--r--gcc/testsuite/gcc.dg/unsigned-long-compare.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/20051215-1.c (renamed from gcc/testsuite/gcc.dg/20051215-1.c)0
-rw-r--r--gcc/testsuite/gcc.target/arm/eabi1.c (renamed from gcc/testsuite/gcc.dg/arm-eabi1.c)0
-rw-r--r--gcc/testsuite/gcc.target/arm/symbian1.c (renamed from gcc/testsuite/gcc.dg/symbian1.c)0
-rw-r--r--gcc/testsuite/gcc.target/arm/symbian2.c (renamed from gcc/testsuite/gcc.dg/symbian2.c)0
-rw-r--r--gcc/testsuite/gcc.target/arm/symbian3.c (renamed from gcc/testsuite/gcc.dg/symbian3.c)0
-rw-r--r--gcc/testsuite/gcc.target/arm/symbian4.c (renamed from gcc/testsuite/gcc.dg/symbian4.c)0
-rw-r--r--gcc/testsuite/gcc.target/arm/symbian5.c (renamed from gcc/testsuite/gcc.dg/symbian5.c)0
-rw-r--r--gcc/testsuite/gcc.target/bfin/longcall-1.c (renamed from gcc/testsuite/gcc.dg/bfin-longcall-1.c)0
-rw-r--r--gcc/testsuite/gcc.target/bfin/longcall-2.c (renamed from gcc/testsuite/gcc.dg/bfin-longcall-2.c)0
-rw-r--r--gcc/testsuite/gcc.target/cris/20011127-1.c (renamed from gcc/testsuite/gcc.dg/20011127-1.c)0
-rw-r--r--gcc/testsuite/gcc.target/cris/asmreg-1.c (renamed from gcc/testsuite/gcc.dg/asmreg-1.c)0
-rw-r--r--gcc/testsuite/gcc.target/cris/peep2-andu1.c (renamed from gcc/testsuite/gcc.dg/cris-peep2-andu1.c)0
-rw-r--r--gcc/testsuite/gcc.target/cris/peep2-andu2.c (renamed from gcc/testsuite/gcc.dg/cris-peep2-andu2.c)0
-rw-r--r--gcc/testsuite/gcc.target/cris/peep2-xsrand.c (renamed from gcc/testsuite/gcc.dg/cris-peep2-xsrand.c)0
-rw-r--r--gcc/testsuite/gcc.target/cris/peep2-xsrand2.c (renamed from gcc/testsuite/gcc.dg/cris-peep2-xsrand2.c)0
-rw-r--r--gcc/testsuite/gcc.target/i386/20011119-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/20020523-1.c4
-rw-r--r--gcc/testsuite/gcc.target/i386/asm-3.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/cmov3.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/cmov4.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/darwin-fpmath.c (renamed from gcc/testsuite/gcc.dg/i386-darwin-fpmath.c)0
-rw-r--r--gcc/testsuite/gcc.target/i386/fastcall-1.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/local2.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/pow-1.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr17390.c10
-rw-r--r--gcc/testsuite/gcc.target/i386/pr32661.c29
-rw-r--r--gcc/testsuite/gcc.target/i386/stack-prot-kernel.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/tailcall-1.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/vectorize5.c17
-rw-r--r--gcc/testsuite/gcc.target/i386/xchg-2.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/xorps-sse.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/xorps-sse2.c15
-rw-r--r--gcc/testsuite/gcc.target/m68k/interrupt-1.c24
-rw-r--r--gcc/testsuite/gcc.target/m68k/pic-1.c (renamed from gcc/testsuite/gcc.dg/m68k-pic-1.c)0
-rw-r--r--gcc/testsuite/gcc.target/m68k/slp-ice.c (renamed from gcc/testsuite/gcc.dg/m68k-slp-ice.c)0
-rw-r--r--gcc/testsuite/gcc.target/mips/20020620-1.c (renamed from gcc/testsuite/gcc.dg/20020620-1.c)0
-rw-r--r--gcc/testsuite/gcc.target/powerpc/const-compare.c (renamed from gcc/testsuite/gcc.dg/const-compare.c)0
-rw-r--r--gcc/testsuite/gcc.target/powerpc/leaf.c (renamed from gcc/testsuite/gcc.dg/rs6000-leaf.c)0
-rw-r--r--gcc/testsuite/gcc.target/powerpc/non-lazy-ptr-test.c (renamed from gcc/testsuite/gcc.dg/non-lazy-ptr-test.c)0
-rw-r--r--gcc/testsuite/gcc.target/powerpc/ppu-intrinsics.c36
-rw-r--r--gcc/testsuite/gcc.target/s390/20020926-1.c (renamed from gcc/testsuite/gcc.dg/20020926-1.c)2
-rw-r--r--gcc/testsuite/gcc.target/s390/20030123-1.c (renamed from gcc/testsuite/gcc.dg/20030123-1.c)2
-rw-r--r--gcc/testsuite/gcc.target/s390/20030129-1.c (renamed from gcc/testsuite/gcc.dg/20030129-1.c)2
-rw-r--r--gcc/testsuite/gcc.target/s390/20040305-1.c (renamed from gcc/testsuite/gcc.dg/20040305-1.c)2
-rw-r--r--gcc/testsuite/gcc.target/s390/20041109-1.c (renamed from gcc/testsuite/gcc.dg/20041109-1.c)2
-rw-r--r--gcc/testsuite/gcc.target/s390/20041216-1.c (renamed from gcc/testsuite/gcc.dg/20041216-1.c)2
-rw-r--r--gcc/testsuite/gcc.target/s390/20050409-1.c (renamed from gcc/testsuite/gcc.dg/20050409-1.c)2
-rw-r--r--gcc/testsuite/gcc.target/s390/20050524-1.c (renamed from gcc/testsuite/gcc.dg/20050524-1.c)2
-rw-r--r--gcc/testsuite/gcc.target/s390/20050824-1.c (renamed from gcc/testsuite/gcc.dg/20050824-1.c)2
-rw-r--r--gcc/testsuite/gcc.target/s390/pr20927.c (renamed from gcc/testsuite/gcc.dg/pr20927.c)2
-rw-r--r--gcc/testsuite/gcc.target/s390/pr24624.c (renamed from gcc/testsuite/gcc.dg/pr24624.c)2
-rw-r--r--gcc/testsuite/gcc.target/s390/pr27661.c (renamed from gcc/testsuite/gcc.dg/pr27661.c)2
-rw-r--r--gcc/testsuite/gcc.target/s390/s390.exp41
-rw-r--r--gcc/testsuite/gcc.target/sh/pr21255-1.c (renamed from gcc/testsuite/gcc.dg/pr21255-1.c)0
-rw-r--r--gcc/testsuite/gcc.target/sh/pr21255-2-mb.c (renamed from gcc/testsuite/gcc.dg/pr21255-2-mb.c)0
-rw-r--r--gcc/testsuite/gcc.target/sh/pr21255-2-ml.c (renamed from gcc/testsuite/gcc.dg/pr21255-2-ml.c)0
-rw-r--r--gcc/testsuite/gcc.target/sh/pr21255-3.c (renamed from gcc/testsuite/gcc.dg/pr21255-3.c)0
-rw-r--r--gcc/testsuite/gcc.target/sh/pr21255-4.c (renamed from gcc/testsuite/gcc.dg/pr21255-4.c)0
-rw-r--r--gcc/testsuite/gcc.target/sh/sh-relax-vxworks.c (renamed from gcc/testsuite/gcc.dg/sh-relax-vxworks.c)0
-rw-r--r--gcc/testsuite/gcc.target/sh/sh-relax.c (renamed from gcc/testsuite/gcc.dg/sh-relax.c)0
-rw-r--r--gcc/testsuite/gcc.target/sh/sh.exp41
-rw-r--r--gcc/testsuite/gcc.target/sh/sh4a-bitmovua.c (renamed from gcc/testsuite/gcc.dg/sh4a-bitmovua.c)0
-rw-r--r--gcc/testsuite/gcc.target/sh/sh4a-cos.c (renamed from gcc/testsuite/gcc.dg/sh4a-cos.c)0
-rw-r--r--gcc/testsuite/gcc.target/sh/sh4a-cosf.c (renamed from gcc/testsuite/gcc.dg/sh4a-cosf.c)0
-rw-r--r--gcc/testsuite/gcc.target/sh/sh4a-fprun.c (renamed from gcc/testsuite/gcc.dg/sh4a-fprun.c)0
-rw-r--r--gcc/testsuite/gcc.target/sh/sh4a-fsrra.c (renamed from gcc/testsuite/gcc.dg/sh4a-fsrra.c)0
-rw-r--r--gcc/testsuite/gcc.target/sh/sh4a-memmovua.c (renamed from gcc/testsuite/gcc.dg/sh4a-memmovua.c)0
-rw-r--r--gcc/testsuite/gcc.target/sh/sh4a-sin.c (renamed from gcc/testsuite/gcc.dg/sh4a-sin.c)0
-rw-r--r--gcc/testsuite/gcc.target/sh/sh4a-sincos.c (renamed from gcc/testsuite/gcc.dg/sh4a-sincos.c)0
-rw-r--r--gcc/testsuite/gcc.target/sh/sh4a-sincosf.c (renamed from gcc/testsuite/gcc.dg/sh4a-sincosf.c)0
-rw-r--r--gcc/testsuite/gcc.target/sh/sh4a-sinf.c (renamed from gcc/testsuite/gcc.dg/sh4a-sinf.c)0
-rw-r--r--gcc/testsuite/gfortran.dg/alloc_comp_basics_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/alloc_comp_constructor_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/assumed_charlen_sharing.f9029
-rw-r--r--gcc/testsuite/gfortran.dg/binding_label_tests_15.f0312
-rw-r--r--gcc/testsuite/gfortran.dg/binding_label_tests_16.f0322
-rw-r--r--gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_2.f0323
-rw-r--r--gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_2_driver.c7
-rw-r--r--gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_3.f0322
-rw-r--r--gcc/testsuite/gfortran.dg/char_assign_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/char_length_7.f9032
-rw-r--r--gcc/testsuite/gfortran.dg/char_length_8.f9069
-rw-r--r--gcc/testsuite/gfortran.dg/char_length_9.f9022
-rw-r--r--gcc/testsuite/gfortran.dg/char_result_4.f908
-rw-r--r--gcc/testsuite/gfortran.dg/common_10.f9055
-rw-r--r--gcc/testsuite/gfortran.dg/gamma_1.f9027
-rw-r--r--gcc/testsuite/gfortran.dg/gamma_2.f9032
-rw-r--r--gcc/testsuite/gfortran.dg/gamma_3.f9027
-rw-r--r--gcc/testsuite/gfortran.dg/gamma_4.f9020
-rw-r--r--gcc/testsuite/gfortran.dg/generic_14.f90105
-rw-r--r--gcc/testsuite/gfortran.dg/generic_9.f902
-rw-r--r--gcc/testsuite/gfortran.dg/initialization_13.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/initialization_4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/interface_abstract_1.f906
-rw-r--r--gcc/testsuite/gfortran.dg/interface_abstract_3.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/is_iostat_end_eor_1.f909
-rw-r--r--gcc/testsuite/gfortran.dg/isnan_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/min_max_optional_2.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/min_max_optional_3.f9014
-rw-r--r--gcc/testsuite/gfortran.dg/min_max_optional_4.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/min_max_optional_5.f9021
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_14.f901
-rw-r--r--gcc/testsuite/gfortran.dg/nan_1.f901
-rw-r--r--gcc/testsuite/gfortran.dg/negative_unit.f3
-rw-r--r--gcc/testsuite/gfortran.dg/openmp_stack.f9022
-rw-r--r--gcc/testsuite/gfortran.dg/pointer_assign_4.f9066
-rw-r--r--gcc/testsuite/gfortran.dg/recursive_stack.f9021
-rw-r--r--gcc/testsuite/gfortran.dg/shape_2.f908
-rw-r--r--gcc/testsuite/gfortran.dg/use_10.f9029
-rw-r--r--gcc/testsuite/gfortran.dg/used_types_18.f9012
-rw-r--r--gcc/testsuite/gfortran.fortran-torture/execute/getarg_1.f908
-rw-r--r--gcc/testsuite/gnat.dg/prefix2.adb31
-rw-r--r--gcc/testsuite/gnat.dg/prefix2.ads17
-rw-r--r--gcc/testsuite/gnat.dg/remote_type.adb26
-rw-r--r--gcc/testsuite/gnat.dg/remote_type.ads24
-rw-r--r--gcc/testsuite/gnat.dg/requeue1.adb51
-rw-r--r--gcc/testsuite/gnat.dg/specs/ai_116.ads23
-rw-r--r--gcc/testsuite/gnat.dg/specs/private_with.ads16
-rw-r--r--gcc/testsuite/gnat.dg/specs/with_containers.ads27
-rw-r--r--gcc/testsuite/gnat.dg/test_prefix1.adb2
-rw-r--r--gcc/testsuite/gnat.dg/test_table1.adb40
-rw-r--r--gcc/testsuite/lib/gcc-dg.exp6
-rw-r--r--gcc/testsuite/lib/target-supports.exp1
-rw-r--r--gcc/toplev.c144
-rw-r--r--gcc/toplev.h2
-rw-r--r--gcc/tree-cfg.c36
-rw-r--r--gcc/tree-data-ref.c39
-rw-r--r--gcc/tree-dfa.c2
-rw-r--r--gcc/tree-dump.c12
-rw-r--r--gcc/tree-dump.h10
-rw-r--r--gcc/tree-eh.c10
-rw-r--r--gcc/tree-flow-inline.h2
-rw-r--r--gcc/tree-flow.h12
-rw-r--r--gcc/tree-gimple.c28
-rw-r--r--gcc/tree-gimple.h1
-rw-r--r--gcc/tree-inline.c64
-rw-r--r--gcc/tree-inline.h1
-rw-r--r--gcc/tree-pass.h2
-rw-r--r--gcc/tree-pretty-print.c9
-rw-r--r--gcc/tree-ssa-alias.c2
-rw-r--r--gcc/tree-ssa-ccp.c7
-rw-r--r--gcc/tree-ssa-loop-niter.c8
-rw-r--r--gcc/tree-ssa-pre.c56
-rw-r--r--gcc/tree-ssa-propagate.c1
-rw-r--r--gcc/tree-ssa-sccvn.c20
-rw-r--r--gcc/tree-ssa-sccvn.h2
-rw-r--r--gcc/tree-ssa-structalias.c34
-rw-r--r--gcc/tree-ssa.c82
-rw-r--r--gcc/tree-vectorizer.c6
-rw-r--r--gcc/tree-vectorizer.h6
-rw-r--r--gcc/tree-vn.c30
-rw-r--r--gcc/tree-vrp.c30
-rw-r--r--gcc/tree.c68
-rw-r--r--gcc/tree.h46
-rw-r--r--gcc/value-prof.c4
-rw-r--r--gcc/varasm.c52
-rw-r--r--gcc/varpool.c5
-rw-r--r--gcc/vmsdbgout.c30
-rw-r--r--gcc/xcoffout.c1
-rw-r--r--libcpp/ChangeLog11
-rw-r--r--libcpp/expr.c63
-rw-r--r--libcpp/include/cpplib.h10
-rw-r--r--libffi/ChangeLog4
-rw-r--r--libffi/testsuite/libffi.call/return_sl.c38
-rw-r--r--libgcc/ChangeLog4
-rw-r--r--libgcc/config.host2
-rw-r--r--libgfortran/ChangeLog222
-rw-r--r--libgfortran/Makefile.am2
-rw-r--r--libgfortran/acinclude.m416
-rw-r--r--libgfortran/config.h.in3
-rwxr-xr-xlibgfortran/configure77
-rw-r--r--libgfortran/configure.ac3
-rw-r--r--libgfortran/generated/matmul_l16.c55
-rw-r--r--libgfortran/generated/matmul_l4.c55
-rw-r--r--libgfortran/generated/matmul_l8.c55
-rw-r--r--libgfortran/generated/maxloc0_16_i1.c33
-rw-r--r--libgfortran/generated/maxloc0_16_i16.c33
-rw-r--r--libgfortran/generated/maxloc0_16_i2.c33
-rw-r--r--libgfortran/generated/maxloc0_16_i4.c33
-rw-r--r--libgfortran/generated/maxloc0_16_i8.c33
-rw-r--r--libgfortran/generated/maxloc0_16_r10.c33
-rw-r--r--libgfortran/generated/maxloc0_16_r16.c33
-rw-r--r--libgfortran/generated/maxloc0_16_r4.c33
-rw-r--r--libgfortran/generated/maxloc0_16_r8.c33
-rw-r--r--libgfortran/generated/maxloc0_4_i1.c33
-rw-r--r--libgfortran/generated/maxloc0_4_i16.c33
-rw-r--r--libgfortran/generated/maxloc0_4_i2.c33
-rw-r--r--libgfortran/generated/maxloc0_4_i4.c33
-rw-r--r--libgfortran/generated/maxloc0_4_i8.c33
-rw-r--r--libgfortran/generated/maxloc0_4_r10.c33
-rw-r--r--libgfortran/generated/maxloc0_4_r16.c33
-rw-r--r--libgfortran/generated/maxloc0_4_r4.c33
-rw-r--r--libgfortran/generated/maxloc0_4_r8.c33
-rw-r--r--libgfortran/generated/maxloc0_8_i1.c33
-rw-r--r--libgfortran/generated/maxloc0_8_i16.c33
-rw-r--r--libgfortran/generated/maxloc0_8_i2.c33
-rw-r--r--libgfortran/generated/maxloc0_8_i4.c33
-rw-r--r--libgfortran/generated/maxloc0_8_i8.c33
-rw-r--r--libgfortran/generated/maxloc0_8_r10.c33
-rw-r--r--libgfortran/generated/maxloc0_8_r16.c33
-rw-r--r--libgfortran/generated/maxloc0_8_r4.c33
-rw-r--r--libgfortran/generated/maxloc0_8_r8.c33
-rw-r--r--libgfortran/generated/maxloc1_16_i1.c40
-rw-r--r--libgfortran/generated/maxloc1_16_i16.c40
-rw-r--r--libgfortran/generated/maxloc1_16_i2.c40
-rw-r--r--libgfortran/generated/maxloc1_16_i4.c40
-rw-r--r--libgfortran/generated/maxloc1_16_i8.c40
-rw-r--r--libgfortran/generated/maxloc1_16_r10.c40
-rw-r--r--libgfortran/generated/maxloc1_16_r16.c40
-rw-r--r--libgfortran/generated/maxloc1_16_r4.c40
-rw-r--r--libgfortran/generated/maxloc1_16_r8.c40
-rw-r--r--libgfortran/generated/maxloc1_4_i1.c40
-rw-r--r--libgfortran/generated/maxloc1_4_i16.c40
-rw-r--r--libgfortran/generated/maxloc1_4_i2.c40
-rw-r--r--libgfortran/generated/maxloc1_4_i4.c40
-rw-r--r--libgfortran/generated/maxloc1_4_i8.c40
-rw-r--r--libgfortran/generated/maxloc1_4_r10.c40
-rw-r--r--libgfortran/generated/maxloc1_4_r16.c40
-rw-r--r--libgfortran/generated/maxloc1_4_r4.c40
-rw-r--r--libgfortran/generated/maxloc1_4_r8.c40
-rw-r--r--libgfortran/generated/maxloc1_8_i1.c40
-rw-r--r--libgfortran/generated/maxloc1_8_i16.c40
-rw-r--r--libgfortran/generated/maxloc1_8_i2.c40
-rw-r--r--libgfortran/generated/maxloc1_8_i4.c40
-rw-r--r--libgfortran/generated/maxloc1_8_i8.c40
-rw-r--r--libgfortran/generated/maxloc1_8_r10.c40
-rw-r--r--libgfortran/generated/maxloc1_8_r16.c40
-rw-r--r--libgfortran/generated/maxloc1_8_r4.c40
-rw-r--r--libgfortran/generated/maxloc1_8_r8.c40
-rw-r--r--libgfortran/generated/maxval_i1.c40
-rw-r--r--libgfortran/generated/maxval_i16.c40
-rw-r--r--libgfortran/generated/maxval_i2.c40
-rw-r--r--libgfortran/generated/maxval_i4.c40
-rw-r--r--libgfortran/generated/maxval_i8.c40
-rw-r--r--libgfortran/generated/maxval_r10.c40
-rw-r--r--libgfortran/generated/maxval_r16.c40
-rw-r--r--libgfortran/generated/maxval_r4.c40
-rw-r--r--libgfortran/generated/maxval_r8.c40
-rw-r--r--libgfortran/generated/minloc0_16_i1.c33
-rw-r--r--libgfortran/generated/minloc0_16_i16.c33
-rw-r--r--libgfortran/generated/minloc0_16_i2.c33
-rw-r--r--libgfortran/generated/minloc0_16_i4.c33
-rw-r--r--libgfortran/generated/minloc0_16_i8.c33
-rw-r--r--libgfortran/generated/minloc0_16_r10.c33
-rw-r--r--libgfortran/generated/minloc0_16_r16.c33
-rw-r--r--libgfortran/generated/minloc0_16_r4.c33
-rw-r--r--libgfortran/generated/minloc0_16_r8.c33
-rw-r--r--libgfortran/generated/minloc0_4_i1.c33
-rw-r--r--libgfortran/generated/minloc0_4_i16.c33
-rw-r--r--libgfortran/generated/minloc0_4_i2.c33
-rw-r--r--libgfortran/generated/minloc0_4_i4.c33
-rw-r--r--libgfortran/generated/minloc0_4_i8.c33
-rw-r--r--libgfortran/generated/minloc0_4_r10.c33
-rw-r--r--libgfortran/generated/minloc0_4_r16.c33
-rw-r--r--libgfortran/generated/minloc0_4_r4.c33
-rw-r--r--libgfortran/generated/minloc0_4_r8.c33
-rw-r--r--libgfortran/generated/minloc0_8_i1.c33
-rw-r--r--libgfortran/generated/minloc0_8_i16.c33
-rw-r--r--libgfortran/generated/minloc0_8_i2.c33
-rw-r--r--libgfortran/generated/minloc0_8_i4.c33
-rw-r--r--libgfortran/generated/minloc0_8_i8.c33
-rw-r--r--libgfortran/generated/minloc0_8_r10.c33
-rw-r--r--libgfortran/generated/minloc0_8_r16.c33
-rw-r--r--libgfortran/generated/minloc0_8_r4.c33
-rw-r--r--libgfortran/generated/minloc0_8_r8.c33
-rw-r--r--libgfortran/generated/minloc1_16_i1.c40
-rw-r--r--libgfortran/generated/minloc1_16_i16.c40
-rw-r--r--libgfortran/generated/minloc1_16_i2.c40
-rw-r--r--libgfortran/generated/minloc1_16_i4.c40
-rw-r--r--libgfortran/generated/minloc1_16_i8.c40
-rw-r--r--libgfortran/generated/minloc1_16_r10.c40
-rw-r--r--libgfortran/generated/minloc1_16_r16.c40
-rw-r--r--libgfortran/generated/minloc1_16_r4.c40
-rw-r--r--libgfortran/generated/minloc1_16_r8.c40
-rw-r--r--libgfortran/generated/minloc1_4_i1.c40
-rw-r--r--libgfortran/generated/minloc1_4_i16.c40
-rw-r--r--libgfortran/generated/minloc1_4_i2.c40
-rw-r--r--libgfortran/generated/minloc1_4_i4.c40
-rw-r--r--libgfortran/generated/minloc1_4_i8.c40
-rw-r--r--libgfortran/generated/minloc1_4_r10.c40
-rw-r--r--libgfortran/generated/minloc1_4_r16.c40
-rw-r--r--libgfortran/generated/minloc1_4_r4.c40
-rw-r--r--libgfortran/generated/minloc1_4_r8.c40
-rw-r--r--libgfortran/generated/minloc1_8_i1.c40
-rw-r--r--libgfortran/generated/minloc1_8_i16.c40
-rw-r--r--libgfortran/generated/minloc1_8_i2.c40
-rw-r--r--libgfortran/generated/minloc1_8_i4.c40
-rw-r--r--libgfortran/generated/minloc1_8_i8.c40
-rw-r--r--libgfortran/generated/minloc1_8_r10.c40
-rw-r--r--libgfortran/generated/minloc1_8_r16.c40
-rw-r--r--libgfortran/generated/minloc1_8_r4.c40
-rw-r--r--libgfortran/generated/minloc1_8_r8.c40
-rw-r--r--libgfortran/generated/minval_i1.c40
-rw-r--r--libgfortran/generated/minval_i16.c40
-rw-r--r--libgfortran/generated/minval_i2.c40
-rw-r--r--libgfortran/generated/minval_i4.c40
-rw-r--r--libgfortran/generated/minval_i8.c40
-rw-r--r--libgfortran/generated/minval_r10.c40
-rw-r--r--libgfortran/generated/minval_r16.c40
-rw-r--r--libgfortran/generated/minval_r4.c40
-rw-r--r--libgfortran/generated/minval_r8.c40
-rw-r--r--libgfortran/generated/product_c10.c40
-rw-r--r--libgfortran/generated/product_c16.c40
-rw-r--r--libgfortran/generated/product_c4.c40
-rw-r--r--libgfortran/generated/product_c8.c40
-rw-r--r--libgfortran/generated/product_i1.c40
-rw-r--r--libgfortran/generated/product_i16.c40
-rw-r--r--libgfortran/generated/product_i2.c40
-rw-r--r--libgfortran/generated/product_i4.c40
-rw-r--r--libgfortran/generated/product_i8.c40
-rw-r--r--libgfortran/generated/product_r10.c40
-rw-r--r--libgfortran/generated/product_r16.c40
-rw-r--r--libgfortran/generated/product_r4.c40
-rw-r--r--libgfortran/generated/product_r8.c40
-rw-r--r--libgfortran/generated/sum_c10.c40
-rw-r--r--libgfortran/generated/sum_c16.c40
-rw-r--r--libgfortran/generated/sum_c4.c40
-rw-r--r--libgfortran/generated/sum_c8.c40
-rw-r--r--libgfortran/generated/sum_i1.c40
-rw-r--r--libgfortran/generated/sum_i16.c40
-rw-r--r--libgfortran/generated/sum_i2.c40
-rw-r--r--libgfortran/generated/sum_i4.c40
-rw-r--r--libgfortran/generated/sum_i8.c40
-rw-r--r--libgfortran/generated/sum_r10.c40
-rw-r--r--libgfortran/generated/sum_r16.c40
-rw-r--r--libgfortran/generated/sum_r4.c40
-rw-r--r--libgfortran/generated/sum_r8.c40
-rw-r--r--libgfortran/gfortran.map4
-rw-r--r--libgfortran/intrinsics/pack_generic.c46
-rw-r--r--libgfortran/intrinsics/unpack_generic.c42
-rw-r--r--libgfortran/io/write.c756
-rw-r--r--libgfortran/io/write_float.def808
-rw-r--r--libgfortran/libgfortran.h20
-rw-r--r--libgfortran/m4/iforeach.m433
-rw-r--r--libgfortran/m4/ifunction.m440
-rw-r--r--libgfortran/m4/matmull.m456
-rw-r--r--libgfortran/runtime/memory.c124
-rw-r--r--libiberty/ChangeLog8
-rw-r--r--libiberty/pex-common.h10
-rw-r--r--libiberty/pex-djgpp.c40
-rw-r--r--libiberty/pex-msdos.c14
-rw-r--r--libiberty/pex-unix.c20
-rw-r--r--libiberty/pex-win32.c32
-rw-r--r--libjava/ChangeLog4
-rw-r--r--libjava/classpath/ChangeLog7
-rw-r--r--libjava/classpath/java/util/EnumSet.java170
-rw-r--r--libjava/gij.cc4
-rw-r--r--libstdc++-v3/ChangeLog96
-rw-r--r--libstdc++-v3/acinclude.m496
-rw-r--r--libstdc++-v3/config.h.in27
-rw-r--r--libstdc++-v3/config/abi/pre/gnu.ver45
-rwxr-xr-xlibstdc++-v3/configure586
-rw-r--r--libstdc++-v3/configure.ac7
-rw-r--r--libstdc++-v3/docs/doxygen/user.cfg.in1
-rw-r--r--libstdc++-v3/include/Makefile.am1
-rw-r--r--libstdc++-v3/include/Makefile.in1
-rw-r--r--libstdc++-v3/include/bits/functional_hash.h16
-rw-r--r--libstdc++-v3/include/std/ostream11
-rw-r--r--libstdc++-v3/include/std/system_error265
-rw-r--r--libstdc++-v3/include/tr1_impl/random6
-rw-r--r--libstdc++-v3/src/Makefile.am7
-rw-r--r--libstdc++-v3/src/Makefile.in33
-rw-r--r--libstdc++-v3/src/system_error.cc71
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc56
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/error_category/cons/default.cc61
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/error_category/operators/equal.cc62
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/error_category/operators/not_equal.cc62
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc63
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool.cc46
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool_neg.cc34
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc58
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc58
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/headers/system_error/std_c++0x_neg.cc (renamed from libstdc++-v3/testsuite/23_containers/hash/requirements/explicit_instantiation.cc)20
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/headers/system_error/types_std_c++0x.cc142
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc47
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc31
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/system_error/what-1.cc59
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/system_error/what-2.cc51
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc69
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc45
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/system_error/what-big.cc41
-rw-r--r--libstdc++-v3/testsuite/20_util/bad_function_call/cons_virtual_derivation.cc (renamed from libstdc++-v3/testsuite/20_util/function_objects/bad_function_call/cons_virtual_derivation.cc)0
-rw-r--r--libstdc++-v3/testsuite/20_util/hash/operators/size_t.cc55
-rw-r--r--libstdc++-v3/testsuite/20_util/hash/requirements/explicit_instantiation.cc48
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc74
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc75
-rw-r--r--libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/33128.cc43
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/hash/operators/size_t.cc75
756 files changed, 18494 insertions, 6794 deletions
diff --git a/ChangeLog b/ChangeLog
index f03b3ab82e4..234f2921cd6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2007-08-30 Krister Walfridsson <cato@df.lth.se>
+
+ * MAINTAINERS (OS Port Maintainers): Add myself as NetBSD maintainer.
+ (Write After Approval): Remove myself.
+
+2007-08-29 Nick Clifton <nickc@redhat.com>
+
+ * config.sub, config.guess: Update from upstream sources.
+
+2007-08-22 Bud Davis <jmdavis@link.com>
+
+ * MAINTAINERS (Write After Approval): Added myself.
+ * MAINTAINERS (Reviewers): Removed myself.
+
2007-08-18 Paul Brook <paul@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
@@ -10,7 +24,6 @@
2007-08-17 Richard Sandiford <richard@codesourcery.com>
Nigel Stephens <nigel@mips.com>
- * config/mt-sde: New file.
* configure.ac (mips*-sde-elf*): New stanza. Use config/mt-sde
as target_makefile_frag.
* configure: Regenerate.
diff --git a/MAINTAINERS b/MAINTAINERS
index 61f7bac3d5d..c853876be7d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -105,6 +105,7 @@ hpux Dave Anglin dave.anglin@nrc.ca
hpux Steve Ellcey sje@cup.hp.com
irix, osf Rainer Orth ro@TechFak.Uni-Bielefeld.DE
netbsd Jason Thorpe thorpej@netbsd.org
+netbsd Krister Walfridsson cato@df.lth.se
sco5, unixware, sco udk Kean Johnston jkj@sco.com
sh-linux-gnu Kaz Kojima kkojima@gcc.gnu.org
RTEMS Ports Joel Sherrill joel@oarcorp.com
@@ -241,7 +242,6 @@ dataflow Kenneth Zadeck zadeck@naturalbridge.com
Fortran Janne Blomqvist jb@gcc.gnu.org
Fortran Tobias Burnus burnus@net-b.de
Fortran François-Xavier Coudert fxcoudert@gcc.gnu.org
-Fortran Bud Davis jmdavis@link.com
Fortran Jerry DeLisle jvdelisle@gcc.gnu.org
Fortran Erik Edelmann erik.edelmann@iki.fi
Fortran Steve Kargl sgk@troutmask.apl.washington.edu
@@ -295,6 +295,7 @@ R. Kelley Cook kcook@gcc.gnu.org
Christian Cornelssen ccorn@cs.tu-berlin.de
Ian Dall ian@beware.dropbear.id.au
David Daney ddaney@avtrex.com
+Bud Davis jmdavis@link.com
Benoit Dupont de Dinechin benoit.dupont-de-dinechin@st.com
Mohan Embar gnustuff@thisiscool.com
Revital Eres eres@il.ibm.com
@@ -413,7 +414,6 @@ Caroline Tice ctice@apple.com
Michael Tiemann tiemann@redhat.com
David Ung davidu@mips.com
Jonathan Wakely redi@gcc.gnu.org
-Krister Walfridsson cato@df.lth.se
Feng Wang fengwang@nudt.edu.cn
Stephen M. Webb stephen.webb@bregmasoft.com
John Wehle john@feith.com
diff --git a/config.guess b/config.guess
index 951383e3554..278f9e9e07c 100755
--- a/config.guess
+++ b/config.guess
@@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc.
-timestamp='2007-05-17'
+timestamp='2007-07-22'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -330,7 +330,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
- i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*)
+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
@@ -793,7 +793,7 @@ EOF
exit ;;
*:Interix*:[3456]*)
case ${UNAME_MACHINE} in
- x86)
+ x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
EM64T | authenticamd)
diff --git a/config.sub b/config.sub
index c060f448339..1761d8bdf63 100755
--- a/config.sub
+++ b/config.sub
@@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc.
-timestamp='2007-04-29'
+timestamp='2007-06-28'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -475,8 +475,8 @@ case $basic_machine in
basic_machine=craynv-cray
os=-unicosmp
;;
- cr16c)
- basic_machine=cr16c-unknown
+ cr16)
+ basic_machine=cr16-unknown
os=-elf
;;
crds | unos)
diff --git a/config/ChangeLog b/config/ChangeLog
index 3df146fbd9c..30cb805b7aa 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -4,6 +4,11 @@
* mt-gnu (CXXFLAGS_FOR_TARGET): Add
$(DEBUG_PREFIX_CFLAGS_FOR_TARGET).
+2007-08-17 Richard Sandiford <richard@codesourcery.com>
+ Nigel Stephens <nigel@mips.com>
+
+ * mt-sde: New file.
+
2007-07-06 H.J. Lu <hongjiu.lu@intel.com>
* tls.m4 (GCC_CHECK_CC_TLS): New.
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 0f66bd2aaaa..7c49c72fb50 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,7 @@
+2007-08-23 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gcc_update: Handle different URL paths and tags.
+
2007-08-16 Alexandre Oliva <aoliva@redhat.com>
* compare-debug: New.
diff --git a/contrib/gcc_update b/contrib/gcc_update
index 7eb839dc687..f29dcb60927 100755
--- a/contrib/gcc_update
+++ b/contrib/gcc_update
@@ -262,8 +262,9 @@ rm -f LAST_UPDATED gcc/REVISION
revision=`svn info | awk '/Revision:/ { print $2 }'`
branch=`svn info | sed -ne "/URL:/ {
-s,.*/gcc/,,g
-s,branches/,,
+s,.*/trunk,trunk,
+s,.*/branches/,,
+s,.*/tags/,,
p
}"`
{
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ea21bd3e9c9..03ee167ce30 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,1229 @@
+2007-08-30 Laurynas Biveinis <laurynas.biveinis@gmail.com>
+
+ * tree-ssa-propagate.c (set_rhs): Remove the copied annotation
+ from the original statement.
+
+2007-08-30 Chao-ying Fu <fu@mips.com>
+
+ * c-lex.c (interpret_fixed): Declare.
+ (interpret_float): Process _Fract and _Accum.
+ (interpret_fixed): New function.
+ * final.c (output_addr_const): Process CONST_FIXED.
+ * simplify-rtx.c (simplify_const_unary_operation): Handle US_NEG.
+ (simplify_binary_operation_1): Handle US_ASHIFT, SS_MULT, US_MULT,
+ SS_DIV, US_DIV.
+ (simplify_const_binary_operation): Handle SS_MULT, US_MULT, SS_DIV,
+ US_DIV, US_ASHIFT.
+ (simplify_immed_subreg): Support CONST_FIXED.
+ Process MODE_FRACT, MODE_UFRACT, MODE_ACCUM, MODE_UACCUM.
+ (simplify_subreg): Support CONST_FIXED.
+
+2007-08-30 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ * config/rs6000/ppu_intrinsics.h: New file.
+ * config.gcc (powerpc*-*-* <extra_headers>): Install
+ ppu_intrinsics.h.
+
+2007-08-30 Kenneth Zadeck <zadeck@naturalbridge.com>
+
+ * cfg.c (dump_flow_info): Change to also print entry and exit
+ block info.
+ * print-rtl.c (print_rtl_single): Allow to print rtl with
+ -fdump-unnumbered.
+
+2007-08-30 Kenneth Zadeck <zadeck@naturalbridge.com>
+
+ * df-core.h (df_dump_region): New function.
+ * df.h (df_dump_region): New function.
+ * loop-invariant.c (find_defs): Add call to df_dump_region.
+ * loop-iv.c (iv_analysis_loop_init): Changed call from df_dump to
+ df_dump_region.
+
+2007-08-30 Jakub Jelinek <jakub@redhat.com>
+
+ * decl.c (start_preparsed_function): Set
+ DECL_DISREGARD_INLINE_LIMITS for GNU_INLINE_P functions.
+
+ PR target/33168
+ * config/rs6000/rs6000.c (rs6000_elf_in_small_data_p): Return
+ true if any of the compare_section_name calls returned true,
+ rather than if any returned false.
+
+2007-08-30 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/33199
+ * tree-ssa-structalias.c (handle_lhs_call): New function.
+ (find_func_aliases): In non-IPA mode make sure that for
+ calls that return a pointer we add a constraint for the
+ result to point to anything.
+
+2007-08-30 Richard Guenther <rguenther@suse.de>
+
+ * doc/invoke.texi (-mveclibabi): Document new target option.
+ * config/i386/i386.opt (-mveclibabi): New target option.
+ * config/i386/i386.c (ix86_veclib_handler): Handler for
+ vectorization library support.
+ (override_options): Handle the -mveclibabi option, initialize
+ the vectorization library handler.
+ (ix86_builtin_vectorized_function): As fallback call the
+ vectorization library handler, if set.
+ (ix86_veclibabi_acml): New static function for ACML ABI style
+ vectorization support.
+
+2007-08-30 Jakub Jelinek <jakub@redhat.com>
+
+ * config/rs6000/rs6000.c (rs6000_emit_sync): For QI or HI mode
+ used_m, even if it is 32-bit aligned, adjust used_m MEM to have
+ SImode and update m. Don't run gen_lowpart_common on arbitrary
+ memory address, force it to register first.
+
+ PR middle-end/32758
+ * dce.c (dce_process_block): Don't delete setters of
+ artificially used registers.
+
+2007-08-30 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * config/s390/s390.md ("*add<mode>3_alc_carry1_cc",
+ "*add<mode>3_alc_carry1_cconly", "*add<mode>3_alc_carry2_cc",
+ "*add<mode>3_alc_carry2_cconly"): New insn definitions.
+
+2007-08-30 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * config/s390/s390.c (s390_expand_addcc): Emit canonical alc
+ pattern.
+ * config/s390/s390.md ("*add<mode>3_alc_cc", "*add<mode>3_alc",
+ "addti3", "*adddi3_31z", "*scond<mode>"): Make alc pattern canonical.
+
+2007-08-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * system.h: Activate -Wcast-qual as warning-only.
+
+2007-08-29 Paolo Bonzini <bonzini@gnu.org>
+
+ PR target/33168
+ * config/rs6000/rs6000.c (compare_section_name): New function.
+ (rs6000_elf_in_small_data_p): Compare section prefixes instead
+ of full name.
+
+2007-08-29 Olivier Hainque <hainque@adacore.com>
+
+ * xcoffout.c: #include debug.h.
+ * Makefile.in (xcoffout.o): Add debug.h dependency.
+
+2007-08-29 Uros Bizjak <ubizjak@gmail.com>
+
+ * simplify-rtx.c (simplify_binary_operation_1) [VEC_SELECT]:
+ Change CONST_VECTOR_ELT to XVECEXP in elem calculation.
+
+2007-08-29 Richard Guenther <rguenther@suse.de>
+
+ * tree-pretty-print.c (dump_generic_node): Print
+ label DECL_UID as D.%u.
+ * tree-dfa.c (dump_variable): Print DECL_UID as D.%u.
+
+2007-08-29 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * gcc/builtin-types.def (BT_FN_PTR_PTR_SIZE): New type.
+ * gcc/builtins.def (BUILT_IN_REALLOC): New builtin.
+
+2007-08-29 Douglas Gregor <doug.gregor@gmail.com>
+
+ PR c++/33194
+ * tree.c (build_type_attribute_qual_variant): Set canonical types
+ on the final, unqualified attribute variant before building the
+ qualified version.
+
+2007-08-29 Jie Zhang <jie.zhang@analog.com>
+
+ * config/bfin/bfin.c (bfin_expand_builtin): Fix the argument
+ order of __builtin_bfin_cmplx_mac and __builtin_bfin_cmplx_msu.
+
+2007-08-29 Jie Zhang <jie.zhang@analog.com>
+
+ Revert
+ 2007-08-29 Jie Zhang <jie.zhang@analog.com>
+ * config/bfin/bfin.md (composev2hi): Put operands into vector
+ with correct order.
+
+2007-08-29 Jie Zhang <jie.zhang@analog.com>
+
+ * config/bfin/bfin.md (composev2hi): Put operands into vector
+ with correct order.
+
+2007-08-29 Jie Zhang <jie.zhang@analog.com>
+
+ * config/bfin/bfin.c (bfin_expand_call): Inline PLT with l1_text
+ attribute when appropriate.
+ (bfin_handle_l1_text_attribute): New.
+ (bfin_handle_l1_data_attribute): New.
+ (bfin_attribute_table): Add attributes: l1_text, l1_data,
+ l1_data_A and l1_data_B.
+ * doc/extend.texi (node Function Attributes): Document l1_text
+ function attribute.
+ (Variable Attributes): Add Blackfin subsection. Document l1_data,
+ l1_data_A and l1_data_B variable attributes.
+
+2007-08-28 Jie Zhang <jie.zhang@analog.com>
+
+ * config/bfin/bfin.opt (minline-plt): Add.
+ * config/bfin/bfin.c (bfin_expand_call): Inline PLT when emit
+ call to global functions.
+ * doc/invoke.texi (Option Summary): Mention -minline-plt.
+ (Blackfin Options): Document -minline-plt.
+
+2007-08-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ * config/m68k/m68k.c (m68k_get_function_kind): Assert we're never
+ given a non-function.
+ (m68k_ok_for_sibcall_p): Only sibcall functions of the same kind.
+
+2007-08-28 DJ Delorie <dj@redhat.com>
+
+ * config/sh/sh.c (sh_gimplify_va_arg_expr): Fix sh2a support.
+
+2007-08-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * system.h (CONST_CAST): Avoid union for gcc-4.0.x.
+
+2007-08-28 Richard Guenther <rguenther@suse.de>
+
+ * tree.h (struct tree_function_decl): Increase size of
+ function_code bitfield.
+
+2007-08-28 Nathan Sidwell <nathan@codesourcery.com>
+ Kazu Hirata <kazu@codesourcery.com>
+
+ * gcc/config/m68k/linux.h
+ (M68K_HONOR_TARGET_STRICT_ALIGNMENT): Redefine as 0.
+ * config/m68k/m68k.c (TARGET_RETURN_IN_MEMORY): New.
+ (m68k_return_in_memory): New.
+ * gcc/config/m68k/m68k.h (M68K_HONOR_TARGET_STRICT_ALIGNMENT):
+ New.
+
+2007-08-28 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/32661
+ * simplify-rtx.c (simplify_binary_operation_1) [VEC_SELECT]:
+ Simplify nested VEC_SELECT (with optional VEC_CONCAT operator as
+ operand) when top VEC_SELECT extracts scalar element.
+ * config/i386/sse.md (*vec_extract_v4si_mem): New pattern.
+ (*vec_extract_v4sf_mem): Ditto.
+
+2007-08-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/32370
+ * passes.c (init_optimization_passes): Move pass_df_finish
+ after pass_postreload sublist.
+
+ PR rtl-optimization/33148
+ * simplify-rtx.c (simplify_unary_operation_1): Only optimize
+ (neg (lt X 0)) if X has scalar int mode.
+
+ PR debug/32914
+ * dwarf2out.c (rtl_for_decl_init): If vector decl has CONSTRUCTOR
+ initializer, use build_vector_from_ctor if possible to create
+ VECTOR_CST out of it. If vector initializer is not VECTOR_CST
+ even after this, return NULL.
+
+2007-08-28 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * c-pretty-print.c (pp_c_constant): Handle COMPLEX_CST.
+
+2007-08-28 Richard Guenther <rguenther@suse.de>
+
+ * tree.h (DECL_DISREGARD_INLINE_LIMITS): New.
+ (struct tree_function_decl): Make function_code a bitfield.
+ Add disregard_inline_limits flag.
+ * cgraphunit.c (cgraph_process_new_functions): Check
+ DECL_DISREGARD_INLINE_LIMITS instead of disregard_inline_limits_p.
+ (cgraph_preserve_function_body_p): Likewise.
+ * ipa-inline.c (compute_inline_parameters): Likewise.
+ * c-decl.c (finish_function): Set DECL_DISREGARD_INLINE_LIMITS
+ for GNU C extern inline functions.
+ (merge_decls): Merge DECL_DISREGARD_INLINE_LIMITS.
+ * tree-inline.c (disregard_inline_limits_p): Remove.
+ * tree-inline.h (disregard_inline_limits_p): Likewise.
+ * c-common.c (handle_always_inline_attribute): Set
+ DECL_DISREGARD_INLINE_LIMITS.
+ * langhooks.c (add_builtin_function): Verify the function code
+ fits in the bitfield.
+
+2007-08-28 Mircea Namolaru <namolaru@il.ibm.com>
+ Vladimir Yanovsky <yanov@il.ibm.com>
+ Revital Eres <eres@il.ibm.com>
+ Andrey Belevantsev <abel@ispras.ru>
+
+ * config/spu/spu.md: Recognize doloop pattern when -fmodulo-sched
+ is set.
+ * modulo-sched.c: Add documentation regarding do-loop.
+ (doloop_register_get): Change number of arguments to support
+ the new do-loop pattern and check whether COUNT_REG has no other
+ occurences in the loop besides in the control part.
+ (duplicate_insns_of_cycles): Do not duplicate the insn which
+ changes count_reg as it is already adjusted.
+ (generate_prolog_epilog): New argument to support the new
+ do-loop pattern. Change the subtract instruction to use
+ expand_simple_binop. Call duplicate_insns_of_cycles with new
+ argument.
+ (sms_schedule): Call doloop_register_get and
+ generate_prolog_epilog with new argument. Do not handle loops
+ with single sets insns with subreg in their lhs.
+ * loop-doloop.c (doloop_optimize): Support for another do-loop
+ pattern.
+ (doloop_condition_get): Gets an instruction instead of a pattern
+ and change the return condition when the do-loop pattern is
+ not parallel.
+ * ddg.c (create_ddg_dep_from_intra_loop_link): Handle only reg
+ deps when considering to not create edges.
+
+2007-08-27 Alexandre Oliva <aoliva@redhat.com>
+
+ * doc/extend.texi (gnu_inline funtion attribute): Document C++
+ behavior.
+
+2007-08-27 Jason Merrill <jason@redhat.com>
+
+ PR c++/31337
+ * gimplify.c (gimplify_modify_expr): Discard the assignment of
+ zero-sized types after calling gimplify_modify_expr_rhs.
+
+2007-08-27 Sandra Loosemore <sandra@codesourcery.com>
+
+ * regclass.c (init_reg_autoinc): Fix typo.
+
+2007-08-27 Daniel Berlin <dberlin@dberlin.org>
+
+ Fix PR tree-optimization/33173
+ * tree-ssa-alias.c (find_used_portions): Fix reversed test.
+
+2007-08-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/31385
+ * config/i386/i386.h (VALID_DFP_MODE_P): New.
+ * config/i386/i386.c (ix86_hard_regno_mode_ok): Allow DFP in
+ GPR.
+
+2007-08-27 Sandra Loosemore <sandra@codesourcery.com>
+ David Ung <davidu@mips.com>
+ Nigel Stephens <nigel@mips.com>
+
+ Separate target-specific initialization from general
+ back-end initialization.
+
+ * toplev.c (init_alignments): New, split out from...
+ (process_options): ...here.
+ (backend_init_target): New, split out from...
+ (backend_init): ...here.
+ (lang_dependent_init_target): New, split out from...
+ (lang_dependent_init): ...here.
+ (target_reinit): New.
+ * toplev.h (target_reinit): Declare.
+ * expr.c (init_expr_target): Renamed from init_expr_once, since it
+ now can be called more than once. Update comments.
+ * expr.h (init_expr_target): Likewise.
+ * alias.c (init_alias_target): Renamed from init_alias_once, since it
+ now can be called more than once. Explicitly zero
+ static_reg_base_value.
+ * emit-rtl.c (init_emit_regs): New, split out from...
+ (init_emit_once): Here.
+ * regclass.c (initial_fixed_regs, initial_call_used_regs): Make
+ non-const, so that changes from command-line arguments can overwrite
+ values provided by the static initializers.
+ (initial_call_really_used_regs): New, used similarly to the above.
+ (initial_reg_names): Likewise.
+ (last_mode_for_init_move_cost): Promoted function-local static to
+ file-scope static to make it accessible outside init_move_cost.
+ (init_reg_sets): Do not initialize fixed_regs and call_used_regs yet.
+ Do not initialize inv_reg_alloc_order yet, either. Do initialize
+ reg_names since it is needed for parsing command-line options.
+ (init_move_cost): Use last_mode_for_init_move_cost instead of
+ function-local static.
+ (init_reg_sets_1): Initialize fixed_regs, call_used_regs, and
+ call_really_used_regs now. Reinitialize reg_names. Also
+ initialize inv_reg_alloc_order. Zero reg_class_subunion and
+ reg_class_superunion. Clear losing_caller_save_reg_set.
+ Preserve global registers if called more than once. Reset
+ move cost, may_move_in_cost, may_move_out_cost, and
+ last_mode_for_init_move_cost.
+ (init_reg_modes_target): Renamed from init_reg_modes_once, since it
+ can now be invoked more than once. Update comments.
+ (init_regs): Update comments.
+ (fix_register): Update initial_fixed_regs, initial_call_used_regs,
+ and initial_call_really_used_regs, instead of the non-initial
+ variables. This allows us to save the command-line register settings
+ after target reinitialization.
+ (init_reg_autoinc): Zero forbidden_inc_dec_classes.
+ * rtl.h (init_emit_regs): Declare.
+ (init_reg_modes_target, init_alias_target): Renamed as described
+ above.
+ * reload1.c (init_reload): Update comments.
+ * optabs.c (init_optabs): Likewise.
+ * cfgloopanal.c (init_set_costs): Explicitly zero target_avail_regs.
+
+2007-08-26 Chao-ying Fu <fu@mips.com>
+
+ * rtl.h (XCNMPFV): Preserve const-ness of parameters through use of
+ __typeof().
+
+2007-08-26 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * alias.c (memory_modified_1, memory_modified_in_insn_p):
+ Constify.
+ * basic-block.h (tree_predicted_by_p, rtl_predicted_by_p):
+ Likewise.
+ * bb-reorder.c (copy_bb_p): Likewise.
+ * cfghooks.c (can_remove_branch_p, can_merge_blocks_p,
+ predicted_by_p, can_duplicate_block_p, block_ends_with_call_p,
+ block_ends_with_condjump_p): Likewise.
+ * cfghooks.h (can_remove_branch_p, can_merge_blocks_p,
+ predicted_by_p, can_duplicate_block_p, block_ends_with_call_p,
+ block_ends_with_condjump_p): Likewise.
+ * cfglayout.c (cfg_layout_can_duplicate_bb_p): Likewise.
+ * cfgrtl.c (can_delete_note_p, can_delete_label_p,
+ rtl_can_merge_blocks, cfg_layout_can_merge_blocks_p,
+ rtl_block_ends_with_call_p, rtl_block_ends_with_condjump_p,
+ need_fake_edge_p, rtl_can_remove_branch_p): Likewise.
+ * dbxout.c (dbx_debug_hooks, xcoff_debug_hooks): Use
+ debug_true_const_tree instad of debug_true_tree.
+ * debug.c (do_nothing_debug_hooks): Likewise.
+ * debug.h (ignore_block, debug_true_const_tree): Constify.
+ * dwarf2out.c (stack_adjust_offset, clobbers_queued_reg_save,
+ dwarf2out_ignore_block, is_pseudo_reg, is_tagged_type,
+ decl_ultimate_origin, block_ultimate_origin, lookup_decl_loc,
+ same_dw_val_p, add_ranges, is_subrange_type, type_is_enum,
+ dbx_reg_number, is_based_loc, field_type,
+ simple_type_align_in_bits, simple_decl_align_in_bits,
+ simple_type_size_in_bits, field_byte_offset, insert_float,
+ type_tag, member_declared_type, is_redundant_typedef,
+ secname_for_decl, is_inlined_entry_point): Likewise.
+ * emit-rtl.c (const_next_insn, const_previous_insn,
+ const_next_nonnote_insn, const_prev_nonnote_insn,
+ const_next_real_insn, const_prev_real_insn,
+ const_next_active_insn, const_prev_active_insn, const_next_label,
+ const_prev_label): Likewise.
+ * except.h (lookup_stmt_eh_region_fn, lookup_stmt_eh_region):
+ Likewise.
+ * haifa-sched.c (may_trap_exp, haifa_classify_insn,
+ find_set_reg_weight, no_real_insns_p, find_set_reg_weight,
+ sched_insn_is_legitimate_for_speculation_p): Likewise.
+ * jump.c (reversed_comparison_code_parts,
+ reversed_comparison_code, reversed_comparison, condjump_label):
+ Likewise.
+ * predict.c (rtl_predicted_by_p, tree_predicted_by_p): Likewise.
+ * reg-stack.c (stack_regs_mentioned_p, stack_regs_mentioned):
+ Likewise.
+ * rtl.h (const_previous_insn, const_next_insn,
+ const_prev_nonnote_insn, const_next_nonnote_insn,
+ const_prev_real_insn, const_next_real_insn,
+ const_prev_active_insn, const_next_active_insn, const_prev_label,
+ const_next_label, modified_between_p, modified_in_p,
+ const_note_storeskeep_with_call_p, condjump_label,
+ reversed_comparison, reversed_comparison_code,
+ reversed_comparison_code_parts, memory_modified_in_insn_p,
+ stack_regs_mentioned): Likewise.
+ * rtlanal.c (modified_between_p, modified_in_p, const_note_stores,
+ keep_with_call_p): Likewise.
+ * sched-deps.c (deps_may_trap_p, sched_get_condition,
+ conditions_mutex_p, sched_insns_conditions_mutex_psd_next_list,
+ sd_lists_size, sd_lists_empty_p): Likewise.
+ * sched-int.h (sched_insns_conditions_mutex_p,
+ haifa_classify_insn, no_real_insns_p,
+ sched_insn_is_legitimate_for_speculation_p, sd_next_list,
+ sd_lists_size, sd_lists_empty_p): Likewise.
+ * sdbout.c (sdb_debug_hooks): Likewise.
+ * tree-cfg.c (tree_can_merge_blocks_p, is_ctrl_altering_stmt,
+ stmt_ends_bb_p, tree_can_remove_branch_p, tree_can_duplicate_bb_p,
+ -tree_block_ends_with_call_p, tree_block_ends_with_condjump_p):
+ Likewise.
+ * tree-eh.c (lookup_stmt_eh_region_fn, lookup_stmt_eh_region,
+ tree_can_throw_internal): Likewise.
+ * tree-flow-inline.h (phi_nodes): Likewise.
+ * tree-flow.h (phi_nodesstmt_ends_bb_p, is_ctrl_altering_stmt,
+ tree_can_throw_internal, lookup_stmt_eh_region): Likewise.
+ * tree-gimple.c (const_get_call_expr_in): Likewise.
+ * tree-gimple.h (const_get_call_expr_in): Likewise.
+ * tree.c (const_lookup_attribute, attribute_list_equal,
+ attribute_list_contained): Likewise.
+ * tree.h (attribute_list_equal, attribute_list_contained,
+ const_lookup_attribute): Likewise.
+ * vmsdbgout.c (vmsdbgout_ignore_block): Likewise.
+
+2007-08-26 Bernhard Fischer <aldot@gcc.gnu.org>
+
+ * tree-ssa-sccvn.c, tree-ssa-sccvn.h, tree-vn.c,
+ tree-ssa-pre.c: Remove unnecessary trailing whitespace.
+
+2007-08-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/32991
+ * config/alpha/constraints.md: Delete "svn:mime-type" property
+ with svn propdel "svn:mime-type".
+
+2007-08-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR middle-end/33181
+ * ifcvt.c (noce_get_alt_condition): Make sure that the previous
+ non NOTE insn doesn't cross basic block.
+ (noce_try_abs): Likewise.
+ (noce_process_if_block): Likewise.
+
+2007-08-26 David Edelsohn <edelsohn@gnu.org>
+
+ PR target/33151
+ * config/rs6000/predicates.md (offsettable_mem_operand): Memory
+ operand without auto-inc-dec.
+ * config/rs6000/rs6000.md (floatsidf2_internal): Use
+ offsettable_mem_operand.
+ (floatunssidf2_internal): Same.
+ (fix_truncdfsi2_internal): Same.
+ (floatsidf_ppc64): Same.
+ (floatunssidf_ppc64): Same.
+ (fix_trunctfsi2_internal): Same.
+
+2007-08-26 Bernhard Fischer <aldot@gcc.gnu.org>
+
+ PR bootstrap/30620
+ * Makefile.in (libbackend.o): Add gcov-iov.h dependency and
+ pass defines needed for version.c.
+
+2007-08-25 Joseph Myers <joseph@codesourcery.com>
+
+ * configure.ac (--debug-prefix-map check): Change assembler
+ version presumed to have feature to 2.18.
+ * configure: Regenerate.
+
+2007-08-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * c-common.c (vector_types_convertible_p,
+ decl_with_nonnull_addr_p, c_promoting_integer_type_p,
+ self_promoting_args_p): Constify.
+ * c-common.h (has_c_linkage, decl_with_nonnull_addr_p,
+ c_promoting_integer_type_p, self_promoting_args_p,
+ anon_aggr_type_p, vector_types_convertible_p): Likewise.
+ * c-decl.c (anon_aggr_type_p): Likewise.
+ * * c-dump.c (dump_stmt): Likewise.
+ * c-objc-common.c (has_c_linkage): Likewise.
+ * c-tree.h (same_translation_unit_p): Likewise.
+ * c-typeck.c (null_pointer_constant_p,
+ tagged_types_tu_compatible_p, function_types_compatible_p,
+ type_lists_compatible_p, lvalue_or_else, lvalue_p,
+ comptypes_internal, struct tagged_tu_seen_cache,
+ same_translation_unit_p, alloc_tagged_tu_seen_cache,
+ c_size_in_bytes): Likewise.
+ * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor,
+ hash_ptr, eq_ptr): Likewise.
+ * langhooks-def.h (lhd_decl_ok_for_sibcall,
+ LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise.
+ * langhooks.c (lhd_decl_ok_for_sibcall): Likewise.
+ * langhooks.h (ok_for_sibcall, omp_privatize_by_reference):
+ Likewise.
+ * optabs.c (optab_for_tree_code): Likewise.
+ * optabs.h (optab_for_tree_code): Likewise.
+ * rtl.h (simplify_rtx): Likewise.
+ * simplify-rtx.c (simplify_rtx): Likewise.
+ * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type,
+ dump_flag, dump_node): Likewise.
+ * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index,
+ queue_and_dump_type, dump_flag): Likewise.
+ * tree-flow.h (vect_can_force_dr_alignment_p): Likewise.
+ * tree-pass.h (dump_node): Likewise.
+ * tree-vectorizer.c (vect_can_force_dr_alignment_p,
+ supportable_narrowing_operation): Likewise.
+ * tree-vectorizer.h (vect_can_force_dr_alignment_p,
+ supportable_narrowing_operation): Likewise.
+ * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity,
+ is_negative_overflow_infinity, is_positive_overflow_infinity,
+ is_overflow_infinity, vrp_val_is_max, vrp_val_is_min,
+ nonnull_arg_p, get_value_range, vrp_operand_equal_p,
+ update_value_range, add_equivalence, ssa_name_nonnegative_p,
+ ssa_name_nonzero_p, fp_predicate): Likewise.
+ * tree.c (auto_var_in_fn_p, empty_body_p): Likewise.
+ * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p,
+ ssa_name_nonnegative_p): Likewise.
+
+2007-08-25 Hans Kester <hans.kester@ellips.nl>
+
+ * config.gcc : Add x86_64-elf target.
+
+2007-08-25 Jakub Jelinek <jakub@redhat.com>
+
+ * expr.c (store_expr): Fix order of store_by_pieces arguments.
+
+2007-08-24 Sandra Loosemore <sandra@codesourcery.com>
+ Nigel Stephens <nigel@mips.com>
+
+ PR target/11787
+
+ * doc/tm.texi (SET_RATIO, SET_BY_PIECES_P): Document new macros.
+ (STORE_BY_PIECES_P): No longer applies to __builtin_memset.
+ * expr.c (SET_BY_PIECES_P): Define.
+ (can_store_by_pieces, store_by_pieces): Add MEMSETP argument; use
+ it to decide whether to use SET_BY_PIECES_P or STORE_BY_PIECES_P.
+ (store_expr): Pass MEMSETP argument to can_store_by_pieces and
+ store_by_pieces.
+ * expr.h (SET_RATIO): Define.
+ (can_store_by_pieces, store_by_pieces): Update prototypes.
+ * builtins.c (expand_builtin_memcpy): Pass MEMSETP argument to
+ can_store_by_pieces/store_by_pieces.
+ (expand_builtin_memcpy_args): Likewise.
+ (expand_builtin_strncpy): Likewise.
+ (expand_builtin_memset_args): Likewise. Also remove special case
+ for optimize_size so that can_store_by_pieces/SET_BY_PIECES_P can
+ decide what to do instead.
+ * value-prof.c (tree_stringops_transform): Pass MEMSETP argument
+ to can_store_by_pieces.
+
+ * config/sh/sh.h (SET_BY_PIECES_P): Clone from STORE_BY_PIECES_P.
+ * config/s390/s390.h (SET_BY_PIECES_P): Likewise.
+
+ * config/mips/mips.opt (mmemcpy): Change from Var to Mask.
+ * config/mips/mips.c (override_options): Make -Os default to -mmemcpy.
+ * config/mips/mips.h (MIPS_CALL_RATIO): Define.
+ (MOVE_RATIO, CLEAR_RATIO, SET_RATIO): Define.
+ (STORE_BY_PIECES_P): Define.
+
+2007-08-24 Tom Tromey <tromey@redhat.com>
+
+ * varpool.c (varpool_last_needed_node): Fix comment typo.
+ * c-decl.c (duplicate_decls): Fix comment typo.
+ (clone_underlying_type): Update comment.
+
+2007-08-24 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * config/alpha/alpha.c (alpha_mangle_type, decl_has_samegp,
+ alpha_in_small_data_p, alpha_split_complex_arg,
+ alpha_stdarg_optimize_hook, TARGET_ASM_CAN_OUTPUT_MI_THUNK):
+ Constify.
+ * config/arm/arm-protos.h (arm_mangle_type): Likewise.
+ * config/arm/arm.c (arm_comp_type_attributes, arm_mangle_type):
+ Likewise.
+ * config/bfin/bfin.c (funkind, bfin_comp_type_attributes,
+ TARGET_ASM_CAN_OUTPUT_MI_THUNK): Likewise.
+ * config/darwin-protos.h (darwin_binds_local_p): Likewise.
+ * config/darwin.c (darwin_binds_local_p): Likewise.
+ * config/frv/frv.c (frv_string_begins_with, frv_in_small_data_p):
+ Likewise.
+ * config/i386/i386-protos.h (i386_pe_binds_local_p,
+ i386_pe_valid_dllimport_attribute_p): Likewise.
+ * config/i386/i386.c (ix86_function_regparm,
+ ix86_comp_type_attributes, ix86_ms_bitfield_layout_p,
+ x86_can_output_mi_thunk, ix86_mangle_type,
+ TARGET_USE_BLOCKS_FOR_CONSTANT_P): Likewise.
+ * config/i386/winnt.c (i386_pe_valid_dllimport_attribute_p,
+ i386_pe_binds_local_p): Likewise.
+ * config/ia64/ia64.c
+ (ia64_first_cycle_multipass_dfa_lookahead_guard_spec,
+ ia64_needs_block_p, ia64_in_small_data_p, ia64_mangle_type,
+ ia64_invalid_conversion, ia64_invalid_unary_op,
+ ia64_invalid_binary_op, TARGET_ASM_CAN_OUTPUT_MI_THUNK):
+ Likewise.
+ * config/m32c/m32c.c (m32c_comp_type_attributes): Likewise.
+ * config/m32r/m32r.c (m32r_in_small_data_p): Likewise.
+ * config/m68k/m68k.c (TARGET_ASM_CAN_OUTPUT_MI_THUNK): Likewise.
+ * config/mips/mips.c (mips_use_blocks_for_constant_p,
+ mips_in_small_data_p, mips_use_anchors_for_symbol_p,
+ mips_comp_type_attributes, TARGET_ASM_CAN_OUTPUT_MI_THUNK,
+ mips_near_type_p, mips_far_type_p, mips_global_symbol_p,
+ mips_symbol_binds_local_p, mips_classify_symbol): Likewise.
+ * config/pa/pa.c (pa_commutative_p): Likewise.
+ * config/rs6000/rs6000-protos.h (rs6000_elf_in_small_data_p):
+ Likewise.
+ * config/rs6000/rs6000.c (rs6000_invalid_within_doloop,
+ rs6000_ms_bitfield_layout_p, rs6000_mangle_type,
+ rs6000_use_blocks_for_constant_p,
+ rs6000_vector_alignment_reachable, rs6000_is_opaque_type,
+ invalid_arg_for_unprototyped_fn, TARGET_ASM_CAN_OUTPUT_MI_THUNK,
+ TARGET_SPLIT_COMPLEX_ARG, rs6000_elf_in_small_data_p): Likewise.
+ * config/s390/s390.c (s390_mangle_type,
+ TARGET_ASM_CAN_OUTPUT_MI_THUNK, TARGET_INVALID_WITHIN_DOLOOP):
+ Likewise.
+ * config/score/score.c (TARGET_ASM_CAN_OUTPUT_MI_THUNK,
+ th_in_small_data_p): Likewise.
+ * config/sh/sh.c (sh_ms_bitfield_layout_p,
+ sh_dwarf_calling_convention, TARGET_ASM_CAN_OUTPUT_MI_THUNK):
+ Likewise.
+ * config/sparc/sparc.c (sparc_can_output_mi_thunk,
+ sparc_mangle_type): Likewise.
+ * config/spu/spu.c (spu_vector_alignment_reachable): Likewise.
+ * config/xtensa/xtensa.c (TARGET_SPLIT_COMPLEX_ARG): Likewise.
+ * emit-rtl.c (const_fixed_htab_hash, const_fixed_htab_eq):
+ Likewise.
+ * hooks.c (hook_bool_mode_const_rtx_false,
+ hook_bool_mode_const_rtx_true,
+ hook_bool_const_tree_hwi_hwi_const_tree_false,
+ hook_bool_const_tree_hwi_hwi_const_tree_true,
+ hook_int_const_tree_0, hook_int_const_tree_const_tree_1,
+ hook_constcharptr_const_tree_null,
+ hook_constcharptr_const_rtx_null,
+ hook_constcharptr_const_tree_const_tree_null,
+ hook_constcharptr_int_const_tree_null,
+ hook_constcharptr_int_const_tree_const_tree_null): New.
+ (hook_bool_mode_rtx_false, hook_bool_mode_rtx_true,
+ hook_bool_tree_hwi_hwi_tree_false,
+ hook_bool_tree_hwi_hwi_tree_true, hook_int_tree_0,
+ hook_int_tree_tree_1, hook_constcharptr_tree_null,
+ hook_constcharptr_rtx_null, hook_constcharptr_tree_tree_null,
+ hook_constcharptr_int_tree_null,
+ hook_constcharptr_int_tree_tree_null): Delete.
+ (default_can_output_mi_thunk_no_vcall): Constify.
+ * hooks.h (hook_bool_mode_rtx_false, hook_bool_mode_rtx_true,
+ hook_bool_tree_hwi_hwi_tree_false,
+ hook_bool_tree_hwi_hwi_tree_true, hook_int_tree_0,
+ hook_int_tree_tree_1, hook_constcharptr_tree_null,
+ hook_constcharptr_rtx_null, hook_constcharptr_tree_tree_null,
+ hook_constcharptr_int_tree_null,
+ hook_constcharptr_int_tree_tree_null): Delete.
+ (hook_bool_mode_const_rtx_false, hook_bool_mode_const_rtx_true,
+ hook_bool_const_tree_hwi_hwi_const_tree_false,
+ hook_bool_const_tree_hwi_hwi_const_tree_true,
+ hook_int_const_tree_0, hook_int_const_tree_const_tree_1,
+ hook_constcharptr_const_tree_null,
+ hook_constcharptr_const_rtx_null,
+ hook_constcharptr_const_tree_const_tree_null,
+ hook_constcharptr_int_const_tree_null,
+ hook_constcharptr_int_const_tree_const_tree_null): New.
+ (default_can_output_mi_thunk_no_vcall): Constify.
+ * integrate.c (function_attribute_inlinable_p): Likewise.
+ * integrate.h (function_attribute_inlinable_p): Likewise.
+ * jump.c (rtx_renumbered_equal_p): Likewise.
+ * output.h (decl_readonly_section, categorize_decl_for_section,
+ default_use_anchors_for_symbol_p, default_binds_local_p,
+ default_binds_local_p_1): Likewise.
+ * rtl.h (rtx_renumbered_equal_p, decl_default_tls_model):
+ Likewise.
+ * target-def.h (TARGET_ASM_CAN_OUTPUT_MI_THUNK,
+ TARGET_VALID_DLLIMPORT_ATTRIBUTE_P, TARGET_VECTOR_OPAQUE_P,
+ TARGET_COMMUTATIVE_P, TARGET_USE_BLOCKS_FOR_CONSTANT_P,
+ TARGET_COMP_TYPE_ATTRIBUTES,
+ TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P,
+ TARGET_MS_BITFIELD_LAYOUT_P, TARGET_MANGLE_TYPE,
+ TARGET_IN_SMALL_DATA_P, TARGET_INVALID_CONVERSION,
+ TARGET_INVALID_UNARY_OP, TARGET_INVALID_BINARY_OP,
+ TARGET_DWARF_CALLING_CONVENTION): Likewise.
+ * target.h (can_output_mi_thunk, needs_block_p,
+ first_cycle_multipass_dfa_lookahead_guard_spec,
+ vector_alignment_reachable, comp_type_attributes,
+ function_attribute_inlinable_p, ms_bitfield_layout_p, mangle_type,
+ commutative_p, use_blocks_for_constant_p,
+ use_anchors_for_symbol_p, in_small_data_p, binds_local_p,
+ vector_opaque_p, dwarf_calling_convention, stdarg_optimize_hook,
+ invalid_within_doloop, valid_dllimport_attribute_p,
+ split_complex_arg, invalid_arg_for_unprototyped_fn,
+ invalid_conversion, invalid_unary_op, invalid_binary_op):
+ Likewise.
+ * targhooks.c (default_invalid_within_doloop,
+ hook_invalid_arg_for_unprototyped_fn,
+ default_builtin_vector_alignment_reachable): Likewise.
+ (hook_bool_rtx_commutative_p): Delete.
+ (hook_bool_const_rtx_commutative_p): New.
+ * targhooks.h (default_invalid_within_doloop,
+ default_builtin_vector_alignment_reachable,
+ hook_invalid_arg_for_unprototyped_fn): Constify.
+ (hook_bool_rtx_commutative_p): Delete.
+ (hook_bool_const_rtx_commutative_p): New.
+ * varasm.c (bss_initializer_p, decl_default_tls_model,
+ categorize_decl_for_section, decl_readonly_section,
+ default_use_anchors_for_symbol_p, default_binds_local_p,
+ default_binds_local_p_1): Constify.
+
+2007-08-24 Jie Zhang <jie.zhang@analog.com>
+
+ * config/bfin/bfin.h (TARGET_CPU_CPP_BUILTINS): Define
+ __NO_BUILTIN if -fno-builtin.
+
+2007-08-24 Jie Zhang <jie.zhang@analog.com>
+
+ * config/bfin/bfin.c (print_operand): Report error instead of
+ ICE for wrong operand.
+
+2007-08-24 Michael Matz <matz@suse.de>
+
+ * Makefile.in (GTFILES_H): Use $(patsubst) instead of $(subst).
+
+2007-08-24 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/33166
+ * tree-ssa.c (useless_type_conversion_p): Split into a
+ recursive and a non-recursive part.
+ (useless_type_conversion_p_1): New function.
+ * tree-ssa-ccp.c (fold_stmt_r): Make sure that the result
+ from maybe_fold_offset_to_reference is trivially convertible
+ to the desired type before doing the simplification.
+
+2007-08-24 Jakub Jelinek <jakub@redhat.com>
+
+ * expr.c (store_expr): Optimize initialization of an array
+ with STRING_CST.
+ * expr.h (builtin_strncpy_read_str): New prototype.
+ * builtins.c (builtin_strncpy_read_str): Remove prototype.
+ No longer static.
+
+2007-08-24 Uros Bizjak <ubizjak@gmail.com>
+
+ PR middle-end/33157
+ * ifcvt.c (noce_find_if_block): Do not clear if_info.cond_earliest
+ field when initializing if_info structure.
+
+2007-08-24 Richard Guenther <rguenther@suse.de>
+
+ * Makefile.in (tree-inline.o): Add $(TARGET_H) and $(INTEGRATE_H)
+ dependencies.
+ * c-objc-common.c (c_cannot_inline_tree_fn): Remove.
+ * langhooks.c (lhd_tree_inlining_cannot_inline_tree_fn): Likewise.
+ * tree-inline.c (inlinable_function_p): Fold in common parts of
+ the cannot_inline_tree_fn langhook.
+ * langhooks-def.h (lhd_tree_inlining_cannot_inline_tree_fn): Remove.
+ (LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN): Likewise.
+ (LANG_HOOKS_TREE_INLINING_INITIALIZER): Remove initializer for
+ cannot_inline_tree_fn langhook.
+ * langhooks.h (struct lang_hooks_for_tree_inlining): Remove
+ cannot_inline_tree_fn member.
+
+2007-08-24 Richard Guenther <rguenther@suse.de>
+
+ * expr.c (get_inner_reference): Do computation of bitoffset
+ from offset in a way we can detect overflow reliably.
+
+2007-08-24 Jie Zhang <jie.zhang@analog.com>
+
+ * crtstuff.c (USE_PT_GNU_EH_FRAME): Don't define for uClibc.
+
+2007-08-24 Jie Zhang <jie.zhang@analog.com>
+
+ * config/bfin/bfin.opt (mfast-fp): Add.
+ * config/bfin/linux.h (LINK_GCC_C_SEQUENCE_SPEC): Let
+ libbffastfp override libgcc if -mfast-fp.
+ * config/bfin/bfin.h (LINK_GCC_C_SEQUENCE_SPEC): Likewise.
+ * doc/invoke.texi (Option Summary): Mention -mfast-fp.
+ (Blackfin Options): Document -mfast-fp.
+
+2007-08-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/32573
+ PR middle-end/32946
+ * tree-data-ref.c (initialize_data_dependence_relation): Clear
+ DDR_SUBSCRIPTS, DDR_DIR_VECTS and DDR_DIST_VECTS at the beginning.
+ (finalize_ddr_dependent): Clear DDR_SUBSCRIPTS after freeing it.
+ (build_classic_dist_vector): Return false rather than true if
+ DDR_ARE_DEPENDENT is non-NULL at the beginning. Return false
+ if either subscript_dependence_tester_1 or build_classic_dist_vector_1
+ returned false. Don't call save_dist_v before calling
+ build_classic_dist_vector_1.
+ (free_dependence_relation): Don't guard freeing DDR_SUBSCRIPTS
+ with NULL DDR_ARE_DEPENDENT. Also free DDR_DIST_VECTS and/or
+ DDR_DIR_VECTS vectors.
+
+2007-08-23 Brian Sidebotham <brian.sidebotham@gmail.com>
+
+ * configure.ac (leb128): Modify sed statement to work with any
+ binutils version string.
+ * configure: Regenerate
+
+2007-08-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * config/arc/arc-protos.h arc_select_cc_mode, gen_compare_reg):
+ Wrap in RTX_CODE macro guard.
+ * config/arm/pe.c (arm_dllexport_p, arm_dllimport_p,
+ arm_dllexport_name_p, arm_dllimport_name_p, arm_mark_dllexport,
+ arm_mark_dllimport, arm_pe_encode_section_info,
+ arm_pe_unique_section): Use ISO-C function declarations.
+ * config/c4x/c4x-c.c (c4x_parse_pragma, c4x_pr_CODE_SECTION,
+ c4x_pr_DATA_SECTION, c4x_pr_FUNC_IS_PURE,
+ c4x_pr_FUNC_NEVER_RETURNS, c4x_pr_INTERRUPT, c4x_pr_ignored):
+ Likewise.
+ * config/iq2000/iq2000.h (ASM_OUTPUT_SKIP): Fix format warning.
+ * config/m68hc11/m68hc11.h (ASM_OUTPUT_EXTERNAL): Undef before
+ defining.
+ * config/mips/mips.h (ASM_DECLARE_OBJECT_NAME): Fix format
+ warnings.
+ * config/mn10300/mn10300.h (OUTPUT_ADDR_CONST_EXTRA): Likewise.
+ * config/pdp11/pdp11.c (pdp11_output_function_epilogue): Likewise.
+ (register_move_cost): Use ISO-C function declarations.
+ * config/pdp11/pdp11.h (PRINT_OPERAND): Fix format warnings.
+ * config/score/score-protos.h (score_declare_object): Add
+ ATTRIBUTE_PRINTF_4.
+ * config/score/score.h (ASM_DECLARE_OBJECT_NAME): Fix format
+ warnings.
+ * final.c (profile_function): Avoid empty if-bodies.
+
+
+ * calls.c (must_pass_in_stack_var_size,
+ must_pass_in_stack_var_size_or_pad): Constify.
+ * config/alpha/alpha-protos.h (function_value): Likewise.
+ * config/alpha/alpha.c (alpha_return_in_memory,
+ alpha_pass_by_reference, function_value,
+ unicosmk_must_pass_in_stack, TARGET_PROMOTE_FUNCTION_ARGS,
+ TARGET_PROMOTE_FUNCTION_RETURN, TARGET_PROMOTE_PROTOTYPES):
+ Likewise.
+ * config/arc/arc.c (arc_return_in_memory, arc_pass_by_reference,
+ TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN,
+ TARGET_PROMOTE_PROTOTYPES): Likewise.
+ * config/arm/arm-protos.h (arm_return_in_memory,
+ arm_pad_arg_upward, arm_function_value): Likewise.
+ * config/arm/arm.c (arm_pass_by_reference,
+ arm_promote_prototypes, arm_return_in_msb, arm_must_pass_in_stack,
+ TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN,
+ arm_function_value, arm_return_in_memory, arm_pad_arg_upward):
+ Likewise.
+ * config/arm/arm.h (ARM_DECLARE_FUNCTION_NAME): Likewise.
+ * config/avr/avr-protos.h (avr_function_value): Likewise.
+ * config/avr/avr.c (avr_return_in_memory,
+ gas_output_limited_string, gas_output_ascii, avr_function_value,
+ avr_return_in_memory): Likewise.
+ * config/bfin/bfin-protos.h (bfin_return_in_memory): Likewise.
+ * config/bfin/bfin.c (bfin_pass_by_reference,
+ bfin_return_in_memory, TARGET_PROMOTE_PROTOTYPES,
+ TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN):
+ Likewise.
+ * config/cris/cris.c (cris_pass_by_reference,
+ TARGET_PROMOTE_FUNCTION_ARGS): Likewise.
+ * config/crx/crx.c (crx_return_in_memory): Likewise.
+ * config/darwin.c (function_base, machopic_function_base_name):
+ Likewise.
+ * config/fr30/fr30.c (fr30_must_pass_in_stack,
+ TARGET_PROMOTE_PROTOTYPES): Likewise.
+ * config/frv/frv.c (frv_must_pass_in_stack): Likewise.
+ * config/h8300/h8300.c (h8300_return_in_memory): Likewise.
+ * config/i386/i386-protos.h (ix86_return_in_memory,
+ ix86_sol10_return_in_memory): Likewise.
+ * config/i386/i386.c (ix86_function_value,
+ ix86_function_sseregparm, ix86_must_pass_in_stack,
+ type_natural_mode, classify_argument, examine_argument,
+ construct_container, ix86_pass_by_reference, function_value_32,
+ function_value_64, ix86_function_value_1, return_in_memory_32,
+ return_in_memory_64, return_in_memory_ms_64,
+ ix86_return_in_memory, ix86_sol10_return_in_memory,
+ TARGET_PROMOTE_PROTOTYPES): Likewise.
+ * config/ia64/ia64-protos.h (ia64_function_value,
+ ia64_hpux_function_arg_padding): Likewise.
+ * config/ia64/ia64.c (hfa_element_mode, ia64_return_in_memory,
+ ia64_function_value, bundle_state_hash, bundle_state_eq_p,
+ ia64_hpux_function_arg_padding): Likewise.
+ * config/iq2000/iq2000-protos.h (function_arg,
+ iq2000_function_value): Likewise.
+ * config/iq2000/iq2000.c (iq2000_return_in_memory,
+ iq2000_pass_by_reference, TARGET_PROMOTE_FUNCTION_ARGS,
+ TARGET_PROMOTE_FUNCTION_RETURN, TARGET_PROMOTE_PROTOTYPES,
+ function_arg, iq2000_function_value): Likewise.
+ * config/m32c/m32c-protos.h (m32c_function_value,
+ m32c_promote_function_return): Likewise.
+ * config/m32c/m32c.c (m32c_pass_by_reference,
+ m32c_promote_prototypes, m32c_promote_function_return,
+ m32c_function_value): Likewise.
+ * config/m32r/m32r.c (m32r_return_in_memory,
+ m32r_pass_by_reference, TARGET_PROMOTE_PROTOTYPES,
+ m32r_in_small_data_p): Likewise.
+ * config/m68hc11/m68hc11-protos.h (m68hc11_function_arg_padding):
+ Likewise.
+ * config/m68hc11/m68hc11.c (m68hc11_return_in_memory,
+ m68hc11_function_arg_padding): Likewise.
+ * config/m68k/m68k-protos.h (m68k_function_value): Likewise.
+ * config/m68k/m68k.c (TARGET_PROMOTE_PROTOTYPES,
+ m68k_function_value): Likewise.
+ * config/mcore/mcore-protos.h (mcore_num_arg_regs,
+ mcore_function_value): Likewise.
+ * config/mcore/mcore.c (handle_structs_in_regs,
+ mcore_return_in_memory, TARGET_PROMOTE_FUNCTION_ARGS,
+ TARGET_PROMOTE_FUNCTION_RETURN, TARGET_PROMOTE_PROTOTYPES,
+ mcore_num_arg_regs, mcore_function_value): Likewise.
+ * config/mips/mips-protos.h (mips_pad_arg_upward,
+ mips_function_value): Likewise.
+ * config/mips/mips.c (mips_fpr_return_fields, mips_return_in_msb,
+ mips_return_in_memory, mips_pass_by_reference, mips_callee_copies,
+ TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN,
+ TARGET_PROMOTE_PROTOTYPES, mips_pad_arg_upward,
+ mips_function_value): Likewise.
+ * config/mmix/mmix-protos.h (mmix_function_outgoing_value):
+ Likewise.
+ * config/mmix/mmix.c (mmix_pass_by_reference,
+ TARGET_PROMOTE_FUNCTION_ARGS, mmix_function_outgoing_value,
+ mmix_encode_section_info): Likewise.
+ * config/mn10300/mn10300-protos.h (mn10300_function_value):
+ Likewise.
+ * config/mn10300/mn10300.c (mn10300_return_in_memory,
+ mn10300_pass_by_reference, TARGET_PROMOTE_PROTOTYPES,
+ mn10300_function_value): Likewise.
+ * config/mt/mt-protos.h (mt_function_value): Likewise.
+ * config/mt/mt.c (mt_pass_by_reference, mt_function_value,
+ mt_pass_in_stack, TARGET_PROMOTE_PROTOTYPES): Likewise.
+ * config/pa/pa-protos.h (function_arg_padding, function_value,
+ pa_return_in_memory): Likewise.
+ * config/pa/pa.c (pa_pass_by_reference,
+ TARGET_PROMOTE_FUNCTION_RETURN, TARGET_PROMOTE_PROTOTYPES,
+ function_arg_padding, function_value, pa_return_in_memory):
+ Likewise.
+ * config/pdp11/pdp11.c (pdp11_return_in_memory): Likewise.
+ * config/rs6000/rs6000-protos.h (rs6000_function_value,
+ function_arg_padding): Likewise.
+ * config/rs6000/rs6000.c (rs6000_return_in_memory,
+ rs6000_darwin64_record_arg_recurse, rs6000_darwin64_record_arg,
+ rs6000_pass_by_reference, rs6000_must_pass_in_stack,
+ TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN,
+ function_arg_padding, altivec_expand_dst_builtin,
+ altivec_expand_builtin, rs6000_expand_builtin, spe_init_builtins,
+ altivec_init_builtins, rs6000_common_init_builtins,
+ rs6000_function_value): Likewise.
+ * s390/s390-protos.h (s390_function_value): Likewise.
+ * config/s390/s390.c (s390_function_arg_size,
+ s390_pass_by_reference, s390_return_in_memory,
+ s390_function_value, TARGET_PROMOTE_FUNCTION_ARGS,
+ TARGET_PROMOTE_FUNCTION_RETURN): Likewise.
+ * config/score/score-protos.h (score_function_value): Likewise.
+ * config/score/score.c (score_arg_partial_bytes,
+ TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN,
+ TARGET_PROMOTE_PROTOTYPES, score_return_in_memory,
+ score_pass_by_reference, score_add_offset, score_function_value):
+ Likewise.
+ * config/sh/sh-protos.h (sh_attr_renesas_p,
+ sh_promote_prototypes): Likewise.
+ * config/sh/sh.c (sh_return_in_memory, sh_pass_by_reference,
+ sh_callee_copies, sh_promote_prototypes, shcompact_byref,
+ sh_attr_renesas_p): Likewise.
+ * config/sparc/sparc-protos.h (function_value,
+ function_arg_padding): Likewise.
+ * config/sparc/sparc.c (sparc_promote_prototypes,
+ sparc_return_in_memory, sparc_pass_by_reference,
+ TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN,
+ function_arg_record_value_2, function_arg_record_value_1,
+ function_arg_record_value, function_arg_record_value,
+ function_arg_padding, function_value): Likewise.
+ * config/spu/spu-protos.h (spu_function_value): Likewise.
+ * config/spu/spu.c (spu_pass_by_reference, spu_return_in_memory,
+ spu_function_value): Likewise.
+ * config/stormy16/stormy16-protos.h (xstormy16_function_value):
+ Likewise.
+ * config/stormy16/stormy16.c (xstormy16_return_in_memory,
+ xstormy16_function_value, TARGET_PROMOTE_FUNCTION_ARGS,
+ TARGET_PROMOTE_FUNCTION_RETURN, TARGET_PROMOTE_PROTOTYPES):
+ Likewise.
+ * config/v850/v850.c (v850_return_in_memory,
+ v850_pass_by_reference, TARGET_PROMOTE_PROTOTYPES): Likewise.
+ * config/vax/vax.c (TARGET_PROMOTE_PROTOTYPES): Likewise.
+ * config/xtensa/xtensa.c (xtensa_return_in_msb,
+ xtensa_return_in_memory, TARGET_PROMOTE_FUNCTION_ARGS,
+ TARGET_PROMOTE_FUNCTION_RETURN, TARGET_PROMOTE_PROTOTYPES):
+ Likewise.
+ * explow.c (promote_mode, hard_function_value): Likewise.
+ * expr.h (hard_function_value, promote_mode): Likewise.
+ * function.c (aggregate_value_p): Likewise.
+ * hooks.c (hook_bool_const_tree_true): New.
+ * hooks.h (hook_bool_const_tree_true): New.
+ * sdbout.c (SET_KNOWN_TYPE_TAG, plain_type_1): Constify.
+ * target-def.h (TARGET_PROMOTE_FUNCTION_ARGS,
+ TARGET_PROMOTE_FUNCTION_RETURN, TARGET_PROMOTE_PROTOTYPES,
+ TARGET_RETURN_IN_MSB): Likewise.
+ * target.h (promote_function_args, promote_function_return,
+ promote_prototypes, return_in_memory, return_in_msb,
+ pass_by_reference, must_pass_in_stack, callee_copies,
+ function_value): Likewise.
+ * targhooks.c (default_return_in_memory,
+ hook_pass_by_reference_must_pass_in_stack,
+ hook_callee_copies_named,
+ hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false,
+ hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true,
+ default_function_value): Likewise.
+ * targhooks.h (default_return_in_memory,
+ hook_pass_by_reference_must_pass_in_stack,
+ hook_callee_copies_named,
+ hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false,
+ hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true,
+ default_function_value): Likewise.
+ * tree-ssa-structalias.c (const_equiv_class_label_t): New.
+ (equiv_class_label_hash, equiv_class_label_eq): Constify.
+ * tree-vectorizer.c (bb_in_loop_p): Likewise.
+ * tree.c (needs_to_live_in_memory): Likewise.
+ * tree.h (struct tree_type, needs_to_live_in_memory,
+ aggregate_value_p, must_pass_in_stack_var_size,
+ must_pass_in_stack_var_size_or_pad): Likewise.
+ * vmsdbgout.c (write_debug_addr, write_debug_delta4,
+ write_debug_string, ASM_OUTPUT_DEBUG_STRING, write_rtnbeg,
+ lookup_filename): Likewise.
+
+2007-08-23 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/17390
+ * config/i386/i386.c (ix86_expand_fp_compare): Expand fp comparison to
+ fake fcomi i387 instruction for !TARGET_CMOVE.
+ (ix86_expand_branch): Expand natural sequence with one jump for
+ all targets, not only TARGET_CMOVE.
+ * config/i386/i386.md (*cmpfp_0_cc): New define_insn_and_split
+ pattern to implement fake fcomi sequence. Split instruction after
+ reload to correct compare sequences.
+ (*cmpfp_xf_cc): Ditto.
+ (*cmpfp_<mode>_cc): Ditto.
+ (*cmpfp_u_cc): Ditto.
+ (*cmpfp_<mode>_cc): Ditto.
+
+2007-08-23 Richard Guenther <rguenther@suse.de>
+
+ * tree-pretty-print.c (dump_generic_node): Annotate
+ GIMPLE_MODIFY_STMTs with volatile ops with "{v}".
+
+2007-08-23 Richard Guenther <rguenther@suse.de>
+
+ * builtins.c (expand_builtin_mathfn): Wrap argument in
+ save_expr directly instead of re-building the call.
+ (expand_builtin_mathfn_2): Likewise.
+ (expand_builtin_mathfn_3): Likewise.
+ (expand_builtin_interclass_mathfn): Likewise.
+ (expand_builtin_int_roundingfn): Set arg.
+ (expand_builtin_int_roundingfn_2): Likewise.
+
+2007-08-23 Paolo Bonzini <bonzini@gnu.org>
+
+ * config/i386/sse.md (*sse_and<mode>3, *sse_ior<mode>3,
+ *sse_nand<mode>3, *sse_xor<mode>3): New.
+
+2007-08-23 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.h (PRINT_OPERAND_PUNCT_VALID_P): Add ';' code.
+ * config/i386/i386.c (print_operand): Handle ';' code. Output
+ semicolon for TARGET_MACHO.
+ * config/i386/sync.md (*sync_compare_and_swap<mode>): Use '%;' to
+ emit semicolon after 'lock' prefix.
+ (sync_double_compare_and_swap<mode>): Ditto.
+ (*sync_double_compare_and_swapdi_pic): Ditto.
+ (*sync_compare_and_swap_cc<mode>): Ditto.
+ (sync_double_compare_and_swap_cc<mode>): Ditto.
+ (*sync_double_compare_and_swap_ccdi_pic): Ditto.
+ (sync_old_add<mode>): Ditto.
+ (sync_add<mode>): Ditto.
+ (sync_sub<mode>): Ditto.
+ (sync_ior<mode>): Ditto.
+ (sync_and<mode>): Ditto.
+ (sync_xor<mode>): Ditto.
+
+2007-08-22 Chao-ying Fu <fu@mips.com>
+
+ * rtl.c (rtx_code_size): Check CONST_FIXED to calcualte correct sizes
+ in DEF_RTL_EXPR.
+ (copy_rtx): Handle CONST_FIXED.
+ (rtx_equal_p): Likewise.
+ * rtl.h (fixed_value.h): New include.
+ (rtx_def): Add a new field of fixed_value to u.
+ (XCNMPFV): Define for accessing fixed_value.
+ (CONST_FIXED_VALUE, CONST_FIXED_VALUE_HIGH, CONST_FIXED_VALUE_LOW):
+ Define.
+ * rtl.def (CONST_FIXED): New constant.
+ (SS_MULT, US_MULT, SS_DIV, US_DIV, FRACT_CONVERT,
+ UNSIGNED_FRACT_CONVERT, SAT_FRACT, UNSIGNED_SAT_FRACT, US_NEG,
+ US_ASHIFT): New codes.
+ * doc/rtl.texi (Expressions): Document const_fixed, us_neg, ss_mult,
+ us_mult, ss_div, us_div, us_ashift, fract_convert, sat_fract,
+ unsigned_fract_convert, unsigned_sat_fract): Document them.
+ * varasm.c (assemble_integer): Extend to support fixed-point constants
+ by using different machine classes.
+ (decode_addr_const): Handle FIXED_CST.
+ (const_hash_1): Likewise.
+ (compare_constant): Likewise.
+ (copy_constant): Likewise.
+ (const_rtx_hash_1): Handle CONST_FIXED.
+ (output_constant_pool_2): Handle MODE_FRACT, MODE_UFRACT, MODE_ACCUM,
+ MODE_UACCUM, MODE_VECTOR_FRACT, MODE_VECTOR_UFRACT, MODE_VECTOR_ACCUM,
+ MODE_VECTOR_UACCUM.
+ (initializer_constant_valid_p): Handle FIXED_CST.
+ (output_constant): Support FIXED_POINT_TYPE.
+ * gengenrtl.c (excluded_rtx): Check CONST_FIXED to exclude.
+ * cse.c (hash_rtx): Support CONST_FIXED.
+ (exp_equiv_p): Likewise.
+ (cannon_reg): Likewise.
+ (fold_rtx): Likewise.
+ (equiv_constant): Likewise.
+ (cse_process_notes_1): Likewise.
+ (count_reg_usage): Likewise.
+ * cselib.c (entry_and_rtx_equal_p): Check CONST_FIXED.
+ (rtx_equal_for_cselib_p): Handle CONST_FIXED.
+ (wrap_constant): Check CONST_FIXED.
+ (cselib_hash_rtx): Support CONST_FIXED.
+ (cselib_subst_to_values): Likewise.
+ * df-scan.c (df_uses_record): Likewise.
+ * gcse.c (want_to_gcse_p): Likewise.
+ (oprs_unchanged_p): Likewise.
+ (oprs_not_set_p): Likewise.
+ (compute_transp): Likewise.
+ (extract_mentioned_regs_helper): Likewise.
+ * genemit.c (gen_exp): Likewise.
+ * local-alloc.c (equiv_init_varies_p): Likewise.
+ (contains_replace_regs): Likewise.
+ (memref_referenced_p): Likewise.
+ * loop-invariant.c (check_maybe_invariant): Likewise.
+ (hash_invariant_expr_1): Likewise.
+ (invariant_expr_equal_p): Likewise.
+ * postreload-gcse.c (oprs_unchanged_p): Likewise.
+ * regclass.c (reg_scan_mark_refs): Likewise.
+ * regrename.c (scan_rtx): Likewise.
+ * resource.c (mark_referenced_resources): Likewise.
+ (mark_set_resources): Likewise.
+ * rtlanal.c (rtx_unstable_p): Likewise.
+ (rtx_varies_p): Likewise.
+ (count_occurrences): Likewise.
+ (reg_mentioned_p): Likewise.
+ (modified_between_p): Likewise.
+ (modified_in_p): Likewise.
+ (volatile_insn_p): Likewise.
+ (volatile_refs_p): Likewise.
+ (side_effects_p): Likewise.
+ (may_trap_p_1): Likewise.
+ (inequality_comparisons_p): Likewise.
+ (computed_jump_p_1): Likewise.
+ (commutative_operand_precedence): Likewise.
+ * sched-deps.c (sched_analyze_2): Likewise.
+ * sched-vis.c (print_value): Likewise.
+ * reload.c (operands_match_p): Likewise.
+ (subst_reg_equivs): Likewise.
+ * reload1.c (eliminate_regs_1): Likewise.
+ (elimination_effects): Likewise.
+ (scan_paradoxical_subregs): Likewise.
+ * alias.c (rtx_equal_for_memref_p): Likewise.
+ * Makefile.in (RTL_BASE_H): Add fixed-value.h.
+ * emit-rtl.c (const_fixed_htab): New hash table.
+ (const_fixed_htab_hash, const_fixed_htab_eq, lookup_const_fixed):
+ Declare.
+ (const_fixed_htab_hash, const_fixed_htab_eq, lookup_const_fixed,
+ const_fixed_from_fixed_value): New functions.
+ (verify_rtx_sharing): Handle CONST_FIXED.
+ (copy_rtx_if_shared_1): Likewise.
+ (reset_used_flags): Likewise.
+ (set_used_flags): Likewise.
+ (copy_insn_1): Likewise.
+ (init_emit_once): Create const_fixed_htab.
+ Store fixed-point scalar and vector zero and one to const_tiny_rtx.
+
+2007-08-22 Zdenek Dvorak <ook@ucw.cz>
+
+ PR tree-optimization/32949
+ * tree-ssa-loop-niter.c (scev_probably_wraps_p): Test nowrap_type_p
+ before failing for ivs with non-constant step.
+
+2007-08-22 Hans-Peter Nilsson <hp@axis.com>
+
+ * doc/md.texi (Iterators): Renamed from Macros. All contents
+ changed to reflect rename of respectively define_code_macro and
+ define_mode_macro to define_code_iterator and define_mode_iterator.
+ (Mode Iterators, Code Iterators): Similar.
+ * read-rtl.c (struct iterator_group, struct iterator_traverse_data)
+ (uses_mode_iterator_p, apply_mode_iterator, uses_code_iterator_p)
+ (apply_iterator_to_string, uses_iterator_p, apply_iterator_traverse)
+ (initialize_iterators, find_iterator, check_code_iterator)
+ (map_attr_string, apply_mode_maps, apply_iterator_to_rtx, add_mapping)
+ (read_mapping, read_rtx_1): Similar.
+ * config/alpha/sync.md, config/alpha/alpha.md, config/frv/frv.md,
+ config/s390/s390.md, config/m32c/blkmov.md, config/m32c/m32c.md,
+ config/spu/spu.md, config/sparc/sparc.md, config/sparc/sync.md,
+ config/i386/i386.md, config/i386/mmx.md, config/i386/sse.md,
+ config/i386/sync.md, config/crx/crx.md, config/xtensa/xtensa.md,
+ config/cris/cris.c, config/cris/cris.md, config/ia64/sync.md,
+ config/ia64/div.md, config/ia64/vect.md, config/ia64/ia64.md,
+ config/m68k/m68k.md, config/rs6000/spe.md, config/rs6000/altivec.md,
+ config/rs6000/sync.md, config/rs6000/rs6000.md,
+ config/arm/vec-common.md, config/arm/neon.md, config/arm/iwmmxt.md,
+ config/arm/arm.md, config/mips/mips-dsp.md, config/mips/mips.md,
+ config/vax/vax.md, config/bfin/bfin.md: Similar.
+
+2007-08-22 David Daney <ddaney@avtrex.com>
+
+ * doc/install.texi (Testing): Mention testing on a simulator.
+
2007-08-22 Janis Johnson <janis187@us.ibm.com>
* config/dfp-bit.c (DFP_TO_DFP): Check for overflow.
@@ -156,8 +1382,8 @@
* c-tree.h (enum c_typespec_keyword): Add cts_fract and cts_accum.
(c_declspecs): Add saturating_p.
* c-decl.c (build_null_declspecs): Initialize saturating_p.
- (declspecs_add_type): Avoid using complex with _Fract, _Accum, or _Sat.
- Handle RID_SAT.
+ (declspecs_add_type): Avoid using complex with _Fract, _Accum, or
+ _Sat. Handle RID_SAT.
Avoid using void, bool, char, int, float, double, _Decimal32,
_Decimal64, _Decimal128, and complex with _Sat.
Handle RID_FRACT and RID_ACCUM.
@@ -453,14 +1679,14 @@
'nested_in_vect_loop' case. Change verbosity level.
(vect_analyze_data_ref_access): Handle the 'nested_in_vect_loop' case.
Don't fail on zero step in the outer-loop for loads.
- (vect_analyze_data_refs): Call split_constant_offset to calculate base,
- offset and init relative to the outer-loop.
+ (vect_analyze_data_refs): Call split_constant_offset to calculate
+ base, offset and init relative to the outer-loop.
* tree-vect-transform.c (vect_create_data_ref_ptr): Replace the unused
BSI function argument with a new function argument - at_loop.
Simplify the condition that determines STEP. Takes additional argument
- INV_P. Support outer-loop vectorization (handle the nested_in_vect_loop
- case), including zero step in the outer-loop. Call
+ INV_P. Support outer-loop vectorization (handle the
+ nested_in_vect_loop case), including zero step in the outer-loop. Call
vect_create_addr_base_for_vector_ref with additional argument.
(vect_create_addr_base_for_vector_ref): Takes additional argument LOOP.
Updated function documentation. Handle the 'nested_in_vect_loop' case.
@@ -470,12 +1696,12 @@
additional argument. Fix typos. Handle the 'nested_in_vect_loop' case.
(vect_setup_realignment): Takes additional arguments INIT_ADDR and
DR_ALIGNMENT_SUPPORT. Returns another value AT_LOOP. Handle the case
- when the realignment setup needs to take place inside the loop. Support
- the dr_explicit_realign scheme. Allow generating the optimized
+ when the realignment setup needs to take place inside the loop.
+ Support the dr_explicit_realign scheme. Allow generating the optimized
realignment scheme for outer-loop vectorization. Added documentation.
- (vectorizable_load): Support the dr_explicit_realign scheme. Handle the
- 'nested_in_vect_loop' case, including loads that are invariant in the
- outer-loop and the realignment schemes. Handle the case when the
+ (vectorizable_load): Support the dr_explicit_realign scheme. Handle
+ the 'nested_in_vect_loop' case, including loads that are invariant in
+ the outer-loop and the realignment schemes. Handle the case when the
realignment setup needs to take place inside the loop. Call
vect_setup_realignment with additional arguments. Call
vect_create_data_ref_ptr with additional argument and with loop instead
@@ -513,9 +1739,9 @@
(new_stmt_vec_info): When setting def_type for phis differentiate
loop-header phis from other phis.
(bb_in_loop_p): New function.
- (new_loop_vec_info): Inner-loop phis already have a stmt_vinfo, so just
- update their loop_vinfo. Order of BB traversal now matters - call
- dfs_enumerate_from with bb_in_loop_p.
+ (new_loop_vec_info): Inner-loop phis already have a stmt_vinfo, so
+ just update their loop_vinfo. Order of BB traversal now matters -
+ call dfs_enumerate_from with bb_in_loop_p.
(destroy_loop_vec_info): Takes additional argument to control whether
stmt_vinfo of the loop stmts should be destroyed as well.
(vect_is_simple_reduction): Allow the "non-reduction" use of a
@@ -974,8 +2200,8 @@
(add_back_forw_dep, delete_back_forw_dep): Ditto.
(debug_ds, sched_insn_is_legitimate_for_speculation_p): Declare
functions.
- (SD_LIST_NONE, SD_LIST_HARD_BACK, SD_LIST_SPEC_BACK, SD_LIST_FORW): New
- constants.
+ (SD_LIST_NONE, SD_LIST_HARD_BACK, SD_LIST_SPEC_BACK, SD_LIST_FORW):
+ New constants.
(SD_LIST_RES_BACK, SD_LIST_RES_FORW, SD_LIST_BACK): Ditto.
(sd_list_types_def): New typedef.
(sd_next_list): Declare function.
@@ -1116,8 +2342,8 @@
Free dependencies at the end of scheduling the ebb.
* ddg.c (create_ddg_dependence): Update to use new interfaces.
- (build_intra_loop_deps): Ditto. Remove separate computation of forward
- dependencies. Free sched-deps dependencies.
+ (build_intra_loop_deps): Ditto. Remove separate computation of
+ forward dependencies. Free sched-deps dependencies.
* config/ia64/ia64.c (ia64_dependencies_evaluation_hook): Update
to use new interfaces.
@@ -2191,13 +3417,14 @@
2007-08-04 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR middle-end/32780
- * fold-const.c (fold_binary <case MINUS_EXPR>): Fix the type of operands
- for the folding of "A - (A & B)" into "~B & A"; cast them to type.
+ * fold-const.c (fold_binary <case MINUS_EXPR>): Fix the type of
+ operands for the folding of "A - (A & B)" into "~B & A"; cast them
+ to type.
2007-08-03 Zdenek Dvorak <ook@ucw.cz>
- * tree-ssa-threadupdate.c (thread_through_all_blocks): Use loops' state
- accessor functions.
+ * tree-ssa-threadupdate.c (thread_through_all_blocks): Use loops'
+ state accessor functions.
* cfgloopmanip.c (remove_path, create_preheaders,
force_single_succ_latches, fix_loop_structure): Ditto.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
@@ -3080,8 +4307,8 @@
2007-07-27 Jan Hubicka <jh@suse.cz>
- * config/i386/i386.c (register_move_cost): Remove accidentally comitted
- #if 0 block.
+ * config/i386/i386.c (register_move_cost): Remove accidentally
+ comitted #if 0 block.
* attribs.c: Include hashtab.h
(attribute_hash): New.
@@ -4010,7 +5237,8 @@
Jakub Jelinek <jakub@redhat.com>
PR middle-end/PR28690
- * optabs.c (expand_binop): (emit_cmp_and_jump_insns): Allow EQ compares.
+ * optabs.c (expand_binop): (emit_cmp_and_jump_insns): Allow
+ EQ compares.
* rtlanal.c (commutative_operand_precedence): Prefer both REG_POINTER
and MEM_POINTER operands over REG and MEM operands.
(swap_commutative_operands_p): Change return value to bool.
@@ -4056,8 +5284,8 @@
(expand_copysign_absneg): If back end provides signbit insn, use it
instead of bit operations on floating point argument.
* builtins.c (enum insn_code signbit_optab[]): Remove array.
- (expand_builtin_signbit): Check signbit_optab->handlers[].insn_code for
- availability of signbit insn.
+ (expand_builtin_signbit): Check signbit_optab->handlers[].insn_code
+ for availability of signbit insn.
* config/i386/i386.md (signbit<mode>2): New insn pattern to implement
signbitf, signbit and signbitl built-ins as inline x87 intrinsics when
@@ -4342,8 +5570,8 @@
* pa-protos.h (pa_eh_return_handler_rtx): Declare.
* pa.c (pa_extra_live_on_entry, rp_saved): Declare.
(TARGET_EXTRA_LIVE_ON_ENTRY): Define.
- (pa_output_function_prologue): Use rp_saved and current_function_is_leaf
- to generate .CALLINFO statement.
+ (pa_output_function_prologue): Use rp_saved and
+ current_function_is_leaf to generate .CALLINFO statement.
(hppa_expand_prologue): Set rp_saved.
(hppa_expand_epilogue): Use rp_saved.
(pa_extra_live_on_entry, pa_eh_return_handler_rtx): New functions.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 48c16f0a378..a3fd8a5d04e 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20070822
+20070831
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 52c11b79392..5e086635445 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -770,7 +770,7 @@ HOSTHOOKS_DEF_H = hosthooks-def.h $(HOOKS_H)
LANGHOOKS_DEF_H = langhooks-def.h $(HOOKS_H)
TARGET_DEF_H = target-def.h $(HOOKS_H)
RTL_BASE_H = rtl.h rtl.def $(MACHMODE_H) reg-notes.def insn-notes.def \
- input.h $(REAL_H) statistics.h vec.h
+ input.h $(REAL_H) statistics.h vec.h fixed-value.h
RTL_H = $(RTL_BASE_H) genrtl.h
PARAMS_H = params.h params.def
BUILTINS_DEF = builtins.def sync-builtins.def omp-builtins.def
@@ -1965,7 +1965,7 @@ tree-inline.o : tree-inline.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(VARRAY_H) $(HASHTAB_H) $(SPLAY_TREE_H) toplev.h \
langhooks.h $(TREE_INLINE_H) $(CGRAPH_H) intl.h $(FUNCTION_H) $(TREE_GIMPLE_H) \
debug.h $(DIAGNOSTIC_H) $(TREE_FLOW_H) tree-iterator.h tree-mudflap.h \
- ipa-prop.h value-prof.h
+ ipa-prop.h value-prof.h $(TARGET_H) $(INTEGRATE_H)
print-tree.o : print-tree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(GGC_H) langhooks.h $(REAL_H) tree-iterator.h fixed-value.h
stor-layout.o : stor-layout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
@@ -2428,7 +2428,7 @@ vmsdbgout.o : vmsdbgout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H)
$(RTL_H) $(FLAGS_H) output.h vmsdbg.h debug.h langhooks.h $(FUNCTION_H) $(TARGET_H)
xcoffout.o : xcoffout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(RTL_H) xcoffout.h $(FLAGS_H) toplev.h output.h dbxout.h \
- $(GGC_H) $(TARGET_H) gstab.h xcoff.h
+ $(GGC_H) $(TARGET_H) debug.h gstab.h xcoff.h
emit-rtl.o : emit-rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(FLAGS_H) $(FUNCTION_H) $(REGS_H) insn-config.h $(RECOG_H) \
$(GGC_H) $(EXPR_H) hard-reg-set.h bitmap.h toplev.h $(BASIC_BLOCK_H) \
@@ -2880,13 +2880,15 @@ mips-tdump.o : mips-tdump.c $(CONFIG_H) $(RTL_H) $(SYSTEM_H) coretypes.h \
# FIXME: writing proper dependencies for this is a *LOT* of work.
libbackend.o : $(OBJS-common:.o=.c) $(out_file) \
insn-config.h insn-flags.h insn-codes.h insn-constants.h \
- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE)
+ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
-DTARGET_NAME=\"$(target_noncanonical)\" \
-DLOCALEDIR=\"$(localedir)\" \
-c $(filter %.c,$^) -o $@ \
-DBASEVER=$(BASEVER_s) -DDATESTAMP=$(DATESTAMP_s) \
- -DDEVPHASE=$(DEVPHASE_s) -combine
+ -DREVISION=$(REVISION_s) \
+ -DDEVPHASE=$(DEVPHASE_s) -DPKGVERSION=$(PKGVERSION_s) \
+ -DBUGURL=$(BUGURL_s) -combine
#
# Generate header and source files from the machine description,
@@ -3094,7 +3096,7 @@ GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/targhooks.c $(out_file) $(srcdir)/passes.c $(srcdir)/cgraphunit.c \
@all_gtfiles@
-GTFILES_H = $(subst /,-, $(subst $(srcdir)/,gt-, $(subst .c,.h, \
+GTFILES_H = $(subst /,-, $(patsubst $(srcdir)/%,gt-%, $(patsubst %.c,%.h, \
$(filter %.c, $(GTFILES)))))
GTFILES_LANG_H = $(patsubst [%], gtype-%.h, $(filter [%], $(GTFILES)))
diff --git a/gcc/alias.c b/gcc/alias.c
index ec298423020..870fbc47adb 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -167,7 +167,7 @@ static rtx adjust_offset_for_component_ref (tree, rtx);
static int nonoverlapping_memrefs_p (const_rtx, const_rtx);
static int write_dependence_p (const_rtx, const_rtx, int);
-static void memory_modified_1 (rtx, const_rtx, void *);
+static void memory_modified_1 (const_rtx, const_rtx, const void *);
static void record_alias_subset (alias_set_type, alias_set_type);
/* Set up all info needed to perform alias analysis on memory references. */
@@ -1233,6 +1233,7 @@ rtx_equal_for_memref_p (const_rtx x, const_rtx y)
case VALUE:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
/* There's no need to compare the contents of CONST_DOUBLEs or
CONST_INTs because pointer equality is a good enough
comparison for these nodes. */
@@ -2324,10 +2325,12 @@ output_dependence (const_rtx mem, const_rtx x)
void
-init_alias_once (void)
+init_alias_target (void)
{
int i;
+ memset (static_reg_base_value, 0, sizeof static_reg_base_value);
+
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
/* Check whether this register can hold an incoming pointer
argument. FUNCTION_ARG_REGNO_P tests outgoing register
@@ -2353,11 +2356,11 @@ init_alias_once (void)
to be memory reference. */
static bool memory_modified;
static void
-memory_modified_1 (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data)
+memory_modified_1 (const_rtx x, const_rtx pat ATTRIBUTE_UNUSED, const void *data)
{
if (MEM_P (x))
{
- if (anti_dependence (x, (rtx)data) || output_dependence (x, (rtx)data))
+ if (anti_dependence (x, (const_rtx)data) || output_dependence (x, (const_rtx)data))
memory_modified = true;
}
}
@@ -2366,12 +2369,12 @@ memory_modified_1 (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data)
/* Return true when INSN possibly modify memory contents of MEM
(i.e. address can be modified). */
bool
-memory_modified_in_insn_p (rtx mem, rtx insn)
+memory_modified_in_insn_p (const_rtx mem, const_rtx insn)
{
if (!INSN_P (insn))
return false;
memory_modified = false;
- note_stores (PATTERN (insn), memory_modified_1, mem);
+ const_note_stores (PATTERN (insn), memory_modified_1, mem);
return memory_modified;
}
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index e8a9b66e142..e2cd90211f1 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -830,8 +830,8 @@ extern void compute_available (sbitmap *, sbitmap *, sbitmap *, sbitmap *);
extern bool maybe_hot_bb_p (const_basic_block);
extern bool probably_cold_bb_p (const_basic_block);
extern bool probably_never_executed_bb_p (const_basic_block);
-extern bool tree_predicted_by_p (basic_block, enum br_predictor);
-extern bool rtl_predicted_by_p (basic_block, enum br_predictor);
+extern bool tree_predicted_by_p (const_basic_block, enum br_predictor);
+extern bool rtl_predicted_by_p (const_basic_block, enum br_predictor);
extern void tree_predict_edge (edge, enum br_predictor, int);
extern void rtl_predict_edge (edge, enum br_predictor, int);
extern void predict_edge_def (edge, enum br_predictor, enum prediction);
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index 432fd0e5015..9bf4086f5ae 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -176,7 +176,7 @@ static basic_block copy_bb (basic_block, edge, basic_block, int);
static fibheapkey_t bb_to_key (basic_block);
static bool better_edge_p (const_basic_block, const_edge, int, int, int, int, const_edge);
static void connect_traces (int, struct trace *);
-static bool copy_bb_p (basic_block, int);
+static bool copy_bb_p (const_basic_block, int);
static int get_uncond_jump_length (void);
static bool push_to_next_round_p (const_basic_block, int, int, int, gcov_type);
static void find_rarely_executed_basic_blocks_and_crossing_edges (edge **,
@@ -1156,7 +1156,7 @@ connect_traces (int n_traces, struct trace *traces)
when code size is allowed to grow by duplication. */
static bool
-copy_bb_p (basic_block bb, int code_may_grow)
+copy_bb_p (const_basic_block bb, int code_may_grow)
{
int size = 0;
int max_size = uncond_jump_length;
diff --git a/gcc/builtin-types.def b/gcc/builtin-types.def
index 792e8da7097..081a33f0467 100644
--- a/gcc/builtin-types.def
+++ b/gcc/builtin-types.def
@@ -289,6 +289,8 @@ DEF_FUNCTION_TYPE_2 (BT_FN_INT_CONST_STRING_VALIST_ARG,
BT_INT, BT_CONST_STRING, BT_VALIST_ARG)
DEF_FUNCTION_TYPE_2 (BT_FN_PTR_SIZE_SIZE,
BT_PTR, BT_SIZE, BT_SIZE)
+DEF_FUNCTION_TYPE_2 (BT_FN_PTR_PTR_SIZE,
+ BT_PTR, BT_PTR, BT_SIZE)
DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT_COMPLEX_FLOAT,
BT_COMPLEX_FLOAT, BT_COMPLEX_FLOAT, BT_COMPLEX_FLOAT)
DEF_FUNCTION_TYPE_2 (BT_FN_COMPLEX_DOUBLE_COMPLEX_DOUBLE_COMPLEX_DOUBLE,
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 64f8185b723..e353e4dce1d 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -125,7 +125,6 @@ static rtx expand_builtin_bcopy (tree, int);
static rtx expand_builtin_strcpy (tree, tree, rtx, enum machine_mode);
static rtx expand_builtin_strcpy_args (tree, tree, tree, rtx, enum machine_mode);
static rtx expand_builtin_stpcpy (tree, rtx, enum machine_mode);
-static rtx builtin_strncpy_read_str (void *, HOST_WIDE_INT, enum machine_mode);
static rtx expand_builtin_strncpy (tree, rtx, enum machine_mode);
static rtx builtin_memset_gen_str (void *, HOST_WIDE_INT, enum machine_mode);
static rtx expand_builtin_memset (tree, rtx, enum machine_mode);
@@ -1813,7 +1812,7 @@ expand_builtin_mathfn (tree exp, rtx target, rtx subtarget)
tree fndecl = get_callee_fndecl (exp);
enum machine_mode mode;
bool errno_set = false;
- tree arg, narg;
+ tree arg;
if (!validate_arglist (exp, REAL_TYPE, VOID_TYPE))
return NULL_RTX;
@@ -1886,12 +1885,7 @@ expand_builtin_mathfn (tree exp, rtx target, rtx subtarget)
/* Wrap the computation of the argument in a SAVE_EXPR, as we may
need to expand the argument again. This way, we will not perform
side-effects more the once. */
- narg = builtin_save_expr (arg);
- if (narg != arg)
- {
- arg = narg;
- exp = build_call_expr (fndecl, 1, arg);
- }
+ CALL_EXPR_ARG (exp, 0) = arg = builtin_save_expr (arg);
op0 = expand_expr (arg, subtarget, VOIDmode, EXPAND_NORMAL);
@@ -1979,10 +1973,9 @@ expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget)
rtx op0, op1, insns;
int op1_type = REAL_TYPE;
tree fndecl = get_callee_fndecl (exp);
- tree arg0, arg1, narg;
+ tree arg0, arg1;
enum machine_mode mode;
bool errno_set = true;
- bool stable = true;
switch (DECL_FUNCTION_CODE (fndecl))
{
@@ -2039,21 +2032,8 @@ expand_builtin_mathfn_2 (tree exp, rtx target, rtx subtarget)
errno_set = false;
/* Always stabilize the argument list. */
- narg = builtin_save_expr (arg1);
- if (narg != arg1)
- {
- arg1 = narg;
- stable = false;
- }
- narg = builtin_save_expr (arg0);
- if (narg != arg0)
- {
- arg0 = narg;
- stable = false;
- }
-
- if (! stable)
- exp = build_call_expr (fndecl, 2, arg0, arg1);
+ CALL_EXPR_ARG (exp, 0) = arg0 = builtin_save_expr (arg0);
+ CALL_EXPR_ARG (exp, 1) = arg1 = builtin_save_expr (arg1);
op0 = expand_expr (arg0, subtarget, VOIDmode, EXPAND_NORMAL);
op1 = expand_normal (arg1);
@@ -2099,7 +2079,7 @@ expand_builtin_mathfn_3 (tree exp, rtx target, rtx subtarget)
rtx op0, insns;
tree fndecl = get_callee_fndecl (exp);
enum machine_mode mode;
- tree arg, narg;
+ tree arg;
if (!validate_arglist (exp, REAL_TYPE, VOID_TYPE))
return NULL_RTX;
@@ -2139,12 +2119,7 @@ expand_builtin_mathfn_3 (tree exp, rtx target, rtx subtarget)
/* Wrap the computation of the argument in a SAVE_EXPR, as we may
need to expand the argument again. This way, we will not perform
side-effects more the once. */
- narg = save_expr (arg);
- if (narg != arg)
- {
- arg = narg;
- exp = build_call_expr (fndecl, 1, arg);
- }
+ CALL_EXPR_ARG (exp, 0) = arg = builtin_save_expr (arg);
op0 = expand_expr (arg, subtarget, VOIDmode, EXPAND_NORMAL);
@@ -2211,7 +2186,7 @@ expand_builtin_interclass_mathfn (tree exp, rtx target, rtx subtarget)
tree fndecl = get_callee_fndecl (exp);
enum machine_mode mode;
bool errno_set = false;
- tree arg, narg;
+ tree arg;
if (!validate_arglist (exp, REAL_TYPE, VOID_TYPE))
return NULL_RTX;
@@ -2257,12 +2232,7 @@ expand_builtin_interclass_mathfn (tree exp, rtx target, rtx subtarget)
/* Wrap the computation of the argument in a SAVE_EXPR, as we may
need to expand the argument again. This way, we will not perform
side-effects more the once. */
- narg = builtin_save_expr (arg);
- if (narg != arg)
- {
- arg = narg;
- exp = build_call_expr (fndecl, 1, arg);
- }
+ CALL_EXPR_ARG (exp, 0) = arg = builtin_save_expr (arg);
op0 = expand_expr (arg, subtarget, VOIDmode, EXPAND_NORMAL);
@@ -2549,7 +2519,7 @@ expand_builtin_int_roundingfn (tree exp, rtx target, rtx subtarget)
/* Wrap the computation of the argument in a SAVE_EXPR, as we may
need to expand the argument again. This way, we will not perform
side-effects more the once. */
- CALL_EXPR_ARG (exp, 0) = builtin_save_expr (arg);
+ CALL_EXPR_ARG (exp, 0) = arg = builtin_save_expr (arg);
op0 = expand_expr (arg, subtarget, VOIDmode, EXPAND_NORMAL);
@@ -2673,7 +2643,7 @@ expand_builtin_int_roundingfn_2 (tree exp, rtx target, rtx subtarget)
/* Wrap the computation of the argument in a SAVE_EXPR, as we may
need to expand the argument again. This way, we will not perform
side-effects more the once. */
- CALL_EXPR_ARG (exp, 0) = builtin_save_expr (arg);
+ CALL_EXPR_ARG (exp, 0) = arg = builtin_save_expr (arg);
op0 = expand_expr (arg, subtarget, VOIDmode, EXPAND_NORMAL);
@@ -3361,11 +3331,11 @@ expand_builtin_memcpy (tree exp, rtx target, enum machine_mode mode)
&& GET_CODE (len_rtx) == CONST_INT
&& (unsigned HOST_WIDE_INT) INTVAL (len_rtx) <= strlen (src_str) + 1
&& can_store_by_pieces (INTVAL (len_rtx), builtin_memcpy_read_str,
- (void *) src_str, dest_align))
+ (void *) src_str, dest_align, false))
{
dest_mem = store_by_pieces (dest_mem, INTVAL (len_rtx),
builtin_memcpy_read_str,
- (void *) src_str, dest_align, 0);
+ (void *) src_str, dest_align, false, 0);
dest_mem = force_operand (XEXP (dest_mem, 0), NULL_RTX);
dest_mem = convert_memory_address (ptr_mode, dest_mem);
return dest_mem;
@@ -3474,13 +3444,14 @@ expand_builtin_mempcpy_args (tree dest, tree src, tree len, tree type,
&& GET_CODE (len_rtx) == CONST_INT
&& (unsigned HOST_WIDE_INT) INTVAL (len_rtx) <= strlen (src_str) + 1
&& can_store_by_pieces (INTVAL (len_rtx), builtin_memcpy_read_str,
- (void *) src_str, dest_align))
+ (void *) src_str, dest_align, false))
{
dest_mem = get_memory_rtx (dest, len);
set_mem_align (dest_mem, dest_align);
dest_mem = store_by_pieces (dest_mem, INTVAL (len_rtx),
builtin_memcpy_read_str,
- (void *) src_str, dest_align, endp);
+ (void *) src_str, dest_align,
+ false, endp);
dest_mem = force_operand (XEXP (dest_mem, 0), NULL_RTX);
dest_mem = convert_memory_address (ptr_mode, dest_mem);
return dest_mem;
@@ -3763,7 +3734,7 @@ expand_builtin_stpcpy (tree exp, rtx target, enum machine_mode mode)
bytes from constant string DATA + OFFSET and return it as target
constant. */
-static rtx
+rtx
builtin_strncpy_read_str (void *data, HOST_WIDE_INT offset,
enum machine_mode mode)
{
@@ -3822,13 +3793,13 @@ expand_builtin_strncpy (tree exp, rtx target, enum machine_mode mode)
if (!p || dest_align == 0 || !host_integerp (len, 1)
|| !can_store_by_pieces (tree_low_cst (len, 1),
builtin_strncpy_read_str,
- (void *) p, dest_align))
+ (void *) p, dest_align, false))
return NULL_RTX;
dest_mem = get_memory_rtx (dest, len);
store_by_pieces (dest_mem, tree_low_cst (len, 1),
builtin_strncpy_read_str,
- (void *) p, dest_align, 0);
+ (void *) p, dest_align, false, 0);
dest_mem = force_operand (XEXP (dest_mem, 0), NULL_RTX);
dest_mem = convert_memory_address (ptr_mode, dest_mem);
return dest_mem;
@@ -3956,14 +3927,15 @@ expand_builtin_memset_args (tree dest, tree val, tree len,
* We can't pass builtin_memset_gen_str as that emits RTL. */
c = 1;
if (host_integerp (len, 1)
- && !(optimize_size && tree_low_cst (len, 1) > 1)
&& can_store_by_pieces (tree_low_cst (len, 1),
- builtin_memset_read_str, &c, dest_align))
+ builtin_memset_read_str, &c, dest_align,
+ true))
{
val_rtx = force_reg (TYPE_MODE (unsigned_char_type_node),
val_rtx);
store_by_pieces (dest_mem, tree_low_cst (len, 1),
- builtin_memset_gen_str, val_rtx, dest_align, 0);
+ builtin_memset_gen_str, val_rtx, dest_align,
+ true, 0);
}
else if (!set_storage_via_setmem (dest_mem, len_rtx, val_rtx,
dest_align, expected_align,
@@ -3981,11 +3953,11 @@ expand_builtin_memset_args (tree dest, tree val, tree len,
if (c)
{
if (host_integerp (len, 1)
- && !(optimize_size && tree_low_cst (len, 1) > 1)
&& can_store_by_pieces (tree_low_cst (len, 1),
- builtin_memset_read_str, &c, dest_align))
+ builtin_memset_read_str, &c, dest_align,
+ true))
store_by_pieces (dest_mem, tree_low_cst (len, 1),
- builtin_memset_read_str, &c, dest_align, 0);
+ builtin_memset_read_str, &c, dest_align, true, 0);
else if (!set_storage_via_setmem (dest_mem, len_rtx, GEN_INT (c),
dest_align, expected_align,
expected_size))
diff --git a/gcc/builtins.def b/gcc/builtins.def
index 628fd257e9e..8bedfbf30e9 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -687,6 +687,7 @@ DEF_GCC_BUILTIN (BUILT_IN_POPCOUNTIMAX, "popcountimax", BT_FN_INT_UINTMAX
DEF_GCC_BUILTIN (BUILT_IN_POPCOUNTL, "popcountl", BT_FN_INT_ULONG, ATTR_CONST_NOTHROW_LIST)
DEF_GCC_BUILTIN (BUILT_IN_POPCOUNTLL, "popcountll", BT_FN_INT_ULONGLONG, ATTR_CONST_NOTHROW_LIST)
DEF_GCC_BUILTIN (BUILT_IN_PREFETCH, "prefetch", BT_FN_VOID_CONST_PTR_VAR, ATTR_NOVOPS_LIST)
+DEF_LIB_BUILTIN (BUILT_IN_REALLOC, "realloc", BT_FN_PTR_PTR_SIZE, ATTR_NOTHROW_LIST)
DEF_GCC_BUILTIN (BUILT_IN_RETURN, "return", BT_FN_VOID_PTR, ATTR_NORETURN_NOTHROW_LIST)
DEF_GCC_BUILTIN (BUILT_IN_RETURN_ADDRESS, "return_address", BT_FN_PTR_UINT, ATTR_NULL)
DEF_GCC_BUILTIN (BUILT_IN_SAVEREGS, "saveregs", BT_FN_PTR_VAR, ATTR_NULL)
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 6c088302e46..8e4ae22271b 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -1172,7 +1172,7 @@ check_main_parameter_types (tree decl)
in effect, emit a note telling the user about that option if such
a note has not previously been emitted. */
bool
-vector_types_convertible_p (tree t1, tree t2, bool emit_lax_note)
+vector_types_convertible_p (const_tree t1, const_tree t2, bool emit_lax_note)
{
static bool emitted_lax_note = false;
bool convertible_lax;
@@ -2896,7 +2896,7 @@ pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
NULL. */
bool
-decl_with_nonnull_addr_p (tree expr)
+decl_with_nonnull_addr_p (const_tree expr)
{
return (DECL_P (expr)
&& (TREE_CODE (expr) == PARM_DECL
@@ -4097,7 +4097,7 @@ def_builtin_1 (enum built_in_function fncode,
integral promotions defined in ISO C99 6.3.1.1/2. */
bool
-c_promoting_integer_type_p (tree t)
+c_promoting_integer_type_p (const_tree t)
{
switch (TREE_CODE (t))
{
@@ -4127,9 +4127,9 @@ c_promoting_integer_type_p (tree t)
and none of their types is affected by default promotions. */
int
-self_promoting_args_p (tree parms)
+self_promoting_args_p (const_tree parms)
{
- tree t;
+ const_tree t;
for (t = parms; t; t = TREE_CHAIN (t))
{
tree type = TREE_VALUE (t);
@@ -4864,8 +4864,9 @@ handle_always_inline_attribute (tree *node, tree name,
{
if (TREE_CODE (*node) == FUNCTION_DECL)
{
- /* Do nothing else, just set the attribute. We'll get at
- it later with lookup_attribute. */
+ /* Set the attribute and mark it for disregarding inline
+ limits. */
+ DECL_DISREGARD_INLINE_LIMITS (*node) = 1;
}
else
{
diff --git a/gcc/c-common.h b/gcc/c-common.h
index a41cf6f245f..5a27eec5e6f 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -319,7 +319,7 @@ extern int c_expand_decl (tree);
extern int field_decl_cmp (const void *, const void *);
extern void resort_sorted_fields (void *, void *, gt_pointer_operator,
void *);
-extern bool has_c_linkage (tree decl);
+extern bool has_c_linkage (const_tree decl);
/* Switches common to the C front ends. */
@@ -677,7 +677,7 @@ extern tree c_common_unsigned_type (tree);
extern tree c_common_signed_type (tree);
extern tree c_common_signed_or_unsigned_type (int, tree);
extern tree c_build_bitfield_integer_type (unsigned HOST_WIDE_INT, int);
-extern bool decl_with_nonnull_addr_p (tree);
+extern bool decl_with_nonnull_addr_p (const_tree);
extern tree c_common_truthvalue_conversion (tree);
extern void c_apply_type_quals_to_decl (int, tree);
extern tree c_sizeof_or_alignof_type (tree, bool, int);
@@ -731,8 +731,8 @@ extern void c_common_finish (void);
extern void c_common_parse_file (int);
extern alias_set_type c_common_get_alias_set (tree);
extern void c_register_builtin_type (tree, const char*);
-extern bool c_promoting_integer_type_p (tree);
-extern int self_promoting_args_p (tree);
+extern bool c_promoting_integer_type_p (const_tree);
+extern int self_promoting_args_p (const_tree);
extern tree strip_array_types (tree);
extern const_tree const_strip_array_types (const_tree);
extern tree strip_pointer_operator (tree);
@@ -772,7 +772,7 @@ enum c_tree_code {
#undef DEFTREECODE
-extern int anon_aggr_type_p (tree);
+extern int anon_aggr_type_p (const_tree);
/* For a VAR_DECL that is an anonymous union, these are the various
sub-variables that make up the anonymous union. */
@@ -830,7 +830,7 @@ extern tree finish_label_address_expr (tree);
extern tree lookup_label (tree);
extern tree lookup_name (tree);
-extern bool vector_types_convertible_p (tree t1, tree t2, bool emit_lax_note);
+extern bool vector_types_convertible_p (const_tree t1, const_tree t2, bool emit_lax_note);
extern rtx c_expand_expr (tree, rtx, enum machine_mode, int, rtx *);
extern void c_expand_body (tree);
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index d6eb39aa45c..714cf62ba03 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -1819,6 +1819,11 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
DECL_UNINLINABLE (newdecl) = DECL_UNINLINABLE (olddecl)
= (DECL_UNINLINABLE (newdecl) || DECL_UNINLINABLE (olddecl));
+
+ DECL_DISREGARD_INLINE_LIMITS (newdecl)
+ = DECL_DISREGARD_INLINE_LIMITS (olddecl)
+ = (DECL_DISREGARD_INLINE_LIMITS (newdecl)
+ || DECL_DISREGARD_INLINE_LIMITS (olddecl));
}
if (DECL_BUILT_IN (olddecl))
@@ -1930,7 +1935,7 @@ duplicate_decls (tree newdecl, tree olddecl)
if (!diagnose_mismatched_decls (newdecl, olddecl, &newtype, &oldtype))
{
- /* Avoid `unused variable' and other warnings warnings for OLDDECL. */
+ /* Avoid `unused variable' and other warnings for OLDDECL. */
TREE_NO_WARNING (olddecl) = 1;
return false;
}
@@ -2028,11 +2033,7 @@ warn_if_shadowing (tree new_decl)
Obviously, we don't want to generate a duplicate ..._TYPE node if
the TYPE_DECL node that we are now processing really represents a
- standard built-in type.
-
- Since all standard types are effectively declared at line zero
- in the source file, we can easily check to see if we are working
- on a standard type by checking the current value of lineno. */
+ standard built-in type. */
static void
clone_underlying_type (tree x)
@@ -6775,6 +6776,11 @@ finish_function (void)
/* Finalize the ELF visibility for the function. */
c_determine_visibility (fndecl);
+ /* For GNU C extern inline functions disregard inline limits. */
+ if (DECL_EXTERNAL (fndecl)
+ && DECL_DECLARED_INLINE_P (fndecl))
+ DECL_DISREGARD_INLINE_LIMITS (fndecl) = 1;
+
/* Genericize before inlining. Delay genericizing nested functions
until their parent function is genericized. Since finalizing
requires GENERIC, delay that as well. */
@@ -6977,7 +6983,7 @@ current_stmt_tree (void)
C. */
int
-anon_aggr_type_p (tree ARG_UNUSED (node))
+anon_aggr_type_p (const_tree ARG_UNUSED (node))
{
return 0;
}
diff --git a/gcc/c-dump.c b/gcc/c-dump.c
index 42f5486163b..f970b39f9f8 100644
--- a/gcc/c-dump.c
+++ b/gcc/c-dump.c
@@ -29,7 +29,7 @@ along with GCC; see the file COPYING3. If not see
/* Dump information common to statements from STMT. */
void
-dump_stmt (dump_info_p di, tree t)
+dump_stmt (dump_info_p di, const_tree t)
{
if (EXPR_HAS_LOCATION (t))
dump_int (di, "line", EXPR_LINENO (t));
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index a4e3b0c8094..17cb9ed5e22 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -61,6 +61,7 @@ bool c_lex_return_raw_strings = false;
static tree interpret_integer (const cpp_token *, unsigned int);
static tree interpret_float (const cpp_token *, unsigned int);
+static tree interpret_fixed (const cpp_token *, unsigned int);
static enum integer_type_kind narrowest_unsigned_type
(unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT, unsigned int);
static enum integer_type_kind narrowest_signed_type
@@ -640,6 +641,10 @@ interpret_float (const cpp_token *token, unsigned int flags)
char *copy;
size_t copylen;
+ /* Decode _Fract and _Accum. */
+ if (flags & CPP_N_FRACT || flags & CPP_N_ACCUM)
+ return interpret_fixed (token, flags);
+
/* Decode type based on width and properties. */
if (flags & CPP_N_DFLOAT)
if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
@@ -731,6 +736,131 @@ interpret_float (const cpp_token *token, unsigned int flags)
return value;
}
+/* Interpret TOKEN, a fixed-point number with FLAGS as classified
+ by cpplib. */
+
+static tree
+interpret_fixed (const cpp_token *token, unsigned int flags)
+{
+ tree type;
+ tree value;
+ FIXED_VALUE_TYPE fixed;
+ char *copy;
+ size_t copylen;
+
+ copylen = token->val.str.len;
+
+ if (flags & CPP_N_FRACT) /* _Fract. */
+ {
+ if (flags & CPP_N_UNSIGNED) /* Unsigned _Fract. */
+ {
+ if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
+ {
+ type = unsigned_long_long_fract_type_node;
+ copylen -= 4;
+ }
+ else if ((flags & CPP_N_WIDTH) == CPP_N_MEDIUM)
+ {
+ type = unsigned_long_fract_type_node;
+ copylen -= 3;
+ }
+ else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL)
+ {
+ type = unsigned_short_fract_type_node;
+ copylen -= 3;
+ }
+ else
+ {
+ type = unsigned_fract_type_node;
+ copylen -= 2;
+ }
+ }
+ else /* Signed _Fract. */
+ {
+ if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
+ {
+ type = long_long_fract_type_node;
+ copylen -= 3;
+ }
+ else if ((flags & CPP_N_WIDTH) == CPP_N_MEDIUM)
+ {
+ type = long_fract_type_node;
+ copylen -= 2;
+ }
+ else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL)
+ {
+ type = short_fract_type_node;
+ copylen -= 2;
+ }
+ else
+ {
+ type = fract_type_node;
+ copylen --;
+ }
+ }
+ }
+ else /* _Accum. */
+ {
+ if (flags & CPP_N_UNSIGNED) /* Unsigned _Accum. */
+ {
+ if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
+ {
+ type = unsigned_long_long_accum_type_node;
+ copylen -= 4;
+ }
+ else if ((flags & CPP_N_WIDTH) == CPP_N_MEDIUM)
+ {
+ type = unsigned_long_accum_type_node;
+ copylen -= 3;
+ }
+ else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL)
+ {
+ type = unsigned_short_accum_type_node;
+ copylen -= 3;
+ }
+ else
+ {
+ type = unsigned_accum_type_node;
+ copylen -= 2;
+ }
+ }
+ else /* Signed _Accum. */
+ {
+ if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
+ {
+ type = long_long_accum_type_node;
+ copylen -= 3;
+ }
+ else if ((flags & CPP_N_WIDTH) == CPP_N_MEDIUM)
+ {
+ type = long_accum_type_node;
+ copylen -= 2;
+ }
+ else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL)
+ {
+ type = short_accum_type_node;
+ copylen -= 2;
+ }
+ else
+ {
+ type = accum_type_node;
+ copylen --;
+ }
+ }
+ }
+
+ copy = (char *) alloca (copylen + 1);
+ memcpy (copy, token->val.str.text, copylen);
+ copy[copylen] = '\0';
+
+ fixed_from_string (&fixed, copy, TYPE_MODE (type));
+
+ /* Create a node with determined type and value. */
+ value = build_fixed (type, fixed);
+
+ return value;
+}
+
/* Convert a series of STRING and/or WSTRING tokens into a tree,
performing string constant concatenation. TOK is the first of
these. VALP is the location to write the string into. OBJC_STRING
diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c
index efd576fd5be..274f2701c96 100644
--- a/gcc/c-objc-common.c
+++ b/gcc/c-objc-common.c
@@ -50,51 +50,6 @@ c_missing_noreturn_ok_p (tree decl)
return flag_hosted && MAIN_NAME_P (DECL_ASSEMBLER_NAME (decl));
}
-int
-c_cannot_inline_tree_fn (tree *fnp)
-{
- tree fn = *fnp;
- bool do_warning = (warn_inline
- && DECL_INLINE (fn)
- && DECL_DECLARED_INLINE_P (fn)
- && !DECL_IN_SYSTEM_HEADER (fn));
- tree always_inline = lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn));
-
- if (flag_really_no_inline && always_inline == NULL)
- {
- if (do_warning)
- warning (OPT_Winline, "function %q+F can never be inlined because it "
- "is suppressed using -fno-inline", fn);
- goto cannot_inline;
- }
-
- /* Don't auto-inline anything that might not be bound within
- this unit of translation. */
- if (always_inline == NULL
- && !DECL_DECLARED_INLINE_P (fn)
- && !targetm.binds_local_p (fn))
- {
- if (do_warning)
- warning (OPT_Winline, "function %q+F can never be inlined because it "
- "might not be bound within this unit of translation", fn);
- goto cannot_inline;
- }
-
- if (!function_attribute_inlinable_p (fn))
- {
- if (do_warning)
- warning (OPT_Winline, "function %q+F can never be inlined because it "
- "uses attributes conflicting with inlining", fn);
- goto cannot_inline;
- }
-
- return 0;
-
- cannot_inline:
- DECL_UNINLINABLE (fn) = 1;
- return 1;
-}
-
/* Called from check_global_declarations. */
bool
@@ -211,7 +166,7 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
/* In C and ObjC, all decls have "C" linkage. */
bool
-has_c_linkage (tree decl ATTRIBUTE_UNUSED)
+has_c_linkage (const_tree decl ATTRIBUTE_UNUSED)
{
return true;
}
diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c
index a5dd82fb0b5..5fdaf2f5e12 100644
--- a/gcc/c-pretty-print.c
+++ b/gcc/c-pretty-print.c
@@ -1012,6 +1012,13 @@ pp_c_constant (c_pretty_printer *pp, tree e)
pp_c_string_literal (pp, e);
break;
+ case COMPLEX_CST:
+ /* Sometimes, we are confused and we think a complex literal
+ is a constant. Such thing is a compound literal which
+ grammatically belongs to postifx-expr production. */
+ pp_c_compound_literal (pp, e);
+ break;
+
default:
pp_unsupported_tree (pp, e);
break;
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
index f2727f82c37..57b19f69857 100644
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -543,7 +543,7 @@ extern struct c_label_context_se *label_context_stack_se;
extern struct c_label_context_vm *label_context_stack_vm;
extern tree require_complete_type (tree);
-extern int same_translation_unit_p (tree, tree);
+extern int same_translation_unit_p (const_tree, const_tree);
extern int comptypes (tree, tree);
extern bool c_vla_type_p (const_tree);
extern bool c_mark_addressable (tree);
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 61b0e2ee9ff..4d4c4d1f4e5 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -74,12 +74,12 @@ static int missing_braces_mentioned;
static int require_constant_value;
static int require_constant_elements;
-static bool null_pointer_constant_p (tree);
+static bool null_pointer_constant_p (const_tree);
static tree qualify_type (tree, tree);
-static int tagged_types_tu_compatible_p (tree, tree);
+static int tagged_types_tu_compatible_p (const_tree, const_tree);
static int comp_target_types (tree, tree);
-static int function_types_compatible_p (tree, tree);
-static int type_lists_compatible_p (tree, tree);
+static int function_types_compatible_p (const_tree, const_tree);
+static int type_lists_compatible_p (const_tree, const_tree);
static tree decl_constant_value_for_broken_optimization (tree);
static tree lookup_field (tree, tree);
static int convert_arguments (int, tree *, tree, tree, tree, tree);
@@ -102,15 +102,15 @@ static void set_nonincremental_init (void);
static void set_nonincremental_init_from_string (tree);
static tree find_init_member (tree);
static void readonly_error (tree, enum lvalue_use);
-static int lvalue_or_else (tree, enum lvalue_use);
-static int lvalue_p (tree);
+static int lvalue_or_else (const_tree, enum lvalue_use);
+static int lvalue_p (const_tree);
static void record_maybe_used_decl (tree);
-static int comptypes_internal (tree, tree);
+static int comptypes_internal (const_tree, const_tree);
/* Return true if EXP is a null pointer constant, false otherwise. */
static bool
-null_pointer_constant_p (tree expr)
+null_pointer_constant_p (const_tree expr)
{
/* This should really operate on c_expr structures, but they aren't
yet available everywhere required. */
@@ -127,8 +127,8 @@ null_pointer_constant_p (tree expr)
struct tagged_tu_seen_cache {
const struct tagged_tu_seen_cache * next;
- tree t1;
- tree t2;
+ const_tree t1;
+ const_tree t2;
/* The return value of tagged_types_tu_compatible_p if we had seen
these two types already. */
int val;
@@ -869,10 +869,10 @@ comptypes (tree type1, tree type2)
differs from comptypes, in that we don't free the seen types. */
static int
-comptypes_internal (tree type1, tree type2)
+comptypes_internal (const_tree type1, const_tree type2)
{
- tree t1 = type1;
- tree t2 = type2;
+ const_tree t1 = type1;
+ const_tree t2 = type2;
int attrval, val;
/* Suppress errors caused by previously reported errors. */
@@ -1045,7 +1045,7 @@ comp_target_types (tree ttl, tree ttr)
being parsed, so if two trees have context chains ending in null,
they're in the same translation unit. */
int
-same_translation_unit_p (tree t1, tree t2)
+same_translation_unit_p (const_tree t1, const_tree t2)
{
while (t1 && TREE_CODE (t1) != TRANSLATION_UNIT_DECL)
switch (TREE_CODE_CLASS (TREE_CODE (t1)))
@@ -1077,7 +1077,7 @@ same_translation_unit_p (tree t1, tree t2)
/* Allocate the seen two types, assuming that they are compatible. */
static struct tagged_tu_seen_cache *
-alloc_tagged_tu_seen_cache (tree t1, tree t2)
+alloc_tagged_tu_seen_cache (const_tree t1, const_tree t2)
{
struct tagged_tu_seen_cache *tu = XNEW (struct tagged_tu_seen_cache);
tu->next = tagged_tu_seen_base;
@@ -1125,7 +1125,7 @@ free_all_tagged_tu_seen_up_to (const struct tagged_tu_seen_cache *tu_til)
rules. */
static int
-tagged_types_tu_compatible_p (tree t1, tree t2)
+tagged_types_tu_compatible_p (const_tree t1, const_tree t2)
{
tree s1, s2;
bool needs_warning = false;
@@ -1339,7 +1339,7 @@ tagged_types_tu_compatible_p (tree t1, tree t2)
Otherwise, the argument types must match. */
static int
-function_types_compatible_p (tree f1, tree f2)
+function_types_compatible_p (const_tree f1, const_tree f2)
{
tree args1, args2;
/* 1 if no need for warning yet, 2 if warning cause has been seen. */
@@ -1402,7 +1402,7 @@ function_types_compatible_p (tree f1, tree f2)
or 2 for compatible with warning. */
static int
-type_lists_compatible_p (tree args1, tree args2)
+type_lists_compatible_p (const_tree args1, const_tree args2)
{
/* 1 if no need for warning yet, 2 if warning cause has been seen. */
int val = 1;
@@ -1503,7 +1503,7 @@ type_lists_compatible_p (tree args1, tree args2)
/* Compute the size to increment a pointer by. */
static tree
-c_size_in_bytes (tree type)
+c_size_in_bytes (const_tree type)
{
enum tree_code code = TREE_CODE (type);
@@ -3198,9 +3198,9 @@ build_unary_op (enum tree_code code, tree xarg, int flag)
Lvalues can have their address taken, unless they have C_DECL_REGISTER. */
static int
-lvalue_p (tree ref)
+lvalue_p (const_tree ref)
{
- enum tree_code code = TREE_CODE (ref);
+ const enum tree_code code = TREE_CODE (ref);
switch (code)
{
@@ -3274,7 +3274,7 @@ readonly_error (tree arg, enum lvalue_use use)
how the lvalue is being used and so selects the error message. */
static int
-lvalue_or_else (tree ref, enum lvalue_use use)
+lvalue_or_else (const_tree ref, enum lvalue_use use)
{
int win = lvalue_p (ref);
diff --git a/gcc/calls.c b/gcc/calls.c
index df9ef39263b..657439a60eb 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -4426,7 +4426,7 @@ store_one_arg (struct arg_data *arg, rtx argblock, int flags,
bool
must_pass_in_stack_var_size (enum machine_mode mode ATTRIBUTE_UNUSED,
- tree type)
+ const_tree type)
{
if (!type)
return false;
@@ -4448,7 +4448,7 @@ must_pass_in_stack_var_size (enum machine_mode mode ATTRIBUTE_UNUSED,
/* ??? Should be able to merge these two by examining BLOCK_REG_PADDING. */
bool
-must_pass_in_stack_var_size_or_pad (enum machine_mode mode, tree type)
+must_pass_in_stack_var_size_or_pad (enum machine_mode mode, const_tree type)
{
if (!type)
return false;
diff --git a/gcc/cfg.c b/gcc/cfg.c
index c62033c8201..e397bf50b36 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -646,7 +646,7 @@ dump_flow_info (FILE *file, int flags)
dump_reg_info (file);
fprintf (file, "\n%d basic blocks, %d edges.\n", n_basic_blocks, n_edges);
- FOR_EACH_BB (bb)
+ FOR_ALL_BB (bb)
{
dump_bb_info (bb, true, true, flags, "", file);
check_bb_profile (bb, file);
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index e224ad81ca2..921bf6fe291 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -321,7 +321,7 @@ redirect_edge_and_branch (edge e, basic_block dest)
to the destination of the other edge going from its source. */
bool
-can_remove_branch_p (edge e)
+can_remove_branch_p (const_edge e)
{
if (!cfg_hooks->can_remove_branch_p)
internal_error ("%s does not support can_remove_branch_p",
@@ -616,7 +616,7 @@ create_empty_bb (basic_block after)
/* Checks whether we may merge blocks BB1 and BB2. */
bool
-can_merge_blocks_p (basic_block bb1, basic_block bb2)
+can_merge_blocks_p (const_basic_block bb1, const_basic_block bb2)
{
bool ret;
@@ -638,7 +638,7 @@ predict_edge (edge e, enum br_predictor predictor, int probability)
}
bool
-predicted_by_p (basic_block bb, enum br_predictor predictor)
+predicted_by_p (const_basic_block bb, enum br_predictor predictor)
{
if (!cfg_hooks->predict_edge)
internal_error ("%s does not support predicted_by_p", cfg_hooks->name);
@@ -839,7 +839,7 @@ tidy_fallthru_edges (void)
/* Returns true if we can duplicate basic block BB. */
bool
-can_duplicate_block_p (basic_block bb)
+can_duplicate_block_p (const_basic_block bb)
{
if (!cfg_hooks->can_duplicate_block_p)
internal_error ("%s does not support can_duplicate_block_p",
@@ -938,7 +938,7 @@ duplicate_block (basic_block bb, edge e, basic_block after)
instructions that must stay with the call, 0 otherwise. */
bool
-block_ends_with_call_p (basic_block bb)
+block_ends_with_call_p (const_basic_block bb)
{
if (!cfg_hooks->block_ends_with_call_p)
internal_error ("%s does not support block_ends_with_call_p", cfg_hooks->name);
@@ -949,7 +949,7 @@ block_ends_with_call_p (basic_block bb)
/* Return 1 if BB ends with a conditional branch, 0 otherwise. */
bool
-block_ends_with_condjump_p (basic_block bb)
+block_ends_with_condjump_p (const_basic_block bb)
{
if (!cfg_hooks->block_ends_with_condjump_p)
internal_error ("%s does not support block_ends_with_condjump_p",
diff --git a/gcc/cfghooks.h b/gcc/cfghooks.h
index 306cfe46081..e305fd230ee 100644
--- a/gcc/cfghooks.h
+++ b/gcc/cfghooks.h
@@ -48,7 +48,7 @@ struct cfg_hooks
/* Returns true if it is possible to remove the edge by redirecting it
to the destination of the other edge going from its source. */
- bool (*can_remove_branch_p) (edge);
+ bool (*can_remove_branch_p) (const_edge);
/* Remove statements corresponding to a given basic block. */
void (*delete_basic_block) (basic_block);
@@ -61,7 +61,7 @@ struct cfg_hooks
bool (*move_block_after) (basic_block b, basic_block a);
/* Return true when blocks A and B can be merged into single basic block. */
- bool (*can_merge_blocks_p) (basic_block a, basic_block b);
+ bool (*can_merge_blocks_p) (const_basic_block a, const_basic_block b);
/* Merge blocks A and B. */
void (*merge_blocks) (basic_block a, basic_block b);
@@ -71,10 +71,10 @@ struct cfg_hooks
/* Return true if the one of outgoing edges is already predicted by
PREDICTOR. */
- bool (*predicted_by_p) (basic_block bb, enum br_predictor predictor);
+ bool (*predicted_by_p) (const_basic_block bb, enum br_predictor predictor);
/* Return true when block A can be duplicated. */
- bool (*can_duplicate_block_p) (basic_block a);
+ bool (*can_duplicate_block_p) (const_basic_block a);
/* Duplicate block A. */
basic_block (*duplicate_block) (basic_block a);
@@ -89,11 +89,11 @@ struct cfg_hooks
/* Say whether a block ends with a call, possibly followed by some
other code that must stay with the call. */
- bool (*block_ends_with_call_p) (basic_block);
+ bool (*block_ends_with_call_p) (const_basic_block);
/* Say whether a block ends with a conditional branch. Switches
and unconditional branches do not qualify. */
- bool (*block_ends_with_condjump_p) (basic_block);
+ bool (*block_ends_with_condjump_p) (const_basic_block);
/* Add fake edges to the function exit for any non constant and non noreturn
calls, volatile inline assembly in the bitmap of blocks specified by
@@ -141,7 +141,7 @@ extern void verify_flow_info (void);
extern void dump_bb (basic_block, FILE *, int);
extern edge redirect_edge_and_branch (edge, basic_block);
extern basic_block redirect_edge_and_branch_force (edge, basic_block);
-extern bool can_remove_branch_p (edge);
+extern bool can_remove_branch_p (const_edge);
extern void remove_branch (edge);
extern void remove_edge (edge);
extern edge split_block (basic_block, void *);
@@ -151,18 +151,18 @@ extern void delete_basic_block (basic_block);
extern basic_block split_edge (edge);
extern basic_block create_basic_block (void *, void *, basic_block);
extern basic_block create_empty_bb (basic_block);
-extern bool can_merge_blocks_p (basic_block, basic_block);
+extern bool can_merge_blocks_p (const_basic_block, const_basic_block);
extern void merge_blocks (basic_block, basic_block);
extern edge make_forwarder_block (basic_block, bool (*)(edge),
void (*) (basic_block));
extern void tidy_fallthru_edge (edge);
extern void tidy_fallthru_edges (void);
extern void predict_edge (edge e, enum br_predictor predictor, int probability);
-extern bool predicted_by_p (basic_block bb, enum br_predictor predictor);
-extern bool can_duplicate_block_p (basic_block);
+extern bool predicted_by_p (const_basic_block bb, enum br_predictor predictor);
+extern bool can_duplicate_block_p (const_basic_block);
extern basic_block duplicate_block (basic_block, edge, basic_block);
-extern bool block_ends_with_call_p (basic_block bb);
-extern bool block_ends_with_condjump_p (basic_block bb);
+extern bool block_ends_with_call_p (const_basic_block bb);
+extern bool block_ends_with_condjump_p (const_basic_block bb);
extern int flow_call_edges_add (sbitmap);
extern void execute_on_growing_pred (edge);
extern void execute_on_shrinking_pred (edge);
diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c
index 7782096800e..c70348c9a4d 100644
--- a/gcc/cfglayout.c
+++ b/gcc/cfglayout.c
@@ -1019,10 +1019,10 @@ force_one_exit_fallthru (void)
only be used through the cfghooks interface, and we do not want to move
it to cfgrtl.c since it would require also moving quite a lot of related
code. */
-extern bool cfg_layout_can_duplicate_bb_p (basic_block);
+extern bool cfg_layout_can_duplicate_bb_p (const_basic_block);
bool
-cfg_layout_can_duplicate_bb_p (basic_block bb)
+cfg_layout_can_duplicate_bb_p (const_basic_block bb)
{
/* Do not attempt to duplicate tablejumps, as we need to unshare
the dispatch table. This is difficult to do, as the instructions
diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c
index d6a74bfe519..c00d1c501be 100644
--- a/gcc/cfgloopanal.c
+++ b/gcc/cfgloopanal.c
@@ -334,6 +334,7 @@ init_set_costs (void)
rtx mem = validize_mem (gen_rtx_MEM (SImode, addr));
unsigned i;
+ target_avail_regs = 0;
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (TEST_HARD_REG_BIT (reg_class_contents[GENERAL_REGS], i)
&& !fixed_regs[i])
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 5d736a5990b..74267383dce 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -62,8 +62,8 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h"
#include "df.h"
-static int can_delete_note_p (rtx);
-static int can_delete_label_p (rtx);
+static int can_delete_note_p (const_rtx);
+static int can_delete_label_p (const_rtx);
static void commit_one_edge_insertion (edge);
static basic_block rtl_split_edge (edge);
static bool rtl_move_block_after (basic_block, basic_block);
@@ -84,7 +84,7 @@ static void rtl_make_forwarder_block (edge);
so that we may simply delete it. */
static int
-can_delete_note_p (rtx note)
+can_delete_note_p (const_rtx note)
{
return (NOTE_KIND (note) == NOTE_INSN_DELETED
|| NOTE_KIND (note) == NOTE_INSN_BASIC_BLOCK);
@@ -93,7 +93,7 @@ can_delete_note_p (rtx note)
/* True if a given label can be deleted. */
static int
-can_delete_label_p (rtx label)
+can_delete_label_p (const_rtx label)
{
return (!LABEL_PRESERVE_P (label)
/* User declared labels must be preserved. */
@@ -625,7 +625,8 @@ rtl_merge_blocks (basic_block a, basic_block b)
/* Return true when block A and B can be merged. */
static bool
-rtl_can_merge_blocks (basic_block a,basic_block b)
+
+rtl_can_merge_blocks (const_basic_block a, const_basic_block b)
{
/* If we are partitioning hot/cold basic blocks, we don't want to
mess up unconditional or indirect jumps that cross between hot
@@ -2530,7 +2531,7 @@ cfg_layout_delete_block (basic_block bb)
/* Return true when blocks A and B can be safely merged. */
static bool
-cfg_layout_can_merge_blocks_p (basic_block a, basic_block b)
+cfg_layout_can_merge_blocks_p (const_basic_block a, const_basic_block b)
{
/* If we are partitioning hot/cold basic blocks, we don't want to
mess up unconditional or indirect jumps that cross between hot
@@ -2686,7 +2687,7 @@ rtl_make_forwarder_block (edge fallthru ATTRIBUTE_UNUSED)
instructions that must stay with the call, 0 otherwise. */
static bool
-rtl_block_ends_with_call_p (basic_block bb)
+rtl_block_ends_with_call_p (const_basic_block bb)
{
rtx insn = BB_END (bb);
@@ -2700,7 +2701,7 @@ rtl_block_ends_with_call_p (basic_block bb)
/* Return 1 if BB ends with a conditional branch, 0 otherwise. */
static bool
-rtl_block_ends_with_condjump_p (basic_block bb)
+rtl_block_ends_with_condjump_p (const_basic_block bb)
{
return any_condjump_p (BB_END (bb));
}
@@ -2709,7 +2710,7 @@ rtl_block_ends_with_condjump_p (basic_block bb)
Helper function for rtl_flow_call_edges_add. */
static bool
-need_fake_edge_p (rtx insn)
+need_fake_edge_p (const_rtx insn)
{
if (!INSN_P (insn))
return false;
@@ -3012,11 +3013,11 @@ insert_insn_end_bb_new (rtx pat, basic_block bb)
it to the destination of the other edge from E->src. */
static bool
-rtl_can_remove_branch_p (edge e)
+rtl_can_remove_branch_p (const_edge e)
{
- basic_block src = e->src;
- basic_block target = EDGE_SUCC (src, EDGE_SUCC (src, 0) == e)->dest;
- rtx insn = BB_END (src), set;
+ const_basic_block src = e->src;
+ const_basic_block target = EDGE_SUCC (src, EDGE_SUCC (src, 0) == e)->dest;
+ const_rtx insn = BB_END (src), set;
/* The conditions are taken from try_redirect_by_replacing_jump. */
if (target == EXIT_BLOCK_PTR)
@@ -3082,7 +3083,7 @@ struct cfg_hooks rtl_cfg_hooks = {
should only be used through the cfghooks interface, and we do not want to
move them here since it would require also moving quite a lot of related
code. They are in cfglayout.c. */
-extern bool cfg_layout_can_duplicate_bb_p (basic_block);
+extern bool cfg_layout_can_duplicate_bb_p (const_basic_block);
extern basic_block cfg_layout_duplicate_bb (basic_block);
struct cfg_hooks cfg_layout_rtl_cfg_hooks = {
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index dddc093b5b3..accb6477d68 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -381,7 +381,7 @@ cgraph_process_new_functions (void)
node->local.self_insns = estimate_num_insns (fndecl,
&eni_inlining_weights);
node->local.disregard_inline_limits
- |= disregard_inline_limits_p (fndecl);
+ |= DECL_DISREGARD_INLINE_LIMITS (fndecl);
/* Inlining characteristics are maintained by the
cgraph_mark_inline. */
node->global.insns = node->local.self_insns;
@@ -1252,7 +1252,7 @@ cgraph_preserve_function_body_p (tree decl)
struct cgraph_node *node;
if (!cgraph_global_info_ready)
return (flag_really_no_inline
- ? disregard_inline_limits_p (decl)
+ ? DECL_DISREGARD_INLINE_LIMITS (decl)
: DECL_INLINE (decl));
/* Look if there is any clone around. */
for (node = cgraph_node (decl); node; node = node->next_clone)
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 503a60bf633..6665eb70370 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -312,7 +312,7 @@ mips*-*-*)
;;
powerpc*-*-*)
cpu_type=rs6000
- extra_headers="ppc-asm.h altivec.h spe.h"
+ extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h"
need_64bit_hwint=yes
case x$with_cpu in
xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[3456]|xpower6x|xrs64a)
@@ -1071,6 +1071,11 @@ i[34567]86-*-elf*)
tmake_file="i386/t-i386elf t-svr4"
use_fixproto=yes
;;
+x86_64-*-elf*)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h i386/x86-64.h"
+ tmake_file="i386/t-i386elf t-svr4"
+ use_fixproto=yes
+ ;;
i[34567]86-sequent-ptx4* | i[34567]86-sequent-sysv4*)
if test x$gas = xyes
then
diff --git a/gcc/config/alpha/alpha-protos.h b/gcc/config/alpha/alpha-protos.h
index 20f1d152390..df2ae6814d2 100644
--- a/gcc/config/alpha/alpha-protos.h
+++ b/gcc/config/alpha/alpha-protos.h
@@ -78,7 +78,7 @@ extern void alpha_initialize_trampoline (rtx, rtx, rtx, int, int, int);
extern void alpha_va_start (tree, rtx);
extern rtx alpha_va_arg (tree, tree);
extern rtx function_arg (CUMULATIVE_ARGS, enum machine_mode, tree, int);
-extern rtx function_value (tree, tree, enum machine_mode);
+extern rtx function_value (const_tree, const_tree, enum machine_mode);
extern void alpha_start_function (FILE *, const char *, tree);
extern void alpha_end_function (FILE *, const char *, tree);
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index de58de2bec9..48696b5ddbd 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -240,7 +240,7 @@ alpha_handle_option (size_t code, const char *arg, int value)
/* Implement TARGET_MANGLE_TYPE. */
static const char *
-alpha_mangle_type (tree type)
+alpha_mangle_type (const_tree type)
{
if (TYPE_MAIN_VARIANT (type) == long_double_type_node
&& TARGET_LONG_DOUBLE_128)
@@ -717,7 +717,7 @@ tls_symbolic_operand_type (rtx symbol)
function in the current unit of translation. */
static bool
-decl_has_samegp (tree decl)
+decl_has_samegp (const_tree decl)
{
/* Functions that are not local can be overridden, and thus may
not share the same gp. */
@@ -740,7 +740,7 @@ decl_has_samegp (tree decl)
/* Return true if EXP should be placed in the small data section. */
static bool
-alpha_in_small_data_p (tree exp)
+alpha_in_small_data_p (const_tree exp)
{
/* We want to merge strings, so we never consider them small data. */
if (TREE_CODE (exp) == STRING_CST)
@@ -5646,7 +5646,7 @@ alpha_arg_partial_bytes (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
/* Return true if TYPE must be returned in memory, instead of in registers. */
static bool
-alpha_return_in_memory (tree type, tree fndecl ATTRIBUTE_UNUSED)
+alpha_return_in_memory (const_tree type, const_tree fndecl ATTRIBUTE_UNUSED)
{
enum machine_mode mode = VOIDmode;
int size;
@@ -5696,7 +5696,7 @@ alpha_return_in_memory (tree type, tree fndecl ATTRIBUTE_UNUSED)
static bool
alpha_pass_by_reference (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
enum machine_mode mode,
- tree type ATTRIBUTE_UNUSED,
+ const_tree type ATTRIBUTE_UNUSED,
bool named ATTRIBUTE_UNUSED)
{
return mode == TFmode || mode == TCmode;
@@ -5711,7 +5711,7 @@ alpha_pass_by_reference (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
$f0 for floating-point functions. */
rtx
-function_value (tree valtype, tree func ATTRIBUTE_UNUSED,
+function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED,
enum machine_mode mode)
{
unsigned int regnum, dummy;
@@ -5762,7 +5762,7 @@ function_value (tree valtype, tree func ATTRIBUTE_UNUSED,
should not split these values. */
static bool
-alpha_split_complex_arg (tree type)
+alpha_split_complex_arg (const_tree type)
{
return TYPE_MODE (type) != TCmode;
}
@@ -5864,7 +5864,7 @@ va_list_skip_additions (tree lhs)
current statement. */
static bool
-alpha_stdarg_optimize_hook (struct stdarg_info *si, tree lhs, tree rhs)
+alpha_stdarg_optimize_hook (struct stdarg_info *si, const_tree lhs, const_tree rhs)
{
tree base, offset, arg1, arg2;
int offset_arg = 1;
@@ -9751,7 +9751,7 @@ alpha_use_linkage (rtx linkage ATTRIBUTE_UNUSED,
registers. */
static bool
-unicosmk_must_pass_in_stack (enum machine_mode mode, tree type)
+unicosmk_must_pass_in_stack (enum machine_mode mode, const_tree type)
{
if (type == NULL)
return false;
@@ -10650,7 +10650,7 @@ alpha_init_libfuncs (void)
#undef TARGET_ASM_OUTPUT_MI_THUNK
#define TARGET_ASM_OUTPUT_MI_THUNK alpha_output_mi_thunk_osf
#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
-#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_tree_hwi_hwi_tree_true
+#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_const_tree_hwi_hwi_const_tree_true
#undef TARGET_STDARG_OPTIMIZE_HOOK
#define TARGET_STDARG_OPTIMIZE_HOOK alpha_stdarg_optimize_hook
#endif
@@ -10664,11 +10664,11 @@ alpha_init_libfuncs (void)
#define TARGET_MACHINE_DEPENDENT_REORG alpha_reorg
#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_false
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_false
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY alpha_return_in_memory
#undef TARGET_PASS_BY_REFERENCE
diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md
index c743e7103b5..f381dded9cc 100644
--- a/gcc/config/alpha/alpha.md
+++ b/gcc/config/alpha/alpha.md
@@ -88,12 +88,12 @@
;; On non-BWX targets, CQImode must be handled the similarly to HImode
;; when generating reloads.
-(define_mode_macro RELOAD12 [QI HI CQI])
+(define_mode_iterator RELOAD12 [QI HI CQI])
(define_mode_attr reloadmode [(QI "qi") (HI "hi") (CQI "hi")])
-;; Other mode macros
-(define_mode_macro I12MODE [QI HI])
-(define_mode_macro I48MODE [SI DI])
+;; Other mode iterators
+(define_mode_iterator I12MODE [QI HI])
+(define_mode_iterator I48MODE [SI DI])
(define_mode_attr modesuffix [(SI "l") (DI "q")])
;; Where necessary, the suffixes _le and _be are used to distinguish between
@@ -6253,7 +6253,7 @@
;; Vector operations
-(define_mode_macro VEC [V8QI V4HI V2SI])
+(define_mode_iterator VEC [V8QI V4HI V2SI])
(define_expand "mov<mode>"
[(set (match_operand:VEC 0 "nonimmediate_operand" "")
diff --git a/gcc/config/alpha/sync.md b/gcc/config/alpha/sync.md
index b9ed6a0fc6b..5c0d2840334 100644
--- a/gcc/config/alpha/sync.md
+++ b/gcc/config/alpha/sync.md
@@ -17,7 +17,7 @@
;; along with GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.
-(define_code_macro FETCHOP [plus minus ior xor and])
+(define_code_iterator FETCHOP [plus minus ior xor and])
(define_code_attr fetchop_name
[(plus "add") (minus "sub") (ior "ior") (xor "xor") (and "and")])
(define_code_attr fetchop_pred
diff --git a/gcc/config/arc/arc-protos.h b/gcc/config/arc/arc-protos.h
index b7f4f61610d..9eadf354b21 100644
--- a/gcc/config/arc/arc-protos.h
+++ b/gcc/config/arc/arc-protos.h
@@ -19,10 +19,12 @@ along with GCC; see the file COPYING3. If not see
extern void arc_va_start (tree, rtx);
+#ifdef RTX_CODE
extern enum machine_mode arc_select_cc_mode (enum rtx_code, rtx, rtx);
/* Define the function that build the compare insn for scc and bcc. */
extern struct rtx_def *gen_compare_reg (enum rtx_code, rtx, rtx);
+#endif
/* Declarations for various fns used in the .md file. */
extern const char *output_shift (rtx *);
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 827cc1e6f0b..a1e04af8c8f 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -94,9 +94,9 @@ static void arc_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
static bool arc_rtx_costs (rtx, int, int, int *);
static int arc_address_cost (rtx);
static void arc_external_libcall (rtx);
-static bool arc_return_in_memory (tree, tree);
+static bool arc_return_in_memory (const_tree, const_tree);
static bool arc_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
- tree, bool);
+ const_tree, bool);
/* Initialize the GCC target structure. */
#undef TARGET_ASM_ALIGNED_HI_OP
@@ -128,11 +128,11 @@ static bool arc_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
#define TARGET_ADDRESS_COST arc_address_cost
#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY arc_return_in_memory
@@ -2316,7 +2316,7 @@ arc_external_libcall (rtx fun ATTRIBUTE_UNUSED)
/* Worker function for TARGET_RETURN_IN_MEMORY. */
static bool
-arc_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+arc_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
{
if (AGGREGATE_TYPE_P (type))
return true;
@@ -2332,7 +2332,7 @@ arc_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
static bool
arc_pass_by_reference (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
- enum machine_mode mode, tree type,
+ enum machine_mode mode, const_tree type,
bool named ATTRIBUTE_UNUSED)
{
unsigned HOST_WIDE_INT size;
diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h
index 4e601a9e1f3..fd81903eae1 100644
--- a/gcc/config/arm/arm-protos.h
+++ b/gcc/config/arm/arm-protos.h
@@ -43,7 +43,7 @@ extern void arm_output_fn_unwind (FILE *, bool);
#ifdef TREE_CODE
-extern int arm_return_in_memory (tree);
+extern int arm_return_in_memory (const_tree);
#endif
#ifdef RTX_CODE
extern bool arm_vector_mode_supported_p (enum machine_mode);
@@ -156,10 +156,10 @@ extern bool arm_output_addr_const_extra (FILE *, rtx);
#if defined TREE_CODE
extern rtx arm_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
extern void arm_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree);
-extern bool arm_pad_arg_upward (enum machine_mode, tree);
+extern bool arm_pad_arg_upward (enum machine_mode, const_tree);
extern bool arm_pad_reg_upward (enum machine_mode, tree, int);
extern bool arm_needs_doubleword_align (enum machine_mode, tree);
-extern rtx arm_function_value(tree, tree);
+extern rtx arm_function_value(const_tree, const_tree);
#endif
extern int arm_apply_result_size (void);
@@ -214,6 +214,6 @@ extern void arm_pr_long_calls (struct cpp_reader *);
extern void arm_pr_no_long_calls (struct cpp_reader *);
extern void arm_pr_long_calls_off (struct cpp_reader *);
-extern const char *arm_mangle_type (tree);
+extern const char *arm_mangle_type (const_tree);
#endif /* ! GCC_ARM_PROTOS_H */
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 6ec0f8c648a..fca424aa577 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -116,7 +116,7 @@ static tree arm_handle_notshared_attribute (tree *, tree, tree, int, bool *);
static void arm_output_function_epilogue (FILE *, HOST_WIDE_INT);
static void arm_output_function_prologue (FILE *, HOST_WIDE_INT);
static void thumb1_output_function_prologue (FILE *, HOST_WIDE_INT);
-static int arm_comp_type_attributes (tree, tree);
+static int arm_comp_type_attributes (const_tree, const_tree);
static void arm_set_default_type_attributes (tree);
static int arm_adjust_cost (rtx, rtx, rtx, int);
static int count_insns_for_constant (HOST_WIDE_INT, int);
@@ -169,12 +169,12 @@ static void aof_asm_init_sections (void);
static void arm_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
tree, int *, int);
static bool arm_pass_by_reference (CUMULATIVE_ARGS *,
- enum machine_mode, tree, bool);
-static bool arm_promote_prototypes (tree);
+ enum machine_mode, const_tree, bool);
+static bool arm_promote_prototypes (const_tree);
static bool arm_default_short_enums (void);
static bool arm_align_anon_bitfield (void);
-static bool arm_return_in_msb (tree);
-static bool arm_must_pass_in_stack (enum machine_mode, tree);
+static bool arm_return_in_msb (const_tree);
+static bool arm_must_pass_in_stack (enum machine_mode, const_tree);
#ifdef TARGET_UNWIND_INFO
static void arm_unwind_emit (FILE *, rtx);
static bool arm_output_ttype (rtx);
@@ -299,9 +299,9 @@ static void arm_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
#define TARGET_INIT_LIBFUNCS arm_init_libfuncs
#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
#undef TARGET_PROMOTE_PROTOTYPES
#define TARGET_PROMOTE_PROTOTYPES arm_promote_prototypes
#undef TARGET_PASS_BY_REFERENCE
@@ -2702,7 +2702,7 @@ arm_canonicalize_comparison (enum rtx_code code, enum machine_mode mode,
/* Define how to find the value returned by a function. */
rtx
-arm_function_value(tree type, tree func ATTRIBUTE_UNUSED)
+arm_function_value(const_tree type, const_tree func ATTRIBUTE_UNUSED)
{
enum machine_mode mode;
int unsignedp ATTRIBUTE_UNUSED;
@@ -2755,7 +2755,7 @@ arm_apply_result_size (void)
or in a register (false). This is called by the macro
RETURN_IN_MEMORY. */
int
-arm_return_in_memory (tree type)
+arm_return_in_memory (const_tree type)
{
HOST_WIDE_INT size;
@@ -3010,7 +3010,7 @@ arm_arg_partial_bytes (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
static bool
arm_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED,
- tree type, bool named ATTRIBUTE_UNUSED)
+ const_tree type, bool named ATTRIBUTE_UNUSED)
{
return type && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST;
}
@@ -3185,7 +3185,7 @@ arm_handle_notshared_attribute (tree *node,
are compatible, and 2 if they are nearly compatible (which causes a
warning to be generated). */
static int
-arm_comp_type_attributes (tree type1, tree type2)
+arm_comp_type_attributes (const_tree type1, const_tree type2)
{
int l1, l2, s1, s2;
@@ -6523,7 +6523,7 @@ coproc_secondary_reload_class (enum machine_mode mode, rtx x, bool wb)
register. */
static bool
-arm_return_in_msb (tree valtype)
+arm_return_in_msb (const_tree valtype)
{
return (TARGET_AAPCS_BASED
&& BYTES_BIG_ENDIAN
@@ -8179,7 +8179,7 @@ arm_reload_out_hi (rtx *operands)
(padded to the size of a word) should be passed in a register. */
static bool
-arm_must_pass_in_stack (enum machine_mode mode, tree type)
+arm_must_pass_in_stack (enum machine_mode mode, const_tree type)
{
if (TARGET_AAPCS_BASED)
return must_pass_in_stack_var_size (mode, type);
@@ -8195,7 +8195,7 @@ arm_must_pass_in_stack (enum machine_mode mode, tree type)
aggregate types are placed in the lowest memory address. */
bool
-arm_pad_arg_upward (enum machine_mode mode, tree type)
+arm_pad_arg_upward (enum machine_mode mode, const_tree type)
{
if (!TARGET_AAPCS_BASED)
return DEFAULT_FUNCTION_ARG_PADDING(mode, type) == upward;
@@ -18177,7 +18177,7 @@ arm_no_early_mul_dep (rtx producer, rtx consumer)
using APCS or ATPCS. */
static bool
-arm_promote_prototypes (tree t ATTRIBUTE_UNUSED)
+arm_promote_prototypes (const_tree t ATTRIBUTE_UNUSED)
{
return !TARGET_AAPCS_BASED;
}
@@ -18966,7 +18966,7 @@ static arm_mangle_map_entry arm_mangle_map[] = {
};
const char *
-arm_mangle_type (tree type)
+arm_mangle_type (const_tree type)
{
arm_mangle_map_entry *pos = arm_mangle_map;
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 26ba33f83ce..ac97a1fabf5 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -2401,7 +2401,7 @@ extern int making_const_table;
fprintf (STREAM, "\t.thumb\n\t.thumb_func\n") ; \
} \
if (TARGET_POKE_FUNCTION_NAME) \
- arm_poke_function_name (STREAM, (char *) NAME); \
+ arm_poke_function_name (STREAM, (const char *) NAME); \
} \
while (0)
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 88c3ac4261c..4a63cfead94 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -309,12 +309,12 @@
(define_attr "ce_count" "" (const_int 1))
;;---------------------------------------------------------------------------
-;; Mode macros
+;; Mode iterators
; A list of modes that are exactly 64 bits in size. We use this to expand
; some splits that are the same for all modes when operating on ARM
; registers.
-(define_mode_macro ANY64 [DI DF V8QI V4HI V2SI V2SF])
+(define_mode_iterator ANY64 [DI DF V8QI V4HI V2SI V2SF])
;;---------------------------------------------------------------------------
;; Predicates
diff --git a/gcc/config/arm/iwmmxt.md b/gcc/config/arm/iwmmxt.md
index 31aaf0f5df3..11188732bc7 100644
--- a/gcc/config/arm/iwmmxt.md
+++ b/gcc/config/arm/iwmmxt.md
@@ -20,10 +20,10 @@
;; <http://www.gnu.org/licenses/>.
;; Integer element sizes implemented by IWMMXT.
-(define_mode_macro VMMX [V2SI V4HI V8QI])
+(define_mode_iterator VMMX [V2SI V4HI V8QI])
;; Integer element sizes for shifts.
-(define_mode_macro VSHFT [V4HI V2SI DI])
+(define_mode_iterator VSHFT [V4HI V2SI DI])
;; Determine element size suffix from vector mode.
(define_mode_attr MMX_char [(V8QI "b") (V4HI "h") (V2SI "w") (DI "d")])
diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md
index fa5b16f7744..167367c5239 100644
--- a/gcc/config/arm/neon.md
+++ b/gcc/config/arm/neon.md
@@ -162,97 +162,97 @@
(UNSPEC_VZIP2 204)])
;; Double-width vector modes.
-(define_mode_macro VD [V8QI V4HI V2SI V2SF])
+(define_mode_iterator VD [V8QI V4HI V2SI V2SF])
;; Double-width vector modes plus 64-bit elements.
-(define_mode_macro VDX [V8QI V4HI V2SI V2SF DI])
+(define_mode_iterator VDX [V8QI V4HI V2SI V2SF DI])
;; Same, without floating-point elements.
-(define_mode_macro VDI [V8QI V4HI V2SI])
+(define_mode_iterator VDI [V8QI V4HI V2SI])
;; Quad-width vector modes.
-(define_mode_macro VQ [V16QI V8HI V4SI V4SF])
+(define_mode_iterator VQ [V16QI V8HI V4SI V4SF])
;; Quad-width vector modes plus 64-bit elements.
-(define_mode_macro VQX [V16QI V8HI V4SI V4SF V2DI])
+(define_mode_iterator VQX [V16QI V8HI V4SI V4SF V2DI])
;; Same, without floating-point elements.
-(define_mode_macro VQI [V16QI V8HI V4SI])
+(define_mode_iterator VQI [V16QI V8HI V4SI])
;; Same, with TImode added, for moves.
-(define_mode_macro VQXMOV [V16QI V8HI V4SI V4SF V2DI TI])
+(define_mode_iterator VQXMOV [V16QI V8HI V4SI V4SF V2DI TI])
;; Opaque structure types wider than TImode.
-(define_mode_macro VSTRUCT [EI OI CI XI])
+(define_mode_iterator VSTRUCT [EI OI CI XI])
;; Number of instructions needed to load/store struct elements. FIXME!
(define_mode_attr V_slen [(EI "2") (OI "2") (CI "3") (XI "4")])
;; Opaque structure types used in table lookups (except vtbl1/vtbx1).
-(define_mode_macro VTAB [TI EI OI])
+(define_mode_iterator VTAB [TI EI OI])
;; vtbl<n> suffix for above modes.
(define_mode_attr VTAB_n [(TI "2") (EI "3") (OI "4")])
;; Widenable modes.
-(define_mode_macro VW [V8QI V4HI V2SI])
+(define_mode_iterator VW [V8QI V4HI V2SI])
;; Narrowable modes.
-(define_mode_macro VN [V8HI V4SI V2DI])
+(define_mode_iterator VN [V8HI V4SI V2DI])
;; All supported vector modes (except singleton DImode).
-(define_mode_macro VDQ [V8QI V16QI V4HI V8HI V2SI V4SI V2SF V4SF V2DI])
+(define_mode_iterator VDQ [V8QI V16QI V4HI V8HI V2SI V4SI V2SF V4SF V2DI])
;; All supported vector modes (except those with 64-bit integer elements).
-(define_mode_macro VDQW [V8QI V16QI V4HI V8HI V2SI V4SI V2SF V4SF])
+(define_mode_iterator VDQW [V8QI V16QI V4HI V8HI V2SI V4SI V2SF V4SF])
;; Supported integer vector modes (not 64 bit elements).
-(define_mode_macro VDQIW [V8QI V16QI V4HI V8HI V2SI V4SI])
+(define_mode_iterator VDQIW [V8QI V16QI V4HI V8HI V2SI V4SI])
;; Supported integer vector modes (not singleton DI)
-(define_mode_macro VDQI [V8QI V16QI V4HI V8HI V2SI V4SI V2DI])
+(define_mode_iterator VDQI [V8QI V16QI V4HI V8HI V2SI V4SI V2DI])
;; Vector modes, including 64-bit integer elements.
-(define_mode_macro VDQX [V8QI V16QI V4HI V8HI V2SI V4SI V2SF V4SF DI V2DI])
+(define_mode_iterator VDQX [V8QI V16QI V4HI V8HI V2SI V4SI V2SF V4SF DI V2DI])
;; Vector modes including 64-bit integer elements, but no floats.
-(define_mode_macro VDQIX [V8QI V16QI V4HI V8HI V2SI V4SI DI V2DI])
+(define_mode_iterator VDQIX [V8QI V16QI V4HI V8HI V2SI V4SI DI V2DI])
;; Vector modes for float->int conversions.
-(define_mode_macro VCVTF [V2SF V4SF])
+(define_mode_iterator VCVTF [V2SF V4SF])
;; Vector modes form int->float conversions.
-(define_mode_macro VCVTI [V2SI V4SI])
+(define_mode_iterator VCVTI [V2SI V4SI])
;; Vector modes for doubleword multiply-accumulate, etc. insns.
-(define_mode_macro VMD [V4HI V2SI V2SF])
+(define_mode_iterator VMD [V4HI V2SI V2SF])
;; Vector modes for quadword multiply-accumulate, etc. insns.
-(define_mode_macro VMQ [V8HI V4SI V4SF])
+(define_mode_iterator VMQ [V8HI V4SI V4SF])
;; Above modes combined.
-(define_mode_macro VMDQ [V4HI V2SI V2SF V8HI V4SI V4SF])
+(define_mode_iterator VMDQ [V4HI V2SI V2SF V8HI V4SI V4SF])
;; As VMD, but integer modes only.
-(define_mode_macro VMDI [V4HI V2SI])
+(define_mode_iterator VMDI [V4HI V2SI])
;; As VMQ, but integer modes only.
-(define_mode_macro VMQI [V8HI V4SI])
+(define_mode_iterator VMQI [V8HI V4SI])
;; Above modes combined.
-(define_mode_macro VMDQI [V4HI V2SI V8HI V4SI])
+(define_mode_iterator VMDQI [V4HI V2SI V8HI V4SI])
;; Modes with 8-bit and 16-bit elements.
-(define_mode_macro VX [V8QI V4HI V16QI V8HI])
+(define_mode_iterator VX [V8QI V4HI V16QI V8HI])
;; Modes with 8-bit elements.
-(define_mode_macro VE [V8QI V16QI])
+(define_mode_iterator VE [V8QI V16QI])
;; Modes with 64-bit elements only.
-(define_mode_macro V64 [DI V2DI])
+(define_mode_iterator V64 [DI V2DI])
;; Modes with 32-bit elements only.
-(define_mode_macro V32 [V2SI V2SF V4SI V4SF])
+(define_mode_iterator V32 [V2SI V2SF V4SI V4SF])
;; (Opposite) mode to convert to/from for above conversions.
(define_mode_attr V_CVTTO [(V2SI "V2SF") (V2SF "V2SI")
@@ -394,10 +394,10 @@
(DI "ti") (V2DI "oi")])
;; Operations on two halves of a quadword vector.
-(define_code_macro vqh_ops [plus smin smax umin umax])
+(define_code_iterator vqh_ops [plus smin smax umin umax])
;; Same, without unsigned variants (for use with *SFmode pattern).
-(define_code_macro vqhs_ops [plus smin smax])
+(define_code_iterator vqhs_ops [plus smin smax])
;; Assembler mnemonics for above codes.
(define_code_attr VQH_mnem [(plus "vadd") (smin "vmin") (smax "vmax")
diff --git a/gcc/config/arm/pe.c b/gcc/config/arm/pe.c
index be4dbb0d3f4..90bc7299386 100644
--- a/gcc/config/arm/pe.c
+++ b/gcc/config/arm/pe.c
@@ -39,8 +39,7 @@ extern int current_function_anonymous_args;
tree current_class_type; /* FIXME */
int
-arm_dllexport_p (decl)
- tree decl;
+arm_dllexport_p (tree decl)
{
tree exp;
@@ -57,8 +56,7 @@ arm_dllexport_p (decl)
/* Return nonzero if DECL is a dllimport'd object. */
int
-arm_dllimport_p (decl)
- tree decl;
+arm_dllimport_p (tree decl)
{
tree imp;
@@ -79,8 +77,7 @@ arm_dllimport_p (decl)
/* Return nonzero if SYMBOL is marked as being dllexport'd. */
int
-arm_dllexport_name_p (symbol)
- const char * symbol;
+arm_dllexport_name_p (const char *symbol)
{
return symbol[0] == ARM_PE_FLAG_CHAR && symbol[1] == 'e' && symbol[2] == '.';
}
@@ -88,8 +85,7 @@ arm_dllexport_name_p (symbol)
/* Return nonzero if SYMBOL is marked as being dllimport'd. */
int
-arm_dllimport_name_p (symbol)
- const char * symbol;
+arm_dllimport_name_p (const char *symbol)
{
return symbol[0] == ARM_PE_FLAG_CHAR && symbol[1] == 'i' && symbol[2] == '.';
}
@@ -98,8 +94,7 @@ arm_dllimport_name_p (symbol)
Note that we override the previous setting (e.g.: dllimport). */
void
-arm_mark_dllexport (decl)
- tree decl;
+arm_mark_dllexport (tree decl)
{
const char * oldname;
char * newname;
@@ -134,8 +129,7 @@ arm_mark_dllexport (decl)
/* Mark a DECL as being dllimport'd. */
void
-arm_mark_dllimport (decl)
- tree decl;
+arm_mark_dllimport (tree decl)
{
const char * oldname;
char * newname;
@@ -201,10 +195,7 @@ arm_mark_dllimport (decl)
}
void
-arm_pe_encode_section_info (decl, rtl, first)
- tree decl;
- rtx rtl;
- int first ATTRIBUTE_UNUSED;
+arm_pe_encode_section_info (tree decl, rtx rtl, int first ATTRIBUTE_UNUSED)
{
/* This bit is copied from arm_encode_section_info. */
if (optimize > 0 && TREE_CONSTANT (decl))
@@ -239,9 +230,7 @@ arm_pe_encode_section_info (decl, rtl, first)
}
void
-arm_pe_unique_section (decl, reloc)
- tree decl;
- int reloc;
+arm_pe_unique_section (tree decl, int reloc)
{
int len;
const char * name;
diff --git a/gcc/config/arm/vec-common.md b/gcc/config/arm/vec-common.md
index f963472a4b2..858d381eed0 100644
--- a/gcc/config/arm/vec-common.md
+++ b/gcc/config/arm/vec-common.md
@@ -21,16 +21,16 @@
;; Vector Moves
;; All integer and float modes supported by Neon and IWMMXT.
-(define_mode_macro VALL [V2DI V2SI V4HI V8QI V2SF V4SI V8HI V16QI V4SF])
+(define_mode_iterator VALL [V2DI V2SI V4HI V8QI V2SF V4SI V8HI V16QI V4SF])
;; All integer and float modes supported by Neon and IWMMXT, except V2DI.
-(define_mode_macro VALLW [V2SI V4HI V8QI V2SF V4SI V8HI V16QI V4SF])
+(define_mode_iterator VALLW [V2SI V4HI V8QI V2SF V4SI V8HI V16QI V4SF])
;; All integer modes supported by Neon and IWMMXT
-(define_mode_macro VINT [V2DI V2SI V4HI V8QI V4SI V8HI V16QI])
+(define_mode_iterator VINT [V2DI V2SI V4HI V8QI V4SI V8HI V16QI])
;; All integer modes supported by Neon and IWMMXT, except V2DI
-(define_mode_macro VINTW [V2SI V4HI V8QI V4SI V8HI V16QI])
+(define_mode_iterator VINTW [V2SI V4HI V8QI V4SI V8HI V16QI])
(define_expand "mov<mode>"
[(set (match_operand:VALL 0 "nonimmediate_operand" "")
diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h
index cc5b9401b9a..7d04b7aaa91 100644
--- a/gcc/config/avr/avr-protos.h
+++ b/gcc/config/avr/avr-protos.h
@@ -43,7 +43,7 @@ extern void asm_output_external (FILE *file, tree decl, char *name);
extern int avr_progmem_p (tree decl, tree attributes);
#ifdef RTX_CODE /* inside TREE_CODE */
-extern rtx avr_function_value (tree type, tree func);
+extern rtx avr_function_value (const_tree type, const_tree func);
extern void init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype,
rtx libname, tree fndecl);
extern rtx function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode,
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 019278d91ee..1382479369f 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -78,7 +78,7 @@ static void avr_asm_out_dtor (rtx, int);
static int avr_operand_rtx_cost (rtx, enum machine_mode, enum rtx_code);
static bool avr_rtx_costs (rtx, int, int, int *);
static int avr_address_cost (rtx);
-static bool avr_return_in_memory (tree, tree);
+static bool avr_return_in_memory (const_tree, const_tree);
static struct machine_function * avr_init_machine_status (void);
/* Allocate registers from r25 to r8 for parameters for function calls. */
#define FIRST_CUM_REG 26
@@ -4475,7 +4475,7 @@ avr_assemble_integer (rtx x, unsigned int size, int aligned_p)
void
gas_output_limited_string(FILE *file, const char *str)
{
- const unsigned char *_limited_str = (unsigned char *) str;
+ const unsigned char *_limited_str = (const unsigned char *) str;
unsigned ch;
fprintf (file, "%s\"", STRING_ASM_OP);
for (; (ch = *_limited_str); _limited_str++)
@@ -4528,7 +4528,7 @@ gas_output_ascii(FILE *file, const char *str, size_t length)
fprintf (file, "\"\n");
bytes_in_chunk = 0;
}
- gas_output_limited_string (file, (char*)_ascii_bytes);
+ gas_output_limited_string (file, (const char*)_ascii_bytes);
_ascii_bytes = p;
}
else
@@ -5615,7 +5615,7 @@ avr_libcall_value (enum machine_mode mode)
function returns a value of data type VALTYPE. */
rtx
-avr_function_value (tree type, tree func ATTRIBUTE_UNUSED)
+avr_function_value (const_tree type, const_tree func ATTRIBUTE_UNUSED)
{
unsigned int offs;
@@ -5935,7 +5935,7 @@ avr_asm_out_dtor (rtx symbol, int priority)
/* Worker function for TARGET_RETURN_IN_MEMORY. */
static bool
-avr_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+avr_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
{
if (TYPE_MODE (type) == BLKmode)
{
diff --git a/gcc/config/bfin/bfin-protos.h b/gcc/config/bfin/bfin-protos.h
index f99e0bcef8c..ad5e7b4b930 100644
--- a/gcc/config/bfin/bfin-protos.h
+++ b/gcc/config/bfin/bfin-protos.h
@@ -86,7 +86,7 @@ extern void asm_conditional_branch (rtx, rtx *, int, int);
extern rtx bfin_gen_compare (rtx, Mmode);
extern int bfin_local_alignment (tree, int);
-extern int bfin_return_in_memory (tree);
+extern int bfin_return_in_memory (const_tree);
extern void initialize_trampoline (rtx, rtx, rtx);
extern bool bfin_legitimate_address_p (Mmode, rtx, int);
extern rtx bfin_va_arg (tree, tree);
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index a946ba66d48..7b2f9880641 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -140,7 +140,8 @@ conditional_register_usage (void)
/* Examine machine-dependent attributes of function type FUNTYPE and return its
type. See the definition of E_FUNKIND. */
-static e_funkind funkind (tree funtype)
+static e_funkind
+funkind (const_tree funtype)
{
tree attrs = TYPE_ATTRIBUTES (funtype);
if (lookup_attribute ("interrupt_handler", attrs))
@@ -1310,26 +1311,31 @@ print_operand (FILE *file, rtx x, char code)
case REG:
if (code == 'h')
{
- gcc_assert (REGNO (x) < 32);
- fprintf (file, "%s", short_reg_names[REGNO (x)]);
- /*fprintf (file, "\n%d\n ", REGNO (x));*/
- break;
+ if (REGNO (x) < 32)
+ fprintf (file, "%s", short_reg_names[REGNO (x)]);
+ else
+ output_operand_lossage ("invalid operand for code '%c'", code);
}
else if (code == 'd')
{
- gcc_assert (REGNO (x) < 32);
- fprintf (file, "%s", high_reg_names[REGNO (x)]);
- break;
+ if (REGNO (x) < 32)
+ fprintf (file, "%s", high_reg_names[REGNO (x)]);
+ else
+ output_operand_lossage ("invalid operand for code '%c'", code);
}
else if (code == 'w')
{
- gcc_assert (REGNO (x) == REG_A0 || REGNO (x) == REG_A1);
- fprintf (file, "%s.w", reg_names[REGNO (x)]);
+ if (REGNO (x) == REG_A0 || REGNO (x) == REG_A1)
+ fprintf (file, "%s.w", reg_names[REGNO (x)]);
+ else
+ output_operand_lossage ("invalid operand for code '%c'", code);
}
else if (code == 'x')
{
- gcc_assert (REGNO (x) == REG_A0 || REGNO (x) == REG_A1);
- fprintf (file, "%s.x", reg_names[REGNO (x)]);
+ if (REGNO (x) == REG_A0 || REGNO (x) == REG_A1)
+ fprintf (file, "%s.x", reg_names[REGNO (x)]);
+ else
+ output_operand_lossage ("invalid operand for code '%c'", code);
}
else if (code == 'v')
{
@@ -1342,18 +1348,24 @@ print_operand (FILE *file, rtx x, char code)
}
else if (code == 'D')
{
- fprintf (file, "%s", dregs_pair_names[REGNO (x)]);
+ if (D_REGNO_P (REGNO (x)))
+ fprintf (file, "%s", dregs_pair_names[REGNO (x)]);
+ else
+ output_operand_lossage ("invalid operand for code '%c'", code);
}
else if (code == 'H')
{
- gcc_assert (mode == DImode || mode == DFmode);
- gcc_assert (REG_P (x));
- fprintf (file, "%s", reg_names[REGNO (x) + 1]);
+ if ((mode == DImode || mode == DFmode) && REG_P (x))
+ fprintf (file, "%s", reg_names[REGNO (x) + 1]);
+ else
+ output_operand_lossage ("invalid operand for code '%c'", code);
}
else if (code == 'T')
{
- gcc_assert (D_REGNO_P (REGNO (x)));
- fprintf (file, "%s", byte_reg_names[REGNO (x)]);
+ if (D_REGNO_P (REGNO (x)))
+ fprintf (file, "%s", byte_reg_names[REGNO (x)]);
+ else
+ output_operand_lossage ("invalid operand for code '%c'", code);
}
else
fprintf (file, "%s", reg_names[REGNO (x)]);
@@ -1608,7 +1620,7 @@ bfin_arg_partial_bytes (CUMULATIVE_ARGS *cum, enum machine_mode mode,
static bool
bfin_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED,
- tree type, bool named ATTRIBUTE_UNUSED)
+ const_tree type, bool named ATTRIBUTE_UNUSED)
{
return type && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST;
}
@@ -1618,7 +1630,7 @@ bfin_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
RETURN_IN_MEMORY. */
int
-bfin_return_in_memory (tree type)
+bfin_return_in_memory (const_tree type)
{
int size = int_size_in_bytes (type);
return size > 2 * UNITS_PER_WORD || size == -1;
@@ -1867,8 +1879,30 @@ bfin_expand_call (rtx retval, rtx fnaddr, rtx callarg1, rtx cookie, int sibcall)
if (TARGET_FDPIC)
{
+ int caller_has_l1_text, callee_has_l1_text;
+
+ caller_has_l1_text = callee_has_l1_text = 0;
+
+ if (lookup_attribute ("l1_text",
+ DECL_ATTRIBUTES (cfun->decl)) != NULL_TREE)
+ caller_has_l1_text = 1;
+
+ if (GET_CODE (callee) == SYMBOL_REF
+ && SYMBOL_REF_DECL (callee) && DECL_P (SYMBOL_REF_DECL (callee))
+ && lookup_attribute
+ ("l1_text",
+ DECL_ATTRIBUTES (SYMBOL_REF_DECL (callee))) != NULL_TREE)
+ callee_has_l1_text = 1;
+
if (GET_CODE (callee) != SYMBOL_REF
- || bfin_longcall_p (callee, INTVAL (cookie)))
+ || bfin_longcall_p (callee, INTVAL (cookie))
+ || (GET_CODE (callee) == SYMBOL_REF
+ && !SYMBOL_REF_LOCAL_P (callee)
+ && TARGET_INLINE_PLT)
+ || caller_has_l1_text != callee_has_l1_text
+ || (caller_has_l1_text && callee_has_l1_text
+ && (GET_CODE (callee) != SYMBOL_REF
+ || !SYMBOL_REF_LOCAL_P (callee))))
{
rtx addr = callee;
if (! address_operand (addr, Pmode))
@@ -4567,7 +4601,7 @@ handle_int_attribute (tree *node, tree name,
warning to be generated). */
static int
-bfin_comp_type_attributes (tree type1, tree type2)
+bfin_comp_type_attributes (const_tree type1, const_tree type2)
{
e_funkind kind1, kind2;
@@ -4631,6 +4665,91 @@ bfin_handle_longcall_attribute (tree *node, tree name,
return NULL_TREE;
}
+/* Handle a "l1_text" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+bfin_handle_l1_text_attribute (tree *node, tree name, tree ARG_UNUSED (args),
+ int ARG_UNUSED (flags), bool *no_add_attrs)
+{
+ tree decl = *node;
+
+ if (TREE_CODE (decl) != FUNCTION_DECL)
+ {
+ error ("`%s' attribute only applies to functions",
+ IDENTIFIER_POINTER (name));
+ *no_add_attrs = true;
+ }
+
+ /* The decl may have already been given a section attribute
+ from a previous declaration. Ensure they match. */
+ else if (DECL_SECTION_NAME (decl) != NULL_TREE
+ && strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)),
+ ".l1.text") != 0)
+ {
+ error ("section of %q+D conflicts with previous declaration",
+ decl);
+ *no_add_attrs = true;
+ }
+ else
+ DECL_SECTION_NAME (decl) = build_string (9, ".l1.text");
+
+ return NULL_TREE;
+}
+
+/* Handle a "l1_data", "l1_data_A" or "l1_data_B" attribute;
+ arguments as in struct attribute_spec.handler. */
+
+static tree
+bfin_handle_l1_data_attribute (tree *node, tree name, tree ARG_UNUSED (args),
+ int ARG_UNUSED (flags), bool *no_add_attrs)
+{
+ tree decl = *node;
+
+ if (TREE_CODE (decl) != VAR_DECL)
+ {
+ error ("`%s' attribute only applies to variables",
+ IDENTIFIER_POINTER (name));
+ *no_add_attrs = true;
+ }
+ else if (current_function_decl != NULL_TREE
+ && !TREE_STATIC (decl))
+ {
+ error ("`%s' attribute cannot be specified for local variables",
+ IDENTIFIER_POINTER (name));
+ *no_add_attrs = true;
+ }
+ else
+ {
+ const char *section_name;
+
+ if (strcmp (IDENTIFIER_POINTER (name), "l1_data") == 0)
+ section_name = ".l1.data";
+ else if (strcmp (IDENTIFIER_POINTER (name), "l1_data_A") == 0)
+ section_name = ".l1.data.A";
+ else if (strcmp (IDENTIFIER_POINTER (name), "l1_data_B") == 0)
+ section_name = ".l1.data.B";
+ else
+ gcc_unreachable ();
+
+ /* The decl may have already been given a section attribute
+ from a previous declaration. Ensure they match. */
+ if (DECL_SECTION_NAME (decl) != NULL_TREE
+ && strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)),
+ section_name) != 0)
+ {
+ error ("section of %q+D conflicts with previous declaration",
+ decl);
+ *no_add_attrs = true;
+ }
+ else
+ DECL_SECTION_NAME (decl)
+ = build_string (strlen (section_name) + 1, section_name);
+ }
+
+ return NULL_TREE;
+}
+
/* Table of valid machine attributes. */
const struct attribute_spec bfin_attribute_table[] =
{
@@ -4643,6 +4762,10 @@ const struct attribute_spec bfin_attribute_table[] =
{ "saveall", 0, 0, false, true, true, NULL },
{ "longcall", 0, 0, false, true, true, bfin_handle_longcall_attribute },
{ "shortcall", 0, 0, false, true, true, bfin_handle_longcall_attribute },
+ { "l1_text", 0, 0, true, false, false, bfin_handle_l1_text_attribute },
+ { "l1_data", 0, 0, true, false, false, bfin_handle_l1_data_attribute },
+ { "l1_data_A", 0, 0, true, false, false, bfin_handle_l1_data_attribute },
+ { "l1_data_B", 0, 0, true, false, false, bfin_handle_l1_data_attribute },
{ NULL, 0, 0, false, false, false, NULL }
};
@@ -5288,25 +5411,25 @@ bfin_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
|| GET_MODE (target) != V2HImode
|| ! (*insn_data[icode].operand[0].predicate) (target, V2HImode))
target = gen_reg_rtx (tmode);
- if (! register_operand (op0, GET_MODE (op0)))
- op0 = copy_to_mode_reg (GET_MODE (op0), op0);
if (! register_operand (op1, GET_MODE (op1)))
op1 = copy_to_mode_reg (GET_MODE (op1), op1);
+ if (! register_operand (op2, GET_MODE (op2)))
+ op2 = copy_to_mode_reg (GET_MODE (op2), op2);
tmp1 = gen_reg_rtx (SImode);
tmp2 = gen_reg_rtx (SImode);
- emit_insn (gen_ashlsi3 (tmp1, gen_lowpart (SImode, op2), GEN_INT (16)));
- emit_move_insn (tmp2, gen_lowpart (SImode, op2));
+ emit_insn (gen_ashlsi3 (tmp1, gen_lowpart (SImode, op0), GEN_INT (16)));
+ emit_move_insn (tmp2, gen_lowpart (SImode, op0));
emit_insn (gen_movstricthi_1 (gen_lowpart (HImode, tmp2), const0_rtx));
emit_insn (gen_load_accumulator_pair (accvec, tmp1, tmp2));
- emit_insn (gen_flag_macv2hi_parts_acconly (accvec, op0, op1, const0_rtx,
+ emit_insn (gen_flag_macv2hi_parts_acconly (accvec, op1, op2, const0_rtx,
const0_rtx, const0_rtx,
const1_rtx, accvec, const0_rtx,
const0_rtx,
GEN_INT (MACFLAG_W32)));
tmp1 = (fcode == BFIN_BUILTIN_CPLX_MAC_16 ? const1_rtx : const0_rtx);
tmp2 = (fcode == BFIN_BUILTIN_CPLX_MAC_16 ? const0_rtx : const1_rtx);
- emit_insn (gen_flag_macv2hi_parts (target, op0, op1, const1_rtx,
+ emit_insn (gen_flag_macv2hi_parts (target, op1, op2, const1_rtx,
const1_rtx, const1_rtx,
const0_rtx, accvec, tmp1, tmp2,
GEN_INT (MACFLAG_NONE), accvec));
@@ -5365,7 +5488,7 @@ bfin_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
#undef TARGET_ASM_OUTPUT_MI_THUNK
#define TARGET_ASM_OUTPUT_MI_THUNK bfin_output_mi_thunk
#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
-#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_tree_hwi_hwi_tree_true
+#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_const_tree_hwi_hwi_const_tree_true
#undef TARGET_SCHED_ADJUST_COST
#define TARGET_SCHED_ADJUST_COST bfin_adjust_cost
@@ -5374,11 +5497,11 @@ bfin_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
#define TARGET_SCHED_ISSUE_RATE bfin_issue_rate
#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
#undef TARGET_ARG_PARTIAL_BYTES
#define TARGET_ARG_PARTIAL_BYTES bfin_arg_partial_bytes
diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h
index 9cb017e0a20..fa6eed349c2 100644
--- a/gcc/config/bfin/bfin.h
+++ b/gcc/config/bfin/bfin.h
@@ -76,6 +76,8 @@ extern int target_flags;
builtin_define ("__BFIN_FDPIC__"); \
if (TARGET_ID_SHARED_LIBRARY) \
builtin_define ("__ID_SHARED_LIB__"); \
+ if (flag_no_builtin) \
+ builtin_define ("__NO_BUILTIN"); \
} \
while (0)
#endif
@@ -89,9 +91,9 @@ extern int target_flags;
# define SUBTARGET_DRIVER_SELF_SPECS
#endif
-#define LINK_GCC_C_SEQUENCE_SPEC \
- "%{mfdpic:%{!static: %L} %{static: %G %L %G}} \
- %{!mfdpic:%G %L %G}"
+#define LINK_GCC_C_SEQUENCE_SPEC "\
+ %{mfast-fp:-lbffastfp} %G %L %{mfast-fp:-lbffastfp} %G \
+"
/* A C string constant that tells the GCC driver program options to pass to
the assembler. It can also specify how to translate options you give to GNU
diff --git a/gcc/config/bfin/bfin.md b/gcc/config/bfin/bfin.md
index 44ee6831fd0..e465cd54e0b 100644
--- a/gcc/config/bfin/bfin.md
+++ b/gcc/config/bfin/bfin.md
@@ -875,7 +875,7 @@
;; DImode logical operations
-(define_code_macro any_logical [and ior xor])
+(define_code_iterator any_logical [and ior xor])
(define_code_attr optab [(and "and")
(ior "ior")
(xor "xor")])
@@ -3544,7 +3544,7 @@
[(set_attr "type" "dsp32")])
-(define_code_macro s_or_u [sign_extend zero_extend])
+(define_code_iterator s_or_u [sign_extend zero_extend])
(define_code_attr su_optab [(sign_extend "mul")
(zero_extend "umul")])
(define_code_attr su_modifier [(sign_extend "IS")
diff --git a/gcc/config/bfin/bfin.opt b/gcc/config/bfin/bfin.opt
index 6836033a6e7..56d37b54a93 100644
--- a/gcc/config/bfin/bfin.opt
+++ b/gcc/config/bfin/bfin.opt
@@ -64,10 +64,18 @@ mlong-calls
Target Report Mask(LONG_CALLS)
Avoid generating pc-relative calls; use indirection
+mfast-fp
+Target Report Mask(FAST_FP)
+Link with the fast floating-point library
+
mfdpic
Target Report Mask(FDPIC)
Enable Function Descriptor PIC mode
+minline-plt
+Target Report Mask(INLINE_PLT)
+Enable inlining of PLT in function calls
+
mstack-check-l1
Target Report Mask(STACK_CHECK_L1)
Do stack checking using bounds in L1 scratch memory
diff --git a/gcc/config/bfin/linux.h b/gcc/config/bfin/linux.h
index d391cd0a1fe..486bb776b39 100644
--- a/gcc/config/bfin/linux.h
+++ b/gcc/config/bfin/linux.h
@@ -35,7 +35,8 @@ asm (TEXT_SECTION_ASM_OP);
#undef LINK_GCC_C_SEQUENCE_SPEC
#define LINK_GCC_C_SEQUENCE_SPEC \
- "%{mfast-fp:-lbffastfp} %{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
+ "%{static:--start-group} %{mfast-fp:-lbffastfp} %G %L %{static:--end-group} \
+ %{!static:%{mfast-fp:-lbffastfp} %G}"
#undef LINK_SPEC
#define LINK_SPEC "\
diff --git a/gcc/config/c4x/c4x-c.c b/gcc/config/c4x/c4x-c.c
index 2bc5c9ac471..3e132b5d9fd 100644
--- a/gcc/config/c4x/c4x-c.c
+++ b/gcc/config/c4x/c4x-c.c
@@ -60,10 +60,7 @@ static int c4x_parse_pragma (const char *, tree *, tree *);
do { warning (OPT_Wpragmas, gmsgid, arg); return -1; } while (0)
static int
-c4x_parse_pragma (name, func, sect)
- const char *name;
- tree *func;
- tree *sect;
+c4x_parse_pragma (const char *name, tree *func, tree *sect)
{
tree f, s, x;
@@ -93,8 +90,7 @@ c4x_parse_pragma (name, func, sect)
}
void
-c4x_pr_CODE_SECTION (pfile)
- cpp_reader *pfile ATTRIBUTE_UNUSED;
+c4x_pr_CODE_SECTION (cpp_reader *pfile ATTRIBUTE_UNUSED)
{
tree func, sect;
@@ -106,8 +102,7 @@ c4x_pr_CODE_SECTION (pfile)
}
void
-c4x_pr_DATA_SECTION (pfile)
- cpp_reader *pfile ATTRIBUTE_UNUSED;
+c4x_pr_DATA_SECTION (cpp_reader *pfile ATTRIBUTE_UNUSED)
{
tree func, sect;
@@ -119,8 +114,7 @@ c4x_pr_DATA_SECTION (pfile)
}
void
-c4x_pr_FUNC_IS_PURE (pfile)
- cpp_reader *pfile ATTRIBUTE_UNUSED;
+c4x_pr_FUNC_IS_PURE (cpp_reader *pfile ATTRIBUTE_UNUSED)
{
tree func;
@@ -130,8 +124,7 @@ c4x_pr_FUNC_IS_PURE (pfile)
}
void
-c4x_pr_FUNC_NEVER_RETURNS (pfile)
- cpp_reader *pfile ATTRIBUTE_UNUSED;
+c4x_pr_FUNC_NEVER_RETURNS (cpp_reader *pfile ATTRIBUTE_UNUSED)
{
tree func;
@@ -141,8 +134,7 @@ c4x_pr_FUNC_NEVER_RETURNS (pfile)
}
void
-c4x_pr_INTERRUPT (pfile)
- cpp_reader *pfile ATTRIBUTE_UNUSED;
+c4x_pr_INTERRUPT (cpp_reader *pfile ATTRIBUTE_UNUSED)
{
tree func;
@@ -154,7 +146,6 @@ c4x_pr_INTERRUPT (pfile)
/* Used for FUNC_CANNOT_INLINE, FUNC_EXT_CALLED, FUNC_IS_SYSTEM,
FUNC_NO_GLOBAL_ASG, and FUNC_NO_IND_ASG. */
void
-c4x_pr_ignored (pfile)
- cpp_reader *pfile ATTRIBUTE_UNUSED;
+c4x_pr_ignored (cpp_reader *pfile ATTRIBUTE_UNUSED)
{
}
diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c
index 4b3eddff5d2..02c52b02394 100644
--- a/gcc/config/cris/cris.c
+++ b/gcc/config/cris/cris.c
@@ -119,7 +119,7 @@ static void cris_init_libfuncs (void);
static bool cris_rtx_costs (rtx, int, int, int *);
static int cris_address_cost (rtx);
static bool cris_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
- tree, bool);
+ const_tree, bool);
static int cris_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
static tree cris_md_asm_clobbers (tree, tree, tree);
@@ -169,7 +169,7 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION;
#define TARGET_ADDRESS_COST cris_address_cost
#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
#undef TARGET_STRUCT_VALUE_RTX
#define TARGET_STRUCT_VALUE_RTX cris_struct_value_rtx
#undef TARGET_SETUP_INCOMING_VARARGS
@@ -870,9 +870,8 @@ cris_print_operand (FILE *file, rtx x, int code)
case 'e':
/* Like 'E', but ignore state set by 'x'. FIXME: Use code
- iterators ("code macros") and attributes in cris.md to avoid
- the need for %x and %E (and %e) and state passed between
- those modifiers. */
+ iterators and attributes in cris.md to avoid the need for %x
+ and %E (and %e) and state passed between those modifiers. */
cris_output_insn_is_bound = 0;
/* FALL THROUGH. */
case 'E':
@@ -3403,7 +3402,7 @@ cris_setup_incoming_varargs (CUMULATIVE_ARGS *ca,
static bool
cris_pass_by_reference (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
- enum machine_mode mode, tree type,
+ enum machine_mode mode, const_tree type,
bool named ATTRIBUTE_UNUSED)
{
return (targetm.calls.must_pass_in_stack (mode, type)
diff --git a/gcc/config/cris/cris.md b/gcc/config/cris/cris.md
index 3f414d78dd6..f9b0e927af3 100644
--- a/gcc/config/cris/cris.md
+++ b/gcc/config/cris/cris.md
@@ -150,9 +150,9 @@
;; Iterator definitions.
;; For the "usual" pattern size alternatives.
-(define_mode_macro BWD [SI HI QI])
-(define_mode_macro WD [SI HI])
-(define_mode_macro BW [HI QI])
+(define_mode_iterator BWD [SI HI QI])
+(define_mode_iterator WD [SI HI])
+(define_mode_iterator BW [HI QI])
(define_mode_attr S [(SI "HI") (HI "QI")])
(define_mode_attr s [(SI "hi") (HI "qi")])
(define_mode_attr m [(SI ".d") (HI ".w") (QI ".b")])
@@ -160,19 +160,19 @@
(define_mode_attr nbitsm1 [(SI "31") (HI "15") (QI "7")])
;; For the sign_extend+zero_extend variants.
-(define_code_macro szext [sign_extend zero_extend])
+(define_code_iterator szext [sign_extend zero_extend])
(define_code_attr u [(sign_extend "") (zero_extend "u")])
(define_code_attr su [(sign_extend "s") (zero_extend "u")])
;; For the shift variants.
-(define_code_macro shift [ashiftrt lshiftrt ashift])
-(define_code_macro shiftrt [ashiftrt lshiftrt])
+(define_code_iterator shift [ashiftrt lshiftrt ashift])
+(define_code_iterator shiftrt [ashiftrt lshiftrt])
(define_code_attr shlr [(ashiftrt "ashr") (lshiftrt "lshr") (ashift "ashl")])
(define_code_attr slr [(ashiftrt "asr") (lshiftrt "lsr") (ashift "lsl")])
-(define_code_macro ncond [eq ne gtu ltu geu leu])
-(define_code_macro ocond [gt le])
-(define_code_macro rcond [lt ge])
+(define_code_iterator ncond [eq ne gtu ltu geu leu])
+(define_code_iterator ocond [gt le])
+(define_code_iterator rcond [lt ge])
(define_code_attr CC [(eq "eq") (ne "ne") (gt "gt") (gtu "hi") (lt "lt")
(ltu "lo") (ge "ge") (geu "hs") (le "le") (leu "ls")])
(define_code_attr rCC [(eq "ne") (ne "eq") (gt "le") (gtu "ls") (lt "ge")
diff --git a/gcc/config/crx/crx.c b/gcc/config/crx/crx.c
index 44bf277570f..5be938bc06d 100644
--- a/gcc/config/crx/crx.c
+++ b/gcc/config/crx/crx.c
@@ -135,7 +135,7 @@ rtx crx_compare_op1 = NULL_RTX;
static bool crx_fixed_condition_code_regs (unsigned int *, unsigned int *);
static rtx crx_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED,
int incoming ATTRIBUTE_UNUSED);
-static bool crx_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED);
+static bool crx_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED);
static int crx_address_cost (rtx);
/*****************************************************************************/
@@ -204,7 +204,7 @@ crx_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED,
/* Implements hook TARGET_RETURN_IN_MEMORY. */
static bool
-crx_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+crx_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
{
if (TYPE_MODE (type) == BLKmode)
{
diff --git a/gcc/config/crx/crx.md b/gcc/config/crx/crx.md
index 89c344ef063..b9655544ffc 100644
--- a/gcc/config/crx/crx.md
+++ b/gcc/config/crx/crx.md
@@ -73,12 +73,12 @@
;; Mode Macro Definitions
-(define_mode_macro ALLMT [QI HI SI SF DI DF])
-(define_mode_macro CRXMM [QI HI SI SF])
-(define_mode_macro CRXIM [QI HI SI])
-(define_mode_macro DIDFM [DI DF])
-(define_mode_macro SISFM [SI SF])
-(define_mode_macro SHORT [QI HI])
+(define_mode_iterator ALLMT [QI HI SI SF DI DF])
+(define_mode_iterator CRXMM [QI HI SI SF])
+(define_mode_iterator CRXIM [QI HI SI])
+(define_mode_iterator DIDFM [DI DF])
+(define_mode_iterator SISFM [SI SF])
+(define_mode_iterator SHORT [QI HI])
(define_mode_attr tIsa [(QI "b") (HI "w") (SI "d") (SF "d")])
(define_mode_attr lImmArith [(QI "4") (HI "4") (SI "6")])
@@ -94,20 +94,20 @@
;; Code Macro Definitions
-(define_code_macro sz_xtnd [sign_extend zero_extend])
+(define_code_iterator sz_xtnd [sign_extend zero_extend])
(define_code_attr sIsa [(sign_extend "") (zero_extend "u")])
(define_code_attr sPat [(sign_extend "s") (zero_extend "u")])
(define_code_attr szPat [(sign_extend "") (zero_extend "zero_")])
(define_code_attr szIsa [(sign_extend "s") (zero_extend "z")])
-(define_code_macro sh_oprnd [ashift ashiftrt lshiftrt])
+(define_code_iterator sh_oprnd [ashift ashiftrt lshiftrt])
(define_code_attr shIsa [(ashift "ll") (ashiftrt "ra") (lshiftrt "rl")])
(define_code_attr shPat [(ashift "ashl") (ashiftrt "ashr") (lshiftrt "lshr")])
-(define_code_macro mima_oprnd [smax umax smin umin])
+(define_code_iterator mima_oprnd [smax umax smin umin])
(define_code_attr mimaIsa [(smax "maxs") (umax "maxu") (smin "mins") (umin "minu")])
-(define_code_macro any_cond [eq ne gt gtu lt ltu ge geu le leu])
+(define_code_iterator any_cond [eq ne gt gtu lt ltu ge geu le leu])
;; Addition Instructions
diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h
index 5a0a2c45712..a8ce17c0111 100644
--- a/gcc/config/darwin-protos.h
+++ b/gcc/config/darwin-protos.h
@@ -84,7 +84,7 @@ extern void darwin_asm_output_dwarf_delta (FILE *, int, const char *,
const char *);
extern void darwin_asm_output_dwarf_offset (FILE *, int, const char *,
section *);
-extern bool darwin_binds_local_p (tree);
+extern bool darwin_binds_local_p (const_tree);
extern void darwin_cpp_builtins (struct cpp_reader *);
extern void darwin_asm_output_anchor (rtx symbol);
extern bool darwin_kextabi_p (void);
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index c532e9dff0c..92ffb821cbb 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -267,7 +267,7 @@ machopic_define_symbol (rtx mem)
SYMBOL_REF_FLAGS (sym_ref) |= MACHO_SYMBOL_FLAG_DEFINED;
}
-static GTY(()) char * function_base;
+static GTY(()) const char * function_base;
const char *
machopic_function_base_name (void)
@@ -276,8 +276,7 @@ machopic_function_base_name (void)
gcc_assert (!MACHO_DYNAMIC_NO_PIC_P);
if (function_base == NULL)
- function_base =
- (char *) ggc_alloc_string ("<pic base>", sizeof ("<pic base>"));
+ function_base = ggc_alloc_string ("<pic base>", sizeof ("<pic base>"));
current_function_uses_pic_offset_table = 1;
@@ -1672,7 +1671,7 @@ darwin_file_end (void)
functions at dynamic-link time, except for vtables in kexts. */
bool
-darwin_binds_local_p (tree decl)
+darwin_binds_local_p (const_tree decl)
{
return default_binds_local_p_1 (decl,
TARGET_KEXTABI && DARWIN_VTABLE_P (decl));
diff --git a/gcc/config/fr30/fr30.c b/gcc/config/fr30/fr30.c
index 6458ea14cdd..7856f879090 100644
--- a/gcc/config/fr30/fr30.c
+++ b/gcc/config/fr30/fr30.c
@@ -122,7 +122,7 @@ static struct fr30_frame_info zero_frame_info;
static void fr30_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
tree, int *, int);
-static bool fr30_must_pass_in_stack (enum machine_mode, tree);
+static bool fr30_must_pass_in_stack (enum machine_mode, const_tree);
static int fr30_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
@@ -153,7 +153,7 @@ static int fr30_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
#define TARGET_ASM_ALIGNED_SI_OP "\t.word\t"
#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
#undef TARGET_PASS_BY_REFERENCE
#define TARGET_PASS_BY_REFERENCE hook_pass_by_reference_must_pass_in_stack
#undef TARGET_ARG_PARTIAL_BYTES
@@ -669,7 +669,7 @@ fr30_print_operand (FILE *file, rtx x, int code)
in registers. */
static bool
-fr30_must_pass_in_stack (enum machine_mode mode, tree type)
+fr30_must_pass_in_stack (enum machine_mode mode, const_tree type)
{
if (mode == BLKmode)
return true;
diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c
index 3498cfc689a..9c31b8bb500 100644
--- a/gcc/config/frv/frv.c
+++ b/gcc/config/frv/frv.c
@@ -270,7 +270,7 @@ frv_cpu_t frv_cpu_type = CPU_TYPE; /* value of -mcpu= */
static bool frv_handle_option (size_t, const char *, int);
static int frv_default_flags_for_cpu (void);
-static int frv_string_begins_with (tree, const char *);
+static int frv_string_begins_with (const_tree, const char *);
static FRV_INLINE bool frv_small_data_reloc_p (rtx, int);
static void frv_print_operand_memory_reference_reg
(FILE *, rtx);
@@ -358,7 +358,7 @@ static bool frv_assemble_integer (rtx, unsigned, int);
static void frv_init_builtins (void);
static rtx frv_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
static void frv_init_libfuncs (void);
-static bool frv_in_small_data_p (tree);
+static bool frv_in_small_data_p (const_tree);
static void frv_asm_output_mi_thunk
(FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree);
static void frv_setup_incoming_varargs (CUMULATIVE_ARGS *,
@@ -375,7 +375,7 @@ static void frv_output_const_unspec (FILE *,
const struct frv_unspec *);
static bool frv_function_ok_for_sibcall (tree, tree);
static rtx frv_struct_value_rtx (tree, int);
-static bool frv_must_pass_in_stack (enum machine_mode mode, tree type);
+static bool frv_must_pass_in_stack (enum machine_mode mode, const_tree type);
static int frv_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
static void frv_output_dwarf_dtprel (FILE *, int, rtx)
@@ -833,9 +833,9 @@ frv_optimization_options (int level, int size ATTRIBUTE_UNUSED)
/* Return true if NAME (a STRING_CST node) begins with PREFIX. */
static int
-frv_string_begins_with (tree name, const char *prefix)
+frv_string_begins_with (const_tree name, const char *prefix)
{
- int prefix_len = strlen (prefix);
+ const int prefix_len = strlen (prefix);
/* Remember: NAME's length includes the null terminator. */
return (TREE_STRING_LENGTH (name) > prefix_len
@@ -3114,7 +3114,7 @@ frv_init_cumulative_args (CUMULATIVE_ARGS *cum,
in registers. */
static bool
-frv_must_pass_in_stack (enum machine_mode mode, tree type)
+frv_must_pass_in_stack (enum machine_mode mode, const_tree type)
{
if (mode == BLKmode)
return true;
@@ -9430,10 +9430,10 @@ frv_expand_builtin (tree exp,
}
static bool
-frv_in_small_data_p (tree decl)
+frv_in_small_data_p (const_tree decl)
{
HOST_WIDE_INT size;
- tree section_name;
+ const_tree section_name;
/* Don't apply the -G flag to internal compiler structures. We
should leave such structures in the main data section, partly
diff --git a/gcc/config/frv/frv.md b/gcc/config/frv/frv.md
index 7c16293d8e4..f8451747b9a 100644
--- a/gcc/config/frv/frv.md
+++ b/gcc/config/frv/frv.md
@@ -86,7 +86,7 @@
(FDPIC_REG 15)
])
-(define_mode_macro IMODE [QI HI SI DI])
+(define_mode_iterator IMODE [QI HI SI DI])
(define_mode_attr IMODEsuffix [(QI "b") (HI "h") (SI "") (DI "d")])
(define_mode_attr BREADsuffix [(QI "ub") (HI "uh") (SI "") (DI "d")])
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index 4e3113a6303..96b6311ce7c 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -5706,7 +5706,7 @@ h8300_init_libfuncs (void)
/* Worker function for TARGET_RETURN_IN_MEMORY. */
static bool
-h8300_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+h8300_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
{
return (TYPE_MODE (type) == BLKmode
|| GET_MODE_SIZE (TYPE_MODE (type)) > (TARGET_H8300 ? 4 : 8));
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index 31cfc47c55a..a12a4f114f1 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -133,8 +133,8 @@ extern rtx ix86_libcall_value (enum machine_mode);
extern bool ix86_function_value_regno_p (int);
extern bool ix86_function_arg_regno_p (int);
extern int ix86_function_arg_boundary (enum machine_mode, tree);
-extern int ix86_return_in_memory (tree);
-extern int ix86_sol10_return_in_memory (tree);
+extern int ix86_return_in_memory (const_tree);
+extern int ix86_sol10_return_in_memory (const_tree);
extern void ix86_va_start (tree, rtx);
extern rtx ix86_va_arg (tree, tree);
@@ -211,9 +211,9 @@ extern void i386_pe_declare_function_type (FILE *, const char *, int);
extern void i386_pe_record_external_function (tree, const char *);
extern void i386_pe_maybe_record_exported_symbol (tree, const char *, int);
extern void i386_pe_encode_section_info (tree, rtx, int);
-extern bool i386_pe_binds_local_p (tree);
+extern bool i386_pe_binds_local_p (const_tree);
extern const char *i386_pe_strip_name_encoding_full (const char *);
-extern bool i386_pe_valid_dllimport_attribute_p (tree);
+extern bool i386_pe_valid_dllimport_attribute_p (const_tree);
extern unsigned int i386_pe_section_type_flags (tree, const char *, int);
extern void i386_pe_asm_named_section (const char *, unsigned int, tree);
extern void i386_pe_asm_output_aligned_decl_common (FILE *, tree,
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index e094efe79d2..a98dcfb3cf6 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -1573,8 +1573,8 @@ static bool ext_80387_constants_init = 0;
static struct machine_function * ix86_init_machine_status (void);
-static rtx ix86_function_value (tree, tree, bool);
-static int ix86_function_regparm (tree, tree);
+static rtx ix86_function_value (const_tree, const_tree, bool);
+static int ix86_function_regparm (const_tree, const_tree);
static void ix86_compute_frame_layout (struct ix86_frame *);
static bool ix86_expand_vector_init_one_nonzero (bool, enum machine_mode,
rtx, rtx, int);
@@ -1620,6 +1620,10 @@ static int ix86_isa_flags_explicit;
#define OPTION_MASK_ISA_SSE4A_UNSET OPTION_MASK_ISA_SSE4
+/* Vectorization library interface and handlers. */
+tree (*ix86_veclib_handler)(enum built_in_function, tree, tree) = NULL;
+static tree ix86_veclibabi_acml (enum built_in_function, tree, tree);
+
/* Implement TARGET_HANDLE_OPTION. */
static bool
@@ -2409,6 +2413,16 @@ override_options (void)
if (!TARGET_80387)
target_flags &= ~MASK_FLOAT_RETURNS;
+ /* Use external vectorized library in vectorizing intrinsics. */
+ if (ix86_veclibabi_string)
+ {
+ if (strcmp (ix86_veclibabi_string, "acml") == 0)
+ ix86_veclib_handler = ix86_veclibabi_acml;
+ else
+ error ("unknown vectorization library ABI type (%s) for "
+ "-mveclibabi= switch", ix86_veclibabi_string);
+ }
+
if ((x86_accumulate_outgoing_args & ix86_tune_mask)
&& !(target_flags_explicit & MASK_ACCUMULATE_OUTGOING_ARGS)
&& !optimize_size)
@@ -2905,7 +2919,7 @@ ix86_handle_cconv_attribute (tree *node, tree name,
warning to be generated). */
static int
-ix86_comp_type_attributes (tree type1, tree type2)
+ix86_comp_type_attributes (const_tree type1, const_tree type2)
{
/* Check for mismatch of non-default calling convention. */
const char *const rtdstr = TARGET_RTD ? "cdecl" : "stdcall";
@@ -2938,7 +2952,7 @@ ix86_comp_type_attributes (tree type1, tree type2)
or considering a libcall. */
static int
-ix86_function_regparm (tree type, tree decl)
+ix86_function_regparm (const_tree type, const_tree decl)
{
tree attr;
int regparm = ix86_regparm;
@@ -2957,7 +2971,8 @@ ix86_function_regparm (tree type, tree decl)
if (decl && TREE_CODE (decl) == FUNCTION_DECL
&& flag_unit_at_a_time && !profile_flag)
{
- struct cgraph_local_info *i = cgraph_local_info (decl);
+ /* FIXME: remove this CONST_CAST when cgraph.[ch] is constified. */
+ struct cgraph_local_info *i = cgraph_local_info ((tree)CONST_CAST(decl));
if (i && i->local)
{
int local_regparm, globals = 0, regno;
@@ -3011,7 +3026,7 @@ ix86_function_regparm (tree type, tree decl)
indirectly or considering a libcall. Otherwise return 0. */
static int
-ix86_function_sseregparm (tree type, tree decl)
+ix86_function_sseregparm (const_tree type, const_tree decl)
{
gcc_assert (!TARGET_64BIT);
@@ -3038,7 +3053,8 @@ ix86_function_sseregparm (tree type, tree decl)
(and DFmode for SSE2) arguments in SSE registers. */
if (decl && TARGET_SSE_MATH && flag_unit_at_a_time && !profile_flag)
{
- struct cgraph_local_info *i = cgraph_local_info (decl);
+ /* FIXME: remove this CONST_CAST when cgraph.[ch] is constified. */
+ struct cgraph_local_info *i = cgraph_local_info ((tree)CONST_CAST(decl));
if (i && i->local)
return TARGET_SSE2 ? 2 : 1;
}
@@ -3182,7 +3198,7 @@ ix86_function_arg_regno_p (int regno)
/* Return if we do not know how to pass TYPE solely in registers. */
static bool
-ix86_must_pass_in_stack (enum machine_mode mode, tree type)
+ix86_must_pass_in_stack (enum machine_mode mode, const_tree type)
{
if (must_pass_in_stack_var_size_or_pad (mode, type))
return true;
@@ -3263,7 +3279,7 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, /* Argument info to initialize */
the middle-end decides to do with these vector types. */
static enum machine_mode
-type_natural_mode (tree type)
+type_natural_mode (const_tree type)
{
enum machine_mode mode = TYPE_MODE (type);
@@ -3377,7 +3393,7 @@ merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2)
*/
static int
-classify_argument (enum machine_mode mode, tree type,
+classify_argument (enum machine_mode mode, const_tree type,
enum x86_64_reg_class classes[MAX_CLASSES], int bit_offset)
{
HOST_WIDE_INT bytes =
@@ -3649,7 +3665,7 @@ classify_argument (enum machine_mode mode, tree type,
/* Examine the argument and return set number of register required in each
class. Return 0 iff parameter should be passed in memory. */
static int
-examine_argument (enum machine_mode mode, tree type, int in_return,
+examine_argument (enum machine_mode mode, const_tree type, int in_return,
int *int_nregs, int *sse_nregs)
{
enum x86_64_reg_class regclass[MAX_CLASSES];
@@ -3692,7 +3708,7 @@ examine_argument (enum machine_mode mode, tree type, int in_return,
static rtx
construct_container (enum machine_mode mode, enum machine_mode orig_mode,
- tree type, int in_return, int nintregs, int nsseregs,
+ const_tree type, int in_return, int nintregs, int nsseregs,
const int *intreg, int sse_regno)
{
/* The following variables hold the static issued_error state. */
@@ -4191,7 +4207,7 @@ function_arg (CUMULATIVE_ARGS *cum, enum machine_mode omode,
static bool
ix86_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED,
- tree type, bool named ATTRIBUTE_UNUSED)
+ const_tree type, bool named ATTRIBUTE_UNUSED)
{
if (TARGET_64BIT_MS_ABI)
{
@@ -4342,7 +4358,7 @@ ix86_function_value_regno_p (int regno)
static rtx
function_value_32 (enum machine_mode orig_mode, enum machine_mode mode,
- tree fntype, tree fn)
+ const_tree fntype, const_tree fn)
{
unsigned int regno;
@@ -4381,7 +4397,7 @@ function_value_32 (enum machine_mode orig_mode, enum machine_mode mode,
static rtx
function_value_64 (enum machine_mode orig_mode, enum machine_mode mode,
- tree valtype)
+ const_tree valtype)
{
rtx ret;
@@ -4438,10 +4454,10 @@ function_value_ms_64 (enum machine_mode orig_mode, enum machine_mode mode)
}
static rtx
-ix86_function_value_1 (tree valtype, tree fntype_or_decl,
+ix86_function_value_1 (const_tree valtype, const_tree fntype_or_decl,
enum machine_mode orig_mode, enum machine_mode mode)
{
- tree fn, fntype;
+ const_tree fn, fntype;
fn = NULL_TREE;
if (fntype_or_decl && DECL_P (fntype_or_decl))
@@ -4457,7 +4473,7 @@ ix86_function_value_1 (tree valtype, tree fntype_or_decl,
}
static rtx
-ix86_function_value (tree valtype, tree fntype_or_decl,
+ix86_function_value (const_tree valtype, const_tree fntype_or_decl,
bool outgoing ATTRIBUTE_UNUSED)
{
enum machine_mode mode, orig_mode;
@@ -4476,7 +4492,7 @@ ix86_libcall_value (enum machine_mode mode)
/* Return true iff type is returned in memory. */
static int
-return_in_memory_32 (tree type, enum machine_mode mode)
+return_in_memory_32 (const_tree type, enum machine_mode mode)
{
HOST_WIDE_INT size;
@@ -4516,14 +4532,14 @@ return_in_memory_32 (tree type, enum machine_mode mode)
}
static int
-return_in_memory_64 (tree type, enum machine_mode mode)
+return_in_memory_64 (const_tree type, enum machine_mode mode)
{
int needed_intregs, needed_sseregs;
return !examine_argument (mode, type, 1, &needed_intregs, &needed_sseregs);
}
static int
-return_in_memory_ms_64 (tree type, enum machine_mode mode)
+return_in_memory_ms_64 (const_tree type, enum machine_mode mode)
{
HOST_WIDE_INT size = int_size_in_bytes (type);
@@ -4536,9 +4552,9 @@ return_in_memory_ms_64 (tree type, enum machine_mode mode)
}
int
-ix86_return_in_memory (tree type)
+ix86_return_in_memory (const_tree type)
{
- enum machine_mode mode = type_natural_mode (type);
+ const enum machine_mode mode = type_natural_mode (type);
if (TARGET_64BIT_MS_ABI)
return return_in_memory_ms_64 (type, mode);
@@ -4554,7 +4570,7 @@ ix86_return_in_memory (tree type)
are returned in memory, rather than in MMX registers. */
int
-ix86_sol10_return_in_memory (tree type)
+ix86_sol10_return_in_memory (const_tree type)
{
int size;
enum machine_mode mode = type_natural_mode (type);
@@ -8495,6 +8511,8 @@ get_some_local_dynamic_name (void)
X -- don't print any sort of PIC '@' suffix for a symbol.
& -- print some in-use local-dynamic symbol name.
H -- print a memory address offset by 8; used for sse high-parts
+ + -- print a branch hint as 'cs' or 'ds' prefix
+ ; -- print a semicolon (after prefixes due to bug in older gas).
*/
void
@@ -8776,6 +8794,15 @@ print_operand (FILE *file, rtx x, int code)
}
return;
}
+
+ case ';':
+#if TARGET_MACHO
+ fputs (" ; ", file);
+#else
+ fputc (' ', file);
+#endif
+ return;
+
default:
output_operand_lossage ("invalid operand code '%c'", code);
}
@@ -11460,26 +11487,24 @@ ix86_expand_fp_compare (enum rtx_code code, rtx op0, rtx op1, rtx scratch,
ix86_fp_comparison_codes (code, &bypass_code, &first_code, &second_code);
/* Do fcomi/sahf based test when profitable. */
- if ((TARGET_CMOVE || TARGET_SAHF)
+ if (ix86_fp_comparison_arithmetics_cost (code) > cost
&& (bypass_code == UNKNOWN || bypass_test)
- && (second_code == UNKNOWN || second_test)
- && ix86_fp_comparison_arithmetics_cost (code) > cost)
+ && (second_code == UNKNOWN || second_test))
{
+ tmp = gen_rtx_COMPARE (fpcmp_mode, op0, op1);
+ tmp = gen_rtx_SET (VOIDmode, gen_rtx_REG (fpcmp_mode, FLAGS_REG),
+ tmp);
if (TARGET_CMOVE)
- {
- tmp = gen_rtx_COMPARE (fpcmp_mode, op0, op1);
- tmp = gen_rtx_SET (VOIDmode, gen_rtx_REG (fpcmp_mode, FLAGS_REG),
- tmp);
- emit_insn (tmp);
- }
+ emit_insn (tmp);
else
{
- tmp = gen_rtx_COMPARE (fpcmp_mode, op0, op1);
- tmp2 = gen_rtx_UNSPEC (HImode, gen_rtvec (1, tmp), UNSPEC_FNSTSW);
+ gcc_assert (TARGET_SAHF);
+
if (!scratch)
scratch = gen_reg_rtx (HImode);
- emit_insn (gen_rtx_SET (VOIDmode, scratch, tmp2));
- emit_insn (gen_x86_sahf_1 (scratch));
+ tmp2 = gen_rtx_CLOBBER (VOIDmode, scratch);
+
+ emit_insn (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, tmp, tmp2)));
}
/* The FP codes work out to act like unsigned. */
@@ -11706,8 +11731,7 @@ ix86_expand_branch (enum rtx_code code, rtx label)
/* Check whether we will use the natural sequence with one jump. If
so, we can expand jump early. Otherwise delay expansion by
creating compound insn to not confuse optimizers. */
- if (bypass_code == UNKNOWN && second_code == UNKNOWN
- && TARGET_CMOVE)
+ if (bypass_code == UNKNOWN && second_code == UNKNOWN)
{
ix86_split_fp_branch (code, ix86_compare_op0, ix86_compare_op1,
gen_rtx_LABEL_REF (VOIDmode, label),
@@ -19924,33 +19948,122 @@ ix86_builtin_vectorized_function (unsigned int fn, tree type_out,
if (out_mode == DFmode && out_n == 2
&& in_mode == DFmode && in_n == 2)
return ix86_builtins[IX86_BUILTIN_SQRTPD];
- return NULL_TREE;
+ break;
case BUILT_IN_SQRTF:
if (out_mode == SFmode && out_n == 4
&& in_mode == SFmode && in_n == 4)
return ix86_builtins[IX86_BUILTIN_SQRTPS];
- return NULL_TREE;
+ break;
case BUILT_IN_LRINT:
if (out_mode == SImode && out_n == 4
&& in_mode == DFmode && in_n == 2)
return ix86_builtins[IX86_BUILTIN_VEC_PACK_SFIX];
- return NULL_TREE;
+ break;
case BUILT_IN_LRINTF:
if (out_mode == SImode && out_n == 4
&& in_mode == SFmode && in_n == 4)
return ix86_builtins[IX86_BUILTIN_CVTPS2DQ];
- return NULL_TREE;
+ break;
default:
;
}
+ /* Dispatch to a handler for a vectorization library. */
+ if (ix86_veclib_handler)
+ return (*ix86_veclib_handler)(fn, type_out, type_in);
+
return NULL_TREE;
}
+/* Handler for an ACML-style interface to a library with vectorized
+ intrinsics. */
+
+static tree
+ix86_veclibabi_acml (enum built_in_function fn, tree type_out, tree type_in)
+{
+ char name[20] = "__vr.._";
+ tree fntype, new_fndecl, args;
+ unsigned arity;
+ const char *bname;
+ enum machine_mode el_mode, in_mode;
+ int n, in_n;
+
+ /* The ACML is 64bits only and suitable for unsafe math only as
+ it does not correctly support parts of IEEE with the required
+ precision such as denormals. */
+ if (!TARGET_64BIT
+ || !flag_unsafe_math_optimizations)
+ return NULL_TREE;
+
+ el_mode = TYPE_MODE (TREE_TYPE (type_out));
+ n = TYPE_VECTOR_SUBPARTS (type_out);
+ in_mode = TYPE_MODE (TREE_TYPE (type_in));
+ in_n = TYPE_VECTOR_SUBPARTS (type_in);
+ if (el_mode != in_mode
+ || n != in_n)
+ return NULL_TREE;
+
+ switch (fn)
+ {
+ case BUILT_IN_SIN:
+ case BUILT_IN_COS:
+ case BUILT_IN_EXP:
+ case BUILT_IN_LOG:
+ case BUILT_IN_LOG2:
+ case BUILT_IN_LOG10:
+ name[4] = 'd';
+ name[5] = '2';
+ if (el_mode != DFmode
+ || n != 2)
+ return NULL_TREE;
+ break;
+
+ case BUILT_IN_SINF:
+ case BUILT_IN_COSF:
+ case BUILT_IN_EXPF:
+ case BUILT_IN_POWF:
+ case BUILT_IN_LOGF:
+ case BUILT_IN_LOG2F:
+ case BUILT_IN_LOG10F:
+ name[4] = 's';
+ name[5] = '4';
+ if (el_mode != SFmode
+ || n != 4)
+ return NULL_TREE;
+ break;
+
+ default:
+ return NULL_TREE;
+ }
+
+ bname = IDENTIFIER_POINTER (DECL_NAME (implicit_built_in_decls[fn]));
+ sprintf (name + 7, "%s", bname+10);
+
+ arity = 0;
+ for (args = DECL_ARGUMENTS (implicit_built_in_decls[fn]); args;
+ args = TREE_CHAIN (args))
+ arity++;
+
+ if (arity == 1)
+ fntype = build_function_type_list (type_out, type_in, NULL);
+ else
+ fntype = build_function_type_list (type_out, type_in, type_in, NULL);
+
+ /* Build a function declaration for the vectorized function. */
+ new_fndecl = build_decl (FUNCTION_DECL, get_identifier (name), fntype);
+ TREE_PUBLIC (new_fndecl) = 1;
+ DECL_EXTERNAL (new_fndecl) = 1;
+ DECL_IS_NOVOPS (new_fndecl) = 1;
+ TREE_READONLY (new_fndecl) = 1;
+
+ return new_fndecl;
+}
+
+
/* Returns a decl of a function that implements conversion of the
input vector of type TYPE, or NULL_TREE if it is not available. */
@@ -20558,6 +20671,8 @@ ix86_hard_regno_mode_ok (int regno, enum machine_mode mode)
return 1;
else if (VALID_FP_MODE_P (mode))
return 1;
+ else if (VALID_DFP_MODE_P (mode))
+ return 1;
/* Lots of MMX code casts 8 byte vector modes to DImode. If we then go
on to use that value in smaller contexts, this can easily force a
pseudo to be allocated to GENERAL_REGS. Since this is no worse than
@@ -21141,7 +21256,7 @@ ix86_handle_struct_attribute (tree *node, tree name,
}
static bool
-ix86_ms_bitfield_layout_p (tree record_type)
+ix86_ms_bitfield_layout_p (const_tree record_type)
{
return (TARGET_MS_BITFIELD_LAYOUT &&
!lookup_attribute ("gcc_struct", TYPE_ATTRIBUTES (record_type)))
@@ -21183,9 +21298,9 @@ x86_this_parameter (tree function)
/* Determine whether x86_output_mi_thunk can succeed. */
static bool
-x86_can_output_mi_thunk (tree thunk ATTRIBUTE_UNUSED,
+x86_can_output_mi_thunk (const_tree thunk ATTRIBUTE_UNUSED,
HOST_WIDE_INT delta ATTRIBUTE_UNUSED,
- HOST_WIDE_INT vcall_offset, tree function)
+ HOST_WIDE_INT vcall_offset, const_tree function)
{
/* 64-bit can handle anything. */
if (TARGET_64BIT)
@@ -22825,7 +22940,7 @@ i386_solaris_elf_named_section (const char *name, unsigned int flags,
/* Return the mangling of TYPE if it is an extended fundamental type. */
static const char *
-ix86_mangle_type (tree type)
+ix86_mangle_type (const_tree type)
{
type = TYPE_MAIN_VARIANT (type);
@@ -23571,7 +23686,7 @@ static const struct attribute_spec ix86_attribute_table[] =
#undef TARGET_CANNOT_FORCE_CONST_MEM
#define TARGET_CANNOT_FORCE_CONST_MEM ix86_cannot_force_const_mem
#undef TARGET_USE_BLOCKS_FOR_CONSTANT_P
-#define TARGET_USE_BLOCKS_FOR_CONSTANT_P hook_bool_mode_rtx_true
+#define TARGET_USE_BLOCKS_FOR_CONSTANT_P hook_bool_mode_const_rtx_true
#undef TARGET_DELEGITIMIZE_ADDRESS
#define TARGET_DELEGITIMIZE_ADDRESS ix86_delegitimize_address
@@ -23625,7 +23740,7 @@ static const struct attribute_spec ix86_attribute_table[] =
#define TARGET_MD_ASM_CLOBBERS ix86_md_asm_clobbers
#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
#undef TARGET_STRUCT_VALUE_RTX
#define TARGET_STRUCT_VALUE_RTX ix86_struct_value_rtx
#undef TARGET_SETUP_INCOMING_VARARGS
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 4a41a6c76f8..93e24dd90fb 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -1088,6 +1088,9 @@ do { \
place emms and femms instructions. */
#define UNITS_PER_SIMD_WORD (TARGET_SSE ? 16 : UNITS_PER_WORD)
+#define VALID_DFP_MODE_P(MODE) \
+ ((MODE) == SDmode || (MODE) == DDmode || (MODE) == TDmode)
+
#define VALID_FP_MODE_P(MODE) \
((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode \
|| (MODE) == SCmode || (MODE) == DCmode || (MODE) == XCmode) \
@@ -2229,7 +2232,7 @@ do { \
print_operand function. */
#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
- ((CODE) == '*' || (CODE) == '+' || (CODE) == '&')
+ ((CODE) == '*' || (CODE) == '+' || (CODE) == '&' || (CODE) == ';')
#define PRINT_OPERAND(FILE, X, CODE) \
print_operand ((FILE), (X), (CODE))
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 751d46b9ac6..a518aaeaca9 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -488,7 +488,7 @@
[(set_attr "length" "128")
(set_attr "type" "multi")])
-(define_code_macro plusminus [plus minus])
+(define_code_iterator plusminus [plus minus])
;; Base name for define_insn and insn mnemonic.
(define_code_attr addsub [(plus "add") (minus "sub")])
@@ -497,7 +497,7 @@
(define_code_attr comm [(plus "%") (minus "")])
;; All single word integer modes.
-(define_mode_macro SWI [QI HI SI (DI "TARGET_64BIT")])
+(define_mode_iterator SWI [QI HI SI (DI "TARGET_64BIT")])
;; Instruction suffix for integer modes.
(define_mode_attr imodesuffix [(QI "b") (HI "w") (SI "l") (DI "q")])
@@ -516,22 +516,22 @@
(DI "x86_64_general_operand")])
;; All x87 floating point modes
-(define_mode_macro X87MODEF [SF DF XF])
+(define_mode_iterator X87MODEF [SF DF XF])
;; x87 SFmode and DFMode floating point modes
-(define_mode_macro X87MODEF12 [SF DF])
+(define_mode_iterator X87MODEF12 [SF DF])
;; All integer modes handled by x87 fisttp operator.
-(define_mode_macro X87MODEI [HI SI DI])
+(define_mode_iterator X87MODEI [HI SI DI])
;; All integer modes handled by integer x87 operators.
-(define_mode_macro X87MODEI12 [HI SI])
+(define_mode_iterator X87MODEI12 [HI SI])
;; All SSE floating point modes
-(define_mode_macro SSEMODEF [SF DF])
+(define_mode_iterator SSEMODEF [SF DF])
;; All integer modes handled by SSE cvtts?2si* operators.
-(define_mode_macro SSEMODEI24 [SI DI])
+(define_mode_iterator SSEMODEI24 [SI DI])
;; SSE asm suffix for floating point modes
(define_mode_attr ssemodefsuffix [(SF "s") (DF "d")])
@@ -925,6 +925,34 @@
]
(const_string "XF")))])
+(define_insn_and_split "*cmpfp_0_cc"
+ [(set (reg:CCFP FLAGS_REG)
+ (compare:CCFP
+ (match_operand 1 "register_operand" "f")
+ (match_operand 2 "const0_operand" "X")))
+ (clobber (match_operand:HI 0 "register_operand" "=a"))]
+ "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
+ && TARGET_SAHF && !TARGET_CMOVE
+ && GET_MODE (operands[1]) == GET_MODE (operands[2])"
+ "#"
+ "&& reload_completed"
+ [(set (match_dup 0)
+ (unspec:HI
+ [(compare:CCFP (match_dup 1)(match_dup 2))]
+ UNSPEC_FNSTSW))
+ (set (reg:CC FLAGS_REG)
+ (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
+ ""
+ [(set_attr "type" "multi")
+ (set_attr "unit" "i387")
+ (set (attr "mode")
+ (cond [(match_operand:SF 1 "" "")
+ (const_string "SF")
+ (match_operand:DF 1 "" "")
+ (const_string "DF")
+ ]
+ (const_string "XF")))])
+
(define_insn "*cmpfp_xf"
[(set (match_operand:HI 0 "register_operand" "=a")
(unspec:HI
@@ -938,6 +966,27 @@
(set_attr "unit" "i387")
(set_attr "mode" "XF")])
+(define_insn_and_split "*cmpfp_xf_cc"
+ [(set (reg:CCFP FLAGS_REG)
+ (compare:CCFP
+ (match_operand:XF 1 "register_operand" "f")
+ (match_operand:XF 2 "register_operand" "f")))
+ (clobber (match_operand:HI 0 "register_operand" "=a"))]
+ "TARGET_80387
+ && TARGET_SAHF && !TARGET_CMOVE"
+ "#"
+ "&& reload_completed"
+ [(set (match_dup 0)
+ (unspec:HI
+ [(compare:CCFP (match_dup 1)(match_dup 2))]
+ UNSPEC_FNSTSW))
+ (set (reg:CC FLAGS_REG)
+ (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
+ ""
+ [(set_attr "type" "multi")
+ (set_attr "unit" "i387")
+ (set_attr "mode" "XF")])
+
(define_insn "*cmpfp_<mode>"
[(set (match_operand:HI 0 "register_operand" "=a")
(unspec:HI
@@ -951,6 +1000,27 @@
(set_attr "unit" "i387")
(set_attr "mode" "<MODE>")])
+(define_insn_and_split "*cmpfp_<mode>_cc"
+ [(set (reg:CCFP FLAGS_REG)
+ (compare:CCFP
+ (match_operand:X87MODEF12 1 "register_operand" "f")
+ (match_operand:X87MODEF12 2 "nonimmediate_operand" "fm")))
+ (clobber (match_operand:HI 0 "register_operand" "=a"))]
+ "TARGET_80387
+ && TARGET_SAHF && !TARGET_CMOVE"
+ "#"
+ "&& reload_completed"
+ [(set (match_dup 0)
+ (unspec:HI
+ [(compare:CCFP (match_dup 1)(match_dup 2))]
+ UNSPEC_FNSTSW))
+ (set (reg:CC FLAGS_REG)
+ (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
+ ""
+ [(set_attr "type" "multi")
+ (set_attr "unit" "i387")
+ (set_attr "mode" "<MODE>")])
+
(define_insn "*cmpfp_u"
[(set (match_operand:HI 0 "register_operand" "=a")
(unspec:HI
@@ -971,6 +1041,34 @@
]
(const_string "XF")))])
+(define_insn_and_split "*cmpfp_u_cc"
+ [(set (reg:CCFPU FLAGS_REG)
+ (compare:CCFPU
+ (match_operand 1 "register_operand" "f")
+ (match_operand 2 "register_operand" "f")))
+ (clobber (match_operand:HI 0 "register_operand" "=a"))]
+ "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
+ && TARGET_SAHF && !TARGET_CMOVE
+ && GET_MODE (operands[1]) == GET_MODE (operands[2])"
+ "#"
+ "&& reload_completed"
+ [(set (match_dup 0)
+ (unspec:HI
+ [(compare:CCFPU (match_dup 1)(match_dup 2))]
+ UNSPEC_FNSTSW))
+ (set (reg:CC FLAGS_REG)
+ (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
+ ""
+ [(set_attr "type" "multi")
+ (set_attr "unit" "i387")
+ (set (attr "mode")
+ (cond [(match_operand:SF 1 "" "")
+ (const_string "SF")
+ (match_operand:DF 1 "" "")
+ (const_string "DF")
+ ]
+ (const_string "XF")))])
+
(define_insn "*cmpfp_<mode>"
[(set (match_operand:HI 0 "register_operand" "=a")
(unspec:HI
@@ -988,6 +1086,33 @@
(set_attr "fp_int_src" "true")
(set_attr "mode" "<MODE>")])
+(define_insn_and_split "*cmpfp_<mode>_cc"
+ [(set (reg:CCFP FLAGS_REG)
+ (compare:CCFP
+ (match_operand 1 "register_operand" "f")
+ (match_operator 3 "float_operator"
+ [(match_operand:X87MODEI12 2 "memory_operand" "m")])))
+ (clobber (match_operand:HI 0 "register_operand" "=a"))]
+ "X87_FLOAT_MODE_P (GET_MODE (operands[1]))
+ && TARGET_SAHF && !TARGET_CMOVE
+ && TARGET_USE_<MODE>MODE_FIOP
+ && (GET_MODE (operands [3]) == GET_MODE (operands[1]))"
+ "#"
+ "&& reload_completed"
+ [(set (match_dup 0)
+ (unspec:HI
+ [(compare:CCFP
+ (match_dup 1)
+ (match_op_dup 3 [(match_dup 2)]))]
+ UNSPEC_FNSTSW))
+ (set (reg:CC FLAGS_REG)
+ (unspec:CC [(match_dup 0)] UNSPEC_SAHF))]
+ ""
+ [(set_attr "type" "multi")
+ (set_attr "unit" "i387")
+ (set_attr "fp_int_src" "true")
+ (set_attr "mode" "<MODE>")])
+
;; FP compares, step 2
;; Move the fpsw to ax.
@@ -10085,7 +10210,7 @@
;; Copysign instructions
-(define_mode_macro CSGNMODE [SF DF TF])
+(define_mode_iterator CSGNMODE [SF DF TF])
(define_mode_attr CSGNVMODE [(SF "V4SF") (DF "V2DF") (TF "TF")])
(define_expand "copysign<mode>3"
@@ -21009,7 +21134,7 @@
}
[(set_attr "type" "multi")])
-(define_mode_macro CRC32MODE [QI HI SI])
+(define_mode_iterator CRC32MODE [QI HI SI])
(define_mode_attr crc32modesuffix [(QI "b") (HI "w") (SI "l")])
(define_mode_attr crc32modeconstraint [(QI "qm") (HI "rm") (SI "rm")])
diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
index a8e6da62fe0..f32193d26b1 100644
--- a/gcc/config/i386/i386.opt
+++ b/gcc/config/i386/i386.opt
@@ -182,6 +182,10 @@ mtune=
Target RejectNegative Joined Var(ix86_tune_string)
Schedule code for given CPU
+mveclibabi=
+Target RejectNegative Joined Var(ix86_veclibabi_string)
+Vector library ABI to use
+
;; ISA support
m32
diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md
index 6268d8fa16c..70073de9278 100644
--- a/gcc/config/i386/mmx.md
+++ b/gcc/config/i386/mmx.md
@@ -31,14 +31,14 @@
;; direction of the user via a builtin.
;; 8 byte integral modes handled by MMX (and by extension, SSE)
-(define_mode_macro MMXMODEI [V8QI V4HI V2SI])
+(define_mode_iterator MMXMODEI [V8QI V4HI V2SI])
;; All 8-byte vector modes handled by MMX
-(define_mode_macro MMXMODE [V8QI V4HI V2SI V2SF])
+(define_mode_iterator MMXMODE [V8QI V4HI V2SI V2SF])
;; Mix-n-match
-(define_mode_macro MMXMODE12 [V8QI V4HI])
-(define_mode_macro MMXMODE24 [V4HI V2SI])
+(define_mode_iterator MMXMODE12 [V8QI V4HI])
+(define_mode_iterator MMXMODE24 [V4HI V2SI])
;; Mapping from integer vector mode to mnemonic suffix
(define_mode_attr mmxvecsize [(V8QI "b") (V4HI "w") (V2SI "d") (DI "q")])
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 72048ad6653..6779e9a805a 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -21,17 +21,17 @@
;; 16 byte integral modes handled by SSE, minus TImode, which gets
;; special-cased for TARGET_64BIT.
-(define_mode_macro SSEMODEI [V16QI V8HI V4SI V2DI])
+(define_mode_iterator SSEMODEI [V16QI V8HI V4SI V2DI])
;; All 16-byte vector modes handled by SSE
-(define_mode_macro SSEMODE [V16QI V8HI V4SI V2DI V4SF V2DF])
+(define_mode_iterator SSEMODE [V16QI V8HI V4SI V2DI V4SF V2DF])
;; Mix-n-match
-(define_mode_macro SSEMODE12 [V16QI V8HI])
-(define_mode_macro SSEMODE24 [V8HI V4SI])
-(define_mode_macro SSEMODE14 [V16QI V4SI])
-(define_mode_macro SSEMODE124 [V16QI V8HI V4SI])
-(define_mode_macro SSEMODE248 [V8HI V4SI V2DI])
+(define_mode_iterator SSEMODE12 [V16QI V8HI])
+(define_mode_iterator SSEMODE24 [V8HI V4SI])
+(define_mode_iterator SSEMODE14 [V16QI V4SI])
+(define_mode_iterator SSEMODE124 [V16QI V8HI V4SI])
+(define_mode_iterator SSEMODE248 [V8HI V4SI V2DI])
;; Mapping from integer vector mode to mnemonic suffix
(define_mode_attr ssevecsize [(V16QI "b") (V8HI "w") (V4SI "d") (V2DI "q")])
@@ -1542,6 +1542,22 @@
(set_attr "prefix_extra" "1")
(set_attr "mode" "V4SF")])
+(define_insn_and_split "*vec_extract_v4sf_mem"
+ [(set (match_operand:SF 0 "register_operand" "=x*rf")
+ (vec_select:SF
+ (match_operand:V4SF 1 "memory_operand" "o")
+ (parallel [(match_operand 2 "const_0_to_3_operand" "n")])))]
+ ""
+ "#"
+ "reload_completed"
+ [(const_int 0)]
+{
+ int i = INTVAL (operands[2]);
+
+ emit_move_insn (operands[0], adjust_address (operands[1], SFmode, i*4));
+ DONE;
+})
+
(define_expand "vec_extractv4sf"
[(match_operand:SF 0 "register_operand" "")
(match_operand:V4SF 1 "register_operand" "")
@@ -3773,10 +3789,21 @@
[(set (match_operand:SSEMODEI 0 "register_operand" "")
(and:SSEMODEI (match_operand:SSEMODEI 1 "nonimmediate_operand" "")
(match_operand:SSEMODEI 2 "nonimmediate_operand" "")))]
- "TARGET_SSE2"
+ "TARGET_SSE"
"ix86_fixup_binary_operands_no_copy (AND, <MODE>mode, operands);")
-(define_insn "*and<mode>3"
+(define_insn "*sse_and<mode>3"
+ [(set (match_operand:SSEMODEI 0 "register_operand" "=x")
+ (and:SSEMODEI
+ (match_operand:SSEMODEI 1 "nonimmediate_operand" "%0")
+ (match_operand:SSEMODEI 2 "nonimmediate_operand" "xm")))]
+ "(TARGET_SSE && !TARGET_SSE2)
+ && ix86_binary_operator_ok (AND, <MODE>mode, operands)"
+ "andps\t{%2, %0|%0, %2}"
+ [(set_attr "type" "sselog")
+ (set_attr "mode" "V4SF")])
+
+(define_insn "*sse2_and<mode>3"
[(set (match_operand:SSEMODEI 0 "register_operand" "=x")
(and:SSEMODEI
(match_operand:SSEMODEI 1 "nonimmediate_operand" "%0")
@@ -3787,6 +3814,16 @@
(set_attr "prefix_data16" "1")
(set_attr "mode" "TI")])
+(define_insn "*sse_nand<mode>3"
+ [(set (match_operand:SSEMODEI 0 "register_operand" "=x")
+ (and:SSEMODEI
+ (not:SSEMODEI (match_operand:SSEMODEI 1 "register_operand" "0"))
+ (match_operand:SSEMODEI 2 "nonimmediate_operand" "xm")))]
+ "(TARGET_SSE && !TARGET_SSE2)"
+ "andnps\t{%2, %0|%0, %2}"
+ [(set_attr "type" "sselog")
+ (set_attr "mode" "V4SF")])
+
(define_insn "sse2_nand<mode>3"
[(set (match_operand:SSEMODEI 0 "register_operand" "=x")
(and:SSEMODEI
@@ -3831,10 +3868,21 @@
[(set (match_operand:SSEMODEI 0 "register_operand" "")
(ior:SSEMODEI (match_operand:SSEMODEI 1 "nonimmediate_operand" "")
(match_operand:SSEMODEI 2 "nonimmediate_operand" "")))]
- "TARGET_SSE2"
+ "TARGET_SSE"
"ix86_fixup_binary_operands_no_copy (IOR, <MODE>mode, operands);")
-(define_insn "*ior<mode>3"
+(define_insn "*sse_ior<mode>3"
+ [(set (match_operand:SSEMODEI 0 "register_operand" "=x")
+ (ior:SSEMODEI
+ (match_operand:SSEMODEI 1 "nonimmediate_operand" "%0")
+ (match_operand:SSEMODEI 2 "nonimmediate_operand" "xm")))]
+ "(TARGET_SSE && !TARGET_SSE2)
+ && ix86_binary_operator_ok (IOR, <MODE>mode, operands)"
+ "orps\t{%2, %0|%0, %2}"
+ [(set_attr "type" "sselog")
+ (set_attr "mode" "V4SF")])
+
+(define_insn "*sse2_ior<mode>3"
[(set (match_operand:SSEMODEI 0 "register_operand" "=x")
(ior:SSEMODEI
(match_operand:SSEMODEI 1 "nonimmediate_operand" "%0")
@@ -3867,10 +3915,21 @@
[(set (match_operand:SSEMODEI 0 "register_operand" "")
(xor:SSEMODEI (match_operand:SSEMODEI 1 "nonimmediate_operand" "")
(match_operand:SSEMODEI 2 "nonimmediate_operand" "")))]
- "TARGET_SSE2"
+ "TARGET_SSE"
"ix86_fixup_binary_operands_no_copy (XOR, <MODE>mode, operands);")
-(define_insn "*xor<mode>3"
+(define_insn "*sse_xor<mode>3"
+ [(set (match_operand:SSEMODEI 0 "register_operand" "=x")
+ (xor:SSEMODEI
+ (match_operand:SSEMODEI 1 "nonimmediate_operand" "%0")
+ (match_operand:SSEMODEI 2 "nonimmediate_operand" "xm")))]
+ "(TARGET_SSE && !TARGET_SSE2)
+ && ix86_binary_operator_ok (XOR, <MODE>mode, operands)"
+ "xorps\t{%2, %0|%0, %2}"
+ [(set_attr "type" "sselog")
+ (set_attr "mode" "V4SF")])
+
+(define_insn "*sse2_xor<mode>3"
[(set (match_operand:SSEMODEI 0 "register_operand" "=x")
(xor:SSEMODEI
(match_operand:SSEMODEI 1 "nonimmediate_operand" "%0")
@@ -4591,6 +4650,22 @@
operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]));
})
+(define_insn_and_split "*vec_ext_v4si_mem"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (vec_select:SI
+ (match_operand:V4SI 1 "memory_operand" "o")
+ (parallel [(match_operand 2 "const_0_to_3_operand" "")])))]
+ ""
+ "#"
+ "reload_completed"
+ [(const_int 0)]
+{
+ int i = INTVAL (operands[2]);
+
+ emit_move_insn (operands[0], adjust_address (operands[1], SImode, i*4));
+ DONE;
+})
+
(define_expand "sse_storeq"
[(set (match_operand:DI 0 "nonimmediate_operand" "")
(vec_select:DI
diff --git a/gcc/config/i386/sync.md b/gcc/config/i386/sync.md
index 7282381c040..19295bbaff1 100644
--- a/gcc/config/i386/sync.md
+++ b/gcc/config/i386/sync.md
@@ -18,14 +18,14 @@
;; along with GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.
-(define_mode_macro IMODE [QI HI SI (DI "TARGET_64BIT")])
+(define_mode_iterator IMODE [QI HI SI (DI "TARGET_64BIT")])
(define_mode_attr modesuffix [(QI "b") (HI "w") (SI "l") (DI "q")])
(define_mode_attr modeconstraint [(QI "q") (HI "r") (SI "r") (DI "r")])
(define_mode_attr immconstraint [(QI "i") (HI "i") (SI "i") (DI "e")])
-(define_mode_macro CASMODE [QI HI SI (DI "TARGET_64BIT || TARGET_CMPXCHG8B")
+(define_mode_iterator CASMODE [QI HI SI (DI "TARGET_64BIT || TARGET_CMPXCHG8B")
(TI "TARGET_64BIT && TARGET_CMPXCHG16B")])
-(define_mode_macro DCASMODE
+(define_mode_iterator DCASMODE
[(DI "!TARGET_64BIT && TARGET_CMPXCHG8B && !flag_pic")
(TI "TARGET_64BIT && TARGET_CMPXCHG16B")])
(define_mode_attr doublemodesuffix [(DI "8") (TI "16")])
@@ -81,7 +81,7 @@
UNSPECV_CMPXCHG_1))
(clobber (reg:CC FLAGS_REG))]
"TARGET_CMPXCHG"
- "lock cmpxchg{<modesuffix>}\t{%3, %1|%1, %3}")
+ "lock{%;| } cmpxchg{<modesuffix>}\t{%3, %1|%1, %3}")
(define_insn "sync_double_compare_and_swap<mode>"
[(set (match_operand:DCASMODE 0 "register_operand" "=A")
@@ -95,7 +95,7 @@
UNSPECV_CMPXCHG_1))
(clobber (reg:CC FLAGS_REG))]
""
- "lock cmpxchg<doublemodesuffix>b\t%1")
+ "lock{%;| }cmpxchg<doublemodesuffix>b\t%1")
;; Theoretically we'd like to use constraint "r" (any reg) for operand
;; 3, but that includes ecx. If operand 3 and 4 are the same (like when
@@ -118,7 +118,7 @@
UNSPECV_CMPXCHG_1))
(clobber (reg:CC FLAGS_REG))]
"!TARGET_64BIT && TARGET_CMPXCHG8B && flag_pic"
- "xchg{l}\t%%ebx, %3\;lock cmpxchg8b\t%1\;xchg{l}\t%%ebx, %3")
+ "xchg{l}\t%%ebx, %3\;lock{%;| }cmpxchg8b\t%1\;xchg{l}\t%%ebx, %3")
(define_expand "sync_compare_and_swap_cc<mode>"
[(parallel
@@ -176,7 +176,7 @@
[(match_dup 1) (match_dup 2) (match_dup 3)] UNSPECV_CMPXCHG_2)
(match_dup 2)))]
"TARGET_CMPXCHG"
- "lock cmpxchg{<modesuffix>}\t{%3, %1|%1, %3}")
+ "lock{%;| }cmpxchg{<modesuffix>}\t{%3, %1|%1, %3}")
(define_insn "sync_double_compare_and_swap_cc<mode>"
[(set (match_operand:DCASMODE 0 "register_operand" "=A")
@@ -195,7 +195,7 @@
UNSPECV_CMPXCHG_2)
(match_dup 2)))]
""
- "lock cmpxchg<doublemodesuffix>b\t%1")
+ "lock{%;| }cmpxchg<doublemodesuffix>b\t%1")
;; See above for the explanation of using the constraint "SD" for
;; operand 3.
@@ -216,7 +216,7 @@
UNSPECV_CMPXCHG_2)
(match_dup 2)))]
"!TARGET_64BIT && TARGET_CMPXCHG8B && flag_pic"
- "xchg{l}\t%%ebx, %3\;lock cmpxchg8b\t%1\;xchg{l}\t%%ebx, %3")
+ "xchg{l}\t%%ebx, %3\;lock{%;| }cmpxchg8b\t%1\;xchg{l}\t%%ebx, %3")
(define_insn "sync_old_add<mode>"
[(set (match_operand:IMODE 0 "register_operand" "=<modeconstraint>")
@@ -227,7 +227,7 @@
(match_operand:IMODE 2 "register_operand" "0")))
(clobber (reg:CC FLAGS_REG))]
"TARGET_XADD"
- "lock xadd{<modesuffix>}\t{%0, %1|%1, %0}")
+ "lock{%;| }xadd{<modesuffix>}\t{%0, %1|%1, %0}")
;; Recall that xchg implicitly sets LOCK#, so adding it again wastes space.
(define_insn "sync_lock_test_and_set<mode>"
@@ -251,12 +251,12 @@
if (TARGET_USE_INCDEC)
{
if (operands[1] == const1_rtx)
- return "lock inc{<modesuffix>}\t%0";
+ return "lock{%;| }inc{<modesuffix>}\t%0";
if (operands[1] == constm1_rtx)
- return "lock dec{<modesuffix>}\t%0";
+ return "lock{%;| }dec{<modesuffix>}\t%0";
}
- return "lock add{<modesuffix>}\t{%1, %0|%0, %1}";
+ return "lock{%;| }add{<modesuffix>}\t{%1, %0|%0, %1}";
})
(define_insn "sync_sub<mode>"
@@ -271,12 +271,12 @@
if (TARGET_USE_INCDEC)
{
if (operands[1] == const1_rtx)
- return "lock dec{<modesuffix>}\t%0";
+ return "lock{%;| }dec{<modesuffix>}\t%0";
if (operands[1] == constm1_rtx)
- return "lock inc{<modesuffix>}\t%0";
+ return "lock{%;| }inc{<modesuffix>}\t%0";
}
- return "lock sub{<modesuffix>}\t{%1, %0|%0, %1}";
+ return "lock{%;| }sub{<modesuffix>}\t{%1, %0|%0, %1}";
})
(define_insn "sync_ior<mode>"
@@ -287,7 +287,7 @@
UNSPECV_LOCK))
(clobber (reg:CC FLAGS_REG))]
""
- "lock or{<modesuffix>}\t{%1, %0|%0, %1}")
+ "lock{%;| }or{<modesuffix>}\t{%1, %0|%0, %1}")
(define_insn "sync_and<mode>"
[(set (match_operand:IMODE 0 "memory_operand" "+m")
@@ -297,7 +297,7 @@
UNSPECV_LOCK))
(clobber (reg:CC FLAGS_REG))]
""
- "lock and{<modesuffix>}\t{%1, %0|%0, %1}")
+ "lock{%;| }and{<modesuffix>}\t{%1, %0|%0, %1}")
(define_insn "sync_xor<mode>"
[(set (match_operand:IMODE 0 "memory_operand" "+m")
@@ -307,4 +307,4 @@
UNSPECV_LOCK))
(clobber (reg:CC FLAGS_REG))]
""
- "lock xor{<modesuffix>}\t{%1, %0|%0, %1}")
+ "lock{%;| }xor{<modesuffix>}\t{%1, %0|%0, %1}")
diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
index 8de14adbc4a..26fe33670b8 100644
--- a/gcc/config/i386/winnt.c
+++ b/gcc/config/i386/winnt.c
@@ -146,7 +146,7 @@ i386_pe_determine_dllimport_p (tree decl)
/* Handle the -mno-fun-dllimport target switch. */
bool
-i386_pe_valid_dllimport_attribute_p (tree decl)
+i386_pe_valid_dllimport_attribute_p (const_tree decl)
{
if (TARGET_NOP_FUN_DLLIMPORT && TREE_CODE (decl) == FUNCTION_DECL)
return false;
@@ -328,7 +328,7 @@ i386_pe_encode_section_info (tree decl, rtx rtl, int first)
}
bool
-i386_pe_binds_local_p (tree exp)
+i386_pe_binds_local_p (const_tree exp)
{
/* PE does not do dynamic binding. Indeed, the only kind of
non-local reference comes from a dllimport'd symbol. */
diff --git a/gcc/config/ia64/div.md b/gcc/config/ia64/div.md
index d26954b9a1e..a6547a680ff 100644
--- a/gcc/config/ia64/div.md
+++ b/gcc/config/ia64/div.md
@@ -158,7 +158,7 @@
;; to be written for RFmode only and to not have to handle multiple
;; modes or to have to handle a register in more than one mode.
-(define_mode_macro SDX_F [SF DF XF])
+(define_mode_iterator SDX_F [SF DF XF])
(define_insn "extend<mode>rf2"
[(set (match_operand:RF 0 "fr_register_operand" "=f")
diff --git a/gcc/config/ia64/ia64-protos.h b/gcc/config/ia64/ia64-protos.h
index eb230b65f36..e3b78641eb8 100644
--- a/gcc/config/ia64/ia64-protos.h
+++ b/gcc/config/ia64/ia64-protos.h
@@ -77,7 +77,7 @@ extern rtx ia64_function_arg (CUMULATIVE_ARGS *, enum machine_mode,
tree, int, int);
extern rtx ia64_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
extern rtx ia64_va_arg (tree, tree);
-extern rtx ia64_function_value (tree, tree);
+extern rtx ia64_function_value (const_tree, const_tree);
#endif /* RTX_CODE */
extern void ia64_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
@@ -100,7 +100,7 @@ extern void ia64_split_return_addr_rtx (rtx);
#ifdef ARGS_SIZE_RTX
/* expr.h defines ARGS_SIZE_RTX and `enum direction'. */
-extern enum direction ia64_hpux_function_arg_padding (enum machine_mode, tree);
+extern enum direction ia64_hpux_function_arg_padding (enum machine_mode, const_tree);
#endif /* ARGS_SIZE_RTX */
extern void ia64_hpux_handle_builtin_pragma (struct cpp_reader *);
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index bb5515169a3..46f75c5a205 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -169,14 +169,14 @@ static void ia64_dependencies_evaluation_hook (rtx, rtx);
static void ia64_init_dfa_pre_cycle_insn (void);
static rtx ia64_dfa_pre_cycle_insn (void);
static int ia64_first_cycle_multipass_dfa_lookahead_guard (rtx);
-static bool ia64_first_cycle_multipass_dfa_lookahead_guard_spec (rtx);
+static bool ia64_first_cycle_multipass_dfa_lookahead_guard_spec (const_rtx);
static int ia64_dfa_new_cycle (FILE *, int, rtx, int, int, int *);
static void ia64_h_i_d_extended (void);
static int ia64_mode_to_int (enum machine_mode);
static void ia64_set_sched_flags (spec_info_t);
static int ia64_speculate_insn (rtx, ds_t, rtx *);
static rtx ia64_gen_spec_insn (rtx, ds_t, int, bool, bool);
-static bool ia64_needs_block_p (rtx);
+static bool ia64_needs_block_p (const_rtx);
static rtx ia64_gen_check (rtx, rtx, bool);
static int ia64_spec_check_p (rtx);
static int ia64_spec_check_src_p (rtx);
@@ -195,13 +195,13 @@ static rtx gen_movdi_x (rtx, rtx, rtx);
static rtx gen_fr_spill_x (rtx, rtx, rtx);
static rtx gen_fr_restore_x (rtx, rtx, rtx);
-static enum machine_mode hfa_element_mode (tree, bool);
+static enum machine_mode hfa_element_mode (const_tree, bool);
static void ia64_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
tree, int *, int);
static int ia64_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
static bool ia64_function_ok_for_sibcall (tree, tree);
-static bool ia64_return_in_memory (tree, tree);
+static bool ia64_return_in_memory (const_tree, const_tree);
static bool ia64_rtx_costs (rtx, int, int, int *);
static void fix_range (const char *);
static bool ia64_handle_option (size_t, const char *, int);
@@ -211,7 +211,7 @@ static void emit_all_insn_group_barriers (FILE *);
static void final_emit_insn_group_barriers (FILE *);
static void emit_predicate_relation_info (void);
static void ia64_reorg (void);
-static bool ia64_in_small_data_p (tree);
+static bool ia64_in_small_data_p (const_tree);
static void process_epilogue (FILE *, rtx, bool, bool);
static int process_set (FILE *, rtx, rtx, bool, bool);
@@ -278,10 +278,10 @@ static tree ia64_gimplify_va_arg (tree, tree, tree *, tree *);
static bool ia64_scalar_mode_supported_p (enum machine_mode mode);
static bool ia64_vector_mode_supported_p (enum machine_mode mode);
static bool ia64_cannot_force_const_mem (rtx);
-static const char *ia64_mangle_type (tree);
-static const char *ia64_invalid_conversion (tree, tree);
-static const char *ia64_invalid_unary_op (int, tree);
-static const char *ia64_invalid_binary_op (int, tree, tree);
+static const char *ia64_mangle_type (const_tree);
+static const char *ia64_invalid_conversion (const_tree, const_tree);
+static const char *ia64_invalid_unary_op (int, const_tree);
+static const char *ia64_invalid_binary_op (int, const_tree, const_tree);
static enum machine_mode ia64_c_mode_for_suffix (char);
/* Table of valid machine attributes. */
@@ -396,7 +396,7 @@ static const struct attribute_spec ia64_attribute_table[] =
#undef TARGET_ASM_OUTPUT_MI_THUNK
#define TARGET_ASM_OUTPUT_MI_THUNK ia64_output_mi_thunk
#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
-#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_tree_hwi_hwi_tree_true
+#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_const_tree_hwi_hwi_const_tree_true
#undef TARGET_ASM_FILE_START
#define TARGET_ASM_FILE_START ia64_file_start
@@ -3870,7 +3870,7 @@ ia64_setup_incoming_varargs (CUMULATIVE_ARGS *cum, enum machine_mode mode,
aggregates are excluded because our parallels crash the middle-end. */
static enum machine_mode
-hfa_element_mode (tree type, bool nested)
+hfa_element_mode (const_tree type, bool nested)
{
enum machine_mode element_mode = VOIDmode;
enum machine_mode mode;
@@ -4346,7 +4346,7 @@ ia64_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
in a register. */
static bool
-ia64_return_in_memory (tree valtype, tree fntype ATTRIBUTE_UNUSED)
+ia64_return_in_memory (const_tree valtype, const_tree fntype ATTRIBUTE_UNUSED)
{
enum machine_mode mode;
enum machine_mode hfa_mode;
@@ -4382,7 +4382,7 @@ ia64_return_in_memory (tree valtype, tree fntype ATTRIBUTE_UNUSED)
/* Return rtx for register that holds the function return value. */
rtx
-ia64_function_value (tree valtype, tree func ATTRIBUTE_UNUSED)
+ia64_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED)
{
enum machine_mode mode;
enum machine_mode hfa_mode;
@@ -6578,7 +6578,7 @@ ia64_first_cycle_multipass_dfa_lookahead_guard (rtx insn)
can be chosen. */
static bool
-ia64_first_cycle_multipass_dfa_lookahead_guard_spec (rtx insn)
+ia64_first_cycle_multipass_dfa_lookahead_guard_spec (const_rtx insn)
{
gcc_assert (insn && INSN_P (insn));
/* Size of ALAT is 32. As far as we perform conservative data speculation,
@@ -7039,7 +7039,7 @@ enum { SPEC_GEN_CHECK_MUTATION_OFFSET = 5 * SPEC_N };
/* Return nonzero, if INSN needs branchy recovery check. */
static bool
-ia64_needs_block_p (rtx insn)
+ia64_needs_block_p (const_rtx insn)
{
int check_no;
@@ -7376,7 +7376,8 @@ static htab_t bundle_state_table;
static unsigned
bundle_state_hash (const void *bundle_state)
{
- const struct bundle_state *state = (struct bundle_state *) bundle_state;
+ const struct bundle_state *const state
+ = (const struct bundle_state *) bundle_state;
unsigned result, i;
for (result = i = 0; i < dfa_state_size; i++)
@@ -7390,8 +7391,10 @@ bundle_state_hash (const void *bundle_state)
static int
bundle_state_eq_p (const void *bundle_state_1, const void *bundle_state_2)
{
- const struct bundle_state * state1 = (struct bundle_state *) bundle_state_1;
- const struct bundle_state * state2 = (struct bundle_state *) bundle_state_2;
+ const struct bundle_state *const state1
+ = (const struct bundle_state *) bundle_state_1;
+ const struct bundle_state *const state2
+ = (const struct bundle_state *) bundle_state_2;
return (state1->insn_num == state2->insn_num
&& memcmp (state1->dfa_state, state2->dfa_state,
@@ -8711,7 +8714,7 @@ ia64_eh_uses (int regno)
types which can't go in sdata/sbss. */
static bool
-ia64_in_small_data_p (tree exp)
+ia64_in_small_data_p (const_tree exp)
{
if (TARGET_NO_SDATA)
return false;
@@ -9235,7 +9238,7 @@ ia64_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
most significant bits of the stack slot. */
enum direction
-ia64_hpux_function_arg_padding (enum machine_mode mode, tree type)
+ia64_hpux_function_arg_padding (enum machine_mode mode, const_tree type)
{
/* Exception to normal case for structures/unions/etc. */
@@ -9765,7 +9768,7 @@ ia64_profile_hook (int labelno)
/* Return the mangling of TYPE if it is an extended fundamental type. */
static const char *
-ia64_mangle_type (tree type)
+ia64_mangle_type (const_tree type)
{
type = TYPE_MAIN_VARIANT (type);
@@ -9790,7 +9793,7 @@ ia64_mangle_type (tree type)
/* Return the diagnostic message string if conversion from FROMTYPE to
TOTYPE is not allowed, NULL otherwise. */
static const char *
-ia64_invalid_conversion (tree fromtype, tree totype)
+ia64_invalid_conversion (const_tree fromtype, const_tree totype)
{
/* Reject nontrivial conversion to or from __fpreg. */
if (TYPE_MODE (fromtype) == RFmode
@@ -9806,7 +9809,7 @@ ia64_invalid_conversion (tree fromtype, tree totype)
/* Return the diagnostic message string if the unary operation OP is
not permitted on TYPE, NULL otherwise. */
static const char *
-ia64_invalid_unary_op (int op, tree type)
+ia64_invalid_unary_op (int op, const_tree type)
{
/* Reject operations on __fpreg other than unary + or &. */
if (TYPE_MODE (type) == RFmode
@@ -9819,7 +9822,7 @@ ia64_invalid_unary_op (int op, tree type)
/* Return the diagnostic message string if the binary operation OP is
not permitted on TYPE1 and TYPE2, NULL otherwise. */
static const char *
-ia64_invalid_binary_op (int op ATTRIBUTE_UNUSED, tree type1, tree type2)
+ia64_invalid_binary_op (int op ATTRIBUTE_UNUSED, const_tree type1, const_tree type2)
{
/* Reject operations on __fpreg. */
if (TYPE_MODE (type1) == RFmode || TYPE_MODE (type2) == RFmode)
diff --git a/gcc/config/ia64/ia64.md b/gcc/config/ia64/ia64.md
index 2cbec722e03..52f26aa84ab 100644
--- a/gcc/config/ia64/ia64.md
+++ b/gcc/config/ia64/ia64.md
@@ -385,8 +385,8 @@
}
[(set_attr "itanium_class" "ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,fld,stf,frbr,tobr,frar_i,toar_i,frar_m,toar_m,frpr,topr")])
-(define_mode_macro MODE [BI QI HI SI DI SF DF XF TI])
-(define_mode_macro MODE_FOR_EXTEND [QI HI SI])
+(define_mode_iterator MODE [BI QI HI SI DI SF DF XF TI])
+(define_mode_iterator MODE_FOR_EXTEND [QI HI SI])
(define_mode_attr output_a [
(BI "ld1.a %0 = %1%P1")
diff --git a/gcc/config/ia64/sync.md b/gcc/config/ia64/sync.md
index 9d9957762a6..c467b0db097 100644
--- a/gcc/config/ia64/sync.md
+++ b/gcc/config/ia64/sync.md
@@ -18,12 +18,12 @@
;; along with GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.
-(define_mode_macro IMODE [QI HI SI DI])
-(define_mode_macro I124MODE [QI HI SI])
-(define_mode_macro I48MODE [SI DI])
+(define_mode_iterator IMODE [QI HI SI DI])
+(define_mode_iterator I124MODE [QI HI SI])
+(define_mode_iterator I48MODE [SI DI])
(define_mode_attr modesuffix [(QI "1") (HI "2") (SI "4") (DI "8")])
-(define_code_macro FETCHOP [plus minus ior xor and])
+(define_code_iterator FETCHOP [plus minus ior xor and])
(define_code_attr fetchop_name
[(plus "add") (minus "sub") (ior "ior") (xor "xor") (and "and")])
diff --git a/gcc/config/ia64/vect.md b/gcc/config/ia64/vect.md
index bca5d8c857d..994ec90b2eb 100644
--- a/gcc/config/ia64/vect.md
+++ b/gcc/config/ia64/vect.md
@@ -20,9 +20,9 @@
;; Integer vector operations
-(define_mode_macro VECINT [V8QI V4HI V2SI])
-(define_mode_macro VECINT12 [V8QI V4HI])
-(define_mode_macro VECINT24 [V4HI V2SI])
+(define_mode_iterator VECINT [V8QI V4HI V2SI])
+(define_mode_iterator VECINT12 [V8QI V4HI])
+(define_mode_iterator VECINT24 [V4HI V2SI])
(define_mode_attr vecsize [(V8QI "1") (V4HI "2") (V2SI "4")])
(define_expand "mov<mode>"
diff --git a/gcc/config/iq2000/iq2000-protos.h b/gcc/config/iq2000/iq2000-protos.h
index 3b2782ce739..9b6837ef975 100644
--- a/gcc/config/iq2000/iq2000-protos.h
+++ b/gcc/config/iq2000/iq2000-protos.h
@@ -47,9 +47,9 @@ extern void gen_conditional_branch (rtx *, enum rtx_code);
#ifdef TREE_CODE
extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx);
extern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
-extern struct rtx_def * function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
+extern struct rtx_def * function_arg (CUMULATIVE_ARGS *, enum machine_mode, const_tree, int);
extern void iq2000_va_start (tree, rtx);
-extern rtx iq2000_function_value (tree, tree);
+extern rtx iq2000_function_value (const_tree, const_tree);
#endif
#endif /* ! GCC_IQ2000_PROTOS_H */
diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c
index ceb2d79546e..782aa72cbb1 100644
--- a/gcc/config/iq2000/iq2000.c
+++ b/gcc/config/iq2000/iq2000.c
@@ -157,16 +157,15 @@ static section *iq2000_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
static void iq2000_init_builtins (void);
static rtx iq2000_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
-static bool iq2000_return_in_memory (tree, tree);
+static bool iq2000_return_in_memory (const_tree, const_tree);
static void iq2000_setup_incoming_varargs (CUMULATIVE_ARGS *,
enum machine_mode, tree, int *,
int);
static bool iq2000_rtx_costs (rtx, int, int, int *);
static int iq2000_address_cost (rtx);
static section *iq2000_select_section (tree, int, unsigned HOST_WIDE_INT);
-static bool iq2000_return_in_memory (tree, tree);
static bool iq2000_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
- tree, bool);
+ const_tree, bool);
static int iq2000_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
@@ -191,11 +190,11 @@ static int iq2000_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
#define TARGET_HAVE_SWITCHABLE_BSS_SECTIONS false
#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY iq2000_return_in_memory
@@ -1184,7 +1183,7 @@ function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
and type TYPE in CUM, or 0 if the argument is to be passed on the stack. */
struct rtx_def *
-function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
+function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, const_tree type,
int named)
{
rtx ret;
@@ -1202,7 +1201,7 @@ function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
"function_arg( {gp reg found = %d, arg # = %2d, words = %2d}, %4s, ",
cum->gp_reg_found, cum->arg_number, cum->arg_words,
GET_MODE_NAME (mode));
- fprintf (stderr, "%p", (void *) type);
+ fprintf (stderr, "%p", (const void *) type);
fprintf (stderr, ", %d ) = ", named);
}
@@ -2199,7 +2198,7 @@ iq2000_select_section (tree decl, int reloc ATTRIBUTE_UNUSED,
FUNC. */
rtx
-iq2000_function_value (tree valtype, tree func ATTRIBUTE_UNUSED)
+iq2000_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED)
{
int reg = GP_RETURN;
enum machine_mode mode = TYPE_MODE (valtype);
@@ -2216,7 +2215,7 @@ iq2000_function_value (tree valtype, tree func ATTRIBUTE_UNUSED)
static bool
iq2000_pass_by_reference (CUMULATIVE_ARGS *cum, enum machine_mode mode,
- tree type, bool named ATTRIBUTE_UNUSED)
+ const_tree type, bool named ATTRIBUTE_UNUSED)
{
int size;
@@ -2825,7 +2824,7 @@ iq2000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
/* Worker function for TARGET_RETURN_IN_MEMORY. */
static bool
-iq2000_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+iq2000_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
{
return ((int_size_in_bytes (type) > (2 * UNITS_PER_WORD))
|| (int_size_in_bytes (type) == -1));
diff --git a/gcc/config/iq2000/iq2000.h b/gcc/config/iq2000/iq2000.h
index 2f2a4f4baa9..dcf7ab62f06 100644
--- a/gcc/config/iq2000/iq2000.h
+++ b/gcc/config/iq2000/iq2000.h
@@ -756,7 +756,8 @@ while (0)
#undef ASM_OUTPUT_SKIP
#define ASM_OUTPUT_SKIP(STREAM,SIZE) \
- fprintf (STREAM, "\t.space\t%u\n", (SIZE))
+ fprintf (STREAM, "\t.space\t" HOST_WIDE_INT_PRINT_UNSIGNED "\n", \
+ (unsigned HOST_WIDE_INT)(SIZE))
#define ASM_OUTPUT_ALIGN(STREAM,LOG) \
if ((LOG) != 0) \
diff --git a/gcc/config/m32c/blkmov.md b/gcc/config/m32c/blkmov.md
index 17076b2e8d5..a734f71789b 100644
--- a/gcc/config/m32c/blkmov.md
+++ b/gcc/config/m32c/blkmov.md
@@ -51,7 +51,7 @@
"if (m32c_expand_movmemhi(operands)) DONE; FAIL;"
)
-;; We can't use mode macros for these because M16C uses r1h to extend
+;; We can't use mode iterators for these because M16C uses r1h to extend
;; the source address, for copying data from ROM to RAM. We don't yet
;; support that, but we need to zero our r1h, so the patterns differ.
diff --git a/gcc/config/m32c/m32c-protos.h b/gcc/config/m32c/m32c-protos.h
index ecc77b443d9..a63191c21ab 100644
--- a/gcc/config/m32c/m32c-protos.h
+++ b/gcc/config/m32c/m32c-protos.h
@@ -50,7 +50,7 @@ void m32c_unpend_compare (void);
#if defined(RTX_CODE) && defined(TREE_CODE)
rtx m32c_function_arg (CUMULATIVE_ARGS *, MM, tree, int);
-rtx m32c_function_value (tree, tree);
+rtx m32c_function_value (const_tree, const_tree);
#endif
@@ -110,7 +110,7 @@ int m32c_split_psi_p (rtx *);
void m32c_function_arg_advance (CUMULATIVE_ARGS *, MM, tree, int);
tree m32c_gimplify_va_arg_expr (tree, tree, tree *, tree *);
void m32c_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, int);
-bool m32c_promote_function_return (tree);
+bool m32c_promote_function_return (const_tree);
int m32c_special_page_vector_p (tree);
#endif
diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c
index b2885b4db00..de983110272 100644
--- a/gcc/config/m32c/m32c.c
+++ b/gcc/config/m32c/m32c.c
@@ -64,13 +64,13 @@ static tree interrupt_handler (tree *, tree, tree, int, bool *);
static tree function_vector_handler (tree *, tree, tree, int, bool *);
static int interrupt_p (tree node);
static bool m32c_asm_integer (rtx, unsigned int, int);
-static int m32c_comp_type_attributes (tree, tree);
+static int m32c_comp_type_attributes (const_tree, const_tree);
static bool m32c_fixed_condition_code_regs (unsigned int *, unsigned int *);
static struct machine_function *m32c_init_machine_status (void);
static void m32c_insert_attributes (tree, tree *);
static bool m32c_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
- tree, bool);
-static bool m32c_promote_prototypes (tree);
+ const_tree, bool);
+static bool m32c_promote_prototypes (const_tree);
static int m32c_pushm_popm (Push_Pop_Type);
static bool m32c_strict_argument_naming (CUMULATIVE_ARGS *);
static rtx m32c_struct_value_rtx (tree, int);
@@ -445,7 +445,7 @@ m32c_init_expanders (void)
#undef TARGET_PROMOTE_FUNCTION_RETURN
#define TARGET_PROMOTE_FUNCTION_RETURN m32c_promote_function_return
bool
-m32c_promote_function_return (tree fntype ATTRIBUTE_UNUSED)
+m32c_promote_function_return (const_tree fntype ATTRIBUTE_UNUSED)
{
return false;
}
@@ -1427,7 +1427,7 @@ m32c_initial_elimination_offset (int from, int to)
#undef TARGET_PROMOTE_PROTOTYPES
#define TARGET_PROMOTE_PROTOTYPES m32c_promote_prototypes
static bool
-m32c_promote_prototypes (tree fntype ATTRIBUTE_UNUSED)
+m32c_promote_prototypes (const_tree fntype ATTRIBUTE_UNUSED)
{
return 0;
}
@@ -1514,7 +1514,7 @@ m32c_function_arg (CUMULATIVE_ARGS * ca,
static bool
m32c_pass_by_reference (CUMULATIVE_ARGS * ca ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED,
- tree type ATTRIBUTE_UNUSED,
+ const_tree type ATTRIBUTE_UNUSED,
bool named ATTRIBUTE_UNUSED)
{
return 0;
@@ -1639,10 +1639,10 @@ m32c_libcall_value (enum machine_mode mode)
/* Implements FUNCTION_VALUE. Functions and libcalls have the same
conventions. */
rtx
-m32c_function_value (tree valtype, tree func ATTRIBUTE_UNUSED)
+m32c_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED)
{
/* return reg or parallel */
- enum machine_mode mode = TYPE_MODE (valtype);
+ const enum machine_mode mode = TYPE_MODE (valtype);
return m32c_libcall_value (mode);
}
@@ -2829,8 +2829,8 @@ static const struct attribute_spec m32c_attribute_table[] = {
#undef TARGET_COMP_TYPE_ATTRIBUTES
#define TARGET_COMP_TYPE_ATTRIBUTES m32c_comp_type_attributes
static int
-m32c_comp_type_attributes (tree type1 ATTRIBUTE_UNUSED,
- tree type2 ATTRIBUTE_UNUSED)
+m32c_comp_type_attributes (const_tree type1 ATTRIBUTE_UNUSED,
+ const_tree type2 ATTRIBUTE_UNUSED)
{
/* 0=incompatible 1=compatible 2=warning */
return 1;
diff --git a/gcc/config/m32c/m32c.md b/gcc/config/m32c/m32c.md
index 8110c0a7247..4bc4d05fbf1 100644
--- a/gcc/config/m32c/m32c.md
+++ b/gcc/config/m32c/m32c.md
@@ -54,15 +54,15 @@
(define_attr "flags" "x,c,z,zc,s,sc,sz,szc,o,oc,oz,ozc,os,osc,osz,oszc,n" (const_string "n"))
(define_asm_attributes [(set_attr "flags" "x")])
-(define_mode_macro QHI [QI HI])
-(define_mode_macro HPSI [(HI "TARGET_A16") (PSI "TARGET_A24")])
-(define_mode_macro QHPSI [QI HI (PSI "TARGET_A24")])
-(define_mode_macro QHSI [QI HI (SI "TARGET_A24")])
+(define_mode_iterator QHI [QI HI])
+(define_mode_iterator HPSI [(HI "TARGET_A16") (PSI "TARGET_A24")])
+(define_mode_iterator QHPSI [QI HI (PSI "TARGET_A24")])
+(define_mode_iterator QHSI [QI HI (SI "TARGET_A24")])
(define_mode_attr bwl [(QI "b") (HI "w") (PSI "l") (SI "l")])
-(define_code_macro any_cond [eq ne gt ge lt le gtu geu ltu leu])
-(define_code_macro eqne_cond [eq ne])
-(define_code_macro gl_cond [gt ge lt le gtu geu ltu leu])
+(define_code_iterator any_cond [eq ne gt ge lt le gtu geu ltu leu])
+(define_code_iterator eqne_cond [eq ne])
+(define_code_iterator gl_cond [gt ge lt le gtu geu ltu leu])
diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c
index d4d54a0bf6f..1edd6597211 100644
--- a/gcc/config/m32r/m32r.c
+++ b/gcc/config/m32r/m32r.c
@@ -80,14 +80,14 @@ static int m32r_adjust_priority (rtx, int);
static int m32r_issue_rate (void);
static void m32r_encode_section_info (tree, rtx, int);
-static bool m32r_in_small_data_p (tree);
-static bool m32r_return_in_memory (tree, tree);
+static bool m32r_in_small_data_p (const_tree);
+static bool m32r_return_in_memory (const_tree, const_tree);
static void m32r_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
tree, int *, int);
static void init_idents (void);
static bool m32r_rtx_costs (rtx, int, int, int *);
static bool m32r_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
- tree, bool);
+ const_tree, bool);
static int m32r_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
@@ -129,7 +129,7 @@ static int m32r_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
#define TARGET_ADDRESS_COST hook_int_rtx_0
#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY m32r_return_in_memory
#undef TARGET_SETUP_INCOMING_VARARGS
@@ -445,9 +445,9 @@ m32r_encode_section_info (tree decl, rtx rtl, int first)
the object doesn't fit the linker will give an error. */
static bool
-m32r_in_small_data_p (tree decl)
+m32r_in_small_data_p (const_tree decl)
{
- tree section;
+ const_tree section;
if (TREE_CODE (decl) != VAR_DECL)
return false;
@@ -458,7 +458,7 @@ m32r_in_small_data_p (tree decl)
section = DECL_SECTION_NAME (decl);
if (section)
{
- char *name = (char *) TREE_STRING_POINTER (section);
+ const char *const name = TREE_STRING_POINTER (section);
if (strcmp (name, ".sdata") == 0 || strcmp (name, ".sbss") == 0)
return true;
}
@@ -639,7 +639,7 @@ memreg_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
static bool
m32r_pass_by_reference (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
- enum machine_mode mode, tree type,
+ enum machine_mode mode, const_tree type,
bool named ATTRIBUTE_UNUSED)
{
int size;
@@ -1006,7 +1006,7 @@ m32r_arg_partial_bytes (CUMULATIVE_ARGS *cum, enum machine_mode mode,
/* Worker function for TARGET_RETURN_IN_MEMORY. */
static bool
-m32r_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+m32r_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
{
return m32r_pass_by_reference (NULL, TYPE_MODE (type), type, false);
}
diff --git a/gcc/config/m68hc11/m68hc11-protos.h b/gcc/config/m68hc11/m68hc11-protos.h
index 7fed9a88b59..1e9cf585904 100644
--- a/gcc/config/m68hc11/m68hc11-protos.h
+++ b/gcc/config/m68hc11/m68hc11-protos.h
@@ -111,7 +111,7 @@ extern void m68hc11_init_cumulative_args (CUMULATIVE_ARGS*, tree, rtx);
extern rtx m68hc11_function_arg (const CUMULATIVE_ARGS* ,
enum machine_mode,
tree, int);
-extern int m68hc11_function_arg_padding (enum machine_mode, tree);
+extern int m68hc11_function_arg_padding (enum machine_mode, const_tree);
extern void m68hc11_function_epilogue (FILE*,int);
diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c
index dd9b45b19c0..0232eda25d9 100644
--- a/gcc/config/m68hc11/m68hc11.c
+++ b/gcc/config/m68hc11/m68hc11.c
@@ -88,7 +88,7 @@ static int autoinc_mode (rtx);
static int m68hc11_make_autoinc_notes (rtx *, void *);
static void m68hc11_init_libfuncs (void);
static rtx m68hc11_struct_value_rtx (tree, int);
-static bool m68hc11_return_in_memory (tree, tree);
+static bool m68hc11_return_in_memory (const_tree, const_tree);
/* Must be set to 1 to produce debug messages. */
int debug_m6811 = 0;
@@ -1479,7 +1479,7 @@ m68hc11_function_arg (const CUMULATIVE_ARGS *cum, enum machine_mode mode,
Structures are stored left shifted in their argument slot. */
int
-m68hc11_function_arg_padding (enum machine_mode mode, tree type)
+m68hc11_function_arg_padding (enum machine_mode mode, const_tree type)
{
if (type != 0 && AGGREGATE_TYPE_P (type))
return upward;
@@ -5483,7 +5483,7 @@ m68hc11_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED,
in the register (D + X = 4). */
static bool
-m68hc11_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+m68hc11_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
{
if (TYPE_MODE (type) == BLKmode)
{
diff --git a/gcc/config/m68hc11/m68hc11.h b/gcc/config/m68hc11/m68hc11.h
index efe83f8948f..7034c93b30e 100644
--- a/gcc/config/m68hc11/m68hc11.h
+++ b/gcc/config/m68hc11/m68hc11.h
@@ -1407,6 +1407,7 @@ do { \
/* Output #ident as a .ident. */
/* output external reference */
+#undef ASM_OUTPUT_EXTERNAL
#define ASM_OUTPUT_EXTERNAL(FILE,DECL,NAME) \
{fputs ("\t; extern\t", FILE); \
assemble_name (FILE, NAME); \
diff --git a/gcc/config/m68k/linux.h b/gcc/config/m68k/linux.h
index f09a2c7e551..cdd510b2988 100644
--- a/gcc/config/m68k/linux.h
+++ b/gcc/config/m68k/linux.h
@@ -31,6 +31,8 @@ along with GCC; see the file COPYING3. If not see
#undef STRICT_ALIGNMENT
#define STRICT_ALIGNMENT 0
+#undef M68K_HONOR_TARGET_STRICT_ALIGNMENT
+#define M68K_HONOR_TARGET_STRICT_ALIGNMENT 0
/* Here are four prefixes that are used by asm_fprintf to
facilitate customization for alternate assembler syntaxes.
diff --git a/gcc/config/m68k/m68k-protos.h b/gcc/config/m68k/m68k-protos.h
index 5be0a3ef6d3..c6d6d33a3a8 100644
--- a/gcc/config/m68k/m68k-protos.h
+++ b/gcc/config/m68k/m68k-protos.h
@@ -60,7 +60,7 @@ extern bool m68k_matches_u_p (rtx);
extern rtx legitimize_pic_address (rtx, enum machine_mode, rtx);
extern int valid_dbcc_comparison_p_2 (rtx, enum machine_mode);
extern rtx m68k_libcall_value (enum machine_mode);
-extern rtx m68k_function_value (tree, tree);
+extern rtx m68k_function_value (const_tree, const_tree);
extern int emit_move_sequence (rtx *, enum machine_mode, rtx);
extern bool m68k_movem_pattern_p (rtx, rtx, HOST_WIDE_INT, bool);
extern const char *m68k_output_movem (rtx *, rtx, HOST_WIDE_INT, bool);
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
index 621035050fe..f1f09bc86c1 100644
--- a/gcc/config/m68k/m68k.c
+++ b/gcc/config/m68k/m68k.c
@@ -134,6 +134,9 @@ static void m68k_compute_frame_layout (void);
static bool m68k_save_reg (unsigned int regno, bool interrupt_handler);
static bool m68k_ok_for_sibcall_p (tree, tree);
static bool m68k_rtx_costs (rtx, int, int, int *);
+#if M68K_HONOR_TARGET_STRICT_ALIGNMENT
+static bool m68k_return_in_memory (tree, tree);
+#endif
/* Specify the identification number of the library being built */
@@ -177,7 +180,7 @@ int m68k_last_compare_had_fp_operands;
#undef TARGET_ASM_OUTPUT_MI_THUNK
#define TARGET_ASM_OUTPUT_MI_THUNK m68k_output_mi_thunk
#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
-#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_tree_hwi_hwi_tree_true
+#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_const_tree_hwi_hwi_const_tree_true
#undef TARGET_ASM_FILE_START_APP_OFF
#define TARGET_ASM_FILE_START_APP_OFF true
@@ -194,7 +197,7 @@ int m68k_last_compare_had_fp_operands;
#define TARGET_ATTRIBUTE_TABLE m68k_attribute_table
#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
#undef TARGET_STRUCT_VALUE_RTX
#define TARGET_STRUCT_VALUE_RTX m68k_struct_value_rtx
@@ -205,6 +208,11 @@ int m68k_last_compare_had_fp_operands;
#undef TARGET_FUNCTION_OK_FOR_SIBCALL
#define TARGET_FUNCTION_OK_FOR_SIBCALL m68k_ok_for_sibcall_p
+#if M68K_HONOR_TARGET_STRICT_ALIGNMENT
+#undef TARGET_RETURN_IN_MEMORY
+#define TARGET_RETURN_IN_MEMORY m68k_return_in_memory
+#endif
+
static const struct attribute_spec m68k_attribute_table[] =
{
/* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
@@ -631,9 +639,8 @@ m68k_get_function_kind (tree func)
{
tree a;
- if (TREE_CODE (func) != FUNCTION_DECL)
- return false;
-
+ gcc_assert (TREE_CODE (func) == FUNCTION_DECL);
+
a = lookup_attribute ("interrupt", DECL_ATTRIBUTES (func));
if (a != NULL_TREE)
return m68k_fk_interrupt_handler;
@@ -1250,14 +1257,30 @@ flags_in_68881 (void)
return cc_status.flags & CC_IN_68881;
}
-/* Implement TARGET_FUNCTION_OK_FOR_SIBCALL_P. We cannot use sibcalls
- for nested functions because we use the static chain register for
- indirect calls. */
+/* Implement TARGET_FUNCTION_OK_FOR_SIBCALL_P. */
static bool
-m68k_ok_for_sibcall_p (tree decl ATTRIBUTE_UNUSED, tree exp)
+m68k_ok_for_sibcall_p (tree decl, tree exp)
{
- return TREE_OPERAND (exp, 2) == NULL;
+ enum m68k_function_kind kind;
+
+ /* We cannot use sibcalls for nested functions because we use the
+ static chain register for indirect calls. */
+ if (CALL_EXPR_STATIC_CHAIN (exp))
+ return false;
+
+ kind = m68k_get_function_kind (current_function_decl);
+ if (kind == m68k_fk_normal_function)
+ /* We can always sibcall from a normal function, because it's
+ undefined if it is calling an interrupt function. */
+ return true;
+
+ /* Otherwise we can only sibcall if the function kind is known to be
+ the same. */
+ if (decl && m68k_get_function_kind (decl) == kind)
+ return true;
+
+ return false;
}
/* Convert X to a legitimate function call memory reference and return the
@@ -4347,7 +4370,7 @@ m68k_libcall_value (enum machine_mode mode)
}
rtx
-m68k_function_value (tree valtype, tree func ATTRIBUTE_UNUSED)
+m68k_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED)
{
enum machine_mode mode;
@@ -4386,3 +4409,25 @@ m68k_function_value (tree valtype, tree func ATTRIBUTE_UNUSED)
else
return gen_rtx_REG (mode, D0_REG);
}
+
+/* Worker function for TARGET_RETURN_IN_MEMORY. */
+#if M68K_HONOR_TARGET_STRICT_ALIGNMENT
+static bool
+m68k_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+{
+ enum machine_mode mode = TYPE_MODE (type);
+
+ if (mode == BLKmode)
+ return true;
+
+ /* If TYPE's known alignment is less than the alignment of MODE that
+ would contain the structure, then return in memory. We need to
+ do so to maintain the compatibility between code compiled with
+ -mstrict-align and that compiled with -mno-strict-align. */
+ if (AGGREGATE_TYPE_P (type)
+ && TYPE_ALIGN (type) < GET_MODE_ALIGNMENT (mode))
+ return true;
+
+ return false;
+}
+#endif
diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
index 75d6d6a0e50..a5f6eedf070 100644
--- a/gcc/config/m68k/m68k.h
+++ b/gcc/config/m68k/m68k.h
@@ -310,6 +310,7 @@ along with GCC; see the file COPYING3. If not see
#define BIGGEST_ALIGNMENT (TARGET_ALIGN_INT ? 32 : 16)
#define STRICT_ALIGNMENT (TARGET_STRICT_ALIGNMENT)
+#define M68K_HONOR_TARGET_STRICT_ALIGNMENT 1
#define INT_TYPE_SIZE (TARGET_SHORT ? 16 : 32)
diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
index 03f14fc860f..99ee142d6d1 100644
--- a/gcc/config/m68k/m68k.md
+++ b/gcc/config/m68k/m68k.md
@@ -138,7 +138,7 @@
;; Mode macros for floating point operations.
;; Valid floating point modes
-(define_mode_macro FP [SF DF (XF "TARGET_68881")])
+(define_mode_iterator FP [SF DF (XF "TARGET_68881")])
;; Mnemonic infix to round result
(define_mode_attr round [(SF "%$") (DF "%&") (XF "")])
;; Mnemonic infix to round result for mul or div instruction
diff --git a/gcc/config/mcore/mcore-protos.h b/gcc/config/mcore/mcore-protos.h
index 301742fc9b6..93c7c11e766 100644
--- a/gcc/config/mcore/mcore-protos.h
+++ b/gcc/config/mcore/mcore-protos.h
@@ -36,11 +36,11 @@ extern int mcore_naked_function_p (void);
#ifdef TREE_CODE
#ifdef HAVE_MACHINE_MODES
-extern int mcore_num_arg_regs (enum machine_mode, tree);
+extern int mcore_num_arg_regs (enum machine_mode, const_tree);
#endif /* HAVE_MACHINE_MODES */
#ifdef RTX_CODE
-extern rtx mcore_function_value (tree, tree);
+extern rtx mcore_function_value (const_tree, const_tree);
#endif /* RTX_CODE */
#endif /* TREE_CODE */
diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c
index d419899c520..cb54ee5a4f3 100644
--- a/gcc/config/mcore/mcore.c
+++ b/gcc/config/mcore/mcore.c
@@ -126,7 +126,7 @@ static rtx emit_new_cond_insn (rtx, int);
static rtx conditionalize_block (rtx);
static void conditionalize_optimization (void);
static void mcore_reorg (void);
-static rtx handle_structs_in_regs (enum machine_mode, tree, int);
+static rtx handle_structs_in_regs (enum machine_mode, const_tree, int);
static void mcore_mark_dllexport (tree);
static void mcore_mark_dllimport (tree);
static int mcore_dllexport_p (tree);
@@ -145,7 +145,7 @@ static int mcore_and_cost (rtx);
static int mcore_ior_cost (rtx);
static bool mcore_rtx_costs (rtx, int, int, int *);
static void mcore_external_libcall (rtx);
-static bool mcore_return_in_memory (tree, tree);
+static bool mcore_return_in_memory (const_tree, const_tree);
static int mcore_arg_partial_bytes (CUMULATIVE_ARGS *,
enum machine_mode,
tree, bool);
@@ -187,11 +187,11 @@ static int mcore_arg_partial_bytes (CUMULATIVE_ARGS *,
#define TARGET_MACHINE_DEPENDENT_REORG mcore_reorg
#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY mcore_return_in_memory
@@ -2662,7 +2662,7 @@ mcore_override_options (void)
hold a function argument of mode MODE and type TYPE. */
int
-mcore_num_arg_regs (enum machine_mode mode, tree type)
+mcore_num_arg_regs (enum machine_mode mode, const_tree type)
{
int size;
@@ -2678,7 +2678,7 @@ mcore_num_arg_regs (enum machine_mode mode, tree type)
}
static rtx
-handle_structs_in_regs (enum machine_mode mode, tree type, int reg)
+handle_structs_in_regs (enum machine_mode mode, const_tree type, int reg)
{
int size;
@@ -2722,7 +2722,7 @@ handle_structs_in_regs (enum machine_mode mode, tree type, int reg)
}
rtx
-mcore_function_value (tree valtype, tree func ATTRIBUTE_UNUSED)
+mcore_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED)
{
enum machine_mode mode;
int unsigned_p;
@@ -3102,8 +3102,8 @@ mcore_external_libcall (rtx fun)
/* Worker function for TARGET_RETURN_IN_MEMORY. */
static bool
-mcore_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+mcore_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
{
- HOST_WIDE_INT size = int_size_in_bytes (type);
+ const HOST_WIDE_INT size = int_size_in_bytes (type);
return (size == -1 || size > 2 * UNITS_PER_WORD);
}
diff --git a/gcc/config/mips/mips-dsp.md b/gcc/config/mips/mips-dsp.md
index 3fdcc593001..60b3a94ee6a 100644
--- a/gcc/config/mips/mips-dsp.md
+++ b/gcc/config/mips/mips-dsp.md
@@ -6,18 +6,18 @@
(CCDSP_CC_REGNUM 186)
(CCDSP_EF_REGNUM 187)])
-;; This mode macro allows si, v2hi, v4qi for all possible modes in DSP ASE.
-(define_mode_macro DSP [(SI "TARGET_DSP")
- (V2HI "TARGET_DSP")
- (V4QI "TARGET_DSP")])
-
-;; This mode macro allows v2hi, v4qi for vector/SIMD data.
-(define_mode_macro DSPV [(V2HI "TARGET_DSP")
- (V4QI "TARGET_DSP")])
-
-;; This mode macro allows si, v2hi for Q31 and V2Q15 fixed-point data.
-(define_mode_macro DSPQ [(SI "TARGET_DSP")
- (V2HI "TARGET_DSP")])
+;; This mode iterator allows si, v2hi, v4qi for all possible modes in DSP ASE.
+(define_mode_iterator DSP [(SI "TARGET_DSP")
+ (V2HI "TARGET_DSP")
+ (V4QI "TARGET_DSP")])
+
+;; This mode iterator allows v2hi, v4qi for vector/SIMD data.
+(define_mode_iterator DSPV [(V2HI "TARGET_DSP")
+ (V4QI "TARGET_DSP")])
+
+;; This mode iterator allows si, v2hi for Q31 and V2Q15 fixed-point data.
+(define_mode_iterator DSPQ [(SI "TARGET_DSP")
+ (V2HI "TARGET_DSP")])
;; DSP instructions use q for fixed-point data, and u for integer in the infix.
(define_mode_attr dspfmt1 [(SI "q") (V2HI "q") (V4QI "u")])
diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h
index 0a42ce13c91..623774961e2 100644
--- a/gcc/config/mips/mips-protos.h
+++ b/gcc/config/mips/mips-protos.h
@@ -223,7 +223,7 @@ extern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
extern struct rtx_def *function_arg (const CUMULATIVE_ARGS *,
enum machine_mode, tree, int);
extern int function_arg_boundary (enum machine_mode, tree);
-extern bool mips_pad_arg_upward (enum machine_mode, tree);
+extern bool mips_pad_arg_upward (enum machine_mode, const_tree);
extern bool mips_pad_reg_upward (enum machine_mode, tree);
extern void mips_va_start (tree, rtx);
@@ -262,7 +262,7 @@ extern enum mips_loadgp_style mips_current_loadgp_style (void);
extern void mips_expand_prologue (void);
extern void mips_expand_epilogue (int);
extern int mips_can_use_return_insn (void);
-extern struct rtx_def *mips_function_value (tree, tree, enum machine_mode);
+extern struct rtx_def *mips_function_value (const_tree, const_tree, enum machine_mode);
extern bool mips_cannot_change_mode_class (enum machine_mode,
enum machine_mode, enum reg_class);
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 6f7f2308a62..2c2f11eb66a 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -291,7 +291,7 @@ static bool mips_valid_base_register_p (rtx, enum machine_mode, int);
static bool mips_classify_address (struct mips_address_info *, rtx,
enum machine_mode, int);
static bool mips_cannot_force_const_mem (rtx);
-static bool mips_use_blocks_for_constant_p (enum machine_mode, rtx);
+static bool mips_use_blocks_for_constant_p (enum machine_mode, const_rtx);
static int mips_symbol_insns (enum mips_symbol_type, enum machine_mode);
static bool mips16_unextended_reference_p (enum machine_mode mode, rtx, rtx);
static rtx mips_force_temporary (rtx, rtx);
@@ -344,10 +344,10 @@ static int symbolic_expression_p (rtx);
static section *mips_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
static section *mips_function_rodata_section (tree);
-static bool mips_in_small_data_p (tree);
-static bool mips_use_anchors_for_symbol_p (rtx);
-static int mips_fpr_return_fields (tree, tree *);
-static bool mips_return_in_msb (tree);
+static bool mips_in_small_data_p (const_tree);
+static bool mips_use_anchors_for_symbol_p (const_rtx);
+static int mips_fpr_return_fields (const_tree, tree *);
+static bool mips_return_in_msb (const_tree);
static rtx mips_return_fpr_pair (enum machine_mode mode,
enum machine_mode mode1, HOST_WIDE_INT,
enum machine_mode mode2, HOST_WIDE_INT);
@@ -381,7 +381,7 @@ static bool mips_strict_matching_cpu_name_p (const char *, const char *);
static bool mips_matching_cpu_name_p (const char *, const char *);
static const struct mips_cpu_info *mips_parse_cpu (const char *);
static const struct mips_cpu_info *mips_cpu_info_from_isa (int);
-static bool mips_return_in_memory (tree, tree);
+static bool mips_return_in_memory (const_tree, const_tree);
static bool mips_strict_argument_naming (CUMULATIVE_ARGS *);
static void mips_macc_chains_record (rtx);
static void mips_macc_chains_reorder (rtx *, int);
@@ -402,9 +402,9 @@ static void mips_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
static tree mips_build_builtin_va_list (void);
static tree mips_gimplify_va_arg_expr (tree, tree, tree *, tree *);
static bool mips_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode mode,
- tree, bool);
+ const_tree, bool);
static bool mips_callee_copies (CUMULATIVE_ARGS *, enum machine_mode mode,
- tree, bool);
+ const_tree, bool);
static int mips_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode mode,
tree, bool);
static bool mips_valid_pointer_mode (enum machine_mode);
@@ -423,7 +423,7 @@ static rtx mips_expand_builtin_compare (enum mips_builtin_type,
static rtx mips_expand_builtin_bposge (enum mips_builtin_type, rtx);
static void mips_encode_section_info (tree, rtx, int);
static void mips_extra_live_on_entry (bitmap);
-static int mips_comp_type_attributes (tree, tree);
+static int mips_comp_type_attributes (const_tree, const_tree);
static int mips_mode_rep_extended (enum machine_mode, enum machine_mode);
static bool mips_offset_within_alignment_p (rtx, HOST_WIDE_INT);
static void mips_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
@@ -1278,11 +1278,11 @@ static const unsigned char mips16e_save_restore_regs[] = {
#define TARGET_GIMPLIFY_VA_ARG_EXPR mips_gimplify_va_arg_expr
#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY mips_return_in_memory
@@ -1292,7 +1292,7 @@ static const unsigned char mips16e_save_restore_regs[] = {
#undef TARGET_ASM_OUTPUT_MI_THUNK
#define TARGET_ASM_OUTPUT_MI_THUNK mips_output_mi_thunk
#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
-#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_tree_hwi_hwi_tree_true
+#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_const_tree_hwi_hwi_const_tree_true
#undef TARGET_SETUP_INCOMING_VARARGS
#define TARGET_SETUP_INCOMING_VARARGS mips_setup_incoming_varargs
@@ -1357,13 +1357,13 @@ struct gcc_target targetm = TARGET_INITIALIZER;
attributes on the given TYPE. */
static bool
-mips_near_type_p (tree type)
+mips_near_type_p (const_tree type)
{
return lookup_attribute ("near", TYPE_ATTRIBUTES (type)) != NULL;
}
static bool
-mips_far_type_p (tree type)
+mips_far_type_p (const_tree type)
{
return (lookup_attribute ("long_call", TYPE_ATTRIBUTES (type)) != NULL
|| lookup_attribute ("far", TYPE_ATTRIBUTES (type)) != NULL);
@@ -1375,7 +1375,7 @@ mips_far_type_p (tree type)
warning to be generated). */
static int
-mips_comp_type_attributes (tree type1, tree type2)
+mips_comp_type_attributes (const_tree type1, const_tree type2)
{
/* Check for mismatch of non-default calling convention. */
if (TREE_CODE (type1) != FUNCTION_TYPE)
@@ -1412,11 +1412,10 @@ mips_split_plus (rtx x, rtx *base_ptr, HOST_WIDE_INT *offset_ptr)
(in the STB_GLOBAL sense). */
static bool
-mips_global_symbol_p (rtx x)
+mips_global_symbol_p (const_rtx x)
{
- tree decl;
+ const_tree const decl = SYMBOL_REF_DECL (x);
- decl = SYMBOL_REF_DECL (x);
if (!decl)
return !SYMBOL_REF_LOCAL_P (x);
@@ -1429,7 +1428,7 @@ mips_global_symbol_p (rtx x)
/* Return true if SYMBOL_REF X binds locally. */
static bool
-mips_symbol_binds_local_p (rtx x)
+mips_symbol_binds_local_p (const_rtx x)
{
return (SYMBOL_REF_DECL (x)
? targetm.binds_local_p (SYMBOL_REF_DECL (x))
@@ -1440,7 +1439,7 @@ mips_symbol_binds_local_p (rtx x)
LABEL_REF X in context CONTEXT. */
static enum mips_symbol_type
-mips_classify_symbol (rtx x, enum mips_symbol_context context)
+mips_classify_symbol (const_rtx x, enum mips_symbol_context context)
{
if (TARGET_RTP_PIC)
return SYMBOL_GOT_DISP;
@@ -1789,7 +1788,7 @@ mips_cannot_force_const_mem (rtx x)
static bool
mips_use_blocks_for_constant_p (enum machine_mode mode ATTRIBUTE_UNUSED,
- rtx x ATTRIBUTE_UNUSED)
+ const_rtx x ATTRIBUTE_UNUSED)
{
return !TARGET_MIPS16_PCREL_LOADS;
}
@@ -4376,7 +4375,7 @@ function_arg_boundary (enum machine_mode mode, tree type)
byte does. */
bool
-mips_pad_arg_upward (enum machine_mode mode, tree type)
+mips_pad_arg_upward (enum machine_mode mode, const_tree type)
{
/* On little-endian targets, the first byte of every stack argument
is passed in the first byte of the stack slot. */
@@ -5324,6 +5323,11 @@ override_options (void)
flag_delayed_branch = 0;
}
+ /* Prefer a call to memcpy over inline code when optimizing for size,
+ though see MOVE_RATIO in mips.h. */
+ if (optimize_size && (target_flags_explicit & MASK_MEMCPY) == 0)
+ target_flags |= MASK_MEMCPY;
+
#ifdef MIPS_TFMODE_FORMAT
REAL_MODE_FORMAT (TFmode) = &MIPS_TFMODE_FORMAT;
#endif
@@ -8367,7 +8371,7 @@ mips_function_rodata_section (tree decl)
mips_classify_symbol decide when to use %gp_rel(...)($gp) accesses. */
static bool
-mips_in_small_data_p (tree decl)
+mips_in_small_data_p (const_tree decl)
{
HOST_WIDE_INT size;
@@ -8416,7 +8420,7 @@ mips_in_small_data_p (tree decl)
where the PC acts as an anchor. */
static bool
-mips_use_anchors_for_symbol_p (rtx symbol)
+mips_use_anchors_for_symbol_p (const_rtx symbol)
{
switch (mips_classify_symbol (symbol, SYMBOL_CONTEXT_MEM))
{
@@ -8439,7 +8443,7 @@ mips_use_anchors_for_symbol_p (rtx symbol)
type. */
static int
-mips_fpr_return_fields (tree valtype, tree *fields)
+mips_fpr_return_fields (const_tree valtype, tree *fields)
{
tree field;
int i;
@@ -8479,7 +8483,7 @@ mips_fpr_return_fields (tree valtype, tree *fields)
- the structure is not returned in floating-point registers. */
static bool
-mips_return_in_msb (tree valtype)
+mips_return_in_msb (const_tree valtype)
{
tree fields[2];
@@ -8524,7 +8528,7 @@ mips_return_fpr_pair (enum machine_mode mode,
VALTYPE is null and MODE is the mode of the return value. */
rtx
-mips_function_value (tree valtype, tree func ATTRIBUTE_UNUSED,
+mips_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED,
enum machine_mode mode)
{
if (valtype)
@@ -8600,7 +8604,7 @@ mips_function_value (tree valtype, tree func ATTRIBUTE_UNUSED,
static bool
mips_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
- enum machine_mode mode, tree type,
+ enum machine_mode mode, const_tree type,
bool named ATTRIBUTE_UNUSED)
{
if (mips_abi == ABI_EABI)
@@ -8624,7 +8628,7 @@ mips_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
static bool
mips_callee_copies (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED,
- tree type ATTRIBUTE_UNUSED, bool named)
+ const_tree type ATTRIBUTE_UNUSED, bool named)
{
return mips_abi == ABI_EABI && named;
}
@@ -10808,7 +10812,7 @@ mips_hard_regno_nregs (int regno, enum machine_mode mode)
course. */
static bool
-mips_return_in_memory (tree type, tree fndecl ATTRIBUTE_UNUSED)
+mips_return_in_memory (const_tree type, const_tree fndecl ATTRIBUTE_UNUSED)
{
if (TARGET_OLDABI)
return (TYPE_MODE (type) == BLKmode);
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 564f8bc0a2d..c3797e530dc 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -2613,7 +2613,7 @@ while (0)
#undef ASM_DECLARE_OBJECT_NAME
#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
- mips_declare_object (STREAM, NAME, "", ":\n", 0)
+ mips_declare_object (STREAM, NAME, "", ":\n")
/* Globalizing directive for a label. */
#define GLOBAL_ASM_OP "\t.globl\t"
@@ -2785,6 +2785,57 @@ while (0)
#undef PTRDIFF_TYPE
#define PTRDIFF_TYPE (POINTER_SIZE == 64 ? "long int" : "int")
+
+/* The base cost of a memcpy call, for MOVE_RATIO and friends. These
+ values were determined experimentally by benchmarking with CSiBE.
+ In theory, the call overhead is higher for TARGET_ABICALLS (especially
+ for o32 where we have to restore $gp afterwards as well as make an
+ indirect call), but in practice, bumping this up higher for
+ TARGET_ABICALLS doesn't make much difference to code size. */
+
+#define MIPS_CALL_RATIO 8
+
+/* Define MOVE_RATIO to encourage use of movmemsi when enabled,
+ since it should always generate code at least as good as
+ move_by_pieces(). But when inline movmemsi pattern is disabled
+ (i.e., with -mips16 or -mmemcpy), instead use a value approximating
+ the length of a memcpy call sequence, so that move_by_pieces will
+ generate inline code if it is shorter than a function call.
+ Since move_by_pieces_ninsns() counts memory-to-memory moves, but
+ we'll have to generate a load/store pair for each, halve the value of
+ MIPS_CALL_RATIO to take that into account.
+ The default value for MOVE_RATIO when HAVE_movmemsi is true is 2.
+ There is no point to setting it to less than this to try to disable
+ move_by_pieces entirely, because that also disables some desirable
+ tree-level optimizations, specifically related to optimizing a
+ one-byte string copy into a simple move byte operation. */
+
+#define MOVE_RATIO \
+ ((TARGET_MIPS16 || TARGET_MEMCPY) ? MIPS_CALL_RATIO / 2 : 2)
+
+/* For CLEAR_RATIO, when optimizing for size, give a better estimate
+ of the length of a memset call, but use the default otherwise. */
+
+#define CLEAR_RATIO \
+ (optimize_size ? MIPS_CALL_RATIO : 15)
+
+/* This is similar to CLEAR_RATIO, but for a non-zero constant, so when
+ optimizing for size adjust the ratio to account for the overhead of
+ loading the constant and replicating it across the word. */
+
+#define SET_RATIO \
+ (optimize_size ? MIPS_CALL_RATIO - 2 : 15)
+
+/* STORE_BY_PIECES_P can be used when copying a constant string, but
+ in that case each word takes 3 insns (lui, ori, sw), or more in
+ 64-bit mode, instead of 2 (lw, sw). For now we always fail this
+ and let the move_by_pieces code copy the string from read-only
+ memory. In the future, this could be tuned further for multi-issue
+ CPUs that can issue stores down one pipe and arithmetic instructions
+ down another; in that case, the lui/ori/sw combination would be a
+ win for long enough strings. */
+
+#define STORE_BY_PIECES_P(SIZE, ALIGN) 0
#ifndef __mips16
/* Since the bits of the _init and _fini function is spread across
diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index bac479f8dc5..44c3c9c135f 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -464,31 +464,31 @@
[(set_attr "type" "multi")
(set_attr "can_delay" "no")])
-;; This mode macro allows 32-bit and 64-bit GPR patterns to be generated
+;; This mode iterator allows 32-bit and 64-bit GPR patterns to be generated
;; from the same template.
-(define_mode_macro GPR [SI (DI "TARGET_64BIT")])
+(define_mode_iterator GPR [SI (DI "TARGET_64BIT")])
-;; This mode macro allows :P to be used for patterns that operate on
+;; This mode iterator allows :P to be used for patterns that operate on
;; pointer-sized quantities. Exactly one of the two alternatives will match.
-(define_mode_macro P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
+(define_mode_iterator P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
-;; This mode macro allows :MOVECC to be used anywhere that a
+;; This mode iterator allows :MOVECC to be used anywhere that a
;; conditional-move-type condition is needed.
-(define_mode_macro MOVECC [SI (DI "TARGET_64BIT") (CC "TARGET_HARD_FLOAT")])
+(define_mode_iterator MOVECC [SI (DI "TARGET_64BIT") (CC "TARGET_HARD_FLOAT")])
-;; This mode macro allows the QI and HI extension patterns to be defined from
+;; This mode iterator allows the QI and HI extension patterns to be defined from
;; the same template.
-(define_mode_macro SHORT [QI HI])
+(define_mode_iterator SHORT [QI HI])
-;; This mode macro allows :ANYF to be used wherever a scalar or vector
+;; This mode iterator allows :ANYF to be used wherever a scalar or vector
;; floating-point mode is allowed.
-(define_mode_macro ANYF [(SF "TARGET_HARD_FLOAT")
- (DF "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT")
- (V2SF "TARGET_PAIRED_SINGLE_FLOAT")])
+(define_mode_iterator ANYF [(SF "TARGET_HARD_FLOAT")
+ (DF "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT")
+ (V2SF "TARGET_PAIRED_SINGLE_FLOAT")])
;; Like ANYF, but only applies to scalar modes.
-(define_mode_macro SCALARF [(SF "TARGET_HARD_FLOAT")
- (DF "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT")])
+(define_mode_iterator SCALARF [(SF "TARGET_HARD_FLOAT")
+ (DF "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT")])
;; In GPR templates, a string like "<d>subu" will expand to "subu" in the
;; 32-bit version and "dsubu" in the 64-bit version.
@@ -545,26 +545,26 @@
(define_mode_attr recip_condition
[(SF "ISA_HAS_FP4") (DF "ISA_HAS_FP4") (V2SF "TARGET_SB1")])
-;; This code macro allows all branch instructions to be generated from
+;; This code iterator allows all branch instructions to be generated from
;; a single define_expand template.
-(define_code_macro any_cond [unordered ordered unlt unge uneq ltgt unle ungt
- eq ne gt ge lt le gtu geu ltu leu])
+(define_code_iterator any_cond [unordered ordered unlt unge uneq ltgt unle ungt
+ eq ne gt ge lt le gtu geu ltu leu])
-;; This code macro allows signed and unsigned widening multiplications
+;; This code iterator allows signed and unsigned widening multiplications
;; to use the same template.
-(define_code_macro any_extend [sign_extend zero_extend])
+(define_code_iterator any_extend [sign_extend zero_extend])
-;; This code macro allows the three shift instructions to be generated
+;; This code iterator allows the three shift instructions to be generated
;; from the same template.
-(define_code_macro any_shift [ashift ashiftrt lshiftrt])
+(define_code_iterator any_shift [ashift ashiftrt lshiftrt])
-;; This code macro allows all native floating-point comparisons to be
+;; This code iterator allows all native floating-point comparisons to be
;; generated from the same template.
-(define_code_macro fcond [unordered uneq unlt unle eq lt le])
+(define_code_iterator fcond [unordered uneq unlt unle eq lt le])
-;; This code macro is used for comparisons that can be implemented
+;; This code iterator is used for comparisons that can be implemented
;; by swapping the operands.
-(define_code_macro swapped_fcond [ge gt unge ungt])
+(define_code_iterator swapped_fcond [ge gt unge ungt])
;; <u> expands to an empty string when doing a signed operation and
;; "u" when doing an unsigned operation.
diff --git a/gcc/config/mips/mips.opt b/gcc/config/mips/mips.opt
index 4a752ec3987..6f6c109187c 100644
--- a/gcc/config/mips/mips.opt
+++ b/gcc/config/mips/mips.opt
@@ -173,7 +173,7 @@ Target Report RejectNegative Mask(LONG64)
Use a 64-bit long type
mmemcpy
-Target Report Var(TARGET_MEMCPY)
+Target Report Mask(MEMCPY)
Don't optimize block moves
mmips-tfile
diff --git a/gcc/config/mmix/mmix-protos.h b/gcc/config/mmix/mmix-protos.h
index f285e7bad3b..c963147717f 100644
--- a/gcc/config/mmix/mmix-protos.h
+++ b/gcc/config/mmix/mmix-protos.h
@@ -53,7 +53,7 @@ extern int mmix_local_regno (int);
extern int mmix_dbx_register_number (int);
extern int mmix_use_simple_return (void);
extern void mmix_make_decl_one_only (tree);
-extern rtx mmix_function_outgoing_value (tree, tree);
+extern rtx mmix_function_outgoing_value (const_tree, const_tree);
extern int mmix_function_value_regno_p (int);
extern int mmix_data_alignment (tree, int);
extern int mmix_constant_alignment (tree, int);
diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c
index e8d3941ba6a..38fd0722d4e 100644
--- a/gcc/config/mmix/mmix.c
+++ b/gcc/config/mmix/mmix.c
@@ -134,8 +134,8 @@ static void mmix_file_start (void);
static void mmix_file_end (void);
static bool mmix_rtx_costs (rtx, int, int, int *);
static rtx mmix_struct_value_rtx (tree, int);
-static bool mmix_pass_by_reference (const CUMULATIVE_ARGS *,
- enum machine_mode, tree, bool);
+static bool mmix_pass_by_reference (CUMULATIVE_ARGS *,
+ enum machine_mode, const_tree, bool);
/* Target structure macros. Listed by node. See `Using and Porting GCC'
for a general description. */
@@ -187,7 +187,7 @@ static bool mmix_pass_by_reference (const CUMULATIVE_ARGS *,
#define TARGET_MACHINE_DEPENDENT_REORG mmix_reorg
#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
#if 0
/* Apparently not doing TRT if int < register-size. FIXME: Perhaps
FUNCTION_VALUE and LIBCALL_VALUE needs tweaking as some ports say. */
@@ -592,8 +592,8 @@ mmix_function_arg (const CUMULATIVE_ARGS *argsp,
everything that goes by value. */
static bool
-mmix_pass_by_reference (const CUMULATIVE_ARGS *argsp, enum machine_mode mode,
- tree type, bool named ATTRIBUTE_UNUSED)
+mmix_pass_by_reference (CUMULATIVE_ARGS *argsp, enum machine_mode mode,
+ const_tree type, bool named ATTRIBUTE_UNUSED)
{
/* FIXME: Check: I'm not sure the must_pass_in_stack check is
necessary. */
@@ -624,7 +624,7 @@ mmix_function_arg_regno_p (int regno, int incoming)
/* FUNCTION_OUTGOING_VALUE. */
rtx
-mmix_function_outgoing_value (tree valtype, tree func ATTRIBUTE_UNUSED)
+mmix_function_outgoing_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED)
{
enum machine_mode mode = TYPE_MODE (valtype);
enum machine_mode cmode;
@@ -1141,7 +1141,7 @@ mmix_encode_section_info (tree decl, rtx rtl, int first)
char *newstr;
/* Why is the return type of ggc_alloc_string const? */
- newstr = (char *) ggc_alloc_string ("", len + 1);
+ newstr = (char *) CONST_CAST (ggc_alloc_string ("", len + 1));
strcpy (newstr + 1, str);
*newstr = '@';
diff --git a/gcc/config/mn10300/mn10300-protos.h b/gcc/config/mn10300/mn10300-protos.h
index aec59985f84..633988b73d7 100644
--- a/gcc/config/mn10300/mn10300-protos.h
+++ b/gcc/config/mn10300/mn10300-protos.h
@@ -48,7 +48,7 @@ extern bool mn10300_wide_const_load_uses_clr (rtx operands[2]);
#ifdef TREE_CODE
extern struct rtx_def *function_arg (CUMULATIVE_ARGS *,
enum machine_mode, tree, int);
-extern rtx mn10300_function_value (tree, tree, int);
+extern rtx mn10300_function_value (const_tree, const_tree, int);
#endif /* TREE_CODE */
extern void expand_prologue (void);
diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c
index 5e20edff352..0fb57cc1bd1 100644
--- a/gcc/config/mn10300/mn10300.c
+++ b/gcc/config/mn10300/mn10300.c
@@ -72,10 +72,10 @@ static int mn10300_address_cost_1 (rtx, int *);
static int mn10300_address_cost (rtx);
static bool mn10300_rtx_costs (rtx, int, int, int *);
static void mn10300_file_start (void);
-static bool mn10300_return_in_memory (tree, tree);
+static bool mn10300_return_in_memory (const_tree, const_tree);
static rtx mn10300_builtin_saveregs (void);
static bool mn10300_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
- tree, bool);
+ const_tree, bool);
static int mn10300_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
@@ -102,7 +102,7 @@ static int mn10300_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
#define TARGET_ENCODE_SECTION_INFO mn10300_encode_section_info
#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY mn10300_return_in_memory
#undef TARGET_PASS_BY_REFERENCE
@@ -1431,7 +1431,7 @@ initial_offset (int from, int to)
/* Worker function for TARGET_RETURN_IN_MEMORY. */
static bool
-mn10300_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+mn10300_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
{
/* Return values > 8 bytes in length in memory. */
return (int_size_in_bytes (type) > 8
@@ -1482,7 +1482,7 @@ mn10300_va_start (tree valist, rtx nextarg)
static bool
mn10300_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
- enum machine_mode mode, tree type,
+ enum machine_mode mode, const_tree type,
bool named ATTRIBUTE_UNUSED)
{
unsigned HOST_WIDE_INT size;
@@ -1592,7 +1592,7 @@ mn10300_arg_partial_bytes (CUMULATIVE_ARGS *cum, enum machine_mode mode,
callers relying on this extra copy. */
rtx
-mn10300_function_value (tree valtype, tree func, int outgoing)
+mn10300_function_value (const_tree valtype, const_tree func, int outgoing)
{
rtx rv;
enum machine_mode mode = TYPE_MODE (valtype);
diff --git a/gcc/config/mn10300/mn10300.h b/gcc/config/mn10300/mn10300.h
index 949b0c5ebd2..9cb8244c1f6 100644
--- a/gcc/config/mn10300/mn10300.h
+++ b/gcc/config/mn10300/mn10300.h
@@ -734,7 +734,7 @@ while (0)
switch (XINT ((X), 1)) \
{ \
case UNSPEC_INT_LABEL: \
- asm_fprintf ((STREAM), ".%LLIL%d", \
+ asm_fprintf ((STREAM), ".%LLIL" HOST_WIDE_INT_PRINT_DEC, \
INTVAL (XVECEXP ((X), 0, 0))); \
break; \
case UNSPEC_PIC: \
diff --git a/gcc/config/mt/mt-protos.h b/gcc/config/mt/mt-protos.h
index c0c7671ca2c..5c959edd9ad 100644
--- a/gcc/config/mt/mt-protos.h
+++ b/gcc/config/mt/mt-protos.h
@@ -60,6 +60,6 @@ extern void mt_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree,
extern rtx mt_function_arg (const CUMULATIVE_ARGS *, enum machine_mode, tree, int, int);
extern void mt_va_start (tree, rtx);
extern enum reg_class mt_secondary_reload_class (enum reg_class, enum machine_mode, rtx);
-extern rtx mt_function_value (tree, enum machine_mode, tree);
+extern rtx mt_function_value (const_tree, enum machine_mode, const_tree);
#endif
#endif
diff --git a/gcc/config/mt/mt.c b/gcc/config/mt/mt.c
index 57864ad7c1e..9e281a154e1 100644
--- a/gcc/config/mt/mt.c
+++ b/gcc/config/mt/mt.c
@@ -631,9 +631,9 @@ mt_arg_partial_bytes (CUMULATIVE_ARGS * pcum,
/* Implement TARGET_PASS_BY_REFERENCE hook. */
static bool
mt_pass_by_reference (CUMULATIVE_ARGS * cum ATTRIBUTE_UNUSED,
- enum machine_mode mode ATTRIBUTE_UNUSED,
- tree type,
- bool named ATTRIBUTE_UNUSED)
+ enum machine_mode mode ATTRIBUTE_UNUSED,
+ const_tree type,
+ bool named ATTRIBUTE_UNUSED)
{
return (type && int_size_in_bytes (type) > 4 * UNITS_PER_WORD);
}
@@ -1464,7 +1464,7 @@ mt_secondary_reload_class (enum reg_class class ATTRIBUTE_UNUSED,
/* Handle FUNCTION_VALUE, FUNCTION_OUTGOING_VALUE, and LIBCALL_VALUE
macros. */
rtx
-mt_function_value (tree valtype, enum machine_mode mode, tree func_decl ATTRIBUTE_UNUSED)
+mt_function_value (const_tree valtype, enum machine_mode mode, const_tree func_decl ATTRIBUTE_UNUSED)
{
if ((mode) == DImode || (mode) == DFmode)
return gen_rtx_MEM (mode, gen_rtx_REG (mode, RETURN_VALUE_REGNUM));
@@ -1631,7 +1631,7 @@ mt_split_words (enum machine_mode nmode,
/* Implement TARGET_MUST_PASS_IN_STACK hook. */
static bool
-mt_pass_in_stack (enum machine_mode mode ATTRIBUTE_UNUSED, tree type)
+mt_pass_in_stack (enum machine_mode mode ATTRIBUTE_UNUSED, const_tree type)
{
return (((type) != 0
&& (TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST
@@ -2469,7 +2469,7 @@ const struct attribute_spec mt_attribute_table[];
#undef TARGET_STRUCT_VALUE_RTX
#define TARGET_STRUCT_VALUE_RTX mt_struct_value_rtx
#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
#undef TARGET_PASS_BY_REFERENCE
#define TARGET_PASS_BY_REFERENCE mt_pass_by_reference
#undef TARGET_MUST_PASS_IN_STACK
diff --git a/gcc/config/pa/pa-protos.h b/gcc/config/pa/pa-protos.h
index b2c1471de62..9d5c2b9e7f2 100644
--- a/gcc/config/pa/pa-protos.h
+++ b/gcc/config/pa/pa-protos.h
@@ -124,7 +124,7 @@ extern int pc_or_label_operand (rtx, enum machine_mode);
#ifdef ARGS_SIZE_RTX
/* expr.h defines ARGS_SIZE_RTX and `enum direction' */
#ifdef TREE_CODE
-extern enum direction function_arg_padding (enum machine_mode, tree);
+extern enum direction function_arg_padding (enum machine_mode, const_tree);
#endif
#endif /* ARGS_SIZE_RTX */
extern int non_hard_reg_operand (rtx, enum machine_mode);
@@ -160,9 +160,9 @@ extern int reloc_needed (tree);
#ifdef RTX_CODE
extern rtx function_arg (CUMULATIVE_ARGS *, enum machine_mode,
tree, int);
-extern rtx function_value (tree, tree);
+extern rtx function_value (const_tree, const_tree);
#endif
-extern bool pa_return_in_memory (tree, tree);
+extern bool pa_return_in_memory (const_tree, const_tree);
#endif /* TREE_CODE */
extern void pa_asm_output_aligned_bss (FILE *, const char *,
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index bb856003e0e..24b798e1265 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -126,7 +126,7 @@ static void pa_init_builtins (void);
static rtx hppa_builtin_saveregs (void);
static tree hppa_gimplify_va_arg_expr (tree, tree, tree *, tree *);
static bool pa_scalar_mode_supported_p (enum machine_mode);
-static bool pa_commutative_p (rtx x, int outer_code);
+static bool pa_commutative_p (const_rtx x, int outer_code);
static void copy_fp_args (rtx) ATTRIBUTE_UNUSED;
static int length_fp_args (rtx) ATTRIBUTE_UNUSED;
static inline void pa_file_start_level (void) ATTRIBUTE_UNUSED;
@@ -148,7 +148,7 @@ static void pa_hpux_init_libfuncs (void);
#endif
static rtx pa_struct_value_rtx (tree, int);
static bool pa_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
- tree, bool);
+ const_tree, bool);
static int pa_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
static struct machine_function * pa_init_machine_status (void);
@@ -285,9 +285,9 @@ static size_t n_deferred_plabels = 0;
#endif
#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
#undef TARGET_STRUCT_VALUE_RTX
#define TARGET_STRUCT_VALUE_RTX pa_struct_value_rtx
@@ -5789,7 +5789,7 @@ pa_eh_return_handler_rtx (void)
static bool
pa_pass_by_reference (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
- enum machine_mode mode, tree type,
+ enum machine_mode mode, const_tree type,
bool named ATTRIBUTE_UNUSED)
{
HOST_WIDE_INT size;
@@ -5806,7 +5806,7 @@ pa_pass_by_reference (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
}
enum direction
-function_arg_padding (enum machine_mode mode, tree type)
+function_arg_padding (enum machine_mode mode, const_tree type)
{
if (mode == BLKmode
|| (TARGET_64BIT && type && AGGREGATE_TYPE_P (type)))
@@ -8135,7 +8135,7 @@ pa_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
space register selection rules for memory addresses. Therefore, we
don't consider a + b == b + a, as this might be inside a MEM. */
static bool
-pa_commutative_p (rtx x, int outer_code)
+pa_commutative_p (const_rtx x, int outer_code)
{
return (COMMUTATIVE_P (x)
&& (TARGET_NO_SPACE_REGS
@@ -9032,7 +9032,7 @@ insn_refs_are_delayed (rtx insn)
to match the HP Compiler ABI. */
rtx
-function_value (tree valtype, tree func ATTRIBUTE_UNUSED)
+function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED)
{
enum machine_mode valmode;
@@ -9492,7 +9492,7 @@ pa_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED,
/* Worker function for TARGET_RETURN_IN_MEMORY. */
bool
-pa_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+pa_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
{
/* SOM ABI says that objects larger than 64 bits are returned in memory.
PA64 ABI says that objects larger than 128 bits are returned in memory.
diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c
index 700616b386c..ba649eac60f 100644
--- a/gcc/config/pdp11/pdp11.c
+++ b/gcc/config/pdp11/pdp11.c
@@ -146,7 +146,7 @@ static bool pdp11_assemble_integer (rtx, unsigned int, int);
static void pdp11_output_function_prologue (FILE *, HOST_WIDE_INT);
static void pdp11_output_function_epilogue (FILE *, HOST_WIDE_INT);
static bool pdp11_rtx_costs (rtx, int, int, int *);
-static bool pdp11_return_in_memory (tree, tree);
+static bool pdp11_return_in_memory (const_tree, const_tree);
/* Initialize the GCC target structure. */
#undef TARGET_ASM_BYTE_OP
@@ -384,7 +384,8 @@ pdp11_output_function_epilogue (FILE *stream, HOST_WIDE_INT size)
/* change fp -> r5 due to the compile error on libgcc2.c */
for (i =7 ; i >= 0 ; i--)
if (df_regs_ever_live_p (i) && ! call_used_regs[i])
- fprintf(stream, "\tmov %#o(r5), %s\n",(-fsize-2*j--)&0xffff, reg_names[i]);
+ fprintf(stream, "\tmov %#" HOST_WIDE_INT_PRINT "o(r5), %s\n",
+ (-fsize-2*j--)&0xffff, reg_names[i]);
/* get ACs */
via_ac = FIRST_PSEUDO_REGISTER -1;
@@ -402,7 +403,8 @@ pdp11_output_function_epilogue (FILE *stream, HOST_WIDE_INT size)
&& df_regs_ever_live_p (i)
&& ! call_used_regs[i])
{
- fprintf(stream, "\tldd %#o(r5), %s\n", (-fsize-k)&0xffff, reg_names[i]);
+ fprintf(stream, "\tldd %#" HOST_WIDE_INT_PRINT "o(r5), %s\n",
+ (-fsize-k)&0xffff, reg_names[i]);
k -= 8;
}
@@ -412,7 +414,8 @@ pdp11_output_function_epilogue (FILE *stream, HOST_WIDE_INT size)
{
gcc_assert (LOAD_FPU_REG_P(via_ac));
- fprintf(stream, "\tldd %#o(r5), %s\n", (-fsize-k)&0xffff, reg_names[via_ac]);
+ fprintf(stream, "\tldd %#" HOST_WIDE_INT_PRINT "o(r5), %s\n",
+ (-fsize-k)&0xffff, reg_names[via_ac]);
fprintf(stream, "\tstd %s, %s\n", reg_names[via_ac], reg_names[i]);
k -= 8;
}
@@ -453,7 +456,8 @@ pdp11_output_function_epilogue (FILE *stream, HOST_WIDE_INT size)
fprintf(stream, "\tmov (sp)+, %s\n", reg_names[i]);
if (fsize)
- fprintf((stream), "\tadd $%#o, sp\n", (fsize)&0xffff);
+ fprintf((stream), "\tadd $%#" HOST_WIDE_INT_PRINT "o, sp\n",
+ (fsize)&0xffff);
}
fprintf (stream, "\trts pc\n");
@@ -1080,8 +1084,7 @@ static const int move_costs[N_REG_CLASSES][N_REG_CLASSES] =
-- as we do here with 22 -- or not ? */
int
-register_move_cost(c1, c2)
- enum reg_class c1, c2;
+register_move_cost(enum reg_class c1, enum reg_class c2)
{
return move_costs[(int)c1][(int)c2];
}
@@ -1752,7 +1755,7 @@ output_addr_const_pdp11 (FILE *file, rtx x)
/* Worker function for TARGET_RETURN_IN_MEMORY. */
static bool
-pdp11_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+pdp11_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
{
/* Should probably return DImode and DFmode in memory, lest
we fill up all regs!
diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h
index 711474170d5..4b8c231376e 100644
--- a/gcc/config/pdp11/pdp11.h
+++ b/gcc/config/pdp11/pdp11.h
@@ -983,7 +983,7 @@ extern struct rtx_def *cc0_reg_rtx;
long sval[2]; \
REAL_VALUE_FROM_CONST_DOUBLE (r, X); \
REAL_VALUE_TO_TARGET_DOUBLE (r, sval); \
- fprintf (FILE, "$%#o", sval[0] >> 16); } \
+ fprintf (FILE, "$%#lo", sval[0] >> 16); } \
else { putc ('$', FILE); output_addr_const_pdp11 (FILE, X); }}
/* Print a memory address as an operand to reference that memory location. */
diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md
index 029874d57be..2261a9369f3 100644
--- a/gcc/config/rs6000/altivec.md
+++ b/gcc/config/rs6000/altivec.md
@@ -162,13 +162,13 @@
])
;; Vec int modes
-(define_mode_macro VI [V4SI V8HI V16QI])
+(define_mode_iterator VI [V4SI V8HI V16QI])
;; Short vec in modes
-(define_mode_macro VIshort [V8HI V16QI])
+(define_mode_iterator VIshort [V8HI V16QI])
;; Vec float modes
-(define_mode_macro VF [V4SF])
-;; Vec modes, pity mode macros are not composable
-(define_mode_macro V [V4SI V8HI V16QI V4SF])
+(define_mode_iterator VF [V4SF])
+;; Vec modes, pity mode iterators are not composable
+(define_mode_iterator V [V4SI V8HI V16QI V4SF])
(define_mode_attr VI_char [(V4SI "w") (V8HI "h") (V16QI "b")])
diff --git a/gcc/config/rs6000/ppu_intrinsics.h b/gcc/config/rs6000/ppu_intrinsics.h
new file mode 100644
index 00000000000..742c5da134a
--- /dev/null
+++ b/gcc/config/rs6000/ppu_intrinsics.h
@@ -0,0 +1,729 @@
+/* PPU intrinsics as defined by the C/C++ Language extension for Cell BEA.
+ Copyright (C) 2007 Free Software Foundation, Inc.
+
+ This file is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at your option)
+ any later version.
+
+ This file is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this file; see the file COPYING. If not, write to the Free
+ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA. */
+
+/* As a special exception, if you include this header file into source files
+ compiled by GCC, this header file does not by itself cause the resulting
+ executable to be covered by the GNU General Public License. This exception
+ does not however invalidate any other reasons why the executable file might
+ be covered by the GNU General Public License. */
+
+/* TODO:
+ misc ops (traps)
+ supervisor/hypervisor mode ops. */
+
+#ifndef _PPU_INTRINSICS_H
+#define _PPU_INTRINSICS_H
+
+#if !defined(__PPU__) && !defined(__ppc__) && !defined(__ppc64__) \
+ && !defined(__GNUC__)
+ #error ppu_intrinsics.h included on wrong platform/compiler
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * unsigned int __cntlzw(unsigned int)
+ * unsigned int __cntlzd(unsigned long long)
+ * int __mulhw(int, int)
+ * unsigned int __mulhwu(unsigned int, unsigned int)
+ * long long __mulhd(long long, long long)
+ * unsigned long long __mulhdu(unsigned long long, unsigned long long)
+ *
+ * void __sync(void)
+ * void __isync(void)
+ * void __lwsync(void)
+ * void __eieio(void)
+ *
+ * void __nop(void)
+ * void __cctpl(void)
+ * void __cctpm(void)
+ * void __cctph(void)
+ * void __db8cyc(void)
+ * void __db10cyc(void)
+ * void __db12cyc(void)
+ * void __db16cyc(void)
+ *
+ * void __mtspr(unsigned int spr, unsigned long long value)
+ * unsigned long long __mfspr(unsigned int spr)
+ * unsigned long long __mftb(void)
+ *
+ * void __icbi(void *base)
+ * void __dcbi(void *base)
+ *
+ * void __dcbf(void *base)
+ * void __dcbz(void *base)
+ * void __dcbst(void *base)
+ * void __dcbtst(void *base)
+ * void __dcbt(void *base)
+ * void __dcbt_TH1000(void *EATRUNC, bool D, bool UG, int ID)
+ * void __dcbt_TH1010(bool GO, int S, int UNITCNT, bool T, bool U, int ID)
+ *
+ * unsigned __lwarx(void *base)
+ * unsigned long long __ldarx(void *base)
+ * bool __stwcx(void *base, unsigned value)
+ * bool __stdcx(void *base, unsigned long long value)
+ *
+ * unsigned short __lhbrx(void *base)
+ * unsigned int __lwbrx(void *base)
+ * unsigned long long __ldbrx(void *base)
+ * void __sthbrx(void *base, unsigned short value)
+ * void __stwbrx(void *base, unsigned int value)
+ * void __stdbrx(void *base, unsigned long long value)
+ *
+ * double __fabs(double x)
+ * float __fabsf(float x)
+ * double __fnabs(double x)
+ * float __fnabsf(float x)
+ * double __fmadd(double x, double y, double z)
+ * double __fmsub(double x, double y, double z)
+ * double __fnmadd(double x, double y, double z)
+ * double __fnmsub(double x, double y, double z)
+ * float __fmadds(float x, float y, float z)
+ * float __fmsubs(float x, float y, float z)
+ * float __fnmadds(float x, float y, float z)
+ * float __fnmsubs(float x, float y, float z)
+ * double __fsel(double x, double y, double z)
+ * float __fsels(float x, float y, float z)
+ * double __frsqrte(double x)
+ * float __fres(float x)
+ * double __fsqrt(double x)
+ * float __fsqrts(float x)
+ * long long __fctid(double x)
+ * long long __fctiw(double x)
+ * double __fcfid(long long x)
+ * double __mffs(void)
+ * void __mtfsf(int mask, double value)
+ * void __mtfsfi(int bits, int field)
+ * void __mtfsb0(int)
+ * void __mtfsb1(int)
+ * double __setflm(double)
+ *
+ * dcbt intrinsics
+ * void __protected_unlimited_stream_set (unsigned int direction, const void *add, unsigned int ID)
+ * void __protected_stream_set (unsigned int direction, const void *add, unsigned int ID)
+ * void __protected_stream_stop_all (void)
+ * void __protected_stream_stop (unsigned int ID)
+ * void __protected_stream_count (unsigned int unit_cnt, unsigned int ID)
+ * void __protected_stream_go (void)
+ */
+
+typedef int __V4SI __attribute__((vector_size(16)));
+
+#define __cntlzw(v) __builtin_clz(v)
+#define __cntlzd(v) __builtin_clzll(v)
+
+#define __mulhw(a,b) __extension__ \
+ ({int result; \
+ __asm__ ("mulhw %0,%1,%2" \
+ : "=r" (result) \
+ : "r" ((int) (a)), \
+ "r" ((int) (b))); \
+ result; })
+
+#define __mulhwu(a,b) __extension__ \
+ ({unsigned int result; \
+ __asm__ ("mulhwu %0,%1,%2" \
+ : "=r" (result) \
+ : "r" ((unsigned int) (a)), \
+ "r" ((unsigned int) (b))); \
+ result; })
+
+#ifdef __powerpc64__
+#define __mulhd(a,b) __extension__ \
+ ({ long long result; \
+ __asm__ ("mulhd %0,%1,%2" \
+ : "=r" (result) \
+ : "r" ((long long) (a)), \
+ "r" ((long long) (b))); \
+ result; })
+
+#define __mulhdu(a,b) __extension__ \
+ ({unsigned long long result; \
+ __asm__ ("mulhdu %0,%1,%2" \
+ : "=r" (result) \
+ : "r" ((unsigned long long) (a)), \
+ "r" ((unsigned long long) (b))); \
+ result; })
+#endif /* __powerpc64__ */
+
+#define __sync() __asm__ volatile ("sync" : : : "memory")
+#define __isync() __asm__ volatile ("isync" : : : "memory")
+#define __lwsync() __asm__ volatile ("lwsync" : : : "memory")
+#define __eieio() __asm__ volatile ("eieio" : : : "memory")
+
+#define __nop() __asm__ volatile ("ori 0,0,0" : : : "memory")
+#define __cctpl() __asm__ volatile ("or 1,1,1" : : : "memory")
+#define __cctpm() __asm__ volatile ("or 2,2,2" : : : "memory")
+#define __cctph() __asm__ volatile ("or 3,3,3" : : : "memory")
+#define __db8cyc() __asm__ volatile ("or 28,28,28" : : : "memory")
+#define __db10cyc() __asm__ volatile ("or 29,29,29" : : : "memory")
+#define __db12cyc() __asm__ volatile ("or 30,30,30" : : : "memory")
+#define __db16cyc() __asm__ volatile ("or 31,31,31" : : : "memory")
+
+#ifdef __powerpc64__
+#define __mtspr(spr, value) \
+ __asm__ volatile ("mtspr %0,%1" : : "n" (spr), "r" (value))
+
+#define __mfspr(spr) __extension__ \
+ ({ unsigned long long result; \
+ __asm__ volatile ("mfspr %0,%1" : "=r" (result) : "n" (spr)); \
+ result; })
+#endif /* __powerpc64__ */
+
+#ifdef __powerpc64__
+/* Work around the hadware bug in the current Cell implemention. */
+#define __mftb() __extension__ \
+ ({ unsigned long long result; \
+ __asm__ volatile ("1: mftb %[current_tb]\n" \
+ "\tcmpwi 7, %[current_tb], 0\n" \
+ "\tbeq- 7, 1b" \
+ : [current_tb] "=r" (result): \
+ :"cr7"); \
+ result; })
+#else
+#define __mftb() __extension__ \
+ ({ unsigned long long result; \
+ unsigned long t; \
+ __asm__ volatile ("1:\n" \
+ "\tmftbu %0\n" \
+ "\tmftb %L0\n" \
+ "\tmftbu %1\n" \
+ "\tcmpw %0,%1\n" \
+ "\tbne 1b" \
+ : "=r" (result), "=r" (t)); \
+ result; })
+#endif /* __powerpc64__ */
+
+#define __dcbf(base) \
+ __asm__ volatile ("dcbf %y0" : "=Z" (*(__V4SI*) (base)) : : "memory")
+
+#define __dcbz(base) \
+ __asm__ volatile ("dcbz %y0" : "=Z" (*(__V4SI*) (base)) : : "memory")
+
+#define __dcbst(base) \
+ __asm__ volatile ("dcbst %y0" : "=Z" (*(__V4SI*) (base)) : : "memory")
+
+#define __dcbtst(base) \
+ __asm__ volatile ("dcbtst %y0" : "=Z" (*(__V4SI*) (base)) : : "memory")
+
+#define __dcbt(base) \
+ __asm__ volatile ("dcbt %y0" : "=Z" (*(__V4SI*) (base)) : : "memory")
+
+#define __icbi(base) \
+ __asm__ volatile ("icbi %y0" : "=Z" (*(__V4SI*) (base)) : : "memory")
+
+#define __dcbt_TH1000(EATRUNC, D, UG, ID) \
+ __asm__ volatile ("dcbt %y0,8" \
+ : "=Z" (*(__V4SI*) (__SIZE_TYPE__)((((__SIZE_TYPE__) (EATRUNC)) & ~0x7F) \
+ | ((((D) & 1) << 6) \
+ | (((UG) & 1) << 5) \
+ | ((ID) & 0xF)))) : : "memory")
+
+#define __dcbt_TH1010(GO, S, UNITCNT, T, U, ID) \
+ __asm__ volatile ("dcbt %y0,10" \
+ : "=Z" (*(__V4SI*) (__SIZE_TYPE__)((((__SIZE_TYPE__) (GO) & 1) << 31) \
+ | (((S) & 0x3) << 29) \
+ | (((UNITCNT) & 0x3FF) << 7) \
+ | (((T) & 1) << 6) \
+ | (((U) & 1) << 5) \
+ | ((ID) & 0xF))) : : "memory")
+
+#define __protected_unlimited_stream_set(DIRECTION, ADDR, ID) \
+ __dcbt_TH1000 ((ADDR), (DIRECTION)>>1, 0, (ID))
+
+#define __protected_stream_set(DIRECTION, ADDR, ID) \
+ __dcbt_TH1000 ((ADDR), (DIRECTION)>>1, 1, (ID))
+
+#define __protected_stream_stop_all() \
+ __dcbt_TH1010 (0, 3, 0, 0, 0, 0)
+
+#define __protected_stream_stop(ID) \
+ __dcbt_TH1010 (0, 2, 0, 0, 0, (ID))
+
+#define __protected_stream_count(CNT, ID) \
+ __dcbt_TH1010 (0, 0, (CNT), 0, 0, (ID))
+
+#define __protected_stream_go() \
+ __dcbt_TH1010 (1, 0, 0, 0, 0, 0)
+
+#define __lhbrx(base) __extension__ \
+ ({unsigned short result; \
+ typedef struct {char a[2];} halfwordsize; \
+ halfwordsize *ptrp = (halfwordsize*)(void*)(base); \
+ __asm__ ("lhbrx %0,%y1" \
+ : "=r" (result) \
+ : "Z" (*ptrp)); \
+ result; })
+
+#define __lwbrx(base) __extension__ \
+ ({unsigned int result; \
+ typedef struct {char a[4];} wordsize; \
+ wordsize *ptrp = (wordsize*)(void*)(base); \
+ __asm__ ("lwbrx %0,%y1" \
+ : "=r" (result) \
+ : "Z" (*ptrp)); \
+ result; })
+
+
+#ifdef __powerpc64__
+#define __ldbrx(base) __extension__ \
+ ({unsigned long long result; \
+ typedef struct {char a[8];} doublewordsize; \
+ doublewordsize *ptrp = (doublewordsize*)(void*)(base); \
+ __asm__ ("ldbrx %0,%y1" \
+ : "=r" (result) \
+ : "Z" (*ptrp)); \
+ result; })
+#else
+#define __ldbrx(base) __extension__ \
+ ({unsigned long long result; \
+ typedef struct {char a[8];} doublewordsize; \
+ doublewordsize *ptrp = (doublewordsize*)(void*)(base); \
+ __asm__ ("lwbrx %L0,%y1\n" \
+ "\tlwbrx %0,%y2" \
+ : "=&r" (result) \
+ : "Z" (*ptrp), "Z" (*((char *) ptrp + 4))); \
+ result; })
+#endif /* __powerpc64__ */
+
+
+#define __sthbrx(base, value) do { \
+ typedef struct {char a[2];} halfwordsize; \
+ halfwordsize *ptrp = (halfwordsize*)(void*)(base); \
+ __asm__ ("sthbrx %1,%y0" \
+ : "=Z" (*ptrp) \
+ : "r" (value)); \
+ } while (0)
+
+#define __stwbrx(base, value) do { \
+ typedef struct {char a[4];} wordsize; \
+ wordsize *ptrp = (wordsize*)(void*)(base); \
+ __asm__ ("stwbrx %1,%y0" \
+ : "=Z" (*ptrp) \
+ : "r" (value)); \
+ } while (0)
+
+#ifdef __powerpc64__
+#define __stdbrx(base, value) do { \
+ typedef struct {char a[8];} doublewordsize; \
+ doublewordsize *ptrp = (doublewordsize*)(void*)(base); \
+ __asm__ ("stdbrx %1,%y0" \
+ : "=Z" (*ptrp) \
+ : "r" (value)); \
+ } while (0)
+#else
+#define __stdbrx(base, value) do { \
+ typedef struct {char a[8];} doublewordsize; \
+ doublewordsize *ptrp = (doublewordsize*)(void*)(base); \
+ __asm__ ("stwbrx %L2,%y0\n" \
+ "\tstwbrx %2,%y1" \
+ : "=Z" (*ptrp), "=Z" (*((char *) ptrp + 4)) \
+ : "r" (value)); \
+ } while (0)
+#endif /* __powerpc64__ */
+
+
+#define __lwarx(base) __extension__ \
+ ({unsigned int result; \
+ typedef struct {char a[4];} wordsize; \
+ wordsize *ptrp = (wordsize*)(void*)(base); \
+ __asm__ volatile ("lwarx %0,%y1" \
+ : "=r" (result) \
+ : "Z" (*ptrp)); \
+ result; })
+
+#ifdef __powerpc64__
+#define __ldarx(base) __extension__ \
+ ({unsigned long long result; \
+ typedef struct {char a[8];} doublewordsize; \
+ doublewordsize *ptrp = (doublewordsize*)(void*)(base); \
+ __asm__ volatile ("ldarx %0,%y1" \
+ : "=r" (result) \
+ : "m" (*ptrp)); \
+ result; })
+#endif /* __powerpc64__ */
+
+#define __stwcx(base, value) __extension__ \
+ ({unsigned int result; \
+ typedef struct {char a[4];} wordsize; \
+ wordsize *ptrp = (wordsize*)(void*)(base); \
+ __asm__ volatile ("stwcx. %2,%y1\n" \
+ "\tmfocrf %0,0x80" \
+ : "=r" (result), \
+ "=Z" (*ptrp) \
+ : "r" (value) : "cr0"); \
+ (result & 0x20000000); })
+
+
+#ifdef __powerpc64__
+#define __stdcx(base, value) __extension__ \
+ ({unsigned long long result; \
+ typedef struct {char a[8];} doublewordsize; \
+ doublewordsize *ptrp = (doublewordsize*)(void*)(base); \
+ __asm__ ("stdcx. %2,%y1\n" \
+ "\tmfocrf %0,0x80" \
+ : "=r" (result), \
+ "=Z" (*ptrp) \
+ : "r" (value) : "cr0"); \
+ (result & 0x20000000); })
+#endif /* __powerpc64__ */
+
+#define __mffs() __extension__ \
+ ({double result; \
+ __asm__ volatile ("mffs %0" : "=f" (result)); \
+ result; })
+
+#define __mtfsf(mask,value) \
+ __asm__ volatile ("mtfsf %0,%1" : : "n" (mask), "f" ((double) (value)))
+
+#define __mtfsfi(bits,field) \
+ __asm__ volatile ("mtfsfi %0,%1" : : "n" (bits), "n" (field))
+
+#define __mtfsb0(bit) __asm__ volatile ("mtfsb0 %0" : : "n" (bit))
+#define __mtfsb1(bit) __asm__ volatile ("mtfsb1 %0" : : "n" (bit))
+
+#define __setflm(v) __extension__ \
+ ({double result; \
+ __asm__ volatile ("mffs %0\n\tmtfsf 255,%1" \
+ : "=&f" (result) \
+ : "f" ((double) (v))); \
+ result; })
+
+/* __builtin_fabs may perform unnecessary rounding. */
+
+/* Rename __fabs and __fabsf to work around internal prototypes defined
+ in bits/mathcalls.h with some glibc versions. */
+#define __fabs __ppu_fabs
+#define __fabsf __ppu_fabsf
+
+static __inline__ double __fabs(double x) __attribute__((always_inline));
+static __inline__ double
+__fabs(double x)
+{
+ double r;
+ __asm__("fabs %0,%1" : "=f"(r) : "f"(x));
+ return r;
+}
+
+static __inline__ float __fabsf(float x) __attribute__((always_inline));
+static __inline__ float
+__fabsf(float x)
+{
+ float r;
+ __asm__("fabs %0,%1" : "=f"(r) : "f"(x));
+ return r;
+}
+
+static __inline__ double __fnabs(double x) __attribute__((always_inline));
+static __inline__ double
+__fnabs(double x)
+{
+ double r;
+ __asm__("fnabs %0,%1" : "=f"(r) : "f"(x));
+ return r;
+}
+
+static __inline__ float __fnabsf(float x) __attribute__((always_inline));
+static __inline__ float
+__fnabsf(float x)
+{
+ float r;
+ __asm__("fnabs %0,%1" : "=f"(r) : "f"(x));
+ return r;
+}
+
+static __inline__ double __fmadd(double x, double y, double z)
+ __attribute__((always_inline));
+static __inline__ double
+__fmadd(double x, double y, double z)
+{
+ double r;
+ __asm__("fmadd %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z));
+ return r;
+}
+
+static __inline__ double __fmsub(double x, double y, double z)
+ __attribute__((always_inline));
+static __inline__ double
+__fmsub(double x, double y, double z)
+{
+ double r;
+ __asm__("fmsub %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z));
+ return r;
+}
+
+static __inline__ double __fnmadd(double x, double y, double z)
+ __attribute__((always_inline));
+static __inline__ double
+__fnmadd(double x, double y, double z)
+{
+ double r;
+ __asm__("fnmadd %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z));
+ return r;
+}
+
+static __inline__ double __fnmsub(double x, double y, double z)
+ __attribute__((always_inline));
+static __inline__ double
+__fnmsub(double x, double y, double z)
+{
+ double r;
+ __asm__("fnmsub %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z));
+ return r;
+}
+
+static __inline__ float __fmadds(float x, float y, float z)
+ __attribute__((always_inline));
+static __inline__ float
+__fmadds(float x, float y, float z)
+{
+ float r;
+ __asm__("fmadds %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z));
+ return r;
+}
+
+static __inline__ float __fmsubs(float x, float y, float z)
+ __attribute__((always_inline));
+static __inline__ float
+__fmsubs(float x, float y, float z)
+{
+ float r;
+ __asm__("fmsubs %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z));
+ return r;
+}
+
+static __inline__ float __fnmadds(float x, float y, float z)
+ __attribute__((always_inline));
+static __inline__ float
+__fnmadds(float x, float y, float z)
+{
+ float r;
+ __asm__("fnmadds %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z));
+ return r;
+}
+
+static __inline__ float __fnmsubs(float x, float y, float z)
+ __attribute__((always_inline));
+static __inline__ float
+__fnmsubs(float x, float y, float z)
+{
+ float r;
+ __asm__("fnmsubs %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z));
+ return r;
+}
+
+static __inline__ double __fsel(double x, double y, double z)
+ __attribute__((always_inline));
+static __inline__ double
+__fsel(double x, double y, double z)
+{
+ double r;
+ __asm__("fsel %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z));
+ return r;
+}
+
+static __inline__ float __fsels(float x, float y, float z)
+ __attribute__((always_inline));
+static __inline__ float
+__fsels(float x, float y, float z)
+{
+ float r;
+ __asm__("fsel %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z));
+ return r;
+}
+
+static __inline__ double __frsqrte(double x) __attribute__((always_inline));
+static __inline__ double
+__frsqrte(double x)
+{
+ double r;
+ __asm__("frsqrte %0,%1" : "=f" (r) : "f" (x));
+ return r;
+}
+
+static __inline__ float __fres(float x) __attribute__((always_inline));
+static __inline__ float
+__fres(float x)
+{
+ float r;
+ __asm__("fres %0,%1" : "=f"(r) : "f"(x));
+ return r;
+}
+
+static __inline__ double __fsqrt(double x) __attribute__((always_inline));
+static __inline__ double
+__fsqrt(double x)
+{
+ double r;
+ __asm__("fsqrt %0,%1" : "=f"(r) : "f"(x));
+ return r;
+}
+
+static __inline__ float __fsqrts(float x) __attribute__((always_inline));
+static __inline__ float
+__fsqrts(float x)
+{
+ float r;
+ __asm__("fsqrts %0,%1" : "=f"(r) : "f"(x));
+ return r;
+}
+
+static __inline__ double __fmul (double a, double b) __attribute__ ((always_inline));
+static __inline__ double
+__fmul(double a, double b)
+{
+ double d;
+ __asm__ ("fmul %0,%1,%2" : "=f" (d) : "f" (a), "f" (b));
+ return d;
+}
+
+static __inline__ float __fmuls (float a, float b) __attribute__ ((always_inline));
+static __inline__ float
+__fmuls (float a, float b)
+{
+ float d;
+ __asm__ ("fmuls %0,%1,%2" : "=f" (d) : "f" (a), "f" (b));
+ return d;
+}
+
+static __inline__ float __frsp (float a) __attribute__ ((always_inline));
+static __inline__ float
+__frsp (float a)
+{
+ float d;
+ __asm__ ("frsp %0,%1" : "=f" (d) : "f" (a));
+ return d;
+}
+
+static __inline__ double __fcfid (long long a) __attribute__((always_inline));
+static __inline__ double
+__fcfid (long long a)
+{
+ double d;
+ __asm__ ("fcfid %0,%1" : "=f" (d) : "f" (a));
+ return d;
+}
+
+static __inline__ long long __fctid (double a) __attribute__ ((always_inline));
+static __inline__ long long
+__fctid (double a)
+{
+ long long d;
+ __asm__ ("fctid %0,%1" : "=f" (d) : "f" (a));
+ return d;
+}
+
+static __inline__ long long __fctidz (double a) __attribute__ ((always_inline));
+static __inline__ long long
+__fctidz (double a)
+{
+ long long d;
+ __asm__ ("fctidz %0,%1" : "=f" (d) : "f" (a));
+ return d;
+}
+
+static __inline__ int __fctiw (double a) __attribute__ ((always_inline));
+static __inline__ int
+__fctiw (double a)
+{
+ unsigned long long d;
+ __asm__ ("fctiw %0,%1" : "=f" (d) : "f" (a));
+ return (int) d;
+}
+
+static __inline__ int __fctiwz (double a) __attribute__ ((always_inline));
+static __inline__ int
+__fctiwz (double a)
+{
+ long long d;
+ __asm__ ("fctiwz %0,%1" : "=f" (d) : "f" (a));
+ return (int) d;
+}
+
+#ifdef __powerpc64__
+#define __rldcl(a,b,mb) __extension__ \
+ ({ \
+ unsigned long long d; \
+ __asm__ ("rldcl %0,%1,%2,%3" : "=r" (d) : "r" (a), "r" (b), "i" (mb)); \
+ d; \
+ })
+
+#define __rldcr(a,b,me) __extension__ \
+ ({ \
+ unsigned long long d; \
+ __asm__ ("rldcr %0,%1,%2,%3" : "=r" (d) : "r" (a), "r" (b), "i" (me)); \
+ d; \
+ })
+
+#define __rldic(a,sh,mb) __extension__ \
+ ({ \
+ unsigned long long d; \
+ __asm__ ("rldic %0,%1,%2,%3" : "=r" (d) : "r" (a), "i" (sh), "i" (mb)); \
+ d; \
+ })
+
+#define __rldicl(a,sh,mb) __extension__ \
+ ({ \
+ unsigned long long d; \
+ __asm__ ("rldicl %0,%1,%2,%3" : "=r" (d) : "r" (a), "i" (sh), "i" (mb)); \
+ d; \
+ })
+
+#define __rldicr(a,sh,me) __extension__ \
+ ({ \
+ unsigned long long d; \
+ __asm__ ("rldicr %0,%1,%2,%3" : "=r" (d) : "r" (a), "i" (sh), "i" (me)); \
+ d; \
+ })
+
+#define __rldimi(a,b,sh,mb) __extension__ \
+ ({ \
+ unsigned long long d; \
+ __asm__ ("rldimi %0,%1,%2,%3" : "=r" (d) : "r" (b), "i" (sh), "i" (mb), "0" (a)); \
+ d; \
+ })
+#endif /* __powerpc64__ */
+
+#define __rlwimi(a,b,sh,mb,me) __extension__ \
+ ({ \
+ unsigned int d; \
+ __asm__ ("rlwimi %0,%1,%2,%3,%4" : "=r" (d) : "r" (b), "i" (sh), "i" (mb), "i" (me), "0" (a)); \
+ d; \
+ })
+
+#define __rlwinm(a,sh,mb,me) __extension__ \
+ ({ \
+ unsigned int d; \
+ __asm__ ("rlwinm %0,%1,%2,%3,%4" : "=r" (d) : "r" (a), "i" (sh), "i" (mb), "i" (me)); \
+ d; \
+ })
+
+#define __rlwnm(a,b,mb,me) __extension__ \
+ ({ \
+ unsigned int d; \
+ __asm__ ("rlwnm %0,%1,%2,%3,%4" : "=r" (d) : "r" (a), "r" (b), "i" (mb), "i" (me)); \
+ d; \
+ })
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PPU_INTRINSICS_H */
diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md
index 877aa16c9c1..f56c176b37c 100644
--- a/gcc/config/rs6000/predicates.md
+++ b/gcc/config/rs6000/predicates.md
@@ -349,10 +349,10 @@
;; Return 1 if the operand is an offsettable memory operand.
(define_predicate "offsettable_mem_operand"
- (and (match_code "mem")
- (match_test "offsettable_address_p (reload_completed
- || reload_in_progress,
- mode, XEXP (op, 0))")))
+ (and (match_operand 0 "memory_operand")
+ (match_test "GET_CODE (XEXP (op, 0)) != PRE_INC
+ && GET_CODE (XEXP (op, 0)) != PRE_DEC
+ && GET_CODE (XEXP (op, 0)) != PRE_MODIFY")))
;; Return 1 if the operand is a memory operand with an address divisible by 4
(define_predicate "word_offset_memref_operand"
diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h
index d759c367c98..c73da36eb9a 100644
--- a/gcc/config/rs6000/rs6000-protos.h
+++ b/gcc/config/rs6000/rs6000-protos.h
@@ -123,15 +123,15 @@ extern void function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
extern int function_arg_boundary (enum machine_mode, tree);
extern rtx function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
extern tree altivec_resolve_overloaded_builtin (tree, tree);
-extern rtx rs6000_function_value (tree, tree);
+extern rtx rs6000_function_value (const_tree, const_tree);
extern rtx rs6000_libcall_value (enum machine_mode);
extern rtx rs6000_va_arg (tree, tree);
extern int function_ok_for_sibcall (tree);
extern void rs6000_elf_declare_function_name (FILE *, const char *, tree);
-extern bool rs6000_elf_in_small_data_p (tree);
+extern bool rs6000_elf_in_small_data_p (const_tree);
#ifdef ARGS_SIZE_RTX
/* expr.h defines ARGS_SIZE_RTX and `enum direction' */
-extern enum direction function_arg_padding (enum machine_mode, tree);
+extern enum direction function_arg_padding (enum machine_mode, const_tree);
#endif /* ARGS_SIZE_RTX */
#endif /* TREE_CODE */
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 44e492854c5..010b532993e 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -702,7 +702,7 @@ struct processor_costs power6_cost = {
static bool rs6000_function_ok_for_sibcall (tree, tree);
-static const char *rs6000_invalid_within_doloop (rtx);
+static const char *rs6000_invalid_within_doloop (const_rtx);
static rtx rs6000_generate_compare (enum rtx_code);
static void rs6000_emit_stack_tie (void);
static void rs6000_frame_related (rtx, rtx, HOST_WIDE_INT, rtx, rtx);
@@ -728,10 +728,10 @@ static void rs6000_assemble_visibility (tree, int);
static int rs6000_ra_ever_killed (void);
static tree rs6000_handle_longcall_attribute (tree *, tree, tree, int, bool *);
static tree rs6000_handle_altivec_attribute (tree *, tree, tree, int, bool *);
-static bool rs6000_ms_bitfield_layout_p (tree);
+static bool rs6000_ms_bitfield_layout_p (const_tree);
static tree rs6000_handle_struct_attribute (tree *, tree, tree, int, bool *);
static void rs6000_eliminate_indexed_memrefs (rtx operands[2]);
-static const char *rs6000_mangle_type (tree);
+static const char *rs6000_mangle_type (const_tree);
extern const struct attribute_spec rs6000_attribute_table[];
static void rs6000_set_default_type_attributes (tree);
static bool rs6000_reg_live_or_pic_offset_p (int);
@@ -740,7 +740,7 @@ static void rs6000_output_function_epilogue (FILE *, HOST_WIDE_INT);
static void rs6000_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT,
tree);
static rtx rs6000_emit_set_long_const (rtx, HOST_WIDE_INT, HOST_WIDE_INT);
-static bool rs6000_return_in_memory (tree, tree);
+static bool rs6000_return_in_memory (const_tree, const_tree);
static void rs6000_file_start (void);
#if TARGET_ELF
static int rs6000_elf_reloc_rw_mask (void);
@@ -753,7 +753,7 @@ static section *rs6000_elf_select_rtx_section (enum machine_mode, rtx,
static void rs6000_elf_encode_section_info (tree, rtx, int)
ATTRIBUTE_UNUSED;
#endif
-static bool rs6000_use_blocks_for_constant_p (enum machine_mode, rtx);
+static bool rs6000_use_blocks_for_constant_p (enum machine_mode, const_rtx);
#if TARGET_XCOFF
static void rs6000_xcoff_asm_output_anchor (rtx);
static void rs6000_xcoff_asm_globalize_label (FILE *, const char *);
@@ -805,7 +805,7 @@ static tree rs6000_builtin_mul_widen_odd (tree);
static tree rs6000_builtin_conversion (enum tree_code, tree);
static void def_builtin (int, const char *, tree, int);
-static bool rs6000_vector_alignment_reachable (tree, bool);
+static bool rs6000_vector_alignment_reachable (const_tree, bool);
static void rs6000_init_builtins (void);
static rtx rs6000_expand_unop_builtin (enum insn_code, tree, rtx);
static rtx rs6000_expand_binop_builtin (enum insn_code, tree, rtx);
@@ -850,7 +850,7 @@ static void compute_save_world_info (rs6000_stack_t *info_ptr);
static void is_altivec_return_reg (rtx, void *);
static rtx generate_set_vrsave (rtx, rs6000_stack_t *, int);
int easy_vector_constant (rtx, enum machine_mode);
-static bool rs6000_is_opaque_type (tree);
+static bool rs6000_is_opaque_type (const_tree);
static rtx rs6000_dwarf_register_span (rtx);
static void rs6000_init_dwarf_reg_sizes_extra (tree);
static rtx rs6000_legitimize_tls_address (rtx, enum tls_model);
@@ -871,19 +871,19 @@ static void rs6000_darwin64_record_arg_flush (CUMULATIVE_ARGS *,
HOST_WIDE_INT,
rtx[], int *);
static void rs6000_darwin64_record_arg_recurse (CUMULATIVE_ARGS *,
- tree, HOST_WIDE_INT,
- rtx[], int *);
-static rtx rs6000_darwin64_record_arg (CUMULATIVE_ARGS *, tree, int, bool);
+ const_tree, HOST_WIDE_INT,
+ rtx[], int *);
+static rtx rs6000_darwin64_record_arg (CUMULATIVE_ARGS *, const_tree, int, bool);
static rtx rs6000_mixed_function_arg (enum machine_mode, tree, int);
static void rs6000_move_block_from_reg (int regno, rtx x, int nregs);
static void setup_incoming_varargs (CUMULATIVE_ARGS *,
enum machine_mode, tree,
int *, int);
static bool rs6000_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
- tree, bool);
+ const_tree, bool);
static int rs6000_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
-static const char *invalid_arg_for_unprototyped_fn (tree, tree, tree);
+static const char *invalid_arg_for_unprototyped_fn (const_tree, const_tree, const_tree);
#if TARGET_MACHO
static void macho_branch_islands (void);
static int no_previous_def (tree function_name);
@@ -893,7 +893,7 @@ static void rs6000_darwin_file_start (void);
static tree rs6000_build_builtin_va_list (void);
static tree rs6000_gimplify_va_arg (tree, tree, tree *, tree *);
-static bool rs6000_must_pass_in_stack (enum machine_mode, tree);
+static bool rs6000_must_pass_in_stack (enum machine_mode, const_tree);
static bool rs6000_scalar_mode_supported_p (enum machine_mode);
static bool rs6000_vector_mode_supported_p (enum machine_mode);
static int get_vec_cmp_insn (enum rtx_code, enum machine_mode,
@@ -1100,7 +1100,7 @@ static const char alt_reg_names[][8] =
#define TARGET_ASM_OUTPUT_MI_THUNK rs6000_output_mi_thunk
#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
-#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_tree_hwi_hwi_tree_true
+#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_const_tree_hwi_hwi_const_tree_true
#undef TARGET_FUNCTION_OK_FOR_SIBCALL
#define TARGET_FUNCTION_OK_FOR_SIBCALL rs6000_function_ok_for_sibcall
@@ -1125,9 +1125,9 @@ static const char alt_reg_names[][8] =
/* On rs6000, function arguments are promoted, as are function return
values. */
#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY rs6000_return_in_memory
@@ -1141,7 +1141,7 @@ static const char alt_reg_names[][8] =
#undef TARGET_PRETEND_OUTGOING_VARARGS_NAMED
#define TARGET_PRETEND_OUTGOING_VARARGS_NAMED hook_bool_CUMULATIVE_ARGS_true
#undef TARGET_SPLIT_COMPLEX_ARG
-#define TARGET_SPLIT_COMPLEX_ARG hook_bool_tree_true
+#define TARGET_SPLIT_COMPLEX_ARG hook_bool_const_tree_true
#undef TARGET_MUST_PASS_IN_STACK
#define TARGET_MUST_PASS_IN_STACK rs6000_must_pass_in_stack
#undef TARGET_PASS_BY_REFERENCE
@@ -1914,7 +1914,7 @@ rs6000_builtin_mul_widen_odd (tree type)
how may iterations are required to reach desired alignment. */
static bool
-rs6000_vector_alignment_reachable (tree type ATTRIBUTE_UNUSED, bool is_packed)
+rs6000_vector_alignment_reachable (const_tree type ATTRIBUTE_UNUSED, bool is_packed)
{
if (is_packed)
return false;
@@ -4765,7 +4765,7 @@ rs6000_emit_move (rtx dest, rtx source, enum machine_mode mode)
memory always. The cast to unsigned makes -1 > 8. */
static bool
-rs6000_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+rs6000_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
{
/* In the darwin64 abi, try to use registers for larger structs
if possible. */
@@ -4887,7 +4887,7 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype,
/* Return true if TYPE must be passed on the stack and not in registers. */
static bool
-rs6000_must_pass_in_stack (enum machine_mode mode, tree type)
+rs6000_must_pass_in_stack (enum machine_mode mode, const_tree type)
{
if (DEFAULT_ABI == ABI_AIX || TARGET_64BIT)
return must_pass_in_stack_var_size (mode, type);
@@ -4905,7 +4905,7 @@ rs6000_must_pass_in_stack (enum machine_mode mode, tree type)
argument slot. */
enum direction
-function_arg_padding (enum machine_mode mode, tree type)
+function_arg_padding (enum machine_mode mode, const_tree type)
{
#ifndef AGGREGATE_PADDING_FIXED
#define AGGREGATE_PADDING_FIXED 0
@@ -5464,7 +5464,7 @@ rs6000_darwin64_record_arg_flush (CUMULATIVE_ARGS *cum,
/* Recursive workhorse for the following. */
static void
-rs6000_darwin64_record_arg_recurse (CUMULATIVE_ARGS *cum, tree type,
+rs6000_darwin64_record_arg_recurse (CUMULATIVE_ARGS *cum, const_tree type,
HOST_WIDE_INT startbitpos, rtx rvec[],
int *k)
{
@@ -5534,7 +5534,7 @@ rs6000_darwin64_record_arg_recurse (CUMULATIVE_ARGS *cum, tree type,
calling convention. */
static rtx
-rs6000_darwin64_record_arg (CUMULATIVE_ARGS *orig_cum, tree type,
+rs6000_darwin64_record_arg (CUMULATIVE_ARGS *orig_cum, const_tree type,
int named, bool retval)
{
rtx rvec[FIRST_PSEUDO_REGISTER];
@@ -5992,7 +5992,7 @@ rs6000_arg_partial_bytes (CUMULATIVE_ARGS *cum, enum machine_mode mode,
static bool
rs6000_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
- enum machine_mode mode, tree type,
+ enum machine_mode mode, const_tree type,
bool named ATTRIBUTE_UNUSED)
{
if (DEFAULT_ABI == ABI_V4 && TARGET_IEEEQUAD && mode == TFmode)
@@ -7737,13 +7737,13 @@ altivec_expand_dst_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
tree arg0, arg1, arg2;
enum machine_mode mode0, mode1, mode2;
rtx pat, op0, op1, op2;
- struct builtin_description *d;
+ const struct builtin_description *d;
size_t i;
*expandedp = false;
/* Handle DST variants. */
- d = (struct builtin_description *) bdesc_dst;
+ d = bdesc_dst;
for (i = 0; i < ARRAY_SIZE (bdesc_dst); i++, d++)
if (d->code == fcode)
{
@@ -7896,8 +7896,8 @@ altivec_expand_vec_ext_builtin (tree exp, rtx target)
static rtx
altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
{
- struct builtin_description *d;
- struct builtin_description_predicates *dp;
+ const struct builtin_description *d;
+ const struct builtin_description_predicates *dp;
size_t i;
enum insn_code icode;
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
@@ -8026,13 +8026,13 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
}
/* Expand abs* operations. */
- d = (struct builtin_description *) bdesc_abs;
+ d = bdesc_abs;
for (i = 0; i < ARRAY_SIZE (bdesc_abs); i++, d++)
if (d->code == fcode)
return altivec_expand_abs_builtin (d->icode, exp, target);
/* Expand the AltiVec predicates. */
- dp = (struct builtin_description_predicates *) bdesc_altivec_preds;
+ dp = bdesc_altivec_preds;
for (i = 0; i < ARRAY_SIZE (bdesc_altivec_preds); i++, dp++)
if (dp->code == fcode)
return altivec_expand_predicate_builtin (dp->icode, dp->opcode,
@@ -8407,7 +8407,7 @@ rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
{
tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
- struct builtin_description *d;
+ const struct builtin_description *d;
size_t i;
rtx ret;
bool success;
@@ -8492,7 +8492,7 @@ rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
return rs6000_expand_binop_builtin (d->icode, exp, target);
/* Handle simple ternary operations. */
- d = (struct builtin_description *) bdesc_3arg;
+ d = bdesc_3arg;
for (i = 0; i < ARRAY_SIZE (bdesc_3arg); i++, d++)
if (d->code == fcode)
return rs6000_expand_ternop_builtin (d->icode, exp, target);
@@ -8867,8 +8867,8 @@ spe_init_builtins (void)
static void
altivec_init_builtins (void)
{
- struct builtin_description *d;
- struct builtin_description_predicates *dp;
+ const struct builtin_description *d;
+ const struct builtin_description_predicates *dp;
size_t i;
tree ftype;
@@ -9049,12 +9049,12 @@ altivec_init_builtins (void)
def_builtin (MASK_ALTIVEC, "__builtin_vec_ctu", opaque_ftype_opaque_int, ALTIVEC_BUILTIN_VEC_CTU);
/* Add the DST variants. */
- d = (struct builtin_description *) bdesc_dst;
+ d = bdesc_dst;
for (i = 0; i < ARRAY_SIZE (bdesc_dst); i++, d++)
def_builtin (d->mask, d->name, void_ftype_pcvoid_int_int, d->code);
/* Initialize the predicates. */
- dp = (struct builtin_description_predicates *) bdesc_altivec_preds;
+ dp = bdesc_altivec_preds;
for (i = 0; i < ARRAY_SIZE (bdesc_altivec_preds); i++, dp++)
{
enum machine_mode mode1;
@@ -9092,7 +9092,7 @@ altivec_init_builtins (void)
}
/* Initialize the abs* operators. */
- d = (struct builtin_description *) bdesc_abs;
+ d = bdesc_abs;
for (i = 0; i < ARRAY_SIZE (bdesc_abs); i++, d++)
{
enum machine_mode mode0;
@@ -9223,7 +9223,7 @@ altivec_init_builtins (void)
static void
rs6000_common_init_builtins (void)
{
- struct builtin_description *d;
+ const struct builtin_description *d;
size_t i;
tree v4sf_ftype_v4sf_v4sf_v16qi
@@ -9420,7 +9420,7 @@ rs6000_common_init_builtins (void)
V8HI_type_node, V8HI_type_node, NULL_TREE);
/* Add the simple ternary operators. */
- d = (struct builtin_description *) bdesc_3arg;
+ d = bdesc_3arg;
for (i = 0; i < ARRAY_SIZE (bdesc_3arg); i++, d++)
{
enum machine_mode mode0, mode1, mode2, mode3;
@@ -12757,14 +12757,16 @@ rs6000_emit_sync (enum rtx_code code, enum machine_mode mode,
ishift = GET_MODE_BITSIZE (SImode) - GET_MODE_BITSIZE (mode);
shift = GEN_INT (ishift);
+ used_m = change_address (used_m, SImode, 0);
}
else
{
rtx addrSI, aligned_addr;
int shift_mask = mode == QImode ? 0x18 : 0x10;
- addrSI = force_reg (SImode, gen_lowpart_common (SImode,
- XEXP (used_m, 0)));
+ addrSI = gen_lowpart_common (SImode,
+ force_reg (Pmode, XEXP (used_m, 0)));
+ addrSI = force_reg (SImode, addrSI);
shift = gen_reg_rtx (SImode);
emit_insn (gen_rlwinm (shift, addrSI, GEN_INT (3),
@@ -12777,14 +12779,14 @@ rs6000_emit_sync (enum rtx_code code, enum machine_mode mode,
1, OPTAB_LIB_WIDEN);
used_m = change_address (used_m, SImode, aligned_addr);
set_mem_align (used_m, 32);
- /* It's safe to keep the old alias set of USED_M, because
- the operation is atomic and only affects the original
- USED_M. */
- if (GET_CODE (m) == NOT)
- m = gen_rtx_NOT (SImode, used_m);
- else
- m = used_m;
}
+ /* It's safe to keep the old alias set of USED_M, because
+ the operation is atomic and only affects the original
+ USED_M. */
+ if (GET_CODE (m) == NOT)
+ m = gen_rtx_NOT (SImode, used_m);
+ else
+ m = used_m;
if (GET_CODE (op) == NOT)
{
@@ -14119,7 +14121,7 @@ rs6000_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
PowerPC uses the COUNT register for branch on table instructions. */
static const char *
-rs6000_invalid_within_doloop (rtx insn)
+rs6000_invalid_within_doloop (const_rtx insn)
{
if (CALL_P (insn))
return "Function call in the loop.";
@@ -19003,7 +19005,7 @@ rs6000_handle_altivec_attribute (tree *node,
elements; we must teach the compiler how to mangle them. */
static const char *
-rs6000_mangle_type (tree type)
+rs6000_mangle_type (const_tree type)
{
type = TYPE_MAIN_VARIANT (type);
@@ -19133,7 +19135,7 @@ rs6000_handle_struct_attribute (tree *node, tree name,
}
static bool
-rs6000_ms_bitfield_layout_p (tree record_type)
+rs6000_ms_bitfield_layout_p (const_tree record_type)
{
return (TARGET_USE_MS_BITFIELD_LAYOUT &&
!lookup_attribute ("gcc_struct", TYPE_ATTRIBUTES (record_type)))
@@ -19234,8 +19236,18 @@ rs6000_elf_encode_section_info (tree decl, rtx rtl, int first)
}
}
+static inline bool
+compare_section_name (const char *section, const char *template)
+{
+ int len;
+
+ len = strlen (template);
+ return (strncmp (section, template, len) == 0
+ && (section[len] == 0 || section[len] == '.'));
+}
+
bool
-rs6000_elf_in_small_data_p (tree decl)
+rs6000_elf_in_small_data_p (const_tree decl)
{
if (rs6000_sdata == SDATA_NONE)
return false;
@@ -19251,10 +19263,12 @@ rs6000_elf_in_small_data_p (tree decl)
if (TREE_CODE (decl) == VAR_DECL && DECL_SECTION_NAME (decl))
{
const char *section = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
- if (strcmp (section, ".sdata") == 0
- || strcmp (section, ".sdata2") == 0
- || strcmp (section, ".sbss") == 0
- || strcmp (section, ".sbss2") == 0
+ if (compare_section_name (section, ".sdata")
+ || compare_section_name (section, ".sdata2")
+ || compare_section_name (section, ".gnu.linkonce.s")
+ || compare_section_name (section, ".sbss")
+ || compare_section_name (section, ".sbss2")
+ || compare_section_name (section, ".gnu.linkonce.sb")
|| strcmp (section, ".PPC.EMB.sdata0") == 0
|| strcmp (section, ".PPC.EMB.sbss0") == 0)
return true;
@@ -19279,7 +19293,7 @@ rs6000_elf_in_small_data_p (tree decl)
/* Implement TARGET_USE_BLOCKS_FOR_CONSTANT_P. */
static bool
-rs6000_use_blocks_for_constant_p (enum machine_mode mode, rtx x)
+rs6000_use_blocks_for_constant_p (enum machine_mode mode, const_rtx x)
{
return !ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (x, mode);
}
@@ -20762,7 +20776,7 @@ rs6000_complex_function_value (enum machine_mode mode)
fp1, unless -msoft-float. */
rtx
-rs6000_function_value (tree valtype, tree func ATTRIBUTE_UNUSED)
+rs6000_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED)
{
enum machine_mode mode;
unsigned int regno;
@@ -20965,7 +20979,7 @@ rs6000_initial_elimination_offset (int from, int to)
/* Return true if TYPE is a SPE or AltiVec opaque type. */
static bool
-rs6000_is_opaque_type (tree type)
+rs6000_is_opaque_type (const_tree type)
{
return (type == opaque_V2SI_type_node
|| type == opaque_V2SF_type_node
@@ -21092,7 +21106,7 @@ rs6000_vector_mode_supported_p (enum machine_mode mode)
/* Target hook for invalid_arg_for_unprototyped_fn. */
static const char *
-invalid_arg_for_unprototyped_fn (tree typelist, tree funcdecl, tree val)
+invalid_arg_for_unprototyped_fn (const_tree typelist, const_tree funcdecl, const_tree val)
{
return (!rs6000_darwin64_abi
&& typelist == 0
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index be682c61331..4bc71128278 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -176,30 +176,30 @@
(include "darwin.md")
-;; Mode macros
+;; Mode iterators
-; This mode macro allows :GPR to be used to indicate the allowable size
+; This mode iterator allows :GPR to be used to indicate the allowable size
; of whole values in GPRs.
-(define_mode_macro GPR [SI (DI "TARGET_POWERPC64")])
+(define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
; Any supported integer mode.
-(define_mode_macro INT [QI HI SI DI TI])
+(define_mode_iterator INT [QI HI SI DI TI])
; Any supported integer mode that fits in one register.
-(define_mode_macro INT1 [QI HI SI (DI "TARGET_POWERPC64")])
+(define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
; extend modes for DImode
-(define_mode_macro QHSI [QI HI SI])
+(define_mode_iterator QHSI [QI HI SI])
; SImode or DImode, even if DImode doesn't fit in GPRs.
-(define_mode_macro SDI [SI DI])
+(define_mode_iterator SDI [SI DI])
; The size of a pointer. Also, the size of the value that a record-condition
; (one with a '.') will compare.
-(define_mode_macro P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
+(define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
; Any hardware-supported floating-point mode
-(define_mode_macro FP [(SF "TARGET_HARD_FLOAT")
+(define_mode_iterator FP [(SF "TARGET_HARD_FLOAT")
(DF "TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)")
(TF "!TARGET_IEEEQUAD
&& TARGET_HARD_FLOAT
@@ -5821,7 +5821,7 @@
(float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
(use (match_operand:SI 2 "gpc_reg_operand" "r"))
(use (match_operand:DF 3 "gpc_reg_operand" "f"))
- (clobber (match_operand:DF 4 "memory_operand" "=o"))
+ (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
(clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
(clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
"! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
@@ -5892,7 +5892,7 @@
(unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
(use (match_operand:SI 2 "gpc_reg_operand" "r"))
(use (match_operand:DF 3 "gpc_reg_operand" "f"))
- (clobber (match_operand:DF 4 "memory_operand" "=o"))
+ (clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
(clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
"! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
"#"
@@ -5959,7 +5959,7 @@
[(set (match_operand:SI 0 "gpc_reg_operand" "=r")
(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
(clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
- (clobber (match_operand:DI 3 "memory_operand" "=o"))]
+ (clobber (match_operand:DI 3 "offsettable_mem_operand" "=o"))]
"(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS"
"#"
"&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[3]))"
@@ -6112,7 +6112,7 @@
(define_insn_and_split "floatsidf_ppc64"
[(set (match_operand:DF 0 "gpc_reg_operand" "=f")
(float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
- (clobber (match_operand:DI 2 "memory_operand" "=o"))
+ (clobber (match_operand:DI 2 "offsettable_mem_operand" "=o"))
(clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
(clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
"TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS"
@@ -6127,7 +6127,7 @@
(define_insn_and_split "floatunssidf_ppc64"
[(set (match_operand:DF 0 "gpc_reg_operand" "=f")
(unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
- (clobber (match_operand:DI 2 "memory_operand" "=o"))
+ (clobber (match_operand:DI 2 "offsettable_mem_operand" "=o"))
(clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))
(clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))]
"TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS"
@@ -8800,7 +8800,7 @@
(clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
(clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
(clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
- (clobber (match_operand:DI 5 "memory_operand" "=o"))]
+ (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
"!TARGET_IEEEQUAD
&& TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
"#"
diff --git a/gcc/config/rs6000/spe.md b/gcc/config/rs6000/spe.md
index d49c12661c8..b7b2fef8eab 100644
--- a/gcc/config/rs6000/spe.md
+++ b/gcc/config/rs6000/spe.md
@@ -36,13 +36,13 @@
])
;; Modes using a 64-bit register.
-(define_mode_macro SPE64 [DF V4HI V2SF V1DI V2SI])
+(define_mode_iterator SPE64 [DF V4HI V2SF V1DI V2SI])
;; Likewise, but allow TFmode (two registers) as well.
-(define_mode_macro SPE64TF [DF V4HI V2SF V1DI V2SI TF])
+(define_mode_iterator SPE64TF [DF V4HI V2SF V1DI V2SI TF])
;; DImode and TImode.
-(define_mode_macro DITI [DI TI])
+(define_mode_iterator DITI [DI TI])
(define_insn "*negsf2_gpr"
[(set (match_operand:SF 0 "gpc_reg_operand" "=r")
diff --git a/gcc/config/rs6000/sync.md b/gcc/config/rs6000/sync.md
index 4573509eaa7..58397154645 100644
--- a/gcc/config/rs6000/sync.md
+++ b/gcc/config/rs6000/sync.md
@@ -21,7 +21,7 @@
(define_mode_attr larx [(SI "lwarx") (DI "ldarx")])
(define_mode_attr stcx [(SI "stwcx.") (DI "stdcx.")])
-(define_code_macro FETCHOP [plus minus ior xor and])
+(define_code_iterator FETCHOP [plus minus ior xor and])
(define_code_attr fetchop_name
[(plus "add") (minus "sub") (ior "ior") (xor "xor") (and "and")])
(define_code_attr fetchop_pred
diff --git a/gcc/config/s390/s390-protos.h b/gcc/config/s390/s390-protos.h
index 3e72f5c00c2..bfefb0daa33 100644
--- a/gcc/config/s390/s390-protos.h
+++ b/gcc/config/s390/s390-protos.h
@@ -121,7 +121,7 @@ extern void s390_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
tree, int);
#ifdef RTX_CODE
extern rtx s390_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
-extern rtx s390_function_value (tree, enum machine_mode);
+extern rtx s390_function_value (const_tree, enum machine_mode);
extern void s390_va_start (tree, rtx);
#endif /* RTX_CODE */
#endif /* TREE_CODE */
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index b37cbc0556d..aa6db1f3d26 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -3927,8 +3927,8 @@ s390_expand_addcc (enum rtx_code cmp_code, rtx cmp_op0, rtx cmp_op1,
if (!register_operand (src, GET_MODE (dst)))
src = force_reg (GET_MODE (dst), src);
- src = gen_rtx_PLUS (GET_MODE (dst), src, const0_rtx);
- op_res = gen_rtx_PLUS (GET_MODE (dst), src, op_res);
+ op_res = gen_rtx_PLUS (GET_MODE (dst), op_res, src);
+ op_res = gen_rtx_PLUS (GET_MODE (dst), op_res, const0_rtx);
}
p = rtvec_alloc (2);
@@ -4370,7 +4370,7 @@ s390_output_dwarf_dtprel (FILE *file, int size, rtx x)
/* Implement TARGET_MANGLE_TYPE. */
static const char *
-s390_mangle_type (tree type)
+s390_mangle_type (const_tree type)
{
if (TYPE_MAIN_VARIANT (type) == long_double_type_node
&& TARGET_LONG_DOUBLE_128)
@@ -7644,7 +7644,7 @@ s390_emit_epilogue (bool sibcall)
MODE must be specified. */
static int
-s390_function_arg_size (enum machine_mode mode, tree type)
+s390_function_arg_size (enum machine_mode mode, const_tree type)
{
if (type)
return int_size_in_bytes (type);
@@ -7742,7 +7742,7 @@ s390_function_arg_integer (enum machine_mode mode, tree type)
static bool
s390_pass_by_reference (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
- enum machine_mode mode, tree type,
+ enum machine_mode mode, const_tree type,
bool named ATTRIBUTE_UNUSED)
{
int size = s390_function_arg_size (mode, type);
@@ -7842,7 +7842,7 @@ s390_function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
hidden first argument. */
static bool
-s390_return_in_memory (tree type, tree fundecl ATTRIBUTE_UNUSED)
+s390_return_in_memory (const_tree type, const_tree fundecl ATTRIBUTE_UNUSED)
{
/* We accept small integral (and similar) types. */
if (INTEGRAL_TYPE_P (type)
@@ -7869,7 +7869,7 @@ s390_return_in_memory (tree type, tree fundecl ATTRIBUTE_UNUSED)
value of mode MODE from a libcall. */
rtx
-s390_function_value (tree type, enum machine_mode mode)
+s390_function_value (const_tree type, enum machine_mode mode)
{
if (type)
{
@@ -9290,7 +9290,7 @@ s390_reorg (void)
#undef TARGET_ASM_OUTPUT_MI_THUNK
#define TARGET_ASM_OUTPUT_MI_THUNK s390_output_mi_thunk
#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
-#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_tree_hwi_hwi_tree_true
+#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_const_tree_hwi_hwi_const_tree_true
#undef TARGET_SCHED_ADJUST_PRIORITY
#define TARGET_SCHED_ADJUST_PRIORITY s390_adjust_priority
@@ -9318,9 +9318,9 @@ s390_reorg (void)
#define TARGET_GIMPLIFY_VA_ARG_EXPR s390_gimplify_va_arg
#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
#undef TARGET_PASS_BY_REFERENCE
#define TARGET_PASS_BY_REFERENCE s390_pass_by_reference
@@ -9334,7 +9334,7 @@ s390_reorg (void)
#define TARGET_CC_MODES_COMPATIBLE s390_cc_modes_compatible
#undef TARGET_INVALID_WITHIN_DOLOOP
-#define TARGET_INVALID_WITHIN_DOLOOP hook_constcharptr_rtx_null
+#define TARGET_INVALID_WITHIN_DOLOOP hook_constcharptr_const_rtx_null
#ifdef HAVE_AS_TLS
#undef TARGET_ASM_OUTPUT_DWARF_DTPREL
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index 4fb55050345..8cc8edfe070 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -803,10 +803,13 @@ extern struct rtx_def *s390_compare_op0, *s390_compare_op1, *s390_compare_emitte
|| (TARGET_64BIT && (SIZE) == 8) )
/* This macro is used to determine whether store_by_pieces should be
- called to "memset" storage with byte values other than zero, or
- to "memcpy" storage when the source is a constant string. */
+ called to "memcpy" storage when the source is a constant string. */
#define STORE_BY_PIECES_P(SIZE, ALIGN) MOVE_BY_PIECES_P (SIZE, ALIGN)
+/* Likewise to decide whether to "memset" storage with byte values
+ other than zero. */
+#define SET_BY_PIECES_P(SIZE, ALIGN) STORE_BY_PIECES_P (SIZE, ALIGN)
+
/* Don't perform CSE on function addresses. */
#define NO_FUNCTION_CSE
diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index 3e5610b6f6d..66cf5612da6 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -246,54 +246,54 @@
;; Other includes
(include "tpf.md")
-;; Macros
+;; Iterators
-;; This mode macro allows floating point patterns to be generated from the
+;; These mode iterators allow floating point patterns to be generated from the
;; same template.
-(define_mode_macro FP [TF DF SF (TD "TARGET_HARD_DFP") (DD "TARGET_HARD_DFP")])
-(define_mode_macro BFP [TF DF SF])
-(define_mode_macro DFP [TD DD])
-(define_mode_macro DFP_ALL [TD DD SD])
-(define_mode_macro DSF [DF SF])
-(define_mode_macro SD_SF [SF SD])
-(define_mode_macro DD_DF [DF DD])
-(define_mode_macro TD_TF [TF TD])
-
-;; These mode macros allow 31-bit and 64-bit TDSI patterns to be generated
+(define_mode_iterator FP [TF DF SF (TD "TARGET_HARD_DFP") (DD "TARGET_HARD_DFP")])
+(define_mode_iterator BFP [TF DF SF])
+(define_mode_iterator DFP [TD DD])
+(define_mode_iterator DFP_ALL [TD DD SD])
+(define_mode_iterator DSF [DF SF])
+(define_mode_iterator SD_SF [SF SD])
+(define_mode_iterator DD_DF [DF DD])
+(define_mode_iterator TD_TF [TF TD])
+
+;; This mode iterator allows 31-bit and 64-bit TDSI patterns to be generated
;; from the same template.
-(define_mode_macro TDSI [(TI "TARGET_64BIT") DI SI])
+(define_mode_iterator TDSI [(TI "TARGET_64BIT") DI SI])
-;; These mode macros allow 31-bit and 64-bit GPR patterns to be generated
+;; These mode iterators allow 31-bit and 64-bit GPR patterns to be generated
;; from the same template.
-(define_mode_macro GPR [(DI "TARGET_64BIT") SI])
-(define_mode_macro DSI [DI SI])
+(define_mode_iterator GPR [(DI "TARGET_64BIT") SI])
+(define_mode_iterator DSI [DI SI])
-;; This mode macro allows :P to be used for patterns that operate on
+;; These mode iterators allow :P to be used for patterns that operate on
;; pointer-sized quantities. Exactly one of the two alternatives will match.
-(define_mode_macro DP [(TI "TARGET_64BIT") (DI "!TARGET_64BIT")])
-(define_mode_macro P [(DI "TARGET_64BIT") (SI "!TARGET_64BIT")])
+(define_mode_iterator DP [(TI "TARGET_64BIT") (DI "!TARGET_64BIT")])
+(define_mode_iterator P [(DI "TARGET_64BIT") (SI "!TARGET_64BIT")])
-;; This mode macro allows the QI and HI patterns to be defined from
+;; This mode iterator allows the QI and HI patterns to be defined from
;; the same template.
-(define_mode_macro HQI [HI QI])
+(define_mode_iterator HQI [HI QI])
-;; This mode macro allows the integer patterns to be defined from the
+;; This mode iterator allows the integer patterns to be defined from the
;; same template.
-(define_mode_macro INT [(DI "TARGET_64BIT") SI HI QI])
+(define_mode_iterator INT [(DI "TARGET_64BIT") SI HI QI])
-;; This macro allows to unify all 'bCOND' expander patterns.
-(define_code_macro COMPARE [eq ne gt gtu lt ltu ge geu le leu unordered
+;; This iterator allows to unify all 'bCOND' expander patterns.
+(define_code_iterator COMPARE [eq ne gt gtu lt ltu ge geu le leu unordered
ordered uneq unlt ungt unle unge ltgt])
-;; This macro allows to unify all 'sCOND' patterns.
-(define_code_macro SCOND [ltu gtu leu geu])
+;; This iterator allows to unify all 'sCOND' patterns.
+(define_code_iterator SCOND [ltu gtu leu geu])
-;; This macro allows some 'ashift' and 'lshiftrt' pattern to be defined from
+;; This iterator allows some 'ashift' and 'lshiftrt' pattern to be defined from
;; the same template.
-(define_code_macro SHIFT [ashift lshiftrt])
+(define_code_iterator SHIFT [ashift lshiftrt])
-;; These macros allow to combine most atomic operations.
-(define_code_macro ATOMIC [and ior xor plus minus mult])
+;; This iterator and attribute allow to combine most atomic operations.
+(define_code_iterator ATOMIC [and ior xor plus minus mult])
(define_code_attr atomic [(and "and") (ior "ior") (xor "xor")
(plus "add") (minus "sub") (mult "nand")])
@@ -312,18 +312,18 @@
(define_mode_attr RXe [(TF "RXE") (DF "RX") (SF "RX")])
;; The decimal floating point variants of add, sub, div and mul support 3
-;; fp register operands. The following macros allow to merge the bfp and
+;; fp register operands. The following attributes allow to merge the bfp and
;; dfp variants in a single insn definition.
-;; This macro is used to set op_type accordingly.
+;; This attribute is used to set op_type accordingly.
(define_mode_attr RRer [(TF "RRE") (DF "RRE") (SF "RRE") (TD "RRR")
(DD "RRR") (SD "RRR")])
-;; This macro is used in the operand constraint list in order to have the
+;; This attribute is used in the operand constraint list in order to have the
;; first and the second operand match for bfp modes.
(define_mode_attr f0 [(TF "0") (DF "0") (SF "0") (TD "f") (DD "f") (DD "f")])
-;; This macro is used in the operand list of the instruction to have an
+;; This attribute is used in the operand list of the instruction to have an
;; additional operand for the dfp instructions.
(define_mode_attr op1 [(TF "") (DF "") (SF "")
(TD "%1,") (DD "%1,") (SD "%1,")])
@@ -341,7 +341,7 @@
;; This is used to disable the memory alternative in TFmode patterns.
(define_mode_attr Rf [(TF "f") (DF "R") (SF "R") (TD "f") (DD "f") (SD "f")])
-;; This macro adds b for bfp instructions and t for dfp instructions and is used
+;; This attribute adds b for bfp instructions and t for dfp instructions and is used
;; within instruction mnemonics.
(define_mode_attr bt [(TF "b") (DF "b") (SF "b") (TD "t") (DD "t") (SD "t")])
@@ -3635,8 +3635,9 @@
(match_dup 7)))
(set (match_dup 6) (plus:DI (match_dup 7) (match_dup 8)))])
(parallel
- [(set (match_dup 3) (plus:DI (plus:DI (match_dup 4) (match_dup 5))
- (ltu:DI (reg:CCL1 CC_REGNUM) (const_int 0))))
+ [(set (match_dup 3) (plus:DI
+ (plus:DI (ltu:DI (reg:CCL1 CC_REGNUM) (const_int 0))
+ (match_dup 4)) (match_dup 5)))
(clobber (reg:CC CC_REGNUM))])]
"operands[3] = operand_subword (operands[0], 0, 0, TImode);
operands[4] = operand_subword (operands[1], 0, 0, TImode);
@@ -3719,8 +3720,9 @@
(match_dup 7)))
(set (match_dup 6) (plus:SI (match_dup 7) (match_dup 8)))])
(parallel
- [(set (match_dup 3) (plus:SI (plus:SI (match_dup 4) (match_dup 5))
- (ltu:SI (reg:CCL1 CC_REGNUM) (const_int 0))))
+ [(set (match_dup 3) (plus:SI
+ (plus:SI (ltu:SI (reg:CCL1 CC_REGNUM) (const_int 0))
+ (match_dup 4)) (match_dup 5)))
(clobber (reg:CC CC_REGNUM))])]
"operands[3] = operand_subword (operands[0], 0, 0, DImode);
operands[4] = operand_subword (operands[1], 0, 0, DImode);
@@ -4304,16 +4306,85 @@
; add(di|si)cc instruction pattern(s).
;
+; the following 4 patterns are used when the result of an add with
+; carry is checked for an overflow condition
+
+; op1 + op2 + c < op1
+
+; alcr, alc, alcgr, alcg
+(define_insn "*add<mode>3_alc_carry1_cc"
+ [(set (reg CC_REGNUM)
+ (compare
+ (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
+ (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
+ (match_operand:GPR 2 "general_operand" "d,m"))
+ (match_dup 1)))
+ (set (match_operand:GPR 0 "register_operand" "=d,d")
+ (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))]
+ "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
+ "@
+ alc<g>r\t%0,%2
+ alc<g>\t%0,%2"
+ [(set_attr "op_type" "RRE,RXY")])
+
+; alcr, alc, alcgr, alcg
+(define_insn "*add<mode>3_alc_carry1_cconly"
+ [(set (reg CC_REGNUM)
+ (compare
+ (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
+ (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
+ (match_operand:GPR 2 "general_operand" "d,m"))
+ (match_dup 1)))
+ (clobber (match_scratch:GPR 0 "=d,d"))]
+ "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
+ "@
+ alc<g>r\t%0,%2
+ alc<g>\t%0,%2"
+ [(set_attr "op_type" "RRE,RXY")])
+
+; op1 + op2 + c < op2
+
+; alcr, alc, alcgr, alcg
+(define_insn "*add<mode>3_alc_carry2_cc"
+ [(set (reg CC_REGNUM)
+ (compare
+ (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
+ (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
+ (match_operand:GPR 2 "general_operand" "d,m"))
+ (match_dup 2)))
+ (set (match_operand:GPR 0 "register_operand" "=d,d")
+ (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))]
+ "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
+ "@
+ alc<g>r\t%0,%2
+ alc<g>\t%0,%2"
+ [(set_attr "op_type" "RRE,RXY")])
+
+; alcr, alc, alcgr, alcg
+(define_insn "*add<mode>3_alc_carry2_cconly"
+ [(set (reg CC_REGNUM)
+ (compare
+ (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
+ (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
+ (match_operand:GPR 2 "general_operand" "d,m"))
+ (match_dup 2)))
+ (clobber (match_scratch:GPR 0 "=d,d"))]
+ "s390_match_ccmode (insn, CCL1mode) && TARGET_CPU_ZARCH"
+ "@
+ alc<g>r\t%0,%2
+ alc<g>\t%0,%2"
+ [(set_attr "op_type" "RRE,RXY")])
+
; alcr, alc, alcgr, alcg
(define_insn "*add<mode>3_alc_cc"
[(set (reg CC_REGNUM)
(compare
- (plus:GPR (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,0")
- (match_operand:GPR 2 "general_operand" "d,m"))
- (match_operand:GPR 3 "s390_alc_comparison" ""))
+ (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
+ (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
+ (match_operand:GPR 2 "general_operand" "d,m"))
(const_int 0)))
(set (match_operand:GPR 0 "register_operand" "=d,d")
- (plus:GPR (plus:GPR (match_dup 1) (match_dup 2)) (match_dup 3)))]
+ (plus:GPR (plus:GPR (match_dup 3) (match_dup 1)) (match_dup 2)))]
"s390_match_ccmode (insn, CCLmode) && TARGET_CPU_ZARCH"
"@
alc<g>r\t%0,%2
@@ -4323,9 +4394,9 @@
; alcr, alc, alcgr, alcg
(define_insn "*add<mode>3_alc"
[(set (match_operand:GPR 0 "register_operand" "=d,d")
- (plus:GPR (plus:GPR (match_operand:GPR 1 "nonimmediate_operand" "%0,0")
- (match_operand:GPR 2 "general_operand" "d,m"))
- (match_operand:GPR 3 "s390_alc_comparison" "")))
+ (plus:GPR (plus:GPR (match_operand:GPR 3 "s390_alc_comparison" "")
+ (match_operand:GPR 1 "nonimmediate_operand" "%0,0"))
+ (match_operand:GPR 2 "general_operand" "d,m")))
(clobber (reg:CC CC_REGNUM))]
"TARGET_CPU_ZARCH"
"@
@@ -4386,8 +4457,8 @@
"&& reload_completed"
[(set (match_dup 0) (const_int 0))
(parallel
- [(set (match_dup 0) (plus:GPR (plus:GPR (match_dup 0) (match_dup 0))
- (match_dup 1)))
+ [(set (match_dup 0) (plus:GPR (plus:GPR (match_dup 1) (match_dup 0))
+ (match_dup 0)))
(clobber (reg:CC CC_REGNUM))])]
"")
diff --git a/gcc/config/score/score-protos.h b/gcc/config/score/score-protos.h
index 56d3bcc9309..ea99eeafb29 100644
--- a/gcc/config/score/score-protos.h
+++ b/gcc/config/score/score-protos.h
@@ -55,7 +55,7 @@ void score_init_cumulative_args (CUMULATIVE_ARGS *cum,
void score_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
tree type, int named);
-rtx score_function_value (tree valtype, tree func, enum machine_mode mode);
+rtx score_function_value (const_tree valtype, const_tree func, enum machine_mode mode);
rtx score_va_arg (tree va_list, tree type);
@@ -71,7 +71,8 @@ int score_register_move_cost (enum machine_mode mode, enum reg_class to,
enum reg_class from);
void score_declare_object (FILE *stream, const char *name,
- const char *directive, const char *fmt, ...);
+ const char *directive, const char *fmt, ...)
+ ATTRIBUTE_PRINTF_4;
void score_declare_object_name (FILE *stream, const char *name, tree decl);
diff --git a/gcc/config/score/score.c b/gcc/config/score/score.c
index 1a3aee5412f..6dba9903b7e 100644
--- a/gcc/config/score/score.c
+++ b/gcc/config/score/score.c
@@ -59,8 +59,8 @@
#define CE_REG_CLASS_P(C) \
((C) == HI_REG || (C) == LO_REG || (C) == CE_REGS)
-static int score_arg_partial_bytes (const CUMULATIVE_ARGS *,
- enum machine_mode, tree, int);
+static int score_arg_partial_bytes (CUMULATIVE_ARGS *,
+ enum machine_mode, tree, bool);
static int score_symbol_insns (enum score_symbol_type);
@@ -101,16 +101,16 @@ static int score_address_cost (rtx);
#define TARGET_ASM_OUTPUT_MI_THUNK th_output_mi_thunk
#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
-#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_tree_hwi_hwi_tree_true
+#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_const_tree_hwi_hwi_const_tree_true
#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
#undef TARGET_MUST_PASS_IN_STACK
#define TARGET_MUST_PASS_IN_STACK must_pass_in_stack_var_size
@@ -137,7 +137,7 @@ static int score_address_cost (rtx);
small structures are returned in a register.
Objects with varying size must still be returned in memory. */
static bool
-score_return_in_memory (tree type, tree fndecl ATTRIBUTE_UNUSED)
+score_return_in_memory (const_tree type, const_tree fndecl ATTRIBUTE_UNUSED)
{
return ((TYPE_MODE (type) == BLKmode)
|| (int_size_in_bytes (type) > 2 * UNITS_PER_WORD)
@@ -147,7 +147,7 @@ score_return_in_memory (tree type, tree fndecl ATTRIBUTE_UNUSED)
/* Return nonzero when an argument must be passed by reference. */
static bool
score_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
- enum machine_mode mode, tree type,
+ enum machine_mode mode, const_tree type,
bool named ATTRIBUTE_UNUSED)
{
/* If we have a variable-sized parameter, we have no choice. */
@@ -156,7 +156,7 @@ score_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
/* Return a legitimate address for REG + OFFSET. */
static rtx
-score_add_offset (rtx temp, rtx reg, HOST_WIDE_INT offset)
+score_add_offset (rtx temp ATTRIBUTE_UNUSED, rtx reg, HOST_WIDE_INT offset)
{
if (!IMM_IN_RANGE (offset, 15, 1))
{
@@ -427,7 +427,7 @@ th_select_rtx_section (enum machine_mode mode, rtx x,
/* Implement TARGET_IN_SMALL_DATA_P. */
static bool
-th_in_small_data_p (tree decl)
+th_in_small_data_p (const_tree decl)
{
HOST_WIDE_INT size;
@@ -685,8 +685,8 @@ score_function_arg_advance (CUMULATIVE_ARGS *cum, enum machine_mode mode,
/* Implement TARGET_ARG_PARTIAL_BYTES macro. */
static int
-score_arg_partial_bytes (const CUMULATIVE_ARGS *cum,
- enum machine_mode mode, tree type, int named)
+score_arg_partial_bytes (CUMULATIVE_ARGS *cum,
+ enum machine_mode mode, tree type, bool named)
{
struct score_arg_info info;
classify_arg (cum, mode, type, named, &info);
@@ -730,7 +730,7 @@ score_function_arg (const CUMULATIVE_ARGS *cum, enum machine_mode mode,
VALTYPE is the return type and MODE is VOIDmode. For libcalls,
VALTYPE is null and MODE is the mode of the return value. */
rtx
-score_function_value (tree valtype, tree func ATTRIBUTE_UNUSED,
+score_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED,
enum machine_mode mode)
{
if (valtype)
diff --git a/gcc/config/score/score.h b/gcc/config/score/score.h
index c0cc3040364..d2c78012c24 100644
--- a/gcc/config/score/score.h
+++ b/gcc/config/score/score.h
@@ -791,7 +791,7 @@ typedef struct score_args
#undef ASM_DECLARE_OBJECT_NAME
#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
- score_declare_object (STREAM, NAME, "", ":\n", 0)
+ score_declare_object (STREAM, NAME, "", ":\n")
/* This says how to output an external. It would be possible not to
output anything and let undefined symbol become external. However
diff --git a/gcc/config/sh/sh-protos.h b/gcc/config/sh/sh-protos.h
index f8ee7ba15cd..e236a0ecd1a 100644
--- a/gcc/config/sh/sh-protos.h
+++ b/gcc/config/sh/sh-protos.h
@@ -137,7 +137,7 @@ extern int initial_elimination_offset (int, int);
extern int fldi_ok (void);
extern int sh_hard_regno_rename_ok (unsigned int, unsigned int);
extern int sh_cfun_interrupt_handler_p (void);
-extern int sh_attr_renesas_p (tree);
+extern int sh_attr_renesas_p (const_tree);
extern int sh_cfun_attr_renesas_p (void);
extern void sh_initialize_trampoline (rtx, rtx, rtx);
extern bool sh_cannot_change_mode_class
@@ -161,7 +161,7 @@ extern rtx sh_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
extern void sh_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
extern int sh_pass_in_reg_p (CUMULATIVE_ARGS *, enum machine_mode, tree);
extern void sh_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, signed int, enum machine_mode);
-extern bool sh_promote_prototypes (tree);
+extern bool sh_promote_prototypes (const_tree);
extern rtx replace_n_hard_rtx (rtx, rtx *, int , int);
extern int shmedia_cleanup_truncate (rtx *, void *);
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index f5e0f6a1c14..927355fb775 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -214,7 +214,7 @@ static bool sh_function_ok_for_sibcall (tree, tree);
static bool sh_cannot_modify_jumps_p (void);
static int sh_target_reg_class (void);
static bool sh_optimize_target_register_callee_saved (bool);
-static bool sh_ms_bitfield_layout_p (tree);
+static bool sh_ms_bitfield_layout_p (const_tree);
static void sh_init_builtins (void);
static void sh_media_init_builtins (void);
@@ -242,7 +242,7 @@ static struct save_entry_s *sh5_schedule_saves (HARD_REG_SET *,
struct save_schedule_s *, int);
static rtx sh_struct_value_rtx (tree, int);
-static bool sh_return_in_memory (tree, tree);
+static bool sh_return_in_memory (const_tree, const_tree);
static rtx sh_builtin_saveregs (void);
static void sh_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int);
static bool sh_strict_argument_naming (CUMULATIVE_ARGS *);
@@ -250,12 +250,12 @@ static bool sh_pretend_outgoing_varargs_named (CUMULATIVE_ARGS *);
static tree sh_build_builtin_va_list (void);
static tree sh_gimplify_va_arg_expr (tree, tree, tree *, tree *);
static bool sh_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
- tree, bool);
+ const_tree, bool);
static bool sh_callee_copies (CUMULATIVE_ARGS *, enum machine_mode,
- tree, bool);
+ const_tree, bool);
static int sh_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
-static int sh_dwarf_calling_convention (tree);
+static int sh_dwarf_calling_convention (const_tree);
/* Initialize the GCC target structure. */
@@ -281,7 +281,7 @@ static int sh_dwarf_calling_convention (tree);
#define TARGET_ASM_OUTPUT_MI_THUNK sh_output_mi_thunk
#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
-#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_tree_hwi_hwi_tree_true
+#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_const_tree_hwi_hwi_const_tree_true
#undef TARGET_ASM_FILE_START
#define TARGET_ASM_FILE_START sh_file_start
@@ -7201,7 +7201,7 @@ sh_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
}
}
- if (TARGET_SH4)
+ if (TARGET_SH4 || TARGET_SH2A_DOUBLE)
{
pass_as_float = ((TREE_CODE (eff_type) == REAL_TYPE && size <= 8)
|| (TREE_CODE (eff_type) == COMPLEX_TYPE
@@ -7313,7 +7313,7 @@ sh_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
tmp = build1 (LABEL_EXPR, void_type_node, lab_false);
gimplify_and_add (tmp, pre_p);
- if (size > 4 && ! TARGET_SH4)
+ if (size > 4 && ! (TARGET_SH4 || TARGET_SH2A))
{
tmp = build2 (GIMPLE_MODIFY_STMT, ptr_type_node,
next_o, next_o_limit);
@@ -7354,7 +7354,7 @@ sh_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
}
bool
-sh_promote_prototypes (tree type)
+sh_promote_prototypes (const_tree type)
{
if (TARGET_HITACHI)
return 0;
@@ -7369,8 +7369,8 @@ sh_promote_prototypes (tree type)
loads them into the full 64-bits registers. */
static int
-shcompact_byref (CUMULATIVE_ARGS *cum, enum machine_mode mode,
- tree type, bool named)
+shcompact_byref (const CUMULATIVE_ARGS *cum, enum machine_mode mode,
+ const_tree type, bool named)
{
unsigned HOST_WIDE_INT size;
@@ -7394,7 +7394,7 @@ shcompact_byref (CUMULATIVE_ARGS *cum, enum machine_mode mode,
static bool
sh_pass_by_reference (CUMULATIVE_ARGS *cum, enum machine_mode mode,
- tree type, bool named)
+ const_tree type, bool named)
{
if (targetm.calls.must_pass_in_stack (mode, type))
return true;
@@ -7416,7 +7416,7 @@ sh_pass_by_reference (CUMULATIVE_ARGS *cum, enum machine_mode mode,
static bool
sh_callee_copies (CUMULATIVE_ARGS *cum, enum machine_mode mode,
- tree type, bool named ATTRIBUTE_UNUSED)
+ const_tree type, bool named ATTRIBUTE_UNUSED)
{
/* ??? How can it possibly be correct to return true only on the
caller side of the equation? Is there someplace else in the
@@ -7715,7 +7715,7 @@ sh_struct_value_rtx (tree fndecl, int incoming ATTRIBUTE_UNUSED)
/* Worker function for TARGET_RETURN_IN_MEMORY. */
static bool
-sh_return_in_memory (tree type, tree fndecl)
+sh_return_in_memory (const_tree type, const_tree fndecl)
{
if (TARGET_SH5)
{
@@ -8052,7 +8052,7 @@ sh_handle_renesas_attribute (tree *node ATTRIBUTE_UNUSED,
/* True if __attribute__((renesas)) or -mrenesas. */
int
-sh_attr_renesas_p (tree td)
+sh_attr_renesas_p (const_tree td)
{
if (TARGET_HITACHI)
return 1;
@@ -9346,7 +9346,7 @@ sh_optimize_target_register_callee_saved (bool after_prologue_epilogue_gen)
}
static bool
-sh_ms_bitfield_layout_p (tree record_type ATTRIBUTE_UNUSED)
+sh_ms_bitfield_layout_p (const_tree record_type ATTRIBUTE_UNUSED)
{
return (TARGET_SH5 || TARGET_HITACHI || sh_attr_renesas_p (record_type));
}
@@ -9774,7 +9774,7 @@ sh_vector_mode_supported_p (enum machine_mode mode)
/* Implements target hook dwarf_calling_convention. Return an enum
of dwarf_calling_convention. */
int
-sh_dwarf_calling_convention (tree func)
+sh_dwarf_calling_convention (const_tree func)
{
if (sh_attr_renesas_p (func))
return DW_CC_GNU_renesas_sh;
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index 71f5b6f3cd9..8f299b75afe 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -2184,6 +2184,8 @@ struct sh_args {
(move_by_pieces_ninsns (SIZE, ALIGN, STORE_MAX_PIECES + 1) \
< (TARGET_SMALLCODE ? 2 : ((ALIGN >= 32) ? 16 : 2)))
+#define SET_BY_PIECES_P(SIZE, ALIGN) STORE_BY_PIECES_P(SIZE, ALIGN)
+
/* Macros to check register numbers against specific register classes. */
/* These assume that REGNO is a hard or pseudo reg number.
diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h
index 5881966be2a..217948af08d 100644
--- a/gcc/config/sparc/sparc-protos.h
+++ b/gcc/config/sparc/sparc-protos.h
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
#define __SPARC_PROTOS_H__
#ifdef TREE_CODE
-extern struct rtx_def *function_value (tree, enum machine_mode, int);
+extern struct rtx_def *function_value (const_tree, enum machine_mode, int);
extern void function_arg_advance (CUMULATIVE_ARGS *,
enum machine_mode, tree, int);
extern struct rtx_def *function_arg (const CUMULATIVE_ARGS *,
@@ -36,7 +36,7 @@ extern void sparc_va_start (tree, rtx);
extern unsigned long sparc_type_code (tree);
#ifdef ARGS_SIZE_RTX
/* expr.h defines ARGS_SIZE_RTX and `enum direction' */
-extern enum direction function_arg_padding (enum machine_mode, tree);
+extern enum direction function_arg_padding (enum machine_mode, const_tree);
#endif /* ARGS_SIZE_RTX */
#endif /* TREE_CODE */
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 0b27b87a2e2..3ad1a7f3cdf 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -372,8 +372,8 @@ static int sparc_vis_mul8x16 (int, int);
static tree sparc_handle_vis_mul8x16 (int, tree, tree, tree);
static void sparc_output_mi_thunk (FILE *, tree, HOST_WIDE_INT,
HOST_WIDE_INT, tree);
-static bool sparc_can_output_mi_thunk (tree, HOST_WIDE_INT,
- HOST_WIDE_INT, tree);
+static bool sparc_can_output_mi_thunk (const_tree, HOST_WIDE_INT,
+ HOST_WIDE_INT, const_tree);
static struct machine_function * sparc_init_machine_status (void);
static bool sparc_cannot_force_const_mem (rtx);
static rtx sparc_tls_get_addr (void);
@@ -381,21 +381,21 @@ static rtx sparc_tls_got (void);
static const char *get_some_local_dynamic_name (void);
static int get_some_local_dynamic_name_1 (rtx *, void *);
static bool sparc_rtx_costs (rtx, int, int, int *);
-static bool sparc_promote_prototypes (tree);
+static bool sparc_promote_prototypes (const_tree);
static rtx sparc_struct_value_rtx (tree, int);
-static bool sparc_return_in_memory (tree, tree);
+static bool sparc_return_in_memory (const_tree, const_tree);
static bool sparc_strict_argument_naming (CUMULATIVE_ARGS *);
static tree sparc_gimplify_va_arg (tree, tree, tree *, tree *);
static bool sparc_vector_mode_supported_p (enum machine_mode);
static bool sparc_pass_by_reference (CUMULATIVE_ARGS *,
- enum machine_mode, tree, bool);
+ enum machine_mode, const_tree, bool);
static int sparc_arg_partial_bytes (CUMULATIVE_ARGS *,
enum machine_mode, tree, bool);
static void sparc_dwarf_handle_frame_unspec (const char *, rtx, int);
static void sparc_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
static void sparc_file_end (void);
#ifdef TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
-static const char *sparc_mangle_type (tree);
+static const char *sparc_mangle_type (const_tree);
#endif
#ifdef SUBTARGET_ATTRIBUTE_TABLE
const struct attribute_spec sparc_attribute_table[];
@@ -494,13 +494,13 @@ static bool fpu_option_set = false;
no-op for TARGET_ARCH32 this is ok. Otherwise we'd need to add a runtime
test for this value. */
#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
/* This is only needed for TARGET_ARCH64, but since PROMOTE_FUNCTION_MODE is a
no-op for TARGET_ARCH32 this is ok. Otherwise we'd need to add a runtime
test for this value. */
#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
#undef TARGET_PROMOTE_PROTOTYPES
#define TARGET_PROMOTE_PROTOTYPES sparc_promote_prototypes
@@ -4469,7 +4469,7 @@ init_cumulative_args (struct sparc_args *cum, tree fntype,
When a prototype says `char' or `short', really pass an `int'. */
static bool
-sparc_promote_prototypes (tree fntype ATTRIBUTE_UNUSED)
+sparc_promote_prototypes (const_tree fntype ATTRIBUTE_UNUSED)
{
return TARGET_ARCH32 ? true : false;
}
@@ -4681,17 +4681,17 @@ struct function_arg_record_value_parms
static void function_arg_record_value_3
(HOST_WIDE_INT, struct function_arg_record_value_parms *);
static void function_arg_record_value_2
- (tree, HOST_WIDE_INT, struct function_arg_record_value_parms *, bool);
+ (const_tree, HOST_WIDE_INT, struct function_arg_record_value_parms *, bool);
static void function_arg_record_value_1
- (tree, HOST_WIDE_INT, struct function_arg_record_value_parms *, bool);
-static rtx function_arg_record_value (tree, enum machine_mode, int, int, int);
+ (const_tree, HOST_WIDE_INT, struct function_arg_record_value_parms *, bool);
+static rtx function_arg_record_value (const_tree, enum machine_mode, int, int, int);
static rtx function_arg_union_value (int, enum machine_mode, int, int);
/* A subroutine of function_arg_record_value. Traverse the structure
recursively and determine how many registers will be required. */
static void
-function_arg_record_value_1 (tree type, HOST_WIDE_INT startbitpos,
+function_arg_record_value_1 (const_tree type, HOST_WIDE_INT startbitpos,
struct function_arg_record_value_parms *parms,
bool packed_p)
{
@@ -4847,7 +4847,7 @@ function_arg_record_value_3 (HOST_WIDE_INT bitpos,
to make that happen. */
static void
-function_arg_record_value_2 (tree type, HOST_WIDE_INT startbitpos,
+function_arg_record_value_2 (const_tree type, HOST_WIDE_INT startbitpos,
struct function_arg_record_value_parms *parms,
bool packed_p)
{
@@ -4954,7 +4954,7 @@ function_arg_record_value_2 (tree type, HOST_WIDE_INT startbitpos,
REGBASE is the regno of the base register for the parameter array. */
static rtx
-function_arg_record_value (tree type, enum machine_mode mode,
+function_arg_record_value (const_tree type, enum machine_mode mode,
int slotno, int named, int regbase)
{
HOST_WIDE_INT typesize = int_size_in_bytes (type);
@@ -5327,7 +5327,7 @@ sparc_arg_partial_bytes (CUMULATIVE_ARGS *cum, enum machine_mode mode,
static bool
sparc_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
- enum machine_mode mode, tree type,
+ enum machine_mode mode, const_tree type,
bool named ATTRIBUTE_UNUSED)
{
if (TARGET_ARCH32)
@@ -5424,7 +5424,7 @@ function_arg_advance (struct sparc_args *cum, enum machine_mode mode,
argument slot. */
enum direction
-function_arg_padding (enum machine_mode mode, tree type)
+function_arg_padding (enum machine_mode mode, const_tree type)
{
if (TARGET_ARCH64 && type != 0 && AGGREGATE_TYPE_P (type))
return upward;
@@ -5437,7 +5437,7 @@ function_arg_padding (enum machine_mode mode, tree type)
Specify whether to return the return value in memory. */
static bool
-sparc_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+sparc_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
{
if (TARGET_ARCH32)
/* Original SPARC 32-bit ABI says that structures and unions,
@@ -5545,7 +5545,7 @@ sparc_struct_value_rtx (tree fndecl, int incoming)
except that up to 32 bytes may be returned in registers. */
rtx
-function_value (tree type, enum machine_mode mode, int incoming_p)
+function_value (const_tree type, enum machine_mode mode, int incoming_p)
{
/* Beware that the two values are swapped here wrt function_arg. */
int regbase = (incoming_p
@@ -8788,10 +8788,10 @@ sparc_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
assembler code for the thunk function specified by the arguments
it is passed, and false otherwise. */
static bool
-sparc_can_output_mi_thunk (tree thunk_fndecl ATTRIBUTE_UNUSED,
+sparc_can_output_mi_thunk (const_tree thunk_fndecl ATTRIBUTE_UNUSED,
HOST_WIDE_INT delta ATTRIBUTE_UNUSED,
HOST_WIDE_INT vcall_offset,
- tree function ATTRIBUTE_UNUSED)
+ const_tree function ATTRIBUTE_UNUSED)
{
/* Bound the loop used in the default method above. */
return (vcall_offset >= -32768 || ! fixed_regs[5]);
@@ -8890,7 +8890,7 @@ sparc_file_end (void)
/* Implement TARGET_MANGLE_TYPE. */
static const char *
-sparc_mangle_type (tree type)
+sparc_mangle_type (const_tree type)
{
if (!TARGET_64BIT
&& TYPE_MAIN_VARIANT (type) == long_double_type_node
diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md
index 05370fcfe14..329dd1a7ab1 100644
--- a/gcc/config/sparc/sparc.md
+++ b/gcc/config/sparc/sparc.md
@@ -1701,7 +1701,7 @@
(set_attr "branch_type" "reg")])
-(define_mode_macro P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
+(define_mode_iterator P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
;; Load in operand 0 the (absolute) address of operand 1, which is a symbolic
;; value subject to a PC-relative relocation. Operand 2 is a helper function
@@ -2340,7 +2340,7 @@
;; Floating point and vector move instructions
;; We don't define V1SI because SI should work just fine.
-(define_mode_macro V32 [SF V2HI V4QI])
+(define_mode_iterator V32 [SF V2HI V4QI])
;; Yes, you guessed it right, the former movsf expander.
(define_expand "mov<V32:mode>"
@@ -2476,7 +2476,7 @@
[(set (match_dup 0) (high:SF (match_dup 1)))
(set (match_dup 0) (lo_sum:SF (match_dup 0) (match_dup 1)))])
-(define_mode_macro V64 [DF V2SI V4HI V8QI])
+(define_mode_iterator V64 [DF V2SI V4HI V8QI])
;; Yes, you again guessed it right, the former movdf expander.
(define_expand "mov<V64:mode>"
@@ -5276,8 +5276,8 @@
;; We define DImode `and' so with DImode `not' we can get
;; DImode `andn'. Other combinations are possible.
-(define_mode_macro V64I [DI V2SI V4HI V8QI])
-(define_mode_macro V32I [SI V2HI V4QI])
+(define_mode_iterator V64I [DI V2SI V4HI V8QI])
+(define_mode_iterator V32I [SI V2HI V4QI])
(define_expand "and<V64I:mode>3"
[(set (match_operand:V64I 0 "register_operand" "")
diff --git a/gcc/config/sparc/sync.md b/gcc/config/sparc/sync.md
index 05c85d90597..17cf691d5b4 100644
--- a/gcc/config/sparc/sync.md
+++ b/gcc/config/sparc/sync.md
@@ -18,9 +18,9 @@
;; along with GCC; see the file COPYING3. If not see
;; <http://www.gnu.org/licenses/>.
-(define_mode_macro I12MODE [QI HI])
-(define_mode_macro I24MODE [HI SI])
-(define_mode_macro I48MODE [SI (DI "TARGET_ARCH64 || TARGET_V8PLUS")])
+(define_mode_iterator I12MODE [QI HI])
+(define_mode_iterator I24MODE [HI SI])
+(define_mode_iterator I48MODE [SI (DI "TARGET_ARCH64 || TARGET_V8PLUS")])
(define_mode_attr modesuffix [(SI "") (DI "x")])
(define_expand "memory_barrier"
diff --git a/gcc/config/spu/spu-protos.h b/gcc/config/spu/spu-protos.h
index 6369a6770ec..b00fc5d4efc 100644
--- a/gcc/config/spu/spu-protos.h
+++ b/gcc/config/spu/spu-protos.h
@@ -59,7 +59,7 @@ extern int spu_legitimate_address (enum machine_mode mode, rtx x,
int reg_ok_strict);
extern rtx spu_legitimize_address (rtx x, rtx oldx, enum machine_mode mode);
extern int spu_initial_elimination_offset (int from, int to);
-extern rtx spu_function_value (tree type, tree func);
+extern rtx spu_function_value (const_tree type, const_tree func);
extern rtx spu_function_arg (int cum, enum machine_mode mode, tree type,
int named);
extern void spu_va_start (tree valist, rtx nextarg);
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index 555beab5318..eda0de03813 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -113,8 +113,8 @@ static tree spu_handle_vector_attribute (tree * node, tree name, tree args,
int flags,
unsigned char *no_add_attrs);
static int spu_naked_function_p (tree func);
-static unsigned char spu_pass_by_reference (int *cum, enum machine_mode mode,
- tree type, unsigned char named);
+static unsigned char spu_pass_by_reference (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+ const_tree type, unsigned char named);
static tree spu_build_builtin_va_list (void);
static tree spu_gimplify_va_arg_expr (tree valist, tree type, tree * pre_p,
tree * post_p);
@@ -128,14 +128,14 @@ static unsigned char spu_rtx_costs (rtx x, int code, int outer_code,
int *total);
static unsigned char spu_function_ok_for_sibcall (tree decl, tree exp);
static void spu_init_libfuncs (void);
-static bool spu_return_in_memory (tree type, tree fntype);
+static bool spu_return_in_memory (const_tree type, const_tree fntype);
static void fix_range (const char *);
static void spu_encode_section_info (tree, rtx, int);
static tree spu_builtin_mul_widen_even (tree);
static tree spu_builtin_mul_widen_odd (tree);
static tree spu_builtin_mask_for_load (void);
static int spu_builtin_vectorization_cost (bool);
-static bool spu_vector_alignment_reachable (tree, bool);
+static bool spu_vector_alignment_reachable (const_tree, bool);
extern const char *reg_names[];
rtx spu_compare_op0, spu_compare_op1;
@@ -3020,7 +3020,7 @@ spu_initial_elimination_offset (int from, int to)
}
rtx
-spu_function_value (tree type, tree func ATTRIBUTE_UNUSED)
+spu_function_value (const_tree type, const_tree func ATTRIBUTE_UNUSED)
{
enum machine_mode mode = TYPE_MODE (type);
int byte_size = ((mode == BLKmode)
@@ -3102,7 +3102,7 @@ spu_function_arg (CUMULATIVE_ARGS cum,
static bool
spu_pass_by_reference (CUMULATIVE_ARGS * cum ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED,
- tree type, bool named ATTRIBUTE_UNUSED)
+ const_tree type, bool named ATTRIBUTE_UNUSED)
{
return type && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST;
}
@@ -4396,7 +4396,7 @@ spu_gen_subreg (enum machine_mode mode, rtx x)
}
static bool
-spu_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+spu_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
{
return (TYPE_MODE (type) == BLKmode
&& ((type) == 0
@@ -5485,7 +5485,7 @@ spu_builtin_vectorization_cost (bool runtime_test)
how may iterations are required to reach desired alignment. */
static bool
-spu_vector_alignment_reachable (tree type ATTRIBUTE_UNUSED, bool is_packed)
+spu_vector_alignment_reachable (const_tree type ATTRIBUTE_UNUSED, bool is_packed)
{
if (is_packed)
return false;
diff --git a/gcc/config/spu/spu.md b/gcc/config/spu/spu.md
index 4f2c41a7ec1..1afdd11f130 100644
--- a/gcc/config/spu/spu.md
+++ b/gcc/config/spu/spu.md
@@ -159,9 +159,9 @@
(include "constraints.md")
-;; Mode macros
+;; Mode iterators
-(define_mode_macro ALL [QI V16QI
+(define_mode_iterator ALL [QI V16QI
HI V8HI
SI V4SI
DI V2DI
@@ -171,43 +171,43 @@
; Everything except DI and TI which are handled separately because
; they need different constraints to correctly test VOIDmode constants
-(define_mode_macro MOV [QI V16QI
+(define_mode_iterator MOV [QI V16QI
HI V8HI
SI V4SI
V2DI
SF V4SF
DF V2DF])
-(define_mode_macro DTI [DI TI])
+(define_mode_iterator DTI [DI TI])
-(define_mode_macro VINT [QI V16QI
+(define_mode_iterator VINT [QI V16QI
HI V8HI
SI V4SI
DI V2DI
TI])
-(define_mode_macro VQHSI [QI V16QI
+(define_mode_iterator VQHSI [QI V16QI
HI V8HI
SI V4SI])
-(define_mode_macro VHSI [HI V8HI
+(define_mode_iterator VHSI [HI V8HI
SI V4SI])
-(define_mode_macro VSDF [SF V4SF
+(define_mode_iterator VSDF [SF V4SF
DF V2DF])
-(define_mode_macro VSI [SI V4SI])
-(define_mode_macro VDI [DI V2DI])
-(define_mode_macro VSF [SF V4SF])
-(define_mode_macro VDF [DF V2DF])
+(define_mode_iterator VSI [SI V4SI])
+(define_mode_iterator VDI [DI V2DI])
+(define_mode_iterator VSF [SF V4SF])
+(define_mode_iterator VDF [DF V2DF])
-(define_mode_macro VCMP [V16QI
+(define_mode_iterator VCMP [V16QI
V8HI
V4SI
V4SF
V2DF])
-(define_mode_macro VCMPU [V16QI
+(define_mode_iterator VCMPU [V16QI
V8HI
V4SI])
@@ -233,10 +233,10 @@
(SI "G") (V4SI "G")])
;; Used for carry and borrow instructions.
-(define_mode_macro CBOP [SI DI V4SI V2DI])
+(define_mode_iterator CBOP [SI DI V4SI V2DI])
;; Used in vec_set and vec_extract
-(define_mode_macro V [V2DI V4SI V8HI V16QI V2DF V4SF])
+(define_mode_iterator V [V2DI V4SI V8HI V16QI V2DF V4SF])
(define_mode_attr inner [(V16QI "QI")
(V8HI "HI")
(V4SI "SI")
@@ -3887,6 +3887,48 @@ selb\t%0,%4,%0,%3"
[(set_attr "type" "br")])
+
+ ;; Define the subtract-one-and-jump insns so loop.c
+ ;; knows what to generate.
+ (define_expand "doloop_end"
+ [(use (match_operand 0 "" "")) ; loop pseudo
+ (use (match_operand 1 "" "")) ; iterations; zero if unknown
+ (use (match_operand 2 "" "")) ; max iterations
+ (use (match_operand 3 "" "")) ; loop level
+ (use (match_operand 4 "" ""))] ; label
+ ""
+ "
+ {
+ /* Currently SMS relies on the do-loop pattern to recognize loops
+ where (1) the control part comprises of all insns defining and/or
+ using a certain 'count' register and (2) the loop count can be
+ adjusted by modifying this register prior to the loop.
+. ??? The possible introduction of a new block to initialize the
+ new IV can potentially effects branch optimizations. */
+ if (optimize > 0 && flag_modulo_sched)
+ {
+ rtx s0;
+ rtx bcomp;
+ rtx loc_ref;
+
+ /* Only use this on innermost loops. */
+ if (INTVAL (operands[3]) > 1)
+ FAIL;
+ if (GET_MODE (operands[0]) != SImode)
+ FAIL;
+
+ s0 = operands [0];
+ emit_move_insn (s0, gen_rtx_PLUS (SImode, s0, GEN_INT (-1)));
+ bcomp = gen_rtx_NE(SImode, s0, const0_rtx);
+ loc_ref = gen_rtx_LABEL_REF (VOIDmode, operands [4]);
+ emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx,
+ gen_rtx_IF_THEN_ELSE (VOIDmode, bcomp,
+ loc_ref, pc_rtx)));
+
+ DONE;
+ }
+ }")
+
;; convert between any two modes, avoiding any GCC assumptions
(define_expand "spu_convert"
[(set (match_operand 0 "spu_reg_operand" "")
diff --git a/gcc/config/stormy16/stormy16-protos.h b/gcc/config/stormy16/stormy16-protos.h
index 50820a144dd..c3c1c7aeec5 100644
--- a/gcc/config/stormy16/stormy16-protos.h
+++ b/gcc/config/stormy16/stormy16-protos.h
@@ -44,7 +44,7 @@ extern rtx xstormy16_function_arg
#if defined (TREE_CODE) && defined (RTX_CODE)
extern void xstormy16_expand_builtin_va_start (tree, rtx);
extern void xstormy16_initialize_trampoline (rtx, rtx, rtx);
-extern rtx xstormy16_function_value (tree, tree);
+extern rtx xstormy16_function_value (const_tree, const_tree);
#endif
#ifdef RTX_CODE
diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c
index d8293c12f00..b41440e6d4e 100644
--- a/gcc/config/stormy16/stormy16.c
+++ b/gcc/config/stormy16/stormy16.c
@@ -58,7 +58,7 @@ static void xstormy16_init_builtins (void);
static rtx xstormy16_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
static bool xstormy16_rtx_costs (rtx, int, int, int *);
static int xstormy16_address_cost (rtx);
-static bool xstormy16_return_in_memory (tree, tree);
+static bool xstormy16_return_in_memory (const_tree, const_tree);
/* Define the information needed to generate branch and scc insns. This is
stored from the compare operation. */
@@ -1515,7 +1515,7 @@ xstormy16_initialize_trampoline (rtx addr, rtx fnaddr, rtx static_chain)
/* Worker function for FUNCTION_VALUE. */
rtx
-xstormy16_function_value (tree valtype, tree func ATTRIBUTE_UNUSED)
+xstormy16_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED)
{
enum machine_mode mode;
mode = TYPE_MODE (valtype);
@@ -2637,9 +2637,9 @@ xstormy16_reorg (void)
/* Worker function for TARGET_RETURN_IN_MEMORY. */
static bool
-xstormy16_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+xstormy16_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
{
- HOST_WIDE_INT size = int_size_in_bytes (type);
+ const HOST_WIDE_INT size = int_size_in_bytes (type);
return (size == -1 || size > UNITS_PER_WORD * NUM_ARGUMENT_REGISTERS);
}
@@ -2670,11 +2670,11 @@ xstormy16_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
#define TARGET_GIMPLIFY_VA_ARG_EXPR xstormy16_expand_builtin_va_arg
#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY xstormy16_return_in_memory
diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c
index 494dbeb6341..85991db47e3 100644
--- a/gcc/config/v850/v850.c
+++ b/gcc/config/v850/v850.c
@@ -66,11 +66,11 @@ static void v850_asm_init_sections (void);
static section *v850_select_section (tree, int, unsigned HOST_WIDE_INT);
static void v850_encode_data_area (tree, rtx);
static void v850_encode_section_info (tree, rtx, int);
-static bool v850_return_in_memory (tree, tree);
+static bool v850_return_in_memory (const_tree, const_tree);
static void v850_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode,
tree, int *, int);
static bool v850_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
- tree, bool);
+ const_tree, bool);
static int v850_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
@@ -143,7 +143,7 @@ static GTY(()) section *zbss_section;
#define TARGET_MACHINE_DEPENDENT_REORG v850_reorg
#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY v850_return_in_memory
@@ -223,7 +223,7 @@ v850_handle_option (size_t code, const char *arg, int value ATTRIBUTE_UNUSED)
static bool
v850_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
- enum machine_mode mode, tree type,
+ enum machine_mode mode, const_tree type,
bool named ATTRIBUTE_UNUSED)
{
unsigned HOST_WIDE_INT size;
@@ -2929,7 +2929,7 @@ v850_select_section (tree exp,
/* Worker function for TARGET_RETURN_IN_MEMORY. */
static bool
-v850_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+v850_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
{
/* Return values > 8 bytes in length in memory. */
return int_size_in_bytes (type) > 8 || TYPE_MODE (type) == BLKmode;
diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c
index 810dcbbfb5b..6cfd7e0d1dc 100644
--- a/gcc/config/vax/vax.c
+++ b/gcc/config/vax/vax.c
@@ -82,7 +82,7 @@ static rtx vax_struct_value_rtx (tree, int);
#define TARGET_ADDRESS_COST vax_address_cost
#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
#undef TARGET_STRUCT_VALUE_RTX
#define TARGET_STRUCT_VALUE_RTX vax_struct_value_rtx
diff --git a/gcc/config/vax/vax.md b/gcc/config/vax/vax.md
index fd0597b72ae..0bc05b461dc 100644
--- a/gcc/config/vax/vax.md
+++ b/gcc/config/vax/vax.md
@@ -42,11 +42,11 @@
;; Integer modes supported on VAX, with a mapping from machine mode
;; to mnemonic suffix. DImode is always a special case.
-(define_mode_macro VAXint [QI HI SI])
+(define_mode_iterator VAXint [QI HI SI])
(define_mode_attr isfx [(QI "b") (HI "w") (SI "l")])
;; Similar for float modes supported on VAX.
-(define_mode_macro VAXfp [SF DF])
+(define_mode_iterator VAXfp [SF DF])
(define_mode_attr fsfx [(SF "f") (DF "%#")])
;; Some output patterns want integer immediates with a prefix...
@@ -1012,7 +1012,7 @@
"jbr %l0")
;; Conditional jumps
-(define_code_macro any_cond [eq ne gt lt gtu ltu ge le geu leu])
+(define_code_iterator any_cond [eq ne gt lt gtu ltu ge le geu leu])
(define_insn "b<code>"
[(set (pc)
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 63d65c249ae..2b307997c43 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -130,7 +130,7 @@ static rtx gen_float_relational (enum rtx_code, rtx, rtx);
static rtx gen_conditional_move (rtx);
static rtx fixup_subreg_mem (rtx);
static struct machine_function * xtensa_init_machine_status (void);
-static bool xtensa_return_in_msb (tree);
+static bool xtensa_return_in_msb (const_tree);
static void printx (FILE *, signed int);
static void xtensa_function_epilogue (FILE *, HOST_WIDE_INT);
static rtx xtensa_builtin_saveregs (void);
@@ -140,7 +140,7 @@ static section *xtensa_select_rtx_section (enum machine_mode, rtx,
unsigned HOST_WIDE_INT);
static bool xtensa_rtx_costs (rtx, int, int, int *);
static tree xtensa_build_builtin_va_list (void);
-static bool xtensa_return_in_memory (tree, tree);
+static bool xtensa_return_in_memory (const_tree, const_tree);
static tree xtensa_gimplify_va_arg_expr (tree, tree, tree *, tree *);
static void xtensa_init_builtins (void);
static tree xtensa_fold_builtin (tree, tree, bool);
@@ -179,16 +179,16 @@ static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] =
#define TARGET_BUILD_BUILTIN_VA_LIST xtensa_build_builtin_va_list
#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY xtensa_return_in_memory
#undef TARGET_SPLIT_COMPLEX_ARG
-#define TARGET_SPLIT_COMPLEX_ARG hook_bool_tree_true
+#define TARGET_SPLIT_COMPLEX_ARG hook_bool_const_tree_true
#undef TARGET_MUST_PASS_IN_STACK
#define TARGET_MUST_PASS_IN_STACK must_pass_in_stack_var_size
@@ -1842,7 +1842,7 @@ function_arg_boundary (enum machine_mode mode, tree type)
static bool
-xtensa_return_in_msb (tree valtype)
+xtensa_return_in_msb (const_tree valtype)
{
return (TARGET_BIG_ENDIAN
&& AGGREGATE_TYPE_P (valtype)
@@ -3100,7 +3100,7 @@ xtensa_rtx_costs (rtx x, int code, int outer_code, int *total)
/* Worker function for TARGET_RETURN_IN_MEMORY. */
static bool
-xtensa_return_in_memory (tree type, tree fntype ATTRIBUTE_UNUSED)
+xtensa_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
{
return ((unsigned HOST_WIDE_INT) int_size_in_bytes (type)
> 4 * UNITS_PER_WORD);
diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md
index 2dd68431160..2f47540a766 100644
--- a/gcc/config/xtensa/xtensa.md
+++ b/gcc/config/xtensa/xtensa.md
@@ -37,9 +37,9 @@
(UNSPECV_S32C1I 5)
])
-;; This code macro allows signed and unsigned widening multiplications
+;; This code iterator allows signed and unsigned widening multiplications
;; to use the same template.
-(define_code_macro any_extend [sign_extend zero_extend])
+(define_code_iterator any_extend [sign_extend zero_extend])
;; <u> expands to an empty string when doing a signed operation and
;; "u" when doing an unsigned operation.
@@ -48,32 +48,32 @@
;; <su> is like <u>, but the signed form expands to "s" rather than "".
(define_code_attr su [(sign_extend "s") (zero_extend "u")])
-;; This code macro allows four integer min/max operations to be
+;; This code iterator allows four integer min/max operations to be
;; generated from one template.
-(define_code_macro any_minmax [smin umin smax umax])
+(define_code_iterator any_minmax [smin umin smax umax])
;; <minmax> expands to the opcode name for any_minmax operations.
(define_code_attr minmax [(smin "min") (umin "minu")
(smax "max") (umax "maxu")])
-;; This code macro allows all branch instructions to be generated from
+;; This code iterator allows all branch instructions to be generated from
;; a single define_expand template.
-(define_code_macro any_cond [eq ne gt ge lt le gtu geu ltu leu])
+(define_code_iterator any_cond [eq ne gt ge lt le gtu geu ltu leu])
-;; This code macro is for setting a register from a comparison.
-(define_code_macro any_scc [eq ne gt ge lt le])
+;; This code iterator is for setting a register from a comparison.
+(define_code_iterator any_scc [eq ne gt ge lt le])
-;; This code macro is for floating-point comparisons.
-(define_code_macro any_scc_sf [eq lt le])
+;; This code iterator is for floating-point comparisons.
+(define_code_iterator any_scc_sf [eq lt le])
-;; These macros allow to combine most atomic operations.
-(define_code_macro ATOMIC [and ior xor plus minus mult])
+;; This iterator and attribute allow to combine most atomic operations.
+(define_code_iterator ATOMIC [and ior xor plus minus mult])
(define_code_attr atomic [(and "and") (ior "ior") (xor "xor")
(plus "add") (minus "sub") (mult "nand")])
-;; These mode macros allow the HI and QI patterns to be defined from
+;; This mode iterator allows the HI and QI patterns to be defined from
;; the same template.
-(define_mode_macro HQI [HI QI])
+(define_mode_iterator HQI [HI QI])
;; Attributes.
diff --git a/gcc/configure b/gcc/configure
index 4c07ea00306..1c5d90e4aba 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -14135,9 +14135,16 @@ L2:' > conftest.s
# arbitrary sections are supported and try the test.
as_ver=`$gcc_cv_as --version 2>/dev/null | sed 1q`
if echo "$as_ver" | grep GNU > /dev/null; then
- as_ver=`echo $as_ver | sed -e 's/GNU assembler \([0-9.][0-9.]*\).*/\1/'`
- as_major=`echo $as_ver | sed 's/\..*//'`
- as_minor=`echo $as_ver | sed 's/[^.]*\.\([0-9]*\).*/\1/'`
+ as_vers=`echo $as_ver | sed -n \
+ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
+ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
+ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
+ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p' \
+ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p' \
+ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p' \
+ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ -].*$,\1,p'`
+ as_major=`expr "$as_vers" : '\([0-9]*\)'`
+ as_minor=`expr "$as_vers" : '[0-9]*\.\([0-9]*\)'`
if test $as_major -eq 2 && test $as_minor -lt 11
then :
else gcc_cv_as_leb128=yes
@@ -16269,7 +16276,7 @@ if test "${gcc_cv_as_debug_prefix_map_flag+set}" = set; then
else
gcc_cv_as_debug_prefix_map_flag=no
if test $in_tree_gas = yes; then
- if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 19 \) \* 1000 + 0`
+ if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 18 \) \* 1000 + 0`
then gcc_cv_as_debug_prefix_map_flag=yes
fi
elif test x$gcc_cv_as != x; then
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 23683d1ee66..00f5b8a5d05 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2133,9 +2133,16 @@ L2:],
as_ver=`$gcc_cv_as --version 2>/dev/null | sed 1q`
if echo "$as_ver" | grep GNU > /dev/null; then
changequote(,)dnl
- as_ver=`echo $as_ver | sed -e 's/GNU assembler \([0-9.][0-9.]*\).*/\1/'`
- as_major=`echo $as_ver | sed 's/\..*//'`
- as_minor=`echo $as_ver | sed 's/[^.]*\.\([0-9]*\).*/\1/'`
+ as_vers=`echo $as_ver | sed -n \
+ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
+ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
+ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
+ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p' \
+ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p' \
+ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ ].*$,\1,p' \
+ -e 's,^.*[ ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ -].*$,\1,p'`
+ as_major=`expr "$as_vers" : '\([0-9]*\)'`
+ as_minor=`expr "$as_vers" : '[0-9]*\.\([0-9]*\)'`
changequote([,])dnl
if test $as_major -eq 2 && test $as_minor -lt 11
then :
@@ -3096,7 +3103,7 @@ if test x"$insn" != x; then
gcc_GAS_CHECK_FEATURE([--debug-prefix-map option],
gcc_cv_as_debug_prefix_map_flag,
- [2,19,0], [--debug-prefix-map /a=/b], [$insn],,
+ [2,18,0], [--debug-prefix-map /a=/b], [$insn],,
[AC_DEFINE(HAVE_AS_DEBUG_PREFIX_MAP, 1,
[Define if your assembler supports the --debug-prefix-map option.])])
fi
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index fa83612725d..a56349b5402 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,8 +1,154 @@
+2007-08-28 Paolo Carlini <pcarlini@suse.de>
+
+ PR c++/33209
+ * error.c (dump_expr): Deal with TEMPLATE_TYPE_PARM and
+ BOUND_TEMPLATE_TEMPLATE_PARM.
+
+2007-08-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/32596
+ PR c++/32400
+ * pt.c (check_explicit_specialization): Set DECL_INTERFACE_KNOWN
+ and DECL_NOT_REALLY_EXTERN if tmpl_func is not public.
+
+2007-08-27 Jason Merrill <jason@redhat.com>
+
+ PR c++/29000
+ * pt.c (build_non_dependent_expr, type_dependent_expression_p):
+ Look inside STMT_EXPR.
+ * semantics.c (stmt_expr_value_expr): New fn.
+ * cp-tree.h: Declare it.
+
+ PR c++/28558
+ * decl.c (groktypename): Ignore attributes applied to class type.
+
+2007-08-28 Richard Guenther <rguenther@suse.de>
+
+ * decl.c (duplicate_decls): Merge DECL_DISREGARD_INLINE_LIMITS.
+
+2007-08-28 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * error.c (dump_expr): Handle COMPLEX_CST.
+ * cxx-pretty-print.c (pp_cxx_primary_expression): Likewise.
+ (pp_cxx_expression): Likewise.
+
+2007-08-27 Alexandre Oliva <aoliva@redhat.com>
+
+ * decl.c (GNU_INLINE_P): New.
+ (duplicate_decls): Handle gnu_inline. Merge attributes and
+ some flags in overriding definitions.
+ (redeclaration_error_message): Handle gnu_inline.
+ (start_preparsed_function): Likewise.
+
+2007-08-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * call.c (sufficient_parms_p): Constify.
+ * class.c (same_signature_p): Likewise.
+ * cp-gimplify.c (is_invisiref_parm,
+ cxx_omp_privatize_by_reference): Likewise.
+ * cp-objcp-common.c (has_c_linkage): Likewise.
+ * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK,
+ sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p,
+ grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for,
+ num_artificial_parms_for, comp_template_parms,
+ template_parameter_pack_p, any_dependent_template_arguments_p,
+ any_type_dependent_arguments_p, any_value_dependent_elements_p,
+ repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p,
+ zero_init_p, member_p, cp_lvalue_kind,
+ builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p,
+ varargs_function_p, is_dummy_object, special_function_kind,
+ string_conv_p, type_unknown_p, comp_except_specs, compparms,
+ comp_cv_qualification, is_bitfield_expr_with_lowered_type,
+ unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly,
+ cp_has_mutable_p, at_least_as_qualified_p,
+ invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise.
+ * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise.
+ * except.c (nothrow_libfn_p): Likewise.
+ * method.c (skip_artificial_parms_for, num_artificial_parms_for):
+ Likewise.
+ * pt.c (comp_template_parms, template_parameter_pack_p,
+ any_type_dependent_arguments_p, any_value_dependent_elements_p,
+ any_dependent_template_arguments_p): Likewise.
+ * repo.c (repo_export_class_p): Likewise.
+ * semantics.c (anon_aggr_type_p): Likewise.
+ * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p,
+ builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p,
+ varargs_function_p, member_p, is_dummy_object, pod_type_p,
+ zero_init_p, special_function_p): Likewise.
+ * typeck.c (comp_array_types, type_unknown_p, comp_except_specs,
+ comp_array_types, at_least_as_qualified_p, comp_cv_qualification,
+ compparms, invalid_nonstatic_memfn_p,
+ is_bitfield_expr_with_lowered_type, unlowered_expr_type,
+ string_conv_p, ptr_reasonably_similar, cp_type_readonly,
+ cp_has_mutable_p, lvalue_or_else): Likewise.
+
+2007-08-25 Paolo Bonzini <bonzini@gnu.org>
+
+ * decl.c (cp_tree_node_structure): Kill TINST_LEVEL case.
+ * cp-objcp-common.c (cp_tree_size): Ditto.
+ * tree.c (cp_walk_subtrees): Ditto
+ * cp-tree.def (TINST_LEVEL): Go away.
+ * cp-tree.h (struct tinst_level_s): Rename to struct tinst_level,
+ move together with other non-tree structs.
+ (enum cp_tree_node_structure_enum): Nuke TS_CP_TINST_LEVEL.
+ (union lang_tree_node): Eliminate tinst_level field.
+ (TINST_DECL, TINST_LOCATION, TINST_IN_SYSTEM_HEADER_P): Annihilate.
+ (current_instantiation, outermost_tinst_level): Return
+ a "struct tinst_level *".
+
+ * error.c (print_instantiation_partial_context): Change second
+ parameter to a "struct tinst_level *". Replace accessor macros
+ with field access.
+ (print_instantiation_full_context): Likewise.
+ * lex.c (in_main_input_context): Likewise.
+
+ * pt.c (struct pending_templates): New.
+ (pending_templates, last_pending_template): Use it as a type.
+ (current_tinst_level): Change typo to "struct tinst_level *"
+ (reopen_tinst_level): Accept "struct tinst_level *", return decl.
+ (add_pending_template): Construct a "struct pending_template".
+ Replace TINST_LEVEL accessor macros with field access.
+ (push_tinst_level): Likewise, using GGC_NEW instead of make_node.
+ (pop_tinst_level): Likewise.
+ (instantiate_pending_templates): Likewise. Factor common code used
+ when an instantiation has been done.
+ (outermost_tinst_level): Replace tree_last with loop.
+ (current_instantiation): Return a "struct tinst_level *".
+
+2007-08-24 Ollie Wild <aaw@google.com>
+
+ * name-lookup.c (add_decl_to_level): Remove addition to vtables chain.
+ * name-lookup.h (cp_binding_level): Remove vtables member.
+
+2007-08-24 Richard Guenther <rguenther@suse.de>
+
+ * tree.c (cp_cannot_inline_tree_fn): Remove.
+ * cp-tree.h (cp_cannot_inline_tree_fn): Likewise.
+ * cp-objcp-common.h (LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN):
+ Remove define.
+
+2007-08-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/32567
+ * typeck.c (build_unary_op) <case PREINCREMENT_EXPR>: Return
+ error_mark_node right away if build_expr_type_conversion
+ returned it.
+
+ PR c++/32898
+ * name-lookup.c (set_decl_namespace): lookup_qualified_name failure
+ is error_mark_node rather than NULL_TREE.
+ * pt.c (check_explicit_specialization): Likewise.
+
+ PR c++/31941
+ * error.c (resolve_virtual_fun_from_obj_type_ref): Handle
+ TARGET_VTABLE_USES_DESCRIPTORS targets properly.
+
2007-08-22 Jason Merrill <jason@redhat.com>
PR c++/29365
* pt.c (outermost_tinst_level): New function.
* lex.c (in_main_input_context): New function.
+ * cp-tree.h: Declare it.
* decl2.c (constrain_class_visibility): Use it to avoid warning
about uses of the anonymous namespace in the main input file.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index a504dc84abc..4dae84a082e 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -467,7 +467,7 @@ null_ptr_cst_p (tree t)
ellipsis. */
bool
-sufficient_parms_p (tree parmlist)
+sufficient_parms_p (const_tree parmlist)
{
for (; parmlist && parmlist != void_list_node;
parmlist = TREE_CHAIN (parmlist))
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 07dc9545141..4e051e3b688 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -1774,7 +1774,7 @@ layout_vtable_decl (tree binfo, int n)
have the same signature. */
int
-same_signature_p (tree fndecl, tree base_fndecl)
+same_signature_p (const_tree fndecl, const_tree base_fndecl)
{
/* One destructor overrides another if they are the same kind of
destructor. */
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 6fcc9b02e40..f9d800ea388 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -590,7 +590,7 @@ cp_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p)
}
static inline bool
-is_invisiref_parm (tree t)
+is_invisiref_parm (const_tree t)
{
return ((TREE_CODE (t) == PARM_DECL || TREE_CODE (t) == RESULT_DECL)
&& DECL_BY_REFERENCE (t));
@@ -928,7 +928,7 @@ cxx_omp_clause_dtor (tree clause, tree decl)
than the DECL itself. */
bool
-cxx_omp_privatize_by_reference (tree decl)
+cxx_omp_privatize_by_reference (const_tree decl)
{
return is_invisiref_parm (decl);
}
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index fbd407c3e12..42b0054055b 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -118,7 +118,6 @@ cp_tree_size (enum tree_code code)
{
switch (code)
{
- case TINST_LEVEL: return sizeof (struct tinst_level_s);
case PTRMEM_CST: return sizeof (struct ptrmem_cst);
case BASELINK: return sizeof (struct tree_baselink);
case TEMPLATE_PARM_INDEX: return sizeof (template_parm_index);
@@ -229,7 +228,7 @@ pop_file_scope (void)
/* c-pragma.c needs to query whether a decl has extern "C" linkage. */
bool
-has_c_linkage (tree decl)
+has_c_linkage (const_tree decl)
{
return DECL_EXTERN_C_P (decl);
}
diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h
index e67b847f421..8c8f93377de 100644
--- a/gcc/cp/cp-objcp-common.h
+++ b/gcc/cp/cp-objcp-common.h
@@ -104,9 +104,6 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t,
#undef LANG_HOOKS_ATTRIBUTE_TABLE
#define LANG_HOOKS_ATTRIBUTE_TABLE cxx_attribute_table
-#undef LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN
-#define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
- cp_cannot_inline_tree_fn
#undef LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P
#define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P cp_var_mod_type_p
#undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def
index 88ecfdb908a..a43fa825307 100644
--- a/gcc/cp/cp-tree.def
+++ b/gcc/cp/cp-tree.def
@@ -311,17 +311,6 @@ DEFTREECODE (EXPR_STMT, "expr_stmt", tcc_expression, 1)
DEFTREECODE (TAG_DEFN, "tag_defn", tcc_expression, 0)
-/* Template instantiation level node.
-
- TINST_DECL contains the original DECL node.
- TINST_LOCATION contains the location where the template is instantiated.
- TINST_IN_SYSTEM_HEADER_P is true if the location is in a system header.
-
- A stack of template instantiation nodes is kept through the TREE_CHAIN
- fields of these nodes. */
-
-DEFTREECODE (TINST_LEVEL, "TINST_LEVEL", tcc_exceptional, 0)
-
/* Represents an 'offsetof' expression during template expansion. */
DEFTREECODE (OFFSETOF_EXPR, "offsetof_expr", tcc_expression, 1)
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 5aea98bb801..e07c0bd40b5 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -182,14 +182,14 @@ struct diagnostic_context;
#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
#define NON_THUNK_FUNCTION_CHECK(NODE) __extension__ \
-({ const tree __t = (NODE); \
+({ __typeof(NODE) const __t = (NODE); \
if (TREE_CODE (__t) != FUNCTION_DECL && \
TREE_CODE (__t) != TEMPLATE_DECL && __t->decl_common.lang_specific \
&& __t->decl_common.lang_specific->decl_flags.thunk_p) \
tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \
__t; })
#define THUNK_FUNCTION_CHECK(NODE) __extension__ \
-({ const tree __t = (NODE); \
+({ __typeof (NODE) const __t = (NODE); \
if (TREE_CODE (__t) != FUNCTION_DECL || !__t->decl_common.lang_specific \
|| !__t->decl_common.lang_specific->decl_flags.thunk_p) \
tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \
@@ -229,15 +229,6 @@ struct template_parm_index_s GTY(())
};
typedef struct template_parm_index_s template_parm_index;
-struct tinst_level_s GTY(())
-{
- struct tree_common common;
- tree decl;
- location_t locus;
- int in_system_header_p;
-};
-typedef struct tinst_level_s * tinst_level_t;
-
struct ptrmem_cst GTY(())
{
struct tree_common common;
@@ -527,7 +518,6 @@ enum cp_tree_node_structure_enum {
TS_CP_GENERIC,
TS_CP_IDENTIFIER,
TS_CP_TPI,
- TS_CP_TINST_LEVEL,
TS_CP_PTRMEM,
TS_CP_BINDING,
TS_CP_OVERLOAD,
@@ -547,7 +537,6 @@ union lang_tree_node GTY((desc ("cp_tree_node_structure (&%h)"),
union tree_node GTY ((tag ("TS_CP_GENERIC"),
desc ("tree_node_structure (&%h)"))) generic;
struct template_parm_index_s GTY ((tag ("TS_CP_TPI"))) tpi;
- struct tinst_level_s GTY ((tag ("TS_CP_TINST_LEVEL"))) tinst_level;
struct ptrmem_cst GTY ((tag ("TS_CP_PTRMEM"))) ptrmem;
struct tree_overload GTY ((tag ("TS_CP_OVERLOAD"))) overload;
struct tree_baselink GTY ((tag ("TS_CP_BASELINK"))) baselink;
@@ -3553,15 +3542,6 @@ typedef enum unification_kind_t {
DEDUCE_EXACT
} unification_kind_t;
-/* Macros for operating on a template instantiation level node. */
-
-#define TINST_DECL(NODE) \
- (((tinst_level_t) TINST_LEVEL_CHECK (NODE))->decl)
-#define TINST_LOCATION(NODE) \
- (((tinst_level_t) TINST_LEVEL_CHECK (NODE))->locus)
-#define TINST_IN_SYSTEM_HEADER_P(NODE) \
- (((tinst_level_t) TINST_LEVEL_CHECK (NODE))->in_system_header_p)
-
/* in class.c */
extern int current_class_depth;
@@ -4056,6 +4036,24 @@ struct cp_declarator {
} u;
};
+/* A level of template instantiation. */
+struct tinst_level GTY(())
+{
+ /* The immediately deeper level in the chain. */
+ struct tinst_level *next;
+
+ /* The original node. Can be either a DECL (for a function or static
+ data member) or a TYPE (for a class), depending on what we were
+ asked to instantiate. */
+ tree decl;
+
+ /* The location where the template is instantiated. */
+ location_t locus;
+
+ /* True if the location is in a system header. */
+ bool in_system_header_p;
+};
+
/* A parameter list indicating for a function with no parameters,
e.g "int f(void)". */
extern cp_parameter_declarator *no_parameters;
@@ -4069,7 +4067,7 @@ extern tree build_addr_func (tree);
extern tree build_call_a (tree, int, tree*);
extern tree build_call_n (tree, int, ...);
extern bool null_ptr_cst_p (tree);
-extern bool sufficient_parms_p (tree);
+extern bool sufficient_parms_p (const_tree);
extern tree type_decays_to (tree);
extern tree build_user_type_conversion (tree, tree, int);
extern tree build_new_function_call (tree, tree, bool);
@@ -4137,7 +4135,7 @@ extern void cxx_print_identifier (FILE *, tree, int);
extern void cxx_print_error_function (struct diagnostic_context *,
const char *);
extern void build_self_reference (void);
-extern int same_signature_p (tree, tree);
+extern int same_signature_p (const_tree, const_tree);
extern void maybe_add_class_template_decl_list (tree, tree, int);
extern void unreverse_member_declarations (tree);
extern void invalidate_class_lookup_cache (void);
@@ -4214,11 +4212,11 @@ extern tree build_ptrmemfunc_type (tree);
extern tree build_ptrmem_type (tree, tree);
/* the grokdeclarator prototype is in decl.h */
extern tree build_this_parm (tree, cp_cv_quals);
-extern int copy_fn_p (tree);
-extern bool move_fn_p (tree);
+extern int copy_fn_p (const_tree);
+extern bool move_fn_p (const_tree);
extern tree get_scope_of_declarator (const cp_declarator *);
extern void grok_special_member_properties (tree);
-extern int grok_ctor_properties (tree, tree);
+extern int grok_ctor_properties (const_tree, const_tree);
extern bool grok_op_properties (tree, bool);
extern tree xref_tag (enum tag_types, tree, tag_scope, bool);
extern tree xref_tag_from_type (tree, tree, tag_scope);
@@ -4320,7 +4318,7 @@ extern tree expand_start_catch_block (tree);
extern void expand_end_catch_block (void);
extern tree build_exc_ptr (void);
extern tree build_throw (tree);
-extern int nothrow_libfn_p (tree);
+extern int nothrow_libfn_p (const_tree);
extern void check_handlers (tree);
extern void choose_personality_routine (enum languages);
extern tree eh_type_info (tree);
@@ -4384,8 +4382,8 @@ extern void use_thunk (tree, bool);
extern void synthesize_method (tree);
extern tree lazily_declare_fn (special_function_kind,
tree);
-extern tree skip_artificial_parms_for (tree, tree);
-extern int num_artificial_parms_for (tree);
+extern tree skip_artificial_parms_for (const_tree, tree);
+extern int num_artificial_parms_for (const_tree);
extern tree make_alias_for (tree, tree);
extern tree locate_copy (tree, void *);
extern tree locate_ctor (tree, void *);
@@ -4428,9 +4426,9 @@ extern int more_specialized_fn (tree, tree, int);
extern void do_decl_instantiation (tree, tree);
extern void do_type_instantiation (tree, tree, tsubst_flags_t);
extern tree instantiate_decl (tree, int, bool);
-extern int comp_template_parms (tree, tree);
+extern int comp_template_parms (const_tree, const_tree);
extern bool uses_parameter_packs (tree);
-extern bool template_parameter_pack_p (tree);
+extern bool template_parameter_pack_p (const_tree);
extern tree make_pack_expansion (tree);
extern bool check_for_bare_parameter_packs (tree);
extern int template_class_depth (tree);
@@ -4448,17 +4446,17 @@ extern tree most_general_template (tree);
extern tree get_mostly_instantiated_function_type (tree);
extern int problematic_instantiation_changed (void);
extern void record_last_problematic_instantiation (void);
-extern tree current_instantiation (void);
+extern struct tinst_level *current_instantiation(void);
extern tree maybe_get_template_decl_from_type_decl (tree);
extern int processing_template_parmlist;
extern bool dependent_type_p (tree);
-extern bool any_dependent_template_arguments_p (tree);
+extern bool any_dependent_template_arguments_p (const_tree);
extern bool dependent_template_p (tree);
extern bool dependent_template_id_p (tree, tree);
extern bool type_dependent_expression_p (tree);
-extern bool any_type_dependent_arguments_p (tree);
+extern bool any_type_dependent_arguments_p (const_tree);
extern bool value_dependent_expression_p (tree);
-extern bool any_value_dependent_elements_p (tree);
+extern bool any_value_dependent_elements_p (const_tree);
extern tree resolve_typename_type (tree, bool);
extern tree template_for_substitution (tree);
extern tree build_non_dependent_expr (tree);
@@ -4466,12 +4464,12 @@ extern tree build_non_dependent_args (tree);
extern bool reregister_specialization (tree, tree, tree);
extern tree fold_non_dependent_expr (tree);
extern bool explicit_class_specialization_p (tree);
-extern tree outermost_tinst_level (void);
+extern struct tinst_level *outermost_tinst_level(void);
/* in repo.c */
extern void init_repo (void);
extern int repo_emit_p (tree);
-extern bool repo_export_class_p (tree);
+extern bool repo_export_class_p (const_tree);
extern void finish_repo (void);
/* in rtti.c */
@@ -4611,6 +4609,7 @@ extern tree finish_non_static_data_member (tree, tree, tree);
extern tree begin_stmt_expr (void);
extern tree finish_stmt_expr_expr (tree, tree);
extern tree finish_stmt_expr (tree, bool);
+extern tree stmt_expr_value_expr (tree);
extern tree perform_koenig_lookup (tree, tree);
extern tree finish_call_expr (tree, tree, bool, bool);
extern tree finish_increment_expr (tree, enum tree_code);
@@ -4664,7 +4663,7 @@ extern tree cxx_omp_clause_default_ctor (tree, tree);
extern tree cxx_omp_clause_copy_ctor (tree, tree, tree);
extern tree cxx_omp_clause_assign_op (tree, tree, tree);
extern tree cxx_omp_clause_dtor (tree, tree);
-extern bool cxx_omp_privatize_by_reference (tree);
+extern bool cxx_omp_privatize_by_reference (const_tree);
extern tree baselink_for_fns (tree);
extern void finish_static_assert (tree, tree, location_t,
bool);
@@ -4681,15 +4680,15 @@ extern bool stabilize_init (tree, tree *);
extern tree add_stmt_to_compound (tree, tree);
extern tree cxx_maybe_build_cleanup (tree);
extern void init_tree (void);
-extern int pod_type_p (tree);
+extern int pod_type_p (const_tree);
extern bool class_tmpl_impl_spec_p (const_tree);
-extern int zero_init_p (tree);
+extern int zero_init_p (const_tree);
extern tree canonical_type_variant (tree);
extern tree copy_binfo (tree, tree, tree,
tree *, int);
-extern int member_p (tree);
-extern cp_lvalue_kind real_lvalue_p (tree);
-extern bool builtin_valid_in_constant_expr_p (tree);
+extern int member_p (const_tree);
+extern cp_lvalue_kind real_lvalue_p (const_tree);
+extern bool builtin_valid_in_constant_expr_p (const_tree);
extern tree build_min (enum tree_code, tree, ...);
extern tree build_min_nt (enum tree_code, ...);
extern tree build_min_non_dep (enum tree_code, tree, ...);
@@ -4712,17 +4711,17 @@ extern tree array_type_nelts_top (tree);
extern tree break_out_target_exprs (tree);
extern tree get_type_decl (tree);
extern tree decl_namespace_context (tree);
-extern bool decl_anon_ns_mem_p (tree);
+extern bool decl_anon_ns_mem_p (const_tree);
extern tree lvalue_type (tree);
extern tree error_type (tree);
-extern int varargs_function_p (tree);
+extern int varargs_function_p (const_tree);
extern bool really_overloaded_fn (tree);
extern bool cp_tree_equal (tree, tree);
extern tree no_linkage_check (tree, bool);
extern void debug_binfo (tree);
extern tree build_dummy_object (tree);
extern tree maybe_dummy_object (tree, tree *);
-extern int is_dummy_object (tree);
+extern int is_dummy_object (const_tree);
extern const struct attribute_spec cxx_attribute_table[];
extern tree make_ptrmem_cst (tree, tree);
extern tree cp_build_type_attribute_variant (tree, tree);
@@ -4730,7 +4729,7 @@ extern tree cp_build_reference_type (tree, bool);
extern tree cp_build_qualified_type_real (tree, int, tsubst_flags_t);
#define cp_build_qualified_type(TYPE, QUALS) \
cp_build_qualified_type_real ((TYPE), (QUALS), tf_warning_or_error)
-extern special_function_kind special_function_p (tree);
+extern special_function_kind special_function_p (const_tree);
extern int count_trees (tree);
extern int char_type_p (tree);
extern void verify_stmt_tree (tree);
@@ -4741,7 +4740,6 @@ extern tree cp_walk_subtrees (tree*, int*, walk_tree_fn,
walk_tree_1 (a, b, c, d, cp_walk_subtrees)
#define cp_walk_tree_without_duplicates(a,b,c) \
walk_tree_without_duplicates_1 (a, b, c, cp_walk_subtrees)
-extern int cp_cannot_inline_tree_fn (tree*);
extern tree fold_if_not_in_template (tree);
extern tree rvalue (tree);
extern tree convert_bitfield_to_declared_type (tree);
@@ -4749,24 +4747,24 @@ extern tree cp_save_expr (tree);
extern bool cast_valid_in_integral_constant_expression_p (tree);
/* in typeck.c */
-extern int string_conv_p (tree, tree, int);
+extern int string_conv_p (const_tree, const_tree, int);
extern tree cp_truthvalue_conversion (tree);
extern tree condition_conversion (tree);
extern tree require_complete_type (tree);
extern tree complete_type (tree);
extern tree complete_type_or_else (tree, tree);
-extern int type_unknown_p (tree);
-extern bool comp_except_specs (tree, tree, bool);
+extern int type_unknown_p (const_tree);
+extern bool comp_except_specs (const_tree, const_tree, bool);
extern bool comptypes (tree, tree, int);
-extern bool compparms (tree, tree);
-extern int comp_cv_qualification (tree, tree);
+extern bool compparms (const_tree, const_tree);
+extern int comp_cv_qualification (const_tree, const_tree);
extern int comp_cv_qual_signature (tree, tree);
extern tree cxx_sizeof_or_alignof_expr (tree, enum tree_code);
extern tree cxx_sizeof_or_alignof_type (tree, enum tree_code, bool);
#define cxx_sizeof_nowarn(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, false)
extern tree inline_conversion (tree);
-extern tree is_bitfield_expr_with_lowered_type (tree);
-extern tree unlowered_expr_type (tree);
+extern tree is_bitfield_expr_with_lowered_type (const_tree);
+extern tree unlowered_expr_type (const_tree);
extern tree decay_conversion (tree);
extern tree build_class_member_access_expr (tree, tree, tree, bool);
extern tree finish_class_member_access_expr (tree, tree, bool);
@@ -4793,12 +4791,12 @@ extern tree convert_for_initialization (tree, tree, tree, int,
const char *, tree, int);
extern int comp_ptr_ttypes (tree, tree);
extern bool comp_ptr_ttypes_const (tree, tree);
-extern int ptr_reasonably_similar (tree, tree);
+extern int ptr_reasonably_similar (const_tree, const_tree);
extern tree build_ptrmemfunc (tree, tree, int, bool);
extern int cp_type_quals (const_tree);
-extern bool cp_type_readonly (tree);
-extern bool cp_has_mutable_p (tree);
-extern bool at_least_as_qualified_p (tree, tree);
+extern bool cp_type_readonly (const_tree);
+extern bool cp_has_mutable_p (const_tree);
+extern bool at_least_as_qualified_p (const_tree, const_tree);
extern void cp_apply_type_quals_to_decl (int, tree);
extern tree build_ptrmemfunc1 (tree, tree, tree);
extern void expand_ptrmemfunc_cst (tree, tree *, tree *);
@@ -4815,11 +4813,11 @@ extern tree build_address (tree);
extern tree build_nop (tree, tree);
extern tree non_reference (tree);
extern tree lookup_anon_field (tree, tree);
-extern bool invalid_nonstatic_memfn_p (tree);
+extern bool invalid_nonstatic_memfn_p (const_tree);
extern tree convert_member_func_to_ptr (tree, tree);
extern tree convert_ptrmem (tree, tree, bool, bool);
-extern int lvalue_or_else (tree, enum lvalue_use);
-extern int lvalue_p (tree);
+extern int lvalue_or_else (const_tree, enum lvalue_use);
+extern int lvalue_p (const_tree);
/* in typeck2.c */
extern void require_complete_eh_spec_types (tree, tree);
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index 18983a4b267..158cbc4f076 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -352,6 +352,7 @@ pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t)
{
case INTEGER_CST:
case REAL_CST:
+ case COMPLEX_CST:
case STRING_CST:
pp_cxx_constant (pp, t);
break;
@@ -928,6 +929,7 @@ pp_cxx_expression (cxx_pretty_printer *pp, tree t)
case STRING_CST:
case INTEGER_CST:
case REAL_CST:
+ case COMPLEX_CST:
pp_cxx_constant (pp, t);
break;
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index ef67bc5fd97..ede4ec64273 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1098,6 +1098,10 @@ check_redeclaration_exception_specification (tree new_decl,
}
}
+#define GNU_INLINE_P(fn) (DECL_DECLARED_INLINE_P (fn) \
+ && lookup_attribute ("gnu_inline", \
+ DECL_ATTRIBUTES (fn)))
+
/* If NEWDECL is a redeclaration of OLDDECL, merge the declarations.
If the redeclaration is invalid, a diagnostic is issued, and the
error_mark_node is returned. Otherwise, OLDDECL is returned.
@@ -1634,20 +1638,46 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
= chainon (DECL_TEMPLATE_SPECIALIZATIONS (olddecl),
DECL_TEMPLATE_SPECIALIZATIONS (newdecl));
+ DECL_ATTRIBUTES (old_result)
+ = (*targetm.merge_decl_attributes) (old_result, new_result);
+
if (DECL_FUNCTION_TEMPLATE_P (newdecl))
{
- DECL_INLINE (old_result)
- |= DECL_INLINE (new_result);
- DECL_DECLARED_INLINE_P (old_result)
- |= DECL_DECLARED_INLINE_P (new_result);
- check_redeclaration_exception_specification (newdecl, olddecl);
+ if (GNU_INLINE_P (old_result) != GNU_INLINE_P (new_result)
+ && DECL_INITIAL (new_result))
+ {
+ if (DECL_INITIAL (old_result))
+ {
+ DECL_INLINE (old_result) = 0;
+ DECL_UNINLINABLE (old_result) = 1;
+ }
+ else
+ {
+ DECL_INLINE (old_result) = DECL_INLINE (new_result);
+ DECL_UNINLINABLE (old_result) = DECL_UNINLINABLE (new_result);
+ }
+ DECL_EXTERNAL (old_result) = DECL_EXTERNAL (new_result);
+ DECL_NOT_REALLY_EXTERN (old_result)
+ = DECL_NOT_REALLY_EXTERN (new_result);
+ DECL_INTERFACE_KNOWN (old_result)
+ = DECL_INTERFACE_KNOWN (new_result);
+ DECL_DECLARED_INLINE_P (old_result)
+ = DECL_DECLARED_INLINE_P (new_result);
+ }
+ else
+ {
+ DECL_INLINE (old_result)
+ |= DECL_INLINE (new_result);
+ DECL_DECLARED_INLINE_P (old_result)
+ |= DECL_DECLARED_INLINE_P (new_result);
+ check_redeclaration_exception_specification (newdecl, olddecl);
+ }
}
/* If the new declaration is a definition, update the file and
line information on the declaration, and also make
the old declaration the same definition. */
- if (DECL_INITIAL (old_result) == NULL_TREE
- && DECL_INITIAL (new_result) != NULL_TREE)
+ if (DECL_INITIAL (new_result) != NULL_TREE)
{
DECL_SOURCE_LOCATION (olddecl)
= DECL_SOURCE_LOCATION (old_result)
@@ -1805,9 +1835,30 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
new_template = NULL_TREE;
if (DECL_LANG_SPECIFIC (newdecl) && DECL_LANG_SPECIFIC (olddecl))
{
- DECL_INTERFACE_KNOWN (newdecl) |= DECL_INTERFACE_KNOWN (olddecl);
- DECL_NOT_REALLY_EXTERN (newdecl) |= DECL_NOT_REALLY_EXTERN (olddecl);
- DECL_COMDAT (newdecl) |= DECL_COMDAT (olddecl);
+ bool old_decl_gnu_inline;
+
+ if ((DECL_INTERFACE_KNOWN (olddecl)
+ && TREE_CODE (olddecl) == FUNCTION_DECL)
+ || (TREE_CODE (olddecl) == TEMPLATE_DECL
+ && TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == FUNCTION_DECL))
+ {
+ tree fn = olddecl;
+
+ if (TREE_CODE (fn) == TEMPLATE_DECL)
+ fn = DECL_TEMPLATE_RESULT (olddecl);
+
+ old_decl_gnu_inline = GNU_INLINE_P (fn) && DECL_INITIAL (fn);
+ }
+ else
+ old_decl_gnu_inline = false;
+
+ if (!old_decl_gnu_inline)
+ {
+ DECL_INTERFACE_KNOWN (newdecl) |= DECL_INTERFACE_KNOWN (olddecl);
+ DECL_INTERFACE_KNOWN (newdecl) |= DECL_INTERFACE_KNOWN (olddecl);
+ DECL_NOT_REALLY_EXTERN (newdecl) |= DECL_NOT_REALLY_EXTERN (olddecl);
+ DECL_COMDAT (newdecl) |= DECL_COMDAT (olddecl);
+ }
DECL_TEMPLATE_INSTANTIATED (newdecl)
|= DECL_TEMPLATE_INSTANTIATED (olddecl);
@@ -1881,6 +1932,13 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
/* [temp.expl.spec/14] We don't inline explicit specialization
just because the primary template says so. */
}
+ else if (new_defines_function && DECL_INITIAL (olddecl))
+ {
+ /* C++ is always in in unit-at-a-time mode, so we never
+ inline re-defined extern inline functions. */
+ DECL_INLINE (newdecl) = 0;
+ DECL_UNINLINABLE (newdecl) = 1;
+ }
else
{
if (DECL_PENDING_INLINE_INFO (newdecl) == 0)
@@ -1896,6 +1954,11 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
DECL_UNINLINABLE (newdecl) = DECL_UNINLINABLE (olddecl)
= (DECL_UNINLINABLE (newdecl) || DECL_UNINLINABLE (olddecl));
+
+ DECL_DISREGARD_INLINE_LIMITS (newdecl)
+ = DECL_DISREGARD_INLINE_LIMITS (olddecl)
+ = (DECL_DISREGARD_INLINE_LIMITS (newdecl)
+ || DECL_DISREGARD_INLINE_LIMITS (olddecl));
}
/* Preserve abstractness on cloned [cd]tors. */
@@ -2123,9 +2186,25 @@ redeclaration_error_message (tree newdecl, tree olddecl)
{
if (DECL_NAME (olddecl) == NULL_TREE)
return "%q#D not declared in class";
- else
+ else if (!GNU_INLINE_P (olddecl)
+ || GNU_INLINE_P (newdecl))
return "redefinition of %q#D";
}
+
+ if (DECL_DECLARED_INLINE_P (olddecl) && DECL_DECLARED_INLINE_P (newdecl))
+ {
+ bool olda = GNU_INLINE_P (olddecl);
+ bool newa = GNU_INLINE_P (newdecl);
+
+ if (olda != newa)
+ {
+ if (newa)
+ return "%q+D redeclared inline with %<gnu_inline%> attribute";
+ else
+ return "%q+D redeclared inline without %<gnu_inline%> attribute";
+ }
+ }
+
return NULL;
}
else if (TREE_CODE (newdecl) == TEMPLATE_DECL)
@@ -2151,9 +2230,24 @@ redeclaration_error_message (tree newdecl, tree olddecl)
ot = DECL_TEMPLATE_RESULT (olddecl);
if (DECL_TEMPLATE_INFO (ot))
ot = DECL_TEMPLATE_RESULT (template_for_substitution (ot));
- if (DECL_INITIAL (nt) && DECL_INITIAL (ot))
+ if (DECL_INITIAL (nt) && DECL_INITIAL (ot)
+ && (!GNU_INLINE_P (ot) || GNU_INLINE_P (nt)))
return "redefinition of %q#D";
+ if (DECL_DECLARED_INLINE_P (ot) && DECL_DECLARED_INLINE_P (nt))
+ {
+ bool olda = GNU_INLINE_P (ot);
+ bool newa = GNU_INLINE_P (nt);
+
+ if (olda != newa)
+ {
+ if (newa)
+ return "%q+D redeclared inline with %<gnu_inline%> attribute";
+ else
+ return "%q+D redeclared inline without %<gnu_inline%> attribute";
+ }
+ }
+
/* Core issue #226 (C++0x):
If a friend function template declaration specifies a
@@ -3783,7 +3877,13 @@ groktypename (cp_decl_specifier_seq *type_specifiers,
type_specifiers->attributes = NULL_TREE;
type = grokdeclarator (declarator, type_specifiers, TYPENAME, 0, &attrs);
if (attrs)
- cplus_decl_attributes (&type, attrs, 0);
+ {
+ if (CLASS_TYPE_P (type))
+ warning (OPT_Wattributes, "ignoring attributes applied to class type "
+ "outside of definition");
+ else
+ cplus_decl_attributes (&type, attrs, 0);
+ }
return type;
}
@@ -9204,7 +9304,7 @@ grokparms (cp_parameter_declarator *first_parm, tree *parms)
operator. */
int
-copy_fn_p (tree d)
+copy_fn_p (const_tree d)
{
tree args;
tree arg_type;
@@ -9260,7 +9360,7 @@ copy_fn_p (tree d)
operator, false otherwise. */
bool
-move_fn_p (tree d)
+move_fn_p (const_tree d)
{
tree args;
tree arg_type;
@@ -9359,7 +9459,7 @@ void grok_special_member_properties (tree decl)
if the class has a constructor of the form X(X). */
int
-grok_ctor_properties (tree ctype, tree decl)
+grok_ctor_properties (const_tree ctype, const_tree decl)
{
int ctor_parm = copy_fn_p (decl);
@@ -10786,6 +10886,15 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
&& lookup_attribute ("noinline", attrs))
warning (0, "inline function %q+D given attribute noinline", decl1);
+ /* Handle gnu_inline attribute. */
+ if (GNU_INLINE_P (decl1))
+ {
+ DECL_EXTERNAL (decl1) = 1;
+ DECL_NOT_REALLY_EXTERN (decl1) = 0;
+ DECL_INTERFACE_KNOWN (decl1) = 1;
+ DECL_DISREGARD_INLINE_LIMITS (decl1) = 1;
+ }
+
if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl1))
/* This is a constructor, we must ensure that any default args
introduced by this definition are propagated to the clones
@@ -11071,8 +11180,9 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
else
{
/* This is a definition, not a reference.
- So clear DECL_EXTERNAL. */
- DECL_EXTERNAL (decl1) = 0;
+ So clear DECL_EXTERNAL, unless this is a GNU extern inline. */
+ if (!GNU_INLINE_P (decl1))
+ DECL_EXTERNAL (decl1) = 0;
if ((DECL_DECLARED_INLINE_P (decl1)
|| DECL_TEMPLATE_INSTANTIATION (decl1))
@@ -12025,7 +12135,6 @@ cp_tree_node_structure (union lang_tree_node * t)
case IDENTIFIER_NODE: return TS_CP_IDENTIFIER;
case OVERLOAD: return TS_CP_OVERLOAD;
case TEMPLATE_PARM_INDEX: return TS_CP_TPI;
- case TINST_LEVEL: return TS_CP_TINST_LEVEL;
case PTRMEM_CST: return TS_CP_PTRMEM;
case BASELINK: return TS_CP_BASELINK;
case STATIC_ASSERT: return TS_CP_STATIC_ASSERT;
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 53d8223a8d2..d6675f0102e 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -82,7 +82,8 @@ static const char *function_category (tree);
static void maybe_print_instantiation_context (diagnostic_context *);
static void print_instantiation_full_context (diagnostic_context *);
static void print_instantiation_partial_context (diagnostic_context *,
- tree, location_t);
+ struct tinst_level *,
+ location_t);
static void cp_diagnostic_starter (diagnostic_context *, diagnostic_info *);
static void cp_diagnostic_finalizer (diagnostic_context *, diagnostic_info *);
static void cp_print_error_function (diagnostic_context *, diagnostic_info *);
@@ -1438,10 +1439,14 @@ static tree
resolve_virtual_fun_from_obj_type_ref (tree ref)
{
tree obj_type = TREE_TYPE (OBJ_TYPE_REF_OBJECT (ref));
- int index = tree_low_cst (OBJ_TYPE_REF_TOKEN (ref), 1);
+ HOST_WIDE_INT index = tree_low_cst (OBJ_TYPE_REF_TOKEN (ref), 1);
tree fun = BINFO_VIRTUALS (TYPE_BINFO (TREE_TYPE (obj_type)));
- while (index--)
+ while (index)
+ {
fun = TREE_CHAIN (fun);
+ index -= (TARGET_VTABLE_USES_DESCRIPTORS
+ ? TARGET_VTABLE_USES_DESCRIPTORS : 1);
+ }
return BV_FN (fun);
}
@@ -1472,6 +1477,7 @@ dump_expr (tree t, int flags)
case INTEGER_CST:
case REAL_CST:
case STRING_CST:
+ case COMPLEX_CST:
pp_constant (cxx_pp, t);
break;
@@ -2043,6 +2049,11 @@ dump_expr (tree t, int flags)
pp_id_expression (cxx_pp, t);
break;
+ case TEMPLATE_TYPE_PARM:
+ case BOUND_TEMPLATE_TEMPLATE_PARM:
+ dump_type (t, flags);
+ break;
+
/* This list is incomplete, but should suffice for now.
It is very important that `sorry' does not call
`report_error_function'. That could cause an infinite loop. */
@@ -2384,30 +2395,30 @@ function_category (tree fn)
static void
print_instantiation_full_context (diagnostic_context *context)
{
- tree p = current_instantiation ();
+ struct tinst_level *p = current_instantiation ();
location_t location = input_location;
if (p)
{
- if (current_function_decl != TINST_DECL (p)
+ if (current_function_decl != p->decl
&& current_function_decl != NULL_TREE)
/* We can get here during the processing of some synthesized
- method. Then, TINST_DECL (p) will be the function that's causing
+ method. Then, P->DECL will be the function that's causing
the synthesis. */
;
else
{
- if (current_function_decl == TINST_DECL (p))
+ if (current_function_decl == p->decl)
/* Avoid redundancy with the "In function" line. */;
else
pp_verbatim (context->printer,
"%s: In instantiation of %qs:\n",
LOCATION_FILE (location),
- decl_as_string (TINST_DECL (p),
+ decl_as_string (p->decl,
TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
- location = TINST_LOCATION (p);
- p = TREE_CHAIN (p);
+ location = p->locus;
+ p = p->next;
}
}
@@ -2417,19 +2428,19 @@ print_instantiation_full_context (diagnostic_context *context)
/* Same as above but less verbose. */
static void
print_instantiation_partial_context (diagnostic_context *context,
- tree t, location_t loc)
+ struct tinst_level *t, location_t loc)
{
expanded_location xloc;
- for (; ; t = TREE_CHAIN (t))
+ for (; ; t = t->next)
{
xloc = expand_location (loc);
- if (t == NULL_TREE)
+ if (t == NULL)
break;
pp_verbatim (context->printer, "%s:%d: instantiated from %qs\n",
xloc.file, xloc.line,
- decl_as_string (TINST_DECL (t),
+ decl_as_string (t->decl,
TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
- loc = TINST_LOCATION (t);
+ loc = t->locus;
}
pp_verbatim (context->printer, "%s:%d: instantiated from here",
xloc.file, xloc.line);
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index 2fe0be1afc0..b6e8eeac710 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -905,7 +905,7 @@ is_admissible_throw_operand (tree expr)
#include "cfns.h"
int
-nothrow_libfn_p (tree fn)
+nothrow_libfn_p (const_tree fn)
{
tree id;
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index e62887dcfc1..3bb1bf43620 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -856,11 +856,11 @@ make_aggr_type (enum tree_code code)
bool
in_main_input_context (void)
{
- tree tl = outermost_tinst_level();
+ struct tinst_level *tl = outermost_tinst_level();
if (tl)
return strcmp (main_input_filename,
- LOCATION_FILE (TINST_LOCATION (tl))) == 0;
+ LOCATION_FILE (tl->locus)) == 0;
else
return strcmp (main_input_filename, input_filename) == 0;
}
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index f4b43a2285d..efb223780da 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -1185,7 +1185,7 @@ lazily_declare_fn (special_function_kind sfk, tree type)
as there are artificial parms in FN. */
tree
-skip_artificial_parms_for (tree fn, tree list)
+skip_artificial_parms_for (const_tree fn, tree list)
{
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
list = TREE_CHAIN (list);
@@ -1203,7 +1203,7 @@ skip_artificial_parms_for (tree fn, tree list)
artificial parms in FN. */
int
-num_artificial_parms_for (tree fn)
+num_artificial_parms_for (const_tree fn)
{
int count = 0;
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 5f7e718d328..5b5e99d76e4 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -536,17 +536,16 @@ supplement_binding (cxx_binding *binding, tree decl)
static void
add_decl_to_level (tree decl, cxx_scope *b)
{
+ /* We used to record virtual tables as if they were ordinary
+ variables, but no longer do so. */
+ gcc_assert (!(TREE_CODE (decl) == VAR_DECL && DECL_VIRTUAL_P (decl)));
+
if (TREE_CODE (decl) == NAMESPACE_DECL
&& !DECL_NAMESPACE_ALIAS (decl))
{
TREE_CHAIN (decl) = b->namespaces;
b->namespaces = decl;
}
- else if (TREE_CODE (decl) == VAR_DECL && DECL_VIRTUAL_P (decl))
- {
- TREE_CHAIN (decl) = b->vtables;
- b->vtables = decl;
- }
else
{
/* We build up the list in reverse order, and reverse it later if
@@ -2970,7 +2969,7 @@ set_decl_namespace (tree decl, tree scope, bool friendp)
/* See whether this has been declared in the namespace. */
old = lookup_qualified_name (scope, DECL_NAME (decl), false, true);
- if (!old)
+ if (old == error_mark_node)
/* No old declaration at all. */
goto complain;
if (!is_overloaded_fn (decl))
diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h
index d82445f3ac2..88551f2b8ac 100644
--- a/gcc/cp/name-lookup.h
+++ b/gcc/cp/name-lookup.h
@@ -190,9 +190,6 @@ struct cp_binding_level GTY(())
/* An array of static functions and variables (for namespaces only) */
VEC(tree,gc) *static_decls;
- /* A chain of VTABLE_DECL nodes. */
- tree vtables;
-
/* A list of USING_DECL nodes. */
tree usings;
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index b4a9b689005..e1eda243c2d 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -52,12 +52,14 @@ typedef int (*tree_fn_t) (tree, void*);
/* The PENDING_TEMPLATES is a TREE_LIST of templates whose
instantiations have been deferred, either because their definitions
- were not yet available, or because we were putting off doing the work.
- The TREE_PURPOSE of each entry is either a DECL (for a function or
- static data member), or a TYPE (for a class) indicating what we are
- hoping to instantiate. The TREE_VALUE is not used. */
-static GTY(()) tree pending_templates;
-static GTY(()) tree last_pending_template;
+ were not yet available, or because we were putting off doing the work. */
+struct pending_template GTY (()) {
+ struct pending_template *next;
+ struct tinst_level *tinst;
+};
+
+static GTY(()) struct pending_template *pending_templates;
+static GTY(()) struct pending_template *last_pending_template;
int processing_template_parmlist;
static int template_header_count;
@@ -65,7 +67,7 @@ static int template_header_count;
static GTY(()) tree saved_trees;
static VEC(int,heap) *inline_parm_levels;
-static GTY(()) tree current_tinst_level;
+static GTY(()) struct tinst_level *current_tinst_level;
static GTY(()) tree saved_access_scope;
@@ -104,7 +106,7 @@ static int unify (tree, tree, tree, tree, int);
static void add_pending_template (tree);
static int push_tinst_level (tree);
static void pop_tinst_level (void);
-static void reopen_tinst_level (tree);
+static tree reopen_tinst_level (struct tinst_level *);
static tree tsubst_initializer_list (tree, tree);
static tree get_class_bindings (tree, tree, tree);
static tree coerce_template_parms (tree, tree, tree, tsubst_flags_t,
@@ -1980,7 +1982,7 @@ check_explicit_specialization (tree declarator,
context. */
fns = lookup_qualified_name (CP_DECL_CONTEXT (decl), dname,
false, true);
- if (!fns || !is_overloaded_fn (fns))
+ if (fns == error_mark_node || !is_overloaded_fn (fns))
{
error ("%qD is not a template function", dname);
fns = error_mark_node;
@@ -2215,6 +2217,11 @@ check_explicit_specialization (tree declarator,
/* This specialization has the same linkage and visibility as
the function template it specializes. */
TREE_PUBLIC (decl) = TREE_PUBLIC (tmpl_func);
+ if (! TREE_PUBLIC (decl))
+ {
+ DECL_INTERFACE_KNOWN (decl) = 1;
+ DECL_NOT_REALLY_EXTERN (decl) = 1;
+ }
DECL_THIS_STATIC (decl) = DECL_THIS_STATIC (tmpl_func);
if (DECL_VISIBILITY_SPECIFIED (tmpl_func))
{
@@ -2262,10 +2269,10 @@ check_explicit_specialization (tree declarator,
DECL_TEMPLATE_PARMS. */
int
-comp_template_parms (tree parms1, tree parms2)
+comp_template_parms (const_tree parms1, const_tree parms2)
{
- tree p1;
- tree p2;
+ const_tree p1;
+ const_tree p2;
if (parms1 == parms2)
return 1;
@@ -2316,7 +2323,7 @@ comp_template_parms (tree parms1, tree parms2)
/* Determine whether PARM is a parameter pack. */
bool
-template_parameter_pack_p (tree parm)
+template_parameter_pack_p (const_tree parm)
{
/* Determine if we have a non-type template parameter pack. */
if (TREE_CODE (parm) == PARM_DECL)
@@ -5139,7 +5146,7 @@ add_pending_template (tree d)
tree ti = (TYPE_P (d)
? CLASSTYPE_TEMPLATE_INFO (d)
: DECL_TEMPLATE_INFO (d));
- tree pt;
+ struct pending_template *pt;
int level;
if (TI_PENDING_TEMPLATE_FLAG (ti))
@@ -5148,14 +5155,16 @@ add_pending_template (tree d)
/* We are called both from instantiate_decl, where we've already had a
tinst_level pushed, and instantiate_template, where we haven't.
Compensate. */
- level = !(current_tinst_level && TINST_DECL (current_tinst_level) == d);
+ level = !current_tinst_level || current_tinst_level->decl != d;
if (level)
push_tinst_level (d);
- pt = tree_cons (current_tinst_level, d, NULL_TREE);
+ pt = GGC_NEW (struct pending_template);
+ pt->next = NULL;
+ pt->tinst = current_tinst_level;
if (last_pending_template)
- TREE_CHAIN (last_pending_template) = pt;
+ last_pending_template->next = pt;
else
pending_templates = pt;
@@ -5974,7 +5983,7 @@ static int last_template_error_tick;
static int
push_tinst_level (tree d)
{
- tree new;
+ struct tinst_level *new;
if (tinst_depth >= max_tinst_depth)
{
@@ -5994,11 +6003,11 @@ push_tinst_level (tree d)
return 0;
}
- new = make_node (TINST_LEVEL);
- TINST_DECL (new) = d;
- TINST_LOCATION (new) = input_location;
- TINST_IN_SYSTEM_HEADER_P (new) = in_system_header;
- TREE_CHAIN (new) = current_tinst_level;
+ new = GGC_NEW (struct tinst_level);
+ new->decl = d;
+ new->locus = input_location;
+ new->in_system_header_p = in_system_header;
+ new->next = current_tinst_level;
current_tinst_level = new;
++tinst_depth;
@@ -6017,41 +6026,44 @@ push_tinst_level (tree d)
static void
pop_tinst_level (void)
{
- tree old = current_tinst_level;
-
/* Restore the filename and line number stashed away when we started
this instantiation. */
- input_location = TINST_LOCATION (old);
- in_system_header = TINST_IN_SYSTEM_HEADER_P (old);
- current_tinst_level = TREE_CHAIN (old);
+ input_location = current_tinst_level->locus;
+ in_system_header = current_tinst_level->in_system_header_p;
+ current_tinst_level = current_tinst_level->next;
--tinst_depth;
++tinst_level_tick;
}
/* We're instantiating a deferred template; restore the template
instantiation context in which the instantiation was requested, which
- is one step out from LEVEL. */
+ is one step out from LEVEL. Return the corresponding DECL or TYPE. */
-static void
-reopen_tinst_level (tree level)
+static tree
+reopen_tinst_level (struct tinst_level *level)
{
- tree t;
+ struct tinst_level *t;
tinst_depth = 0;
- for (t = level; t; t = TREE_CHAIN (t))
+ for (t = level; t; t = t->next)
++tinst_depth;
current_tinst_level = level;
pop_tinst_level ();
+ return level->decl;
}
/* Returns the TINST_LEVEL which gives the original instantiation
context. */
-tree
+struct tinst_level *
outermost_tinst_level (void)
{
- return tree_last (current_tinst_level);
+ struct tinst_level *level = current_tinst_level;
+ if (level)
+ while (level->next)
+ level = level->next;
+ return level;
}
/* DECL is a friend FUNCTION_DECL or TEMPLATE_DECL. ARGS is the
@@ -14486,8 +14498,6 @@ out:
void
instantiate_pending_templates (int retries)
{
- tree *t;
- tree last = NULL_TREE;
int reconsider;
location_t saved_loc = input_location;
int saved_in_system_header = in_system_header;
@@ -14497,7 +14507,7 @@ instantiate_pending_templates (int retries)
to avoid infinite loop. */
if (pending_templates && retries >= max_tinst_depth)
{
- tree decl = TREE_VALUE (pending_templates);
+ tree decl = pending_templates->tinst->decl;
error ("template instantiation depth exceeds maximum of %d"
" instantiating %q+D, possibly from virtual table generation"
@@ -14511,14 +14521,13 @@ instantiate_pending_templates (int retries)
do
{
+ struct pending_template **t = &pending_templates;
+ struct pending_template *last = NULL;
reconsider = 0;
-
- t = &pending_templates;
while (*t)
{
- tree instantiation = TREE_VALUE (*t);
-
- reopen_tinst_level (TREE_PURPOSE (*t));
+ tree instantiation = reopen_tinst_level ((*t)->tinst);
+ bool complete = false;
if (TYPE_P (instantiation))
{
@@ -14539,15 +14548,7 @@ instantiate_pending_templates (int retries)
reconsider = 1;
}
- if (COMPLETE_TYPE_P (instantiation))
- /* If INSTANTIATION has been instantiated, then we don't
- need to consider it again in the future. */
- *t = TREE_CHAIN (*t);
- else
- {
- last = *t;
- t = &TREE_CHAIN (*t);
- }
+ complete = COMPLETE_TYPE_P (instantiation);
}
else
{
@@ -14562,19 +14563,21 @@ instantiate_pending_templates (int retries)
reconsider = 1;
}
- if (DECL_TEMPLATE_SPECIALIZATION (instantiation)
- || DECL_TEMPLATE_INSTANTIATED (instantiation))
- /* If INSTANTIATION has been instantiated, then we don't
- need to consider it again in the future. */
- *t = TREE_CHAIN (*t);
- else
- {
- last = *t;
- t = &TREE_CHAIN (*t);
- }
+ complete = (DECL_TEMPLATE_SPECIALIZATION (instantiation)
+ || DECL_TEMPLATE_INSTANTIATED (instantiation));
+ }
+
+ if (complete)
+ /* If INSTANTIATION has been instantiated, then we don't
+ need to consider it again in the future. */
+ *t = (*t)->next;
+ else
+ {
+ last = *t;
+ t = &(*t)->next;
}
tinst_depth = 0;
- current_tinst_level = NULL_TREE;
+ current_tinst_level = NULL;
}
last_pending_template = last;
}
@@ -14823,7 +14826,7 @@ record_last_problematic_instantiation (void)
last_template_error_tick = tinst_level_tick;
}
-tree
+struct tinst_level *
current_instantiation (void)
{
return current_tinst_level;
@@ -15274,6 +15277,9 @@ type_dependent_expression_p (tree expression)
&& !DECL_TEMPLATE_TEMPLATE_PARM_P (expression))
return false;
+ if (TREE_CODE (expression) == STMT_EXPR)
+ expression = stmt_expr_value_expr (expression);
+
if (TREE_TYPE (expression) == unknown_type_node)
{
if (TREE_CODE (expression) == ADDR_EXPR)
@@ -15322,7 +15328,7 @@ type_dependent_expression_p (tree expression)
contains a type-dependent expression. */
bool
-any_type_dependent_arguments_p (tree args)
+any_type_dependent_arguments_p (const_tree args)
{
while (args)
{
@@ -15339,7 +15345,7 @@ any_type_dependent_arguments_p (tree args)
expressions) contains any value-dependent expressions. */
bool
-any_value_dependent_elements_p (tree list)
+any_value_dependent_elements_p (const_tree list)
{
for (; list; list = TREE_CHAIN (list))
if (value_dependent_expression_p (TREE_VALUE (list)))
@@ -15434,7 +15440,7 @@ any_template_arguments_need_structural_equality_p (tree args)
any dependent arguments. */
bool
-any_dependent_template_arguments_p (tree args)
+any_dependent_template_arguments_p (const_tree args)
{
int i;
int j;
@@ -15446,7 +15452,7 @@ any_dependent_template_arguments_p (tree args)
for (i = 0; i < TMPL_ARGS_DEPTH (args); ++i)
{
- tree level = TMPL_ARGS_LEVEL (args, i + 1);
+ const_tree level = TMPL_ARGS_LEVEL (args, i + 1);
for (j = 0; j < TREE_VEC_LENGTH (level); ++j)
if (dependent_template_arg_p (TREE_VEC_ELT (level, j)))
return true;
@@ -15614,6 +15620,8 @@ build_non_dependent_expr (tree expr)
/* Preserve OVERLOADs; the functions must be available to resolve
types. */
inner_expr = expr;
+ if (TREE_CODE (inner_expr) == STMT_EXPR)
+ inner_expr = stmt_expr_value_expr (inner_expr);
if (TREE_CODE (inner_expr) == ADDR_EXPR)
inner_expr = TREE_OPERAND (inner_expr, 0);
if (TREE_CODE (inner_expr) == COMPONENT_REF)
diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c
index 227c1ea11aa..624d6d7bd35 100644
--- a/gcc/cp/repo.c
+++ b/gcc/cp/repo.c
@@ -347,7 +347,7 @@ repo_emit_p (tree decl)
export from this translation unit. */
bool
-repo_export_class_p (tree class_type)
+repo_export_class_p (const_tree class_type)
{
if (!flag_use_repository)
return false;
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 176e6bea11a..9faa413b376 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -436,7 +436,7 @@ add_decl_expr (tree decl)
declared is not an anonymous union" [class.union]. */
int
-anon_aggr_type_p (tree node)
+anon_aggr_type_p (const_tree node)
{
return ANON_AGGR_TYPE_P (node);
}
@@ -1754,6 +1754,25 @@ finish_stmt_expr (tree stmt_expr, bool has_no_scope)
return result;
}
+/* Returns the expression which provides the value of STMT_EXPR. */
+
+tree
+stmt_expr_value_expr (tree stmt_expr)
+{
+ tree t = STMT_EXPR_STMT (stmt_expr);
+
+ if (TREE_CODE (t) == BIND_EXPR)
+ t = BIND_EXPR_BODY (t);
+
+ if (TREE_CODE (t) == STATEMENT_LIST)
+ t = STATEMENT_LIST_TAIL (t)->stmt;
+
+ if (TREE_CODE (t) == EXPR_STMT)
+ t = EXPR_STMT_EXPR (t);
+
+ return t;
+}
+
/* Perform Koenig lookup. FN is the postfix-expression representing
the function (or functions) to call; ARGS are the arguments to the
call. Returns the functions to be considered by overload
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 9c80fba30d6..4ee3f886d25 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -43,7 +43,7 @@ static tree build_cplus_array_type_1 (tree, tree);
static int list_hash_eq (const void *, const void *);
static hashval_t list_hash_pieces (tree, tree, tree);
static hashval_t list_hash (const void *);
-static cp_lvalue_kind lvalue_p_1 (tree, int);
+static cp_lvalue_kind lvalue_p_1 (const_tree, int);
static tree build_target_expr (tree, tree);
static tree count_trees_r (tree *, int *, void *);
static tree verify_stmt_tree_r (tree *, int *, void *);
@@ -58,7 +58,7 @@ static tree handle_init_priority_attribute (tree *, tree, tree, int, bool *);
nonzero, rvalues of class type are considered lvalues. */
static cp_lvalue_kind
-lvalue_p_1 (tree ref,
+lvalue_p_1 (const_tree ref,
int treat_class_rvalues_as_lvalues)
{
cp_lvalue_kind op1_lvalue_kind = clk_none;
@@ -223,7 +223,7 @@ lvalue_p_1 (tree ref,
computes the C++ definition of lvalue. */
cp_lvalue_kind
-real_lvalue_p (tree ref)
+real_lvalue_p (const_tree ref)
{
return lvalue_p_1 (ref,
/*treat_class_rvalues_as_lvalues=*/0);
@@ -233,7 +233,7 @@ real_lvalue_p (tree ref)
considered lvalues. */
int
-lvalue_p (tree ref)
+lvalue_p (const_tree ref)
{
return
(lvalue_p_1 (ref, /*class rvalue ok*/ 1) != clk_none);
@@ -243,7 +243,7 @@ lvalue_p (tree ref)
constant-expression. */
bool
-builtin_valid_in_constant_expr_p (tree decl)
+builtin_valid_in_constant_expr_p (const_tree decl)
{
/* At present BUILT_IN_CONSTANT_P is the only builtin we're allowing
in constant-expressions. We may want to add other builtins later. */
@@ -1673,7 +1673,7 @@ decl_namespace_context (tree decl)
nested, or false otherwise. */
bool
-decl_anon_ns_mem_p (tree decl)
+decl_anon_ns_mem_p (const_tree decl)
{
while (1)
{
@@ -1971,9 +1971,9 @@ error_type (tree arg)
/* Does FUNCTION use a variable-length argument list? */
int
-varargs_function_p (tree function)
+varargs_function_p (const_tree function)
{
- tree parm = TYPE_ARG_TYPES (TREE_TYPE (function));
+ const_tree parm = TYPE_ARG_TYPES (TREE_TYPE (function));
for (; parm; parm = TREE_CHAIN (parm))
if (TREE_VALUE (parm) == void_type_node)
return 0;
@@ -1983,9 +1983,9 @@ varargs_function_p (tree function)
/* Returns 1 if decl is a member of a class. */
int
-member_p (tree decl)
+member_p (const_tree decl)
{
- const tree ctx = DECL_CONTEXT (decl);
+ const_tree const ctx = DECL_CONTEXT (decl);
return (ctx && TYPE_P (ctx));
}
@@ -2039,7 +2039,7 @@ maybe_dummy_object (tree type, tree* binfop)
/* Returns 1 if OB is a placeholder object, or a pointer to one. */
int
-is_dummy_object (tree ob)
+is_dummy_object (const_tree ob)
{
if (TREE_CODE (ob) == INDIRECT_REF)
ob = TREE_OPERAND (ob, 0);
@@ -2050,9 +2050,9 @@ is_dummy_object (tree ob)
/* Returns 1 iff type T is a POD type, as defined in [basic.types]. */
int
-pod_type_p (tree t)
+pod_type_p (const_tree t)
{
- t = strip_array_types (t);
+ t = const_strip_array_types (t);
if (t == error_mark_node)
return 1;
@@ -2087,9 +2087,9 @@ class_tmpl_impl_spec_p (const_tree t)
zeros in it. */
int
-zero_init_p (tree t)
+zero_init_p (const_tree t)
{
- t = strip_array_types (t);
+ t = const_strip_array_types (t);
if (t == error_mark_node)
return 1;
@@ -2318,11 +2318,6 @@ cp_walk_subtrees (tree *tp, int *walk_subtrees_p, walk_tree_fn func,
*walk_subtrees_p = 0;
break;
- case TINST_LEVEL:
- WALK_SUBTREE (TINST_DECL (*tp));
- *walk_subtrees_p = 0;
- break;
-
case PTRMEM_CST:
WALK_SUBTREE (TREE_TYPE (*tp));
*walk_subtrees_p = 0;
@@ -2398,58 +2393,6 @@ cp_walk_subtrees (tree *tp, int *walk_subtrees_p, walk_tree_fn func,
#undef WALK_SUBTREE
}
-/* Decide whether there are language-specific reasons to not inline a
- function as a tree. */
-
-int
-cp_cannot_inline_tree_fn (tree* fnp)
-{
- tree fn = *fnp;
-
- /* We can inline a template instantiation only if it's fully
- instantiated. */
- if (DECL_TEMPLATE_INFO (fn)
- && TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn)))
- {
- /* Don't instantiate functions that are not going to be
- inlined. */
- if (!DECL_INLINE (DECL_TEMPLATE_RESULT
- (template_for_substitution (fn))))
- return 1;
-
- fn = *fnp = instantiate_decl (fn, /*defer_ok=*/0, /*undefined_ok=*/0);
-
- if (TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn)))
- return 1;
- }
-
- if (flag_really_no_inline
- && lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)) == NULL)
- return 1;
-
- /* Don't auto-inline functions that might be replaced at link-time
- with an alternative definition. */
- if (!DECL_DECLARED_INLINE_P (fn) && DECL_REPLACEABLE_P (fn))
- {
- DECL_UNINLINABLE (fn) = 1;
- return 1;
- }
-
- if (varargs_function_p (fn))
- {
- DECL_UNINLINABLE (fn) = 1;
- return 1;
- }
-
- if (! function_attribute_inlinable_p (fn))
- {
- DECL_UNINLINABLE (fn) = 1;
- return 1;
- }
-
- return 0;
-}
-
/* Like save_expr, but for C++. */
tree
@@ -2477,7 +2420,7 @@ init_tree (void)
predicate to test whether or not DECL is a special function. */
special_function_kind
-special_function_p (tree decl)
+special_function_p (const_tree decl)
{
/* Rather than doing all this stuff with magic names, we should
probably have a field of type `special_function_kind' in
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index f0196088219..e996df97f1b 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -51,7 +51,7 @@ static tree cp_pointer_int_sum (enum tree_code, tree, tree);
static tree rationalize_conditional_expr (enum tree_code, tree);
static int comp_ptr_ttypes_real (tree, tree, int);
static bool comp_except_types (tree, tree, bool);
-static bool comp_array_types (tree, tree, bool);
+static bool comp_array_types (const_tree, const_tree, bool);
static tree pointer_diff (tree, tree, tree);
static tree get_delta_difference (tree, tree, bool, bool);
static void casts_away_constness_r (tree *, tree *);
@@ -151,7 +151,7 @@ complete_type_or_else (tree type, tree value)
/* Return truthvalue of whether type of EXP is instantiated. */
int
-type_unknown_p (tree exp)
+type_unknown_p (const_tree exp)
{
return (TREE_CODE (exp) == TREE_LIST
|| TREE_TYPE (exp) == unknown_type_node);
@@ -820,10 +820,10 @@ comp_except_types (tree a, tree b, bool exact)
we should try to make use of that. */
bool
-comp_except_specs (tree t1, tree t2, bool exact)
+comp_except_specs (const_tree t1, const_tree t2, bool exact)
{
- tree probe;
- tree base;
+ const_tree probe;
+ const_tree base;
int length = 0;
if (t1 == t2)
@@ -867,7 +867,7 @@ comp_except_specs (tree t1, tree t2, bool exact)
[] can match [size]. */
static bool
-comp_array_types (tree t1, tree t2, bool allow_redeclaration)
+comp_array_types (const_tree t1, const_tree t2, bool allow_redeclaration)
{
tree d1;
tree d2;
@@ -1154,7 +1154,7 @@ comptypes (tree t1, tree t2, int strict)
/* Returns 1 if TYPE1 is at least as qualified as TYPE2. */
bool
-at_least_as_qualified_p (tree type1, tree type2)
+at_least_as_qualified_p (const_tree type1, const_tree type2)
{
int q1 = cp_type_quals (type1);
int q2 = cp_type_quals (type2);
@@ -1167,7 +1167,7 @@ at_least_as_qualified_p (tree type1, tree type2)
more cv-qualified that TYPE1, and 0 otherwise. */
int
-comp_cv_qualification (tree type1, tree type2)
+comp_cv_qualification (const_tree type1, const_tree type2)
{
int q1 = cp_type_quals (type1);
int q2 = cp_type_quals (type2);
@@ -1206,9 +1206,9 @@ comp_cv_qual_signature (tree type1, tree type2)
element by element. */
bool
-compparms (tree parms1, tree parms2)
+compparms (const_tree parms1, const_tree parms2)
{
- tree t1, t2;
+ const_tree t1, t2;
/* An unspecified parmlist matches any specified parmlist
whose argument types don't need default promotions. */
@@ -1398,7 +1398,7 @@ cxx_sizeof_or_alignof_expr (tree e, enum tree_code op)
violates these rules. */
bool
-invalid_nonstatic_memfn_p (tree expr)
+invalid_nonstatic_memfn_p (const_tree expr)
{
if (TREE_CODE (TREE_TYPE (expr)) == METHOD_TYPE)
{
@@ -1413,7 +1413,7 @@ invalid_nonstatic_memfn_p (tree expr)
of the bitfield. Otherwise, return NULL_TREE. */
tree
-is_bitfield_expr_with_lowered_type (tree exp)
+is_bitfield_expr_with_lowered_type (const_tree exp)
{
switch (TREE_CODE (exp))
{
@@ -1452,7 +1452,7 @@ is_bitfield_expr_with_lowered_type (tree exp)
than NULL_TREE. */
tree
-unlowered_expr_type (tree exp)
+unlowered_expr_type (const_tree exp)
{
tree type;
@@ -1633,7 +1633,7 @@ inline_conversion (tree exp)
decay_conversion to one. */
int
-string_conv_p (tree totype, tree exp, int warn)
+string_conv_p (const_tree totype, const_tree exp, int warn)
{
tree t;
@@ -4259,6 +4259,8 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert)
errstring ="no post-decrement operator for type";
break;
}
+ else if (arg == error_mark_node)
+ return error_mark_node;
/* Report something read-only. */
@@ -6851,7 +6853,7 @@ comp_ptr_ttypes (tree to, tree from)
type or inheritance-related types, regardless of cv-quals. */
int
-ptr_reasonably_similar (tree to, tree from)
+ptr_reasonably_similar (const_tree to, const_tree from)
{
for (; ; to = TREE_TYPE (to), from = TREE_TYPE (from))
{
@@ -6925,18 +6927,18 @@ cp_type_quals (const_tree type)
arrays. */
bool
-cp_type_readonly (tree type)
+cp_type_readonly (const_tree type)
{
- type = strip_array_types (type);
+ type = const_strip_array_types (type);
return TYPE_READONLY (type);
}
/* Returns nonzero if the TYPE contains a mutable member. */
bool
-cp_has_mutable_p (tree type)
+cp_has_mutable_p (const_tree type)
{
- type = strip_array_types (type);
+ type = const_strip_array_types (type);
return CLASS_TYPE_P (type) && CLASSTYPE_HAS_MUTABLE (type);
}
@@ -7108,7 +7110,7 @@ non_reference (tree t)
how the lvalue is being used and so selects the error message. */
int
-lvalue_or_else (tree ref, enum lvalue_use use)
+lvalue_or_else (const_tree ref, enum lvalue_use use)
{
int win = lvalue_p (ref);
diff --git a/gcc/crtstuff.c b/gcc/crtstuff.c
index fc57d45afc8..49e68cdebbb 100644
--- a/gcc/crtstuff.c
+++ b/gcc/crtstuff.c
@@ -92,7 +92,10 @@ call_ ## FUNC (void) \
&& !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
&& defined(__GLIBC__) && __GLIBC__ >= 2
#include <link.h>
-# if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
+/* uClibc pretends to be glibc 2.2 and DT_CONFIG is defined in its link.h.
+ But it doesn't use PT_GNU_EH_FRAME ELF segment currently. */
+# if !defined(__UCLIBC__) \
+ && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
|| (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
# define USE_PT_GNU_EH_FRAME
# endif
diff --git a/gcc/cse.c b/gcc/cse.c
index 6c2530ac612..c2b4d182bd0 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -2160,6 +2160,11 @@ hash_rtx (const_rtx x, enum machine_mode mode, int *do_not_record_p,
+ (unsigned int) CONST_DOUBLE_HIGH (x));
return hash;
+ case CONST_FIXED:
+ hash += (unsigned int) code + (unsigned int) GET_MODE (x);
+ hash += fixed_hash (CONST_FIXED_VALUE (x));
+ return hash;
+
case CONST_VECTOR:
{
int units;
@@ -2401,6 +2406,7 @@ exp_equiv_p (const_rtx x, const_rtx y, int validate, bool for_gcse)
case CC0:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
return x == y;
case LABEL_REF:
@@ -2667,6 +2673,7 @@ canon_reg (rtx x, rtx insn)
case CONST:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case LABEL_REF:
@@ -2962,6 +2969,7 @@ fold_rtx (rtx x, rtx insn)
case CONST:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case LABEL_REF:
@@ -3028,6 +3036,7 @@ fold_rtx (rtx x, rtx insn)
case SYMBOL_REF:
case LABEL_REF:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
const_arg = folded_arg;
break;
@@ -3645,7 +3654,8 @@ equiv_constant (rtx x)
/* See if we previously assigned a constant value to this SUBREG. */
if ((new = lookup_as_function (x, CONST_INT)) != 0
- || (new = lookup_as_function (x, CONST_DOUBLE)) != 0)
+ || (new = lookup_as_function (x, CONST_DOUBLE)) != 0
+ || (new = lookup_as_function (x, CONST_FIXED)) != 0)
return new;
if (REG_P (SUBREG_REG (x))
@@ -5707,6 +5717,7 @@ cse_process_notes_1 (rtx x, rtx object, bool *changed)
case SYMBOL_REF:
case LABEL_REF:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case PC:
case CC0:
@@ -6317,6 +6328,7 @@ count_reg_usage (rtx x, int *counts, rtx dest, int incr)
case CONST:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case LABEL_REF:
diff --git a/gcc/cselib.c b/gcc/cselib.c
index e93b7a86c3c..c4c77c2c5ef 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -237,7 +237,7 @@ entry_and_rtx_equal_p (const void *entry, const void *x_arg)
rtx x = (rtx) x_arg;
enum machine_mode mode = GET_MODE (x);
- gcc_assert (GET_CODE (x) != CONST_INT
+ gcc_assert (GET_CODE (x) != CONST_INT && GET_CODE (x) != CONST_FIXED
&& (mode != VOIDmode || GET_CODE (x) != CONST_DOUBLE));
if (mode != GET_MODE (v->val_rtx))
@@ -246,6 +246,7 @@ entry_and_rtx_equal_p (const void *entry, const void *x_arg)
/* Unwrap X if necessary. */
if (GET_CODE (x) == CONST
&& (GET_CODE (XEXP (x, 0)) == CONST_INT
+ || GET_CODE (XEXP (x, 0)) == CONST_FIXED
|| GET_CODE (XEXP (x, 0)) == CONST_DOUBLE))
x = XEXP (x, 0);
@@ -472,6 +473,7 @@ rtx_equal_for_cselib_p (rtx x, rtx y)
switch (GET_CODE (x))
{
case CONST_DOUBLE:
+ case CONST_FIXED:
return 0;
case LABEL_REF:
@@ -554,7 +556,7 @@ rtx_equal_for_cselib_p (rtx x, rtx y)
static rtx
wrap_constant (enum machine_mode mode, rtx x)
{
- if (GET_CODE (x) != CONST_INT
+ if (GET_CODE (x) != CONST_INT && GET_CODE (x) != CONST_FIXED
&& (GET_CODE (x) != CONST_DOUBLE || GET_MODE (x) != VOIDmode))
return x;
gcc_assert (mode != VOIDmode);
@@ -618,6 +620,11 @@ cselib_hash_rtx (rtx x, int create)
+ (unsigned) CONST_DOUBLE_HIGH (x));
return hash ? hash : (unsigned int) CONST_DOUBLE;
+ case CONST_FIXED:
+ hash += (unsigned int) code + (unsigned int) GET_MODE (x);
+ hash += fixed_hash (CONST_FIXED_VALUE (x));
+ return hash ? hash : (unsigned int) CONST_FIXED;
+
case CONST_VECTOR:
{
int units;
@@ -1124,6 +1131,7 @@ cselib_subst_to_values (rtx x)
case CONST_DOUBLE:
case CONST_VECTOR:
case CONST_INT:
+ case CONST_FIXED:
return x;
case POST_INC:
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index 8c6a72e05ff..1d47eed8724 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -353,7 +353,7 @@ const struct gcc_debug_hooks dbx_debug_hooks =
dbxout_end_source_file,
dbxout_begin_block,
dbxout_end_block,
- debug_true_tree, /* ignore_block */
+ debug_true_const_tree, /* ignore_block */
dbxout_source_line, /* source_line */
dbxout_begin_prologue, /* begin_prologue */
debug_nothing_int_charstar, /* end_prologue */
@@ -389,7 +389,7 @@ const struct gcc_debug_hooks xcoff_debug_hooks =
dbxout_end_source_file,
xcoffout_begin_block,
xcoffout_end_block,
- debug_true_tree, /* ignore_block */
+ debug_true_const_tree, /* ignore_block */
xcoffout_source_line,
xcoffout_begin_prologue, /* begin_prologue */
debug_nothing_int_charstar, /* end_prologue */
diff --git a/gcc/dce.c b/gcc/dce.c
index c9ff13fa17b..c5af55ecc12 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -527,6 +527,7 @@ static bool
dce_process_block (basic_block bb, bool redo_out)
{
bitmap local_live = BITMAP_ALLOC (&dce_tmp_bitmap_obstack);
+ bitmap au;
rtx insn;
bool block_changed;
struct df_ref **def_rec, **use_rec;
@@ -569,6 +570,15 @@ dce_process_block (basic_block bb, bool redo_out)
bitmap_set_bit (local_live, DF_REF_REGNO (use));
}
+ /* These regs are considered always live so if they end up dying
+ because of some def, we need to bring the back again.
+ Calling df_simulate_fixup_sets has the disadvantage of calling
+ df_has_eh_preds once per insn, so we cache the information here. */
+ if (df_has_eh_preds (bb))
+ au = df->eh_block_artificial_uses;
+ else
+ au = df->regular_block_artificial_uses;
+
FOR_BB_INSNS_REVERSE (bb, insn)
if (INSN_P (insn))
{
@@ -580,7 +590,8 @@ dce_process_block (basic_block bb, bool redo_out)
/* The insn is needed if there is someone who uses the output. */
for (def_rec = DF_INSN_DEFS (insn); *def_rec; def_rec++)
- if (bitmap_bit_p (local_live, DF_REF_REGNO (*def_rec)))
+ if (bitmap_bit_p (local_live, DF_REF_REGNO (*def_rec))
+ || bitmap_bit_p (au, DF_REF_REGNO (*def_rec)))
{
needed = true;
break;
diff --git a/gcc/ddg.c b/gcc/ddg.c
index 295811db4c1..f1ec8fdb121 100644
--- a/gcc/ddg.c
+++ b/gcc/ddg.c
@@ -176,13 +176,17 @@ create_ddg_dep_from_intra_loop_link (ddg_ptr g, ddg_node_ptr src_node,
rtx set;
set = single_set (dest_node->insn);
- if (set)
+ /* TODO: Handle registers that REG_P is not true for them, i.e.
+ subregs and special registers. */
+ if (set && REG_P (SET_DEST (set)))
{
int regno = REGNO (SET_DEST (set));
- struct df_ref *first_def =
- df_bb_regno_first_def_find (g->bb, regno);
+ struct df_ref *first_def;
struct df_rd_bb_info *bb_info = DF_RD_BB_INFO (g->bb);
+ first_def = df_bb_regno_first_def_find (g->bb, regno);
+ gcc_assert (first_def);
+
if (bitmap_bit_p (bb_info->gen, first_def->id))
return;
}
diff --git a/gcc/debug.c b/gcc/debug.c
index baa38751247..12a726f9509 100644
--- a/gcc/debug.c
+++ b/gcc/debug.c
@@ -32,7 +32,7 @@ const struct gcc_debug_hooks do_nothing_debug_hooks =
debug_nothing_int,
debug_nothing_int_int, /* begin_block */
debug_nothing_int_int, /* end_block */
- debug_true_tree, /* ignore_block */
+ debug_true_const_tree, /* ignore_block */
debug_nothing_int_charstar, /* source_line */
debug_nothing_int_charstar, /* begin_prologue */
debug_nothing_int_charstar, /* end_prologue */
@@ -72,7 +72,7 @@ debug_nothing_tree_tree (tree t1 ATTRIBUTE_UNUSED,
}
bool
-debug_true_tree (tree block ATTRIBUTE_UNUSED)
+debug_true_const_tree (const_tree block ATTRIBUTE_UNUSED)
{
return true;
}
diff --git a/gcc/debug.h b/gcc/debug.h
index d1431f5c7ad..03c80412709 100644
--- a/gcc/debug.h
+++ b/gcc/debug.h
@@ -56,7 +56,7 @@ struct gcc_debug_hooks
instructions. This may not be the case for blocks containing
nested functions, since we may actually call such a function even
though the BLOCK information is messed up. Defaults to true. */
- bool (* ignore_block) (tree);
+ bool (* ignore_block) (const_tree);
/* Record a source file location at (FILE, LINE). */
void (* source_line) (unsigned int line, const char *file);
@@ -140,7 +140,7 @@ extern void debug_nothing_int_int (unsigned int, unsigned int);
extern void debug_nothing_tree (tree);
extern void debug_nothing_tree_int (tree, int);
extern void debug_nothing_tree_tree (tree, tree);
-extern bool debug_true_tree (tree);
+extern bool debug_true_const_tree (const_tree);
extern void debug_nothing_rtx (rtx);
/* Hooks for various debug formats. */
diff --git a/gcc/df-core.c b/gcc/df-core.c
index 3b4e7b3e579..9bebdbe35d1 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -1761,6 +1761,7 @@ df_print_regset (FILE *file, bitmap r)
/* Dump dataflow info. */
+
void
df_dump (FILE *file)
{
@@ -1778,6 +1779,34 @@ df_dump (FILE *file)
}
+/* Dump dataflow info for df->blocks_to_analyze. */
+
+void
+df_dump_region (FILE *file)
+{
+ if (df->blocks_to_analyze)
+ {
+ bitmap_iterator bi;
+ unsigned int bb_index;
+
+ fprintf (file, "\n\nstarting region dump\n");
+ df_dump_start (file);
+
+ EXECUTE_IF_SET_IN_BITMAP (df->blocks_to_analyze, 0, bb_index, bi)
+ {
+ basic_block bb = BASIC_BLOCK (bb_index);
+
+ df_print_bb_index (bb, file);
+ df_dump_top (bb, file);
+ df_dump_bottom (bb, file);
+ }
+ fprintf (file, "\n");
+ }
+ else
+ df_dump (file);
+}
+
+
/* Dump the introductory information for each problem defined. */
void
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 76f85c142af..08875038a5a 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -2821,6 +2821,7 @@ df_uses_record (struct df_collection_rec *collection_rec,
case CONST_INT:
case CONST:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case PC:
case CC0:
diff --git a/gcc/df.h b/gcc/df.h
index 7457277915d..3ff7f39834c 100644
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -836,6 +836,7 @@ extern bool df_reg_used (rtx, rtx);
extern void df_worklist_dataflow (struct dataflow *,bitmap, int *, int);
extern void df_print_regset (FILE *file, bitmap r);
extern void df_dump (FILE *);
+extern void df_dump_region (FILE *);
extern void df_dump_start (FILE *);
extern void df_dump_top (basic_block, FILE *);
extern void df_dump_bottom (basic_block, FILE *);
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 95d25caa235..5ae033c0946 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -1718,8 +1718,8 @@ refer to the single copy in the library. Note that the two
definitions of the functions need not be precisely the same, although
if they do not have the same effect your program may behave oddly.
-If the function is neither @code{extern} nor @code{static}, then the
-function is compiled as a standalone function, as well as being
+In C, if the function is neither @code{extern} nor @code{static}, then
+the function is compiled as a standalone function, as well as being
inlined where possible.
This is how GCC traditionally handled functions declared
@@ -1731,6 +1731,10 @@ preprocessor macros @code{__GNUC_GNU_INLINE__} or
@code{__GNUC_STDC_INLINE__} are defined. @xref{Inline,,An Inline
Function is As Fast As a Macro}.
+In C++, this attribute does not depend on @code{extern} in any way,
+but it still requires the @code{inline} keyword to enable its special
+behavior.
+
@cindex @code{flatten} function attribute
@item flatten
Generally, inlining into a function is limited. For a function marked with
@@ -2144,6 +2148,13 @@ When used together with @code{interrupt_handler}, @code{exception_handler}
or @code{nmi_handler}, code will be generated to load the stack pointer
from the USP register in the function prologue.
+@item l1_text
+@cindex @code{l1_text} function attribute
+This attribute specifies a function to be placed into L1 Instruction
+SRAM. The function will be put into a specific section named @code{.l1.text}.
+With @option{-mfdpic}, function calls with a such function as the callee
+or caller will use inlined PLT.
+
@item long_call/short_call
@cindex indirect calls on ARM
This attribute specifies how a particular function is called on
@@ -3461,6 +3472,24 @@ The @code{dllexport} attribute is described in @xref{Function Attributes}.
@end table
+@subsection Blackfin Variable Attributes
+
+Three attributes are currently defined for the Blackfin.
+
+@table @code
+@item l1_data
+@item l1_data_A
+@item l1_data_B
+@cindex @code{l1_data} variable attribute
+@cindex @code{l1_data_A} variable attribute
+@cindex @code{l1_data_B} variable attribute
+Use these attributes on the Blackfin to place the variable into L1 Data SRAM.
+Variables with @code{l1_data} attribute will be put into the specific section
+named @code{.l1.data}. Those with @code{l1_data_A} attribute will be put into
+the specific section named @code{.l1.data.A}. Those with @code{l1_data_B}
+attribute will be put into the specific section named @code{.l1.data.B}.
+@end table
+
@subsection M32R/D Variable Attributes
One attribute is currently defined for the M32R/D@.
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index dcd78f87a46..ad2b5f9eb85 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1986,6 +1986,9 @@ might emit some harmless messages resembling
@samp{WARNING: Couldn't find the global config file.} or
@samp{WARNING: Couldn't find tool init file} that can be ignored.
+If you are testing a cross-compiler, you may want to run the testsuite
+on a simulator as described at @uref{http://gcc.gnu.org/simtest-howto.html}.
+
@section How can you run the testsuite on selected tests?
In order to run sets of tests selectively, there are targets
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 4b1219b148e..1646df305cb 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -450,7 +450,7 @@ Objective-C and Objective-C++ Dialects}.
-mstack-check-l1 -mid-shared-library -mno-id-shared-library @gol
-mshared-library-id=@var{n} -mleaf-id-shared-library @gol
-mno-leaf-id-shared-library -msep-data -mno-sep-data -mlong-calls @gol
--mno-long-calls}
+-mno-long-calls -mfast-fp -minline-plt}
@emph{CRIS Options}
@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
@@ -557,7 +557,7 @@ Objective-C and Objective-C++ Dialects}.
-mthreads -mno-align-stringops -minline-all-stringops @gol
-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
-m96bit-long-double -mregparm=@var{num} -msseregparm @gol
--mpc32 -mpc64 -mpc80 mstackrealign @gol
+-mveclibabi=@var{type} -mpc32 -mpc64 -mpc80 -mstackrealign @gol
-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
-mcmodel=@var{code-model} @gol
-m32 -m64 -mlarge-data-threshold=@var{num}}
@@ -8612,6 +8612,17 @@ This feature is not enabled by default. Specifying
@option{-mno-long-calls} will restore the default behavior. Note these
switches have no effect on how the compiler generates code to handle
function calls via function pointers.
+
+@item -mfast-fp
+@opindex mfast-fp
+Link with the fast floating-point library. This library relaxes some of
+the IEEE floating-point standard's rules for checking inputs against
+Not-a-Number (NAN), in the interest of performance.
+
+@item -minline-plt
+@opindex minline-plt
+Enable inlining of PLT entries in function calls to functions that are
+not known to bind locally. It has no effect without @option{-mfdpic}.
@end table
@node CRIS Options
@@ -10429,6 +10440,19 @@ vectorized variants RCPPS and RSQRTPS) instead of DIVSS and SQRTSS (and their
vectorized variants). These instructions will be generated only when
@option{-funsafe-math-optimizations} is enabled.
+@item -mveclibabi=@var{type}
+@opindex mveclibabi
+Specifies the ABI type to use for vectorizing intrinsics using an
+external library. Supported types are @code{acml} for the AMD
+math core library style of interfacing. GCC will currently emit
+calls to @code{__vrd2_sin}, @code{__vrd2_cos}, @code{__vrd2_exp},
+@code{__vrd2_log}, @code{__vrd2_log2}, @code{__vrd2_log10},
+@code{__vrs4_sinf}, @code{__vrs4_cosf}, @code{__vrs4_expf},
+@code{__vrs4_logf}, @code{__vrs4_log2f}, @code{__vrs4_log10f}
+and @code{__vrs4_powf} when using this type and @option{-ftree-vectorize}
+is enabled. A ACML ABI compatible library will have to be specified
+at link time.
+
@item -mpush-args
@itemx -mno-push-args
@opindex mpush-args
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index 0942e57349c..51da432c4fc 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -47,7 +47,7 @@ See the next chapter for information on the C header file.
predication.
* Constant Definitions::Defining symbolic constants that can be used in the
md file.
-* Macros:: Using macros to generate patterns from a template.
+* Iterators:: Using iterators to generate patterns from a template.
@end menu
@node Overview
@@ -7649,22 +7649,22 @@ The constants that are defined with a define_constant are also output
in the insn-codes.h header file as #defines.
@end ifset
@ifset INTERNALS
-@node Macros
-@section Macros
-@cindex macros in @file{.md} files
+@node Iterators
+@section Iterators
+@cindex iterators in @file{.md} files
Ports often need to define similar patterns for more than one machine
-mode or for more than one rtx code. GCC provides some simple macro
+mode or for more than one rtx code. GCC provides some simple iterator
facilities to make this process easier.
@menu
-* Mode Macros:: Generating variations of patterns for different modes.
-* Code Macros:: Doing the same for codes.
+* Mode Iterators:: Generating variations of patterns for different modes.
+* Code Iterators:: Doing the same for codes.
@end menu
-@node Mode Macros
-@subsection Mode Macros
-@cindex mode macros in @file{.md} files
+@node Mode Iterators
+@subsection Mode Iterators
+@cindex mode iterators in @file{.md} files
Ports often need to define similar patterns for two or more different modes.
For example:
@@ -7681,25 +7681,25 @@ If a port uses @code{SImode} pointers in one configuration and
@code{SImode} and @code{DImode} patterns for manipulating pointers.
@end itemize
-Mode macros allow several patterns to be instantiated from one
+Mode iterators allow several patterns to be instantiated from one
@file{.md} file template. They can be used with any type of
rtx-based construct, such as a @code{define_insn},
@code{define_split}, or @code{define_peephole2}.
@menu
-* Defining Mode Macros:: Defining a new mode macro.
-* Substitutions:: Combining mode macros with substitutions
-* Examples:: Examples
+* Defining Mode Iterators:: Defining a new mode iterator.
+* Substitutions:: Combining mode iterators with substitutions
+* Examples:: Examples
@end menu
-@node Defining Mode Macros
-@subsubsection Defining Mode Macros
-@findex define_mode_macro
+@node Defining Mode Iterators
+@subsubsection Defining Mode Iterators
+@findex define_mode_iterator
-The syntax for defining a mode macro is:
+The syntax for defining a mode iterator is:
@smallexample
-(define_mode_macro @var{name} [(@var{mode1} "@var{cond1}") ... (@var{moden} "@var{condn}")])
+(define_mode_iterator @var{name} [(@var{mode1} "@var{cond1}") ... (@var{moden} "@var{condn}")])
@end smallexample
This allows subsequent @file{.md} file constructs to use the mode suffix
@@ -7712,7 +7712,7 @@ C condition will also require that @var{condi} be true.
For example:
@smallexample
-(define_mode_macro P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
+(define_mode_iterator P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
@end smallexample
defines a new mode suffix @code{:P}. Every construct that uses
@@ -7726,21 +7726,21 @@ as ``always true''. @code{(@var{mode} "")} can also be abbreviated
to @code{@var{mode}}. For example:
@smallexample
-(define_mode_macro GPR [SI (DI "TARGET_64BIT")])
+(define_mode_iterator GPR [SI (DI "TARGET_64BIT")])
@end smallexample
means that the @code{:DI} expansion only applies if @code{TARGET_64BIT}
but that the @code{:SI} expansion has no such constraint.
-Macros are applied in the order they are defined. This can be
-significant if two macros are used in a construct that requires
+Iterators are applied in the order they are defined. This can be
+significant if two iterators are used in a construct that requires
substitutions. @xref{Substitutions}.
@node Substitutions
-@subsubsection Substitution in Mode Macros
+@subsubsection Substitution in Mode Iterators
@findex define_mode_attr
-If an @file{.md} file construct uses mode macros, each version of the
+If an @file{.md} file construct uses mode iterators, each version of the
construct will often need slightly different strings or modes. For
example:
@@ -7756,7 +7756,7 @@ each instruction will often use a different assembler mnemonic.
@item
When a @code{define_insn} requires operands with different modes,
-using a macro for one of the operand modes usually requires a specific
+using an iterator for one of the operand modes usually requires a specific
mode for the other operand(s).
@end itemize
@@ -7772,9 +7772,9 @@ upper case. You can define other attributes using:
where @var{name} is the name of the attribute and @var{valuei}
is the value associated with @var{modei}.
-When GCC replaces some @var{:macro} with @var{:mode}, it will scan
+When GCC replaces some @var{:iterator} with @var{:mode}, it will scan
each string and mode in the pattern for sequences of the form
-@code{<@var{macro}:@var{attr}>}, where @var{attr} is the name of a
+@code{<@var{iterator}:@var{attr}>}, where @var{attr} is the name of a
mode attribute. If the attribute is defined for @var{mode}, the whole
@code{<...>} sequence will be replaced by the appropriate attribute
value.
@@ -7782,7 +7782,7 @@ value.
For example, suppose an @file{.md} file has:
@smallexample
-(define_mode_macro P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
+(define_mode_iterator P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
(define_mode_attr load [(SI "lw") (DI "ld")])
@end smallexample
@@ -7794,23 +7794,23 @@ will use @code{"lw\t%0,%1"} and the @code{DI} version will use
Here is an example of using an attribute for a mode:
@smallexample
-(define_mode_macro LONG [SI DI])
+(define_mode_iterator LONG [SI DI])
(define_mode_attr SHORT [(SI "HI") (DI "SI")])
(define_insn ...
(sign_extend:LONG (match_operand:<LONG:SHORT> ...)) ...)
@end smallexample
-The @code{@var{macro}:} prefix may be omitted, in which case the
-substitution will be attempted for every macro expansion.
+The @code{@var{iterator}:} prefix may be omitted, in which case the
+substitution will be attempted for every iterator expansion.
@node Examples
-@subsubsection Mode Macro Examples
+@subsubsection Mode Iterator Examples
Here is an example from the MIPS port. It defines the following
modes and attributes (among others):
@smallexample
-(define_mode_macro GPR [SI (DI "TARGET_64BIT")])
+(define_mode_iterator GPR [SI (DI "TARGET_64BIT")])
(define_mode_attr d [(SI "") (DI "d")])
@end smallexample
@@ -7850,28 +7850,28 @@ This is exactly equivalent to:
(set_attr "mode" "DI")])
@end smallexample
-@node Code Macros
-@subsection Code Macros
-@cindex code macros in @file{.md} files
-@findex define_code_macro
+@node Code Iterators
+@subsection Code Iterators
+@cindex code iterators in @file{.md} files
+@findex define_code_iterator
@findex define_code_attr
-Code macros operate in a similar way to mode macros. @xref{Mode Macros}.
+Code iterators operate in a similar way to mode iterators. @xref{Mode Iterators}.
The construct:
@smallexample
-(define_code_macro @var{name} [(@var{code1} "@var{cond1}") ... (@var{coden} "@var{condn}")])
+(define_code_iterator @var{name} [(@var{code1} "@var{cond1}") ... (@var{coden} "@var{condn}")])
@end smallexample
defines a pseudo rtx code @var{name} that can be instantiated as
@var{codei} if condition @var{condi} is true. Each @var{codei}
must have the same rtx format. @xref{RTL Classes}.
-As with mode macros, each pattern that uses @var{name} will be
+As with mode iterators, each pattern that uses @var{name} will be
expanded @var{n} times, once with all uses of @var{name} replaced by
@var{code1}, once with all uses replaced by @var{code2}, and so on.
-@xref{Defining Mode Macros}.
+@xref{Defining Mode Iterators}.
It is possible to define attributes for codes as well as for modes.
There are two standard code attributes: @code{code}, the name of the
@@ -7882,11 +7882,11 @@ Other attributes are defined using:
(define_code_attr @var{name} [(@var{code1} "@var{value1}") ... (@var{coden} "@var{valuen}")])
@end smallexample
-Here's an example of code macros in action, taken from the MIPS port:
+Here's an example of code iterators in action, taken from the MIPS port:
@smallexample
-(define_code_macro any_cond [unordered ordered unlt unge uneq ltgt unle ungt
- eq ne gt ge lt le gtu geu ltu leu])
+(define_code_iterator any_cond [unordered ordered unlt unge uneq ltgt unle ungt
+ eq ne gt ge lt le gtu geu ltu leu])
(define_expand "b<code>"
[(set (pc)
diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi
index 247a22e9ad3..83fa0895d0d 100644
--- a/gcc/doc/rtl.texi
+++ b/gcc/doc/rtl.texi
@@ -1492,6 +1492,15 @@ bits but small enough to fit within twice that number of bits (GCC
does not provide a mechanism to represent even larger constants). In
the latter case, @var{m} will be @code{VOIDmode}.
+@findex const_fixed
+@item (const_fixed:@var{m} @var{addr})
+Represents a fixed-point constant of mode @var{m}.
+The data structure, which contains data with the size of two
+@code{HOST_BITS_PER_WIDE_INT} and the associated fixed-point mode,
+is access with the macro @code{CONST_FIXED_VALUE}. The high part of data
+is accessed with @code{CONST_FIXED_VALUE_HIGH}; the low part is accessed
+with @code{CONST_FIXED_VALUE_LOW}.
+
@findex const_vector
@item (const_vector:@var{m} [@var{x0} @var{x1} @dots{}])
Represents a vector constant. The square brackets stand for the vector
@@ -2013,24 +2022,35 @@ still known.
@findex neg
@findex ss_neg
+@findex us_neg
@cindex negation
@cindex negation with signed saturation
+@cindex negation with unsigned saturation
@item (neg:@var{m} @var{x})
@itemx (ss_neg:@var{m} @var{x})
+@itemx (us_neg:@var{m} @var{x})
These two expressions represent the negation (subtraction from zero) of
the value represented by @var{x}, carried out in mode @var{m}. They
differ in the behavior on overflow of integer modes. In the case of
@code{neg}, the negation of the operand may be a number not representable
in mode @var{m}, in which case it is truncated to @var{m}. @code{ss_neg}
-ensures that an out-of-bounds result saturates to the maximum or minimum
-representable value.
+and @code{us_neg} ensure that an out-of-bounds result saturates to the
+maximum or minimum signed or unsigned value.
@findex mult
+@findex ss_mult
+@findex us_mult
@cindex multiplication
@cindex product
+@cindex multiplication with signed saturation
+@cindex multiplication with unsigned saturation
@item (mult:@var{m} @var{x} @var{y})
+@itemx (ss_mult:@var{m} @var{x} @var{y})
+@itemx (us_mult:@var{m} @var{x} @var{y})
Represents the signed product of the values represented by @var{x} and
@var{y} carried out in machine mode @var{m}.
+@code{ss_mult} and @code{us_mult} ensure that an out-of-bounds result
+saturates to the maximum or minimum signed or unsigned value.
Some machines support a multiplication that generates a product wider
than the operands. Write the pattern for this as
@@ -2046,14 +2066,19 @@ For unsigned widening multiplication, use the same idiom, but with
@code{zero_extend} instead of @code{sign_extend}.
@findex div
+@findex ss_div
@cindex division
@cindex signed division
+@cindex signed division with signed saturation
@cindex quotient
@item (div:@var{m} @var{x} @var{y})
+@itemx (ss_div:@var{m} @var{x} @var{y})
Represents the quotient in signed division of @var{x} by @var{y},
carried out in machine mode @var{m}. If @var{m} is a floating point
mode, it represents the exact quotient; otherwise, the integerized
quotient.
+@code{ss_div} ensures that an out-of-bounds result saturates to the maximum
+or minimum signed value.
Some machines have division instructions in which the operands and
quotient widths are not all the same; you should represent
@@ -2065,9 +2090,13 @@ such instructions using @code{truncate} and @code{sign_extend} as in,
@findex udiv
@cindex unsigned division
+@cindex unsigned division with unsigned saturation
@cindex division
@item (udiv:@var{m} @var{x} @var{y})
+@itemx (us_div:@var{m} @var{x} @var{y})
Like @code{div} but represents unsigned division.
+@code{us_div} ensures that an out-of-bounds result saturates to the maximum
+or minimum unsigned value.
@findex mod
@findex umod
@@ -2131,18 +2160,21 @@ fixed-point mode.
@findex ashift
@findex ss_ashift
+@findex us_ashift
@cindex left shift
@cindex shift
@cindex arithmetic shift
@cindex arithmetic shift with signed saturation
+@cindex arithmetic shift with unsigned saturation
@item (ashift:@var{m} @var{x} @var{c})
@itemx (ss_ashift:@var{m} @var{x} @var{c})
-These two expressions represent the result of arithmetically shifting @var{x}
+@itemx (us_ashift:@var{m} @var{x} @var{c})
+These three expressions represent the result of arithmetically shifting @var{x}
left by @var{c} places. They differ in their behavior on overflow of integer
modes. An @code{ashift} operation is a plain shift with no special behavior
-in case of a change in the sign bit; @code{ss_ashift} saturates to the minimum
-or maximum representable value if any of the bits shifted out differs from the
-final sign bit.
+in case of a change in the sign bit; @code{ss_ashift} and @code{us_ashift}
+saturates to the minimum or maximum representable value if any of the bits
+shifted out differs from the final sign bit.
@var{x} have mode @var{m}, a fixed-point machine mode. @var{c}
be a fixed-point mode or be a constant with mode @code{VOIDmode}; which
@@ -2529,6 +2561,38 @@ When @var{m} is a floating point mode, represents the result of
converting floating point value @var{x} (valid for mode @var{m}) to an
integer, still represented in floating point mode @var{m}, by rounding
towards zero.
+
+@findex fract_convert
+@item (fract_convert:@var{m} @var{x})
+Represents the result of converting fixed-point value @var{x} to
+fixed-point mode @var{m}, signed integer value @var{x} to
+fixed-point mode @var{m}, floating-point value @var{x} to
+fixed-point mode @var{m}, fixed-point value @var{x} to integer mode @var{m}
+regarded as signed, or fixed-point value @var{x} to floating-point mode @var{m}.
+When overflows or underflows happen, the results are undefined.
+
+@findex sat_fract
+@item (sat_fract:@var{m} @var{x})
+Represents the result of converting fixed-point value @var{x} to
+fixed-point mode @var{m}, signed integer value @var{x} to
+fixed-point mode @var{m}, or floating-point value @var{x} to
+fixed-point mode @var{m}.
+When overflows or underflows happen, the results are saturated to the
+maximum or the minimum.
+
+@findex unsigned_fract_convert
+@item (unsigned_fract_convert:@var{m} @var{x})
+Represents the result of converting fixed-point value @var{x} to
+integer mode @var{m} regarded as unsigned, or unsigned integer value @var{x} to
+fixed-point mode @var{m}.
+When overflows or underflows happen, the results are undefined.
+
+@findex unsigned_sat_fract
+@item (unsigned_sat_fract:@var{m} @var{x})
+Represents the result of converting unsigned integer value @var{x} to
+fixed-point mode @var{m}.
+When overflows or underflows happen, the results are saturated to the
+maximum or the minimum.
@end table
@node RTL Declarations
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 0ec10c5949d..a913b8058c6 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -5897,12 +5897,30 @@ will be used. Defaults to 1 if @code{move_by_pieces_ninsns} returns less
than @code{CLEAR_RATIO}.
@end defmac
+@defmac SET_RATIO
+The threshold of number of scalar move insns, @emph{below} which a sequence
+of insns should be generated to set memory to a constant value, instead of
+a block set insn or a library call.
+Increasing the value will always make code faster, but
+eventually incurs high cost in increased code size.
+
+If you don't define this, it defaults to the value of @code{MOVE_RATIO}.
+@end defmac
+
+@defmac SET_BY_PIECES_P (@var{size}, @var{alignment})
+A C expression used to determine whether @code{store_by_pieces} will be
+used to set a chunk of memory to a constant value, or whether some
+other mechanism will be used. Used by @code{__builtin_memset} when
+storing values other than constant zero.
+Defaults to 1 if @code{move_by_pieces_ninsns} returns less
+than @code{SET_RATIO}.
+@end defmac
+
@defmac STORE_BY_PIECES_P (@var{size}, @var{alignment})
A C expression used to determine whether @code{store_by_pieces} will be
-used to set a chunk of memory to a constant value, or whether some other
-mechanism will be used. Used by @code{__builtin_memset} when storing
-values other than constant zero and by @code{__builtin_strcpy} when
-when called with a constant source string.
+used to set a chunk of memory to a constant string value, or whether some
+other mechanism will be used. Used by @code{__builtin_strcpy} when
+called with a constant source string.
Defaults to 1 if @code{move_by_pieces_ninsns} returns less
than @code{MOVE_RATIO}.
@end defmac
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index a03b81abf5b..e1b332f7101 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -354,12 +354,12 @@ static void reg_save (const char *, unsigned, unsigned, HOST_WIDE_INT);
#ifdef DWARF2_UNWIND_INFO
static void initial_return_save (rtx);
#endif
-static HOST_WIDE_INT stack_adjust_offset (rtx);
+static HOST_WIDE_INT stack_adjust_offset (const_rtx);
static void output_cfi (dw_cfi_ref, dw_fde_ref, int);
static void output_call_frame_info (int);
static void dwarf2out_stack_adjust (rtx, bool);
static void flush_queued_reg_saves (void);
-static bool clobbers_queued_reg_save (rtx);
+static bool clobbers_queued_reg_save (const_rtx);
static void dwarf2out_frame_debug_expr (rtx, const char *);
/* Support for complex CFA locations. */
@@ -1025,10 +1025,10 @@ initial_return_save (rtx rtl)
contains. */
static HOST_WIDE_INT
-stack_adjust_offset (rtx pattern)
+stack_adjust_offset (const_rtx pattern)
{
- rtx src = SET_SRC (pattern);
- rtx dest = SET_DEST (pattern);
+ const_rtx src = SET_SRC (pattern);
+ const_rtx dest = SET_DEST (pattern);
HOST_WIDE_INT offset = 0;
enum rtx_code code;
@@ -1286,7 +1286,7 @@ flush_queued_reg_saves (void)
have a new location for? */
static bool
-clobbers_queued_reg_save (rtx insn)
+clobbers_queued_reg_save (const_rtx insn)
{
struct queued_reg_save *q;
@@ -3651,7 +3651,7 @@ static void dwarf2out_start_source_file (unsigned, const char *);
static void dwarf2out_end_source_file (unsigned);
static void dwarf2out_begin_block (unsigned, unsigned);
static void dwarf2out_end_block (unsigned, unsigned);
-static bool dwarf2out_ignore_block (tree);
+static bool dwarf2out_ignore_block (const_tree);
static void dwarf2out_global_decl (tree);
static void dwarf2out_type_decl (tree, int);
static void dwarf2out_imported_module_or_decl (tree, tree);
@@ -4069,14 +4069,14 @@ static HOST_WIDE_INT frame_pointer_fb_offset;
/* Forward declarations for functions defined in this file. */
-static int is_pseudo_reg (rtx);
+static int is_pseudo_reg (const_rtx);
static tree type_main_variant (tree);
-static int is_tagged_type (tree);
+static int is_tagged_type (const_tree);
static const char *dwarf_tag_name (unsigned);
static const char *dwarf_attr_name (unsigned);
static const char *dwarf_form_name (unsigned);
-static tree decl_ultimate_origin (tree);
-static tree block_ultimate_origin (tree);
+static tree decl_ultimate_origin (const_tree);
+static tree block_ultimate_origin (const_tree);
static tree decl_class_context (tree);
static void add_dwarf_attr (dw_die_ref, dw_attr_ref);
static inline enum dw_val_class AT_class (dw_attr_ref);
@@ -4139,7 +4139,7 @@ static int decl_die_table_eq (const void *, const void *);
static dw_die_ref lookup_decl_die (tree);
static hashval_t decl_loc_table_hash (const void *);
static int decl_loc_table_eq (const void *, const void *);
-static var_loc_list *lookup_decl_loc (tree);
+static var_loc_list *lookup_decl_loc (const_tree);
static void equate_decl_number_to_die (tree, dw_die_ref);
static void add_var_loc_to_decl (tree, struct var_loc_node *);
static void print_spaces (FILE *);
@@ -4151,7 +4151,7 @@ static void loc_checksum (dw_loc_descr_ref, struct md5_ctx *);
static void attr_checksum (dw_attr_ref, struct md5_ctx *, int *);
static void die_checksum (dw_die_ref, struct md5_ctx *, int *);
static int same_loc_p (dw_loc_descr_ref, dw_loc_descr_ref, int *);
-static int same_dw_val_p (dw_val_node *, dw_val_node *, int *);
+static int same_dw_val_p (const dw_val_node *, const dw_val_node *, int *);
static int same_attr_p (dw_attr_ref, dw_attr_ref, int *);
static int same_die_p (dw_die_ref, dw_die_ref, int *);
static int same_die_p_wrap (dw_die_ref, dw_die_ref);
@@ -4191,18 +4191,18 @@ static void output_pubnames (VEC (pubname_entry,gc) *);
static void add_arange (tree, dw_die_ref);
static void output_aranges (void);
static unsigned int add_ranges_num (int);
-static unsigned int add_ranges (tree);
+static unsigned int add_ranges (const_tree);
static unsigned int add_ranges_by_labels (const char *, const char *);
static void output_ranges (void);
static void output_line_info (void);
static void output_file_names (void);
static dw_die_ref base_type_die (tree);
static int is_base_type (tree);
-static bool is_subrange_type (tree);
+static bool is_subrange_type (const_tree);
static dw_die_ref subrange_type_die (tree, dw_die_ref);
static dw_die_ref modified_type_die (tree, int, int, dw_die_ref);
-static int type_is_enum (tree);
-static unsigned int dbx_reg_number (rtx);
+static int type_is_enum (const_tree);
+static unsigned int dbx_reg_number (const_rtx);
static void add_loc_descr_op_piece (dw_loc_descr_ref *, int);
static dw_loc_descr_ref reg_loc_descriptor (rtx, enum var_init_status);
static dw_loc_descr_ref one_reg_loc_descriptor (unsigned int,
@@ -4212,7 +4212,7 @@ static dw_loc_descr_ref multiple_reg_loc_descriptor (rtx, rtx,
static dw_loc_descr_ref int_loc_descriptor (HOST_WIDE_INT);
static dw_loc_descr_ref based_loc_descr (rtx, HOST_WIDE_INT,
enum var_init_status);
-static int is_based_loc (rtx);
+static int is_based_loc (const_rtx);
static dw_loc_descr_ref mem_loc_descriptor (rtx, enum machine_mode mode,
enum var_init_status);
static dw_loc_descr_ref concat_loc_descriptor (rtx, rtx,
@@ -4221,18 +4221,18 @@ static dw_loc_descr_ref loc_descriptor (rtx, enum var_init_status);
static dw_loc_descr_ref loc_descriptor_from_tree_1 (tree, int);
static dw_loc_descr_ref loc_descriptor_from_tree (tree);
static HOST_WIDE_INT ceiling (HOST_WIDE_INT, unsigned int);
-static tree field_type (tree);
-static unsigned int simple_type_align_in_bits (tree);
-static unsigned int simple_decl_align_in_bits (tree);
-static unsigned HOST_WIDE_INT simple_type_size_in_bits (tree);
-static HOST_WIDE_INT field_byte_offset (tree);
+static tree field_type (const_tree);
+static unsigned int simple_type_align_in_bits (const_tree);
+static unsigned int simple_decl_align_in_bits (const_tree);
+static unsigned HOST_WIDE_INT simple_type_size_in_bits (const_tree);
+static HOST_WIDE_INT field_byte_offset (const_tree);
static void add_AT_location_description (dw_die_ref, enum dwarf_attribute,
dw_loc_descr_ref);
static void add_data_member_location_attribute (dw_die_ref, tree);
static void add_const_value_attribute (dw_die_ref, rtx);
static void insert_int (HOST_WIDE_INT, unsigned, unsigned char *);
static HOST_WIDE_INT extract_int (const unsigned char *, unsigned);
-static void insert_float (rtx, unsigned char *);
+static void insert_float (const_rtx, unsigned char *);
static rtx rtl_for_decl_location (tree);
static void add_location_or_const_value_attribute (dw_die_ref, tree,
enum dwarf_attribute);
@@ -4256,8 +4256,8 @@ static inline int local_scope_p (dw_die_ref);
static inline int class_or_namespace_scope_p (dw_die_ref);
static void add_type_attribute (dw_die_ref, tree, int, int, dw_die_ref);
static void add_calling_convention_attribute (dw_die_ref, tree);
-static const char *type_tag (tree);
-static tree member_declared_type (tree);
+static const char *type_tag (const_tree);
+static tree member_declared_type (const_tree);
#if 0
static const char *decl_start_label (tree);
#endif
@@ -4290,7 +4290,7 @@ static void gen_type_die (tree, dw_die_ref);
static void gen_tagged_type_instantiation_die (tree, dw_die_ref);
static void gen_block_die (tree, dw_die_ref, int);
static void decls_for_scope (tree, dw_die_ref, int);
-static int is_redundant_typedef (tree);
+static int is_redundant_typedef (const_tree);
static void gen_namespace_die (tree);
static void gen_decl_die (tree, dw_die_ref);
static dw_die_ref force_decl_die (tree);
@@ -4437,7 +4437,7 @@ dwarf2out_set_demangle_name_func (const char *(*func) (const char *))
/* Test if rtl node points to a pseudo register. */
static inline int
-is_pseudo_reg (rtx rtl)
+is_pseudo_reg (const_rtx rtl)
{
return ((REG_P (rtl) && REGNO (rtl) >= FIRST_PSEUDO_REGISTER)
|| (GET_CODE (rtl) == SUBREG
@@ -4467,7 +4467,7 @@ type_main_variant (tree type)
/* Return nonzero if the given type node represents a tagged type. */
static inline int
-is_tagged_type (tree type)
+is_tagged_type (const_tree type)
{
enum tree_code code = TREE_CODE (type);
@@ -4863,7 +4863,7 @@ dwarf_form_name (unsigned int form)
given block. */
static tree
-decl_ultimate_origin (tree decl)
+decl_ultimate_origin (const_tree decl)
{
if (!CODE_CONTAINS_STRUCT (TREE_CODE (decl), TS_DECL_COMMON))
return NULL_TREE;
@@ -4888,7 +4888,7 @@ decl_ultimate_origin (tree decl)
given block. */
static tree
-block_ultimate_origin (tree block)
+block_ultimate_origin (const_tree block)
{
tree immediate_origin = BLOCK_ABSTRACT_ORIGIN (block);
@@ -5734,7 +5734,7 @@ decl_loc_table_eq (const void *x, const void *y)
/* Return the var_loc list associated with a given declaration. */
static inline var_loc_list *
-lookup_decl_loc (tree decl)
+lookup_decl_loc (const_tree decl)
{
return htab_find_with_hash (decl_loc_table, decl, DECL_UID (decl));
}
@@ -6099,7 +6099,7 @@ same_loc_p (dw_loc_descr_ref loc1, dw_loc_descr_ref loc2, int *mark)
/* Do the values look the same? */
static int
-same_dw_val_p (dw_val_node *v1, dw_val_node *v2, int *mark)
+same_dw_val_p (const dw_val_node *v1, const dw_val_node *v2, int *mark)
{
dw_loc_descr_ref loc1, loc2;
rtx r1, r2;
@@ -7667,7 +7667,7 @@ add_ranges_num (int num)
range terminator if BLOCK is NULL. */
static unsigned int
-add_ranges (tree block)
+add_ranges (const_tree block)
{
return add_ranges_num (block ? BLOCK_NUMBER (block) : 0);
}
@@ -8515,7 +8515,7 @@ is_base_type (tree type)
ERROR_MARK node. */
static inline unsigned HOST_WIDE_INT
-simple_type_size_in_bits (tree type)
+simple_type_size_in_bits (const_tree type)
{
if (TREE_CODE (type) == ERROR_MARK)
return BITS_PER_WORD;
@@ -8531,7 +8531,7 @@ simple_type_size_in_bits (tree type)
emitted as a subrange type. */
static inline bool
-is_subrange_type (tree type)
+is_subrange_type (const_tree type)
{
tree subtype = TREE_TYPE (type);
@@ -8757,7 +8757,7 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type,
an enumerated type. */
static inline int
-type_is_enum (tree type)
+type_is_enum (const_tree type)
{
return TREE_CODE (type) == ENUMERAL_TYPE;
}
@@ -8765,7 +8765,7 @@ type_is_enum (tree type)
/* Return the DBX register number described by a given RTL node. */
static unsigned int
-dbx_reg_number (rtx rtl)
+dbx_reg_number (const_rtx rtl)
{
unsigned regno = REGNO (rtl);
@@ -8991,7 +8991,7 @@ based_loc_descr (rtx reg, HOST_WIDE_INT offset,
/* Return true if this RTL expression describes a base+offset calculation. */
static inline int
-is_based_loc (rtx rtl)
+is_based_loc (const_rtx rtl)
{
return (GET_CODE (rtl) == PLUS
&& ((REG_P (XEXP (rtl, 0))
@@ -9840,7 +9840,7 @@ ceiling (HOST_WIDE_INT value, unsigned int boundary)
ERROR_MARK node. */
static inline tree
-field_type (tree decl)
+field_type (const_tree decl)
{
tree type;
@@ -9859,13 +9859,13 @@ field_type (tree decl)
be an ERROR_MARK node. */
static inline unsigned
-simple_type_align_in_bits (tree type)
+simple_type_align_in_bits (const_tree type)
{
return (TREE_CODE (type) != ERROR_MARK) ? TYPE_ALIGN (type) : BITS_PER_WORD;
}
static inline unsigned
-simple_decl_align_in_bits (tree decl)
+simple_decl_align_in_bits (const_tree decl)
{
return (TREE_CODE (decl) != ERROR_MARK) ? DECL_ALIGN (decl) : BITS_PER_WORD;
}
@@ -9896,7 +9896,7 @@ round_up_to_align (HOST_WIDE_INT t, unsigned int align)
just yet). */
static HOST_WIDE_INT
-field_byte_offset (tree decl)
+field_byte_offset (const_tree decl)
{
HOST_WIDE_INT object_offset_in_bits;
HOST_WIDE_INT bitpos_int;
@@ -10162,7 +10162,7 @@ extract_int (const unsigned char *src, unsigned int size)
/* Writes floating point values to dw_vec_const array. */
static void
-insert_float (rtx rtl, unsigned char *array)
+insert_float (const_rtx rtl, unsigned char *array)
{
REAL_VALUE_TYPE rv;
long val[4];
@@ -10403,6 +10403,43 @@ rtl_for_decl_init (tree init, tree type)
else if (initializer_constant_valid_p (init, type)
&& ! walk_tree (&init, reference_to_unused, NULL, NULL))
{
+ /* Convert vector CONSTRUCTOR initializers to VECTOR_CST if
+ possible. */
+ if (TREE_CODE (type) == VECTOR_TYPE)
+ switch (TREE_CODE (init))
+ {
+ case VECTOR_CST:
+ break;
+ case CONSTRUCTOR:
+ if (TREE_CONSTANT (init))
+ {
+ VEC(constructor_elt,gc) *elts = CONSTRUCTOR_ELTS (init);
+ bool constant_p = true;
+ tree value;
+ unsigned HOST_WIDE_INT ix;
+
+ /* Even when ctor is constant, it might contain non-*_CST
+ elements (e.g. { 1.0/0.0 - 1.0/0.0, 0.0 }) and those don't
+ belong into VECTOR_CST nodes. */
+ FOR_EACH_CONSTRUCTOR_VALUE (elts, ix, value)
+ if (!CONSTANT_CLASS_P (value))
+ {
+ constant_p = false;
+ break;
+ }
+
+ if (constant_p)
+ {
+ init = build_vector_from_ctor (type, elts);
+ break;
+ }
+ }
+ /* FALLTHRU */
+
+ default:
+ return NULL;
+ }
+
rtl = expand_expr (init, NULL_RTX, VOIDmode, EXPAND_INITIALIZER);
/* If expand_expr returns a MEM, it wasn't immediate. */
@@ -10622,7 +10659,7 @@ rtl_for_decl_location (tree decl)
XXX: If you split a variable across multiple sections, we won't notice. */
static const char *
-secname_for_decl (tree decl)
+secname_for_decl (const_tree decl)
{
const char *secname;
@@ -11488,7 +11525,7 @@ add_calling_convention_attribute (dw_die_ref subr_die, tree type)
was declared without a tag. */
static const char *
-type_tag (tree type)
+type_tag (const_tree type)
{
const char *name = 0;
@@ -11526,7 +11563,7 @@ type_tag (tree type)
for bit field types. */
static inline tree
-member_declared_type (tree member)
+member_declared_type (const_tree member)
{
return (DECL_BIT_FIELD_TYPE (member)
? DECL_BIT_FIELD_TYPE (member) : TREE_TYPE (member));
@@ -12484,7 +12521,7 @@ add_call_src_coords_attributes (tree stmt, dw_die_ref die)
first subblock's abstract origin is the function's outermost block,
then we're looking at the main entry point. */
static bool
-is_inlined_entry_point (tree stmt)
+is_inlined_entry_point (const_tree stmt)
{
tree decl, block;
@@ -13339,7 +13376,7 @@ decls_for_scope (tree stmt, dw_die_ref context_die, int depth)
/* Is this a typedef we can avoid emitting? */
static inline int
-is_redundant_typedef (tree decl)
+is_redundant_typedef (const_tree decl)
{
if (TYPE_DECL_IS_STUB (decl))
return 1;
@@ -13950,7 +13987,7 @@ dwarf2out_end_block (unsigned int line ATTRIBUTE_UNUSED, unsigned int blocknum)
we may end up calling them anyway. */
static bool
-dwarf2out_ignore_block (tree block)
+dwarf2out_ignore_block (const_tree block)
{
tree decl;
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 6e7230db98c..6a4604d40e9 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -164,6 +164,10 @@ static GTY ((if_marked ("ggc_marked_p"), param_is (struct reg_attrs)))
static GTY ((if_marked ("ggc_marked_p"), param_is (struct rtx_def)))
htab_t const_double_htab;
+/* A hash table storing all CONST_FIXEDs. */
+static GTY ((if_marked ("ggc_marked_p"), param_is (struct rtx_def)))
+ htab_t const_fixed_htab;
+
#define first_insn (cfun->emit->x_first_insn)
#define last_insn (cfun->emit->x_last_insn)
#define cur_insn_uid (cfun->emit->x_cur_insn_uid)
@@ -179,6 +183,9 @@ static int const_int_htab_eq (const void *, const void *);
static hashval_t const_double_htab_hash (const void *);
static int const_double_htab_eq (const void *, const void *);
static rtx lookup_const_double (rtx);
+static hashval_t const_fixed_htab_hash (const void *);
+static int const_fixed_htab_eq (const void *, const void *);
+static rtx lookup_const_fixed (rtx);
static hashval_t mem_attrs_htab_hash (const void *);
static int mem_attrs_htab_eq (const void *, const void *);
static mem_attrs *get_mem_attrs (alias_set_type, tree, rtx, rtx, unsigned int,
@@ -247,6 +254,33 @@ const_double_htab_eq (const void *x, const void *y)
CONST_DOUBLE_REAL_VALUE (b));
}
+/* Returns a hash code for X (which is really a CONST_FIXED). */
+
+static hashval_t
+const_fixed_htab_hash (const void *x)
+{
+ const_rtx const value = (const_rtx) x;
+ hashval_t h;
+
+ h = fixed_hash (CONST_FIXED_VALUE (value));
+ /* MODE is used in the comparison, so it should be in the hash. */
+ h ^= GET_MODE (value);
+ return h;
+}
+
+/* Returns nonzero if the value represented by X (really a ...)
+ is the same as that represented by Y (really a ...). */
+
+static int
+const_fixed_htab_eq (const void *x, const void *y)
+{
+ const_rtx const a = (const_rtx) x, b = (const_rtx) y;
+
+ if (GET_MODE (a) != GET_MODE (b))
+ return 0;
+ return fixed_identical (CONST_FIXED_VALUE (a), CONST_FIXED_VALUE (b));
+}
+
/* Returns a hash code for X (which is a really a mem_attrs *). */
static hashval_t
@@ -452,6 +486,34 @@ const_double_from_real_value (REAL_VALUE_TYPE value, enum machine_mode mode)
return lookup_const_double (real);
}
+/* Determine whether FIXED, a CONST_FIXED, already exists in the
+ hash table. If so, return its counterpart; otherwise add it
+ to the hash table and return it. */
+
+static rtx
+lookup_const_fixed (rtx fixed)
+{
+ void **slot = htab_find_slot (const_fixed_htab, fixed, INSERT);
+ if (*slot == 0)
+ *slot = fixed;
+
+ return (rtx) *slot;
+}
+
+/* Return a CONST_FIXED rtx for a fixed-point value specified by
+ VALUE in mode MODE. */
+
+rtx
+const_fixed_from_fixed_value (FIXED_VALUE_TYPE value, enum machine_mode mode)
+{
+ rtx fixed = rtx_alloc (CONST_FIXED);
+ PUT_MODE (fixed, mode);
+
+ fixed->u.fv = value;
+
+ return lookup_const_fixed (fixed);
+}
+
/* Return a CONST_DOUBLE or CONST_INT for a value specified as a pair
of ints: I0 is the low-order word and I1 is the high-order word.
Do not use this routine for non-integer modes; convert to
@@ -2224,6 +2286,7 @@ verify_rtx_sharing (rtx orig, rtx insn)
case REG:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case LABEL_REF:
@@ -2423,6 +2486,7 @@ repeat:
case REG:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case LABEL_REF:
@@ -2540,6 +2604,7 @@ repeat:
case REG:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case CODE_LABEL:
@@ -2609,6 +2674,7 @@ set_used_flags (rtx x)
case REG:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case CODE_LABEL:
@@ -2799,103 +2865,169 @@ get_max_uid (void)
/* Return the next insn. If it is a SEQUENCE, return the first insn
of the sequence. */
+#define NEXT_INSN_BODY do { \
+ if (insn) \
+ { \
+ insn = NEXT_INSN (insn); \
+ if (insn && NONJUMP_INSN_P (insn) \
+ && GET_CODE (PATTERN (insn)) == SEQUENCE) \
+ insn = XVECEXP (PATTERN (insn), 0, 0); \
+ } \
+ return insn; \
+} while (0)
+
rtx
next_insn (rtx insn)
{
- if (insn)
- {
- insn = NEXT_INSN (insn);
- if (insn && NONJUMP_INSN_P (insn)
- && GET_CODE (PATTERN (insn)) == SEQUENCE)
- insn = XVECEXP (PATTERN (insn), 0, 0);
- }
+ NEXT_INSN_BODY;
+}
- return insn;
+const_rtx
+const_next_insn (const_rtx insn)
+{
+ NEXT_INSN_BODY;
}
+#undef NEXT_INSN_BODY
+
/* Return the previous insn. If it is a SEQUENCE, return the last insn
of the sequence. */
+#define PREVIOUS_INSN_BODY do { \
+ if (insn) \
+ { \
+ insn = PREV_INSN (insn); \
+ if (insn && NONJUMP_INSN_P (insn) \
+ && GET_CODE (PATTERN (insn)) == SEQUENCE) \
+ insn = XVECEXP (PATTERN (insn), 0, XVECLEN (PATTERN (insn), 0) - 1); \
+ } \
+ return insn; \
+} while (0)
+
rtx
previous_insn (rtx insn)
{
- if (insn)
- {
- insn = PREV_INSN (insn);
- if (insn && NONJUMP_INSN_P (insn)
- && GET_CODE (PATTERN (insn)) == SEQUENCE)
- insn = XVECEXP (PATTERN (insn), 0, XVECLEN (PATTERN (insn), 0) - 1);
- }
+ PREVIOUS_INSN_BODY;
+}
- return insn;
+const_rtx
+const_previous_insn (const_rtx insn)
+{
+ PREVIOUS_INSN_BODY;
}
+#undef PREVIOUS_INSN_BODY
+
/* Return the next insn after INSN that is not a NOTE. This routine does not
look inside SEQUENCEs. */
+#define NEXT_NONNOTE_INSN_BODY do { \
+ while (insn) \
+ { \
+ insn = NEXT_INSN (insn); \
+ if (insn == 0 || !NOTE_P (insn)) \
+ break; \
+ } \
+ return insn; \
+} while (0)
+
rtx
next_nonnote_insn (rtx insn)
{
- while (insn)
- {
- insn = NEXT_INSN (insn);
- if (insn == 0 || !NOTE_P (insn))
- break;
- }
+ NEXT_NONNOTE_INSN_BODY;
+}
- return insn;
+const_rtx
+const_next_nonnote_insn (const_rtx insn)
+{
+ NEXT_NONNOTE_INSN_BODY;
}
+#undef NEXT_NONNOTE_INSN_BODY
+
/* Return the previous insn before INSN that is not a NOTE. This routine does
not look inside SEQUENCEs. */
+#define PREV_NONNOTE_INSN_BODY do { \
+ while (insn) \
+ { \
+ insn = PREV_INSN (insn); \
+ if (insn == 0 || !NOTE_P (insn)) \
+ break; \
+ } \
+ return insn; \
+} while (0)
+
rtx
prev_nonnote_insn (rtx insn)
{
- while (insn)
- {
- insn = PREV_INSN (insn);
- if (insn == 0 || !NOTE_P (insn))
- break;
- }
+ PREV_NONNOTE_INSN_BODY;
+}
- return insn;
+const_rtx
+const_prev_nonnote_insn (const_rtx insn)
+{
+ PREV_NONNOTE_INSN_BODY;
}
+#undef PREV_NONNOTE_INSN_BODY
+
/* Return the next INSN, CALL_INSN or JUMP_INSN after INSN;
or 0, if there is none. This routine does not look inside
SEQUENCEs. */
+#define NEXT_REAL_INSN_BODY do { \
+ while (insn) \
+ { \
+ insn = NEXT_INSN (insn); \
+ if (insn == 0 || INSN_P (insn)) \
+ break; \
+ } \
+ return insn; \
+} while (0)
+
rtx
next_real_insn (rtx insn)
{
- while (insn)
- {
- insn = NEXT_INSN (insn);
- if (insn == 0 || INSN_P (insn))
- break;
- }
+ NEXT_REAL_INSN_BODY;
+}
- return insn;
+const_rtx
+const_next_real_insn (const_rtx insn)
+{
+ NEXT_REAL_INSN_BODY;
}
+#undef NEXT_REAL_INSN_BODY
+
/* Return the last INSN, CALL_INSN or JUMP_INSN before INSN;
or 0, if there is none. This routine does not look inside
SEQUENCEs. */
+#define PREV_REAL_INSN_BODY do { \
+ while (insn) \
+ { \
+ insn = PREV_INSN (insn); \
+ if (insn == 0 || INSN_P (insn)) \
+ break; \
+ } \
+ return insn; \
+} while (0)
+
rtx
prev_real_insn (rtx insn)
{
- while (insn)
- {
- insn = PREV_INSN (insn);
- if (insn == 0 || INSN_P (insn))
- break;
- }
+ PREV_REAL_INSN_BODY;
+}
- return insn;
+const_rtx
+const_prev_real_insn (const_rtx insn)
+{
+ PREV_REAL_INSN_BODY;
}
+#undef PREV_REAL_INSN_BODY
+
/* Return the last CALL_INSN in the current list, or 0 if there is none.
This routine does not look inside SEQUENCEs. */
@@ -2926,66 +3058,110 @@ active_insn_p (const_rtx insn)
&& GET_CODE (PATTERN (insn)) != CLOBBER))));
}
+#define NEXT_ACTIVE_INSN_BODY do { \
+ while (insn) \
+ { \
+ insn = NEXT_INSN (insn); \
+ if (insn == 0 || active_insn_p (insn)) \
+ break; \
+ } \
+ return insn;\
+} while (0)
+
rtx
next_active_insn (rtx insn)
{
- while (insn)
- {
- insn = NEXT_INSN (insn);
- if (insn == 0 || active_insn_p (insn))
- break;
- }
+ NEXT_ACTIVE_INSN_BODY;
+}
- return insn;
+const_rtx
+const_next_active_insn (const_rtx insn)
+{
+ NEXT_ACTIVE_INSN_BODY;
}
+#undef NEXT_ACTIVE_INSN_BODY
+
/* Find the last insn before INSN that really does something. This routine
does not look inside SEQUENCEs. Until reload has completed, this is the
same as prev_real_insn. */
+#define PREV_ACTIVE_INSN_BODY do { \
+ while (insn) \
+ { \
+ insn = PREV_INSN (insn);\
+ if (insn == 0 || active_insn_p (insn)) \
+ break; \
+ } \
+ return insn; \
+} while (0)
+
rtx
prev_active_insn (rtx insn)
{
- while (insn)
- {
- insn = PREV_INSN (insn);
- if (insn == 0 || active_insn_p (insn))
- break;
- }
+ PREV_ACTIVE_INSN_BODY;
+}
- return insn;
+const_rtx
+const_prev_active_insn (const_rtx insn)
+{
+ PREV_ACTIVE_INSN_BODY;
}
+#undef PREV_ACTIVE_INSN_BODY
+
/* Return the next CODE_LABEL after the insn INSN, or 0 if there is none. */
+#define NEXT_LABEL_BODY do { \
+ while (insn) \
+ { \
+ insn = NEXT_INSN (insn); \
+ if (insn == 0 || LABEL_P (insn)) \
+ break; \
+ } \
+ return insn; \
+} while (0)
+
rtx
next_label (rtx insn)
{
- while (insn)
- {
- insn = NEXT_INSN (insn);
- if (insn == 0 || LABEL_P (insn))
- break;
- }
+ NEXT_LABEL_BODY;
+}
- return insn;
+const_rtx
+const_next_label (const_rtx insn)
+{
+ NEXT_LABEL_BODY;
}
+#undef NEXT_LABEL_BODY
+
/* Return the last CODE_LABEL before the insn INSN, or 0 if there is none. */
+#define PREV_LABEL_BODY do { \
+ while (insn) \
+ { \
+ insn = PREV_INSN (insn); \
+ if (insn == 0 || LABEL_P (insn)) \
+ break; \
+ } \
+ return insn; \
+} while (0)
+
rtx
prev_label (rtx insn)
{
- while (insn)
- {
- insn = PREV_INSN (insn);
- if (insn == 0 || LABEL_P (insn))
- break;
- }
+ PREV_LABEL_BODY;
+}
- return insn;
+const_rtx
+const_prev_label (const_rtx insn)
+{
+ PREV_LABEL_BODY;
}
+#undef PREV_LABEL_BODY
+
/* Return the last label to mark the same position as LABEL. Return null
if LABEL itself is null. */
@@ -4838,6 +5014,7 @@ copy_insn_1 (rtx orig)
case REG:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case CODE_LABEL:
@@ -5083,6 +5260,74 @@ gen_rtx_CONST_VECTOR (enum machine_mode mode, rtvec v)
return gen_rtx_raw_CONST_VECTOR (mode, v);
}
+/* Initialise global register information required by all functions. */
+
+void
+init_emit_regs (void)
+{
+ int i;
+
+ /* Reset register attributes */
+ htab_empty (reg_attrs_htab);
+
+ /* We need reg_raw_mode, so initialize the modes now. */
+ init_reg_modes_target ();
+
+ /* Assign register numbers to the globally defined register rtx. */
+ pc_rtx = gen_rtx_PC (VOIDmode);
+ cc0_rtx = gen_rtx_CC0 (VOIDmode);
+ stack_pointer_rtx = gen_raw_REG (Pmode, STACK_POINTER_REGNUM);
+ frame_pointer_rtx = gen_raw_REG (Pmode, FRAME_POINTER_REGNUM);
+ hard_frame_pointer_rtx = gen_raw_REG (Pmode, HARD_FRAME_POINTER_REGNUM);
+ arg_pointer_rtx = gen_raw_REG (Pmode, ARG_POINTER_REGNUM);
+ virtual_incoming_args_rtx =
+ gen_raw_REG (Pmode, VIRTUAL_INCOMING_ARGS_REGNUM);
+ virtual_stack_vars_rtx =
+ gen_raw_REG (Pmode, VIRTUAL_STACK_VARS_REGNUM);
+ virtual_stack_dynamic_rtx =
+ gen_raw_REG (Pmode, VIRTUAL_STACK_DYNAMIC_REGNUM);
+ virtual_outgoing_args_rtx =
+ gen_raw_REG (Pmode, VIRTUAL_OUTGOING_ARGS_REGNUM);
+ virtual_cfa_rtx = gen_raw_REG (Pmode, VIRTUAL_CFA_REGNUM);
+
+ /* Initialize RTL for commonly used hard registers. These are
+ copied into regno_reg_rtx as we begin to compile each function. */
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ static_regno_reg_rtx[i] = gen_raw_REG (reg_raw_mode[i], i);
+
+#ifdef RETURN_ADDRESS_POINTER_REGNUM
+ return_address_pointer_rtx
+ = gen_raw_REG (Pmode, RETURN_ADDRESS_POINTER_REGNUM);
+#endif
+
+#ifdef STATIC_CHAIN_REGNUM
+ static_chain_rtx = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM);
+
+#ifdef STATIC_CHAIN_INCOMING_REGNUM
+ if (STATIC_CHAIN_INCOMING_REGNUM != STATIC_CHAIN_REGNUM)
+ static_chain_incoming_rtx
+ = gen_rtx_REG (Pmode, STATIC_CHAIN_INCOMING_REGNUM);
+ else
+#endif
+ static_chain_incoming_rtx = static_chain_rtx;
+#endif
+
+#ifdef STATIC_CHAIN
+ static_chain_rtx = STATIC_CHAIN;
+
+#ifdef STATIC_CHAIN_INCOMING
+ static_chain_incoming_rtx = STATIC_CHAIN_INCOMING;
+#else
+ static_chain_incoming_rtx = static_chain_rtx;
+#endif
+#endif
+
+ if ((unsigned) PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM)
+ pic_offset_table_rtx = gen_raw_REG (Pmode, PIC_OFFSET_TABLE_REGNUM);
+ else
+ pic_offset_table_rtx = NULL_RTX;
+}
+
/* Create some permanent unique rtl objects shared between all functions.
LINE_NUMBERS is nonzero if line numbers are to be generated. */
@@ -5093,17 +5338,17 @@ init_emit_once (int line_numbers)
enum machine_mode mode;
enum machine_mode double_mode;
- /* We need reg_raw_mode, so initialize the modes now. */
- init_reg_modes_once ();
-
- /* Initialize the CONST_INT, CONST_DOUBLE, and memory attribute hash
- tables. */
+ /* Initialize the CONST_INT, CONST_DOUBLE, CONST_FIXED, and memory attribute
+ hash tables. */
const_int_htab = htab_create_ggc (37, const_int_htab_hash,
const_int_htab_eq, NULL);
const_double_htab = htab_create_ggc (37, const_double_htab_hash,
const_double_htab_eq, NULL);
+ const_fixed_htab = htab_create_ggc (37, const_fixed_htab_hash,
+ const_fixed_htab_eq, NULL);
+
mem_attrs_htab = htab_create_ggc (37, mem_attrs_htab_hash,
mem_attrs_htab_eq, NULL);
reg_attrs_htab = htab_create_ggc (37, reg_attrs_htab_hash,
@@ -5141,34 +5386,6 @@ init_emit_once (int line_numbers)
ptr_mode = mode_for_size (POINTER_SIZE, GET_MODE_CLASS (Pmode), 0);
- /* Assign register numbers to the globally defined register rtx.
- This must be done at runtime because the register number field
- is in a union and some compilers can't initialize unions. */
-
- pc_rtx = gen_rtx_PC (VOIDmode);
- cc0_rtx = gen_rtx_CC0 (VOIDmode);
- stack_pointer_rtx = gen_raw_REG (Pmode, STACK_POINTER_REGNUM);
- frame_pointer_rtx = gen_raw_REG (Pmode, FRAME_POINTER_REGNUM);
- if (hard_frame_pointer_rtx == 0)
- hard_frame_pointer_rtx = gen_raw_REG (Pmode,
- HARD_FRAME_POINTER_REGNUM);
- if (arg_pointer_rtx == 0)
- arg_pointer_rtx = gen_raw_REG (Pmode, ARG_POINTER_REGNUM);
- virtual_incoming_args_rtx =
- gen_raw_REG (Pmode, VIRTUAL_INCOMING_ARGS_REGNUM);
- virtual_stack_vars_rtx =
- gen_raw_REG (Pmode, VIRTUAL_STACK_VARS_REGNUM);
- virtual_stack_dynamic_rtx =
- gen_raw_REG (Pmode, VIRTUAL_STACK_DYNAMIC_REGNUM);
- virtual_outgoing_args_rtx =
- gen_raw_REG (Pmode, VIRTUAL_OUTGOING_ARGS_REGNUM);
- virtual_cfa_rtx = gen_raw_REG (Pmode, VIRTUAL_CFA_REGNUM);
-
- /* Initialize RTL for commonly used hard registers. These are
- copied into regno_reg_rtx as we begin to compile each function. */
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- static_regno_reg_rtx[i] = gen_raw_REG (reg_raw_mode[i], i);
-
#ifdef INIT_EXPANDERS
/* This is to initialize {init|mark|free}_machine_status before the first
call to push_function_context_to. This is needed by the Chill front
@@ -5280,6 +5497,8 @@ init_emit_once (int line_numbers)
FCONST0(mode).data.high = 0;
FCONST0(mode).data.low = 0;
FCONST0(mode).mode = mode;
+ const_tiny_rtx[0][(int) mode] = CONST_FIXED_FROM_FIXED_VALUE (
+ FCONST0 (mode), mode);
}
for (mode = GET_CLASS_NARROWEST_MODE (MODE_UFRACT);
@@ -5289,6 +5508,8 @@ init_emit_once (int line_numbers)
FCONST0(mode).data.high = 0;
FCONST0(mode).data.low = 0;
FCONST0(mode).mode = mode;
+ const_tiny_rtx[0][(int) mode] = CONST_FIXED_FROM_FIXED_VALUE (
+ FCONST0 (mode), mode);
}
for (mode = GET_CLASS_NARROWEST_MODE (MODE_ACCUM);
@@ -5298,6 +5519,8 @@ init_emit_once (int line_numbers)
FCONST0(mode).data.high = 0;
FCONST0(mode).data.low = 0;
FCONST0(mode).mode = mode;
+ const_tiny_rtx[0][(int) mode] = CONST_FIXED_FROM_FIXED_VALUE (
+ FCONST0 (mode), mode);
/* We store the value 1. */
FCONST1(mode).data.high = 0;
@@ -5308,6 +5531,8 @@ init_emit_once (int line_numbers)
&FCONST1(mode).data.low,
&FCONST1(mode).data.high,
SIGNED_FIXED_POINT_MODE_P (mode));
+ const_tiny_rtx[1][(int) mode] = CONST_FIXED_FROM_FIXED_VALUE (
+ FCONST1 (mode), mode);
}
for (mode = GET_CLASS_NARROWEST_MODE (MODE_UACCUM);
@@ -5317,6 +5542,8 @@ init_emit_once (int line_numbers)
FCONST0(mode).data.high = 0;
FCONST0(mode).data.low = 0;
FCONST0(mode).mode = mode;
+ const_tiny_rtx[0][(int) mode] = CONST_FIXED_FROM_FIXED_VALUE (
+ FCONST0 (mode), mode);
/* We store the value 1. */
FCONST1(mode).data.high = 0;
@@ -5327,6 +5554,38 @@ init_emit_once (int line_numbers)
&FCONST1(mode).data.low,
&FCONST1(mode).data.high,
SIGNED_FIXED_POINT_MODE_P (mode));
+ const_tiny_rtx[1][(int) mode] = CONST_FIXED_FROM_FIXED_VALUE (
+ FCONST1 (mode), mode);
+ }
+
+ for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FRACT);
+ mode != VOIDmode;
+ mode = GET_MODE_WIDER_MODE (mode))
+ {
+ const_tiny_rtx[0][(int) mode] = gen_const_vector (mode, 0);
+ }
+
+ for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_UFRACT);
+ mode != VOIDmode;
+ mode = GET_MODE_WIDER_MODE (mode))
+ {
+ const_tiny_rtx[0][(int) mode] = gen_const_vector (mode, 0);
+ }
+
+ for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_ACCUM);
+ mode != VOIDmode;
+ mode = GET_MODE_WIDER_MODE (mode))
+ {
+ const_tiny_rtx[0][(int) mode] = gen_const_vector (mode, 0);
+ const_tiny_rtx[1][(int) mode] = gen_const_vector (mode, 1);
+ }
+
+ for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_UACCUM);
+ mode != VOIDmode;
+ mode = GET_MODE_WIDER_MODE (mode))
+ {
+ const_tiny_rtx[0][(int) mode] = gen_const_vector (mode, 0);
+ const_tiny_rtx[1][(int) mode] = gen_const_vector (mode, 1);
}
for (i = (int) CCmode; i < (int) MAX_MACHINE_MODE; ++i)
@@ -5336,36 +5595,6 @@ init_emit_once (int line_numbers)
const_tiny_rtx[0][(int) BImode] = const0_rtx;
if (STORE_FLAG_VALUE == 1)
const_tiny_rtx[1][(int) BImode] = const1_rtx;
-
-#ifdef RETURN_ADDRESS_POINTER_REGNUM
- return_address_pointer_rtx
- = gen_raw_REG (Pmode, RETURN_ADDRESS_POINTER_REGNUM);
-#endif
-
-#ifdef STATIC_CHAIN_REGNUM
- static_chain_rtx = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM);
-
-#ifdef STATIC_CHAIN_INCOMING_REGNUM
- if (STATIC_CHAIN_INCOMING_REGNUM != STATIC_CHAIN_REGNUM)
- static_chain_incoming_rtx
- = gen_rtx_REG (Pmode, STATIC_CHAIN_INCOMING_REGNUM);
- else
-#endif
- static_chain_incoming_rtx = static_chain_rtx;
-#endif
-
-#ifdef STATIC_CHAIN
- static_chain_rtx = STATIC_CHAIN;
-
-#ifdef STATIC_CHAIN_INCOMING
- static_chain_incoming_rtx = STATIC_CHAIN_INCOMING;
-#else
- static_chain_incoming_rtx = static_chain_rtx;
-#endif
-#endif
-
- if ((unsigned) PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM)
- pic_offset_table_rtx = gen_raw_REG (Pmode, PIC_OFFSET_TABLE_REGNUM);
}
/* Produce exact duplicate of insn INSN after AFTER.
diff --git a/gcc/except.h b/gcc/except.h
index b3b95b14962..3fb33809d85 100644
--- a/gcc/except.h
+++ b/gcc/except.h
@@ -112,8 +112,8 @@ extern int eh_region_outermost (struct function *, int, int);
/* tree-eh.c */
extern void add_stmt_to_eh_region_fn (struct function *, tree, int);
extern bool remove_stmt_from_eh_region_fn (struct function *, tree);
-extern int lookup_stmt_eh_region_fn (struct function *, tree);
-extern int lookup_stmt_eh_region (tree);
+extern int lookup_stmt_eh_region_fn (struct function *, const_tree);
+extern int lookup_stmt_eh_region (const_tree);
extern bool verify_eh_edges (tree);
/* If non-NULL, this is a function that returns an expression to be
diff --git a/gcc/explow.c b/gcc/explow.c
index 636dcb98a27..c669e3f1758 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -778,10 +778,10 @@ copy_to_suggested_reg (rtx x, rtx target, enum machine_mode mode)
#endif
enum machine_mode
-promote_mode (tree type, enum machine_mode mode, int *punsignedp,
+promote_mode (const_tree type, enum machine_mode mode, int *punsignedp,
int for_call ATTRIBUTE_UNUSED)
{
- enum tree_code code = TREE_CODE (type);
+ const enum tree_code code = TREE_CODE (type);
int unsignedp = *punsignedp;
#ifndef PROMOTE_MODE
@@ -1476,7 +1476,7 @@ probe_stack_range (HOST_WIDE_INT first, rtx size)
and 0 otherwise. */
rtx
-hard_function_value (tree valtype, tree func, tree fntype,
+hard_function_value (const_tree valtype, const_tree func, const_tree fntype,
int outgoing ATTRIBUTE_UNUSED)
{
rtx val;
diff --git a/gcc/expr.c b/gcc/expr.c
index dc6615abac0..9f321c80ad9 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -186,8 +186,15 @@ static bool float_extend_from_mem[NUM_MACHINE_MODES][NUM_MACHINE_MODES];
#endif
/* This macro is used to determine whether store_by_pieces should be
- called to "memset" storage with byte values other than zero, or
- to "memcpy" storage when the source is a constant string. */
+ called to "memset" storage with byte values other than zero. */
+#ifndef SET_BY_PIECES_P
+#define SET_BY_PIECES_P(SIZE, ALIGN) \
+ (move_by_pieces_ninsns (SIZE, ALIGN, STORE_MAX_PIECES + 1) \
+ < (unsigned int) SET_RATIO)
+#endif
+
+/* This macro is used to determine whether store_by_pieces should be
+ called to "memcpy" storage when the source is a constant string. */
#ifndef STORE_BY_PIECES_P
#define STORE_BY_PIECES_P(SIZE, ALIGN) \
(move_by_pieces_ninsns (SIZE, ALIGN, STORE_MAX_PIECES + 1) \
@@ -236,11 +243,12 @@ enum insn_code sync_lock_release[NUM_MACHINE_MODES];
#define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) STRICT_ALIGNMENT
#endif
-/* This is run once per compilation to set up which modes can be used
- directly in memory and to initialize the block move optab. */
+/* This is run to set up which modes can be used
+ directly in memory and to initialize the block move optab. It is run
+ at the beginning of compilation and when the target is reinitialized. */
void
-init_expr_once (void)
+init_expr_target (void)
{
rtx insn, pat;
enum machine_mode mode;
@@ -2191,13 +2199,14 @@ use_group_regs (rtx *call_fusage, rtx regs)
/* Determine whether the LEN bytes generated by CONSTFUN can be
stored to memory using several move instructions. CONSTFUNDATA is
a pointer which will be passed as argument in every CONSTFUN call.
- ALIGN is maximum alignment we can assume. Return nonzero if a
- call to store_by_pieces should succeed. */
+ ALIGN is maximum alignment we can assume. MEMSETP is true if this is
+ a memset operation and false if it's a copy of a constant string.
+ Return nonzero if a call to store_by_pieces should succeed. */
int
can_store_by_pieces (unsigned HOST_WIDE_INT len,
rtx (*constfun) (void *, HOST_WIDE_INT, enum machine_mode),
- void *constfundata, unsigned int align)
+ void *constfundata, unsigned int align, bool memsetp)
{
unsigned HOST_WIDE_INT l;
unsigned int max_size;
@@ -2210,7 +2219,9 @@ can_store_by_pieces (unsigned HOST_WIDE_INT len,
if (len == 0)
return 1;
- if (! STORE_BY_PIECES_P (len, align))
+ if (! (memsetp
+ ? SET_BY_PIECES_P (len, align)
+ : STORE_BY_PIECES_P (len, align)))
return 0;
tmode = mode_for_size (STORE_MAX_PIECES * BITS_PER_UNIT, MODE_INT, 1);
@@ -2285,7 +2296,8 @@ can_store_by_pieces (unsigned HOST_WIDE_INT len,
/* Generate several move instructions to store LEN bytes generated by
CONSTFUN to block TO. (A MEM rtx with BLKmode). CONSTFUNDATA is a
pointer which will be passed as argument in every CONSTFUN call.
- ALIGN is maximum alignment we can assume.
+ ALIGN is maximum alignment we can assume. MEMSETP is true if this is
+ a memset operation and false if it's a copy of a constant string.
If ENDP is 0 return to, if ENDP is 1 return memory at the end ala
mempcpy, and if ENDP is 2 return memory the end minus one byte ala
stpcpy. */
@@ -2293,7 +2305,7 @@ can_store_by_pieces (unsigned HOST_WIDE_INT len,
rtx
store_by_pieces (rtx to, unsigned HOST_WIDE_INT len,
rtx (*constfun) (void *, HOST_WIDE_INT, enum machine_mode),
- void *constfundata, unsigned int align, int endp)
+ void *constfundata, unsigned int align, bool memsetp, int endp)
{
struct store_by_pieces data;
@@ -2303,7 +2315,9 @@ store_by_pieces (rtx to, unsigned HOST_WIDE_INT len,
return to;
}
- gcc_assert (STORE_BY_PIECES_P (len, align));
+ gcc_assert (memsetp
+ ? SET_BY_PIECES_P (len, align)
+ : STORE_BY_PIECES_P (len, align));
data.constfun = constfun;
data.constfundata = constfundata;
data.len = len;
@@ -4472,10 +4486,52 @@ store_expr (tree exp, rtx target, int call_param_p, bool nontemporal)
return NULL_RTX;
}
+ else if (TREE_CODE (exp) == STRING_CST
+ && !nontemporal && !call_param_p
+ && TREE_STRING_LENGTH (exp) > 0
+ && TYPE_MODE (TREE_TYPE (exp)) == BLKmode)
+ {
+ /* Optimize initialization of an array with a STRING_CST. */
+ HOST_WIDE_INT exp_len, str_copy_len;
+ rtx dest_mem;
+
+ exp_len = int_expr_size (exp);
+ if (exp_len <= 0)
+ goto normal_expr;
+
+ str_copy_len = strlen (TREE_STRING_POINTER (exp));
+ if (str_copy_len < TREE_STRING_LENGTH (exp) - 1)
+ goto normal_expr;
+
+ str_copy_len = TREE_STRING_LENGTH (exp);
+ if ((STORE_MAX_PIECES & (STORE_MAX_PIECES - 1)) == 0)
+ {
+ str_copy_len += STORE_MAX_PIECES - 1;
+ str_copy_len &= ~(STORE_MAX_PIECES - 1);
+ }
+ str_copy_len = MIN (str_copy_len, exp_len);
+ if (!can_store_by_pieces (str_copy_len, builtin_strncpy_read_str,
+ (void *) TREE_STRING_POINTER (exp),
+ MEM_ALIGN (target), false))
+ goto normal_expr;
+
+ dest_mem = target;
+
+ dest_mem = store_by_pieces (dest_mem,
+ str_copy_len, builtin_strncpy_read_str,
+ (void *) TREE_STRING_POINTER (exp),
+ MEM_ALIGN (target), false,
+ exp_len > str_copy_len ? 1 : 0);
+ if (exp_len > str_copy_len)
+ clear_storage (dest_mem, GEN_INT (exp_len - str_copy_len),
+ BLOCK_OP_NORMAL);
+ return NULL_RTX;
+ }
else
{
rtx tmp_target;
+ normal_expr:
/* If we want to use a nontemporal store, force the value to
register first. */
tmp_target = nontemporal ? NULL_RTX : target;
@@ -5782,7 +5838,6 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
enum machine_mode mode = VOIDmode;
tree offset = size_zero_node;
tree bit_offset = bitsize_zero_node;
- tree tem;
/* First get the mode, signedness, and size. We do this from just the
outermost expression. */
@@ -5825,6 +5880,8 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
*pbitsize = tree_low_cst (size_tree, 1);
}
+ *pmode = mode;
+
/* Compute cumulative bit-offset for nested component-refs and array-refs,
and find the ultimate containing object. */
while (1)
@@ -5909,18 +5966,25 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
done:
/* If OFFSET is constant, see if we can return the whole thing as a
- constant bit position. Otherwise, split it up. */
- if (host_integerp (offset, 0)
- && 0 != (tem = size_binop (MULT_EXPR,
- fold_convert (bitsizetype, offset),
- bitsize_unit_node))
- && 0 != (tem = size_binop (PLUS_EXPR, tem, bit_offset))
- && host_integerp (tem, 0))
- *pbitpos = tree_low_cst (tem, 0), *poffset = 0;
- else
- *pbitpos = tree_low_cst (bit_offset, 0), *poffset = offset;
+ constant bit position. Make sure to handle overflow during
+ this conversion. */
+ if (host_integerp (offset, 0))
+ {
+ double_int tem = double_int_mul (tree_to_double_int (offset),
+ uhwi_to_double_int (BITS_PER_UNIT));
+ tem = double_int_add (tem, tree_to_double_int (bit_offset));
+ if (double_int_fits_in_shwi_p (tem))
+ {
+ *pbitpos = double_int_to_shwi (tem);
+ *poffset = NULL_TREE;
+ return exp;
+ }
+ }
+
+ /* Otherwise, split it up. */
+ *pbitpos = tree_low_cst (bit_offset, 0);
+ *poffset = offset;
- *pmode = mode;
return exp;
}
diff --git a/gcc/expr.h b/gcc/expr.h
index 2e75916f832..f9532eceb96 100644
--- a/gcc/expr.h
+++ b/gcc/expr.h
@@ -84,6 +84,13 @@ enum expand_modifier {EXPAND_NORMAL = 0, EXPAND_STACK_PARM, EXPAND_SUM,
#define CLEAR_RATIO (optimize_size ? 3 : 15)
#endif
#endif
+
+/* If a memory set (to value other than zero) operation would take
+ SET_RATIO or more simple move-instruction sequences, we will do a movmem
+ or libcall instead. */
+#ifndef SET_RATIO
+#define SET_RATIO MOVE_RATIO
+#endif
enum direction {none, upward, downward};
@@ -341,12 +348,13 @@ extern void expand_builtin_setjmp_setup (rtx, rtx);
extern void expand_builtin_setjmp_receiver (rtx);
extern rtx expand_builtin_saveregs (void);
extern void expand_builtin_trap (void);
+extern rtx builtin_strncpy_read_str (void *, HOST_WIDE_INT, enum machine_mode);
/* Functions from expr.c: */
-/* This is run once per compilation to set up which modes can be used
- directly in memory and to initialize the block move optab. */
-extern void init_expr_once (void);
+/* This is run during target initialization to set up which modes can be
+ used directly in memory and to initialize the block move optab. */
+extern void init_expr_target (void);
/* This is run at the start of compiling a function. */
extern void init_expr (void);
@@ -443,20 +451,23 @@ extern int can_move_by_pieces (unsigned HOST_WIDE_INT, unsigned int);
CONSTFUN with several move instructions by store_by_pieces
function. CONSTFUNDATA is a pointer which will be passed as argument
in every CONSTFUN call.
- ALIGN is maximum alignment we can assume. */
+ ALIGN is maximum alignment we can assume.
+ MEMSETP is true if this is a real memset/bzero, not a copy
+ of a const string. */
extern int can_store_by_pieces (unsigned HOST_WIDE_INT,
rtx (*) (void *, HOST_WIDE_INT,
enum machine_mode),
- void *, unsigned int);
+ void *, unsigned int, bool);
/* Generate several move instructions to store LEN bytes generated by
CONSTFUN to block TO. (A MEM rtx with BLKmode). CONSTFUNDATA is a
pointer which will be passed as argument in every CONSTFUN call.
ALIGN is maximum alignment we can assume.
+ MEMSETP is true if this is a real memset/bzero, not a copy.
Returns TO + LEN. */
extern rtx store_by_pieces (rtx, unsigned HOST_WIDE_INT,
rtx (*) (void *, HOST_WIDE_INT, enum machine_mode),
- void *, unsigned int, int);
+ void *, unsigned int, bool, int);
/* Emit insns to set X from Y. */
extern rtx emit_move_insn (rtx, rtx);
@@ -567,7 +578,7 @@ extern HOST_WIDE_INT int_expr_size (tree);
/* Return an rtx that refers to the value returned by a function
in its original home. This becomes invalid if any more code is emitted. */
-extern rtx hard_function_value (tree, tree, tree, int);
+extern rtx hard_function_value (const_tree, const_tree, const_tree, int);
extern rtx prepare_call_address (rtx, rtx, rtx *, int, int);
@@ -688,7 +699,7 @@ extern rtx force_reg (enum machine_mode, rtx);
extern rtx force_not_mem (rtx);
/* Return mode and signedness to use when object is promoted. */
-extern enum machine_mode promote_mode (tree, enum machine_mode, int *, int);
+extern enum machine_mode promote_mode (const_tree, enum machine_mode, int *, int);
/* Remove some bytes from the stack. An rtx says how many. */
extern void adjust_stack (rtx);
diff --git a/gcc/final.c b/gcc/final.c
index 008a773ca23..7c2b4ea9f08 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1523,7 +1523,9 @@ profile_function (FILE *file ATTRIBUTE_UNUSED)
#if defined(ASM_OUTPUT_REG_PUSH)
if (sval && svrtx != NULL_RTX && REG_P (svrtx))
- ASM_OUTPUT_REG_PUSH (file, REGNO (svrtx));
+ {
+ ASM_OUTPUT_REG_PUSH (file, REGNO (svrtx));
+ }
#endif
#if defined(STATIC_CHAIN_INCOMING_REGNUM) && defined(ASM_OUTPUT_REG_PUSH)
@@ -1554,7 +1556,9 @@ profile_function (FILE *file ATTRIBUTE_UNUSED)
#if defined(ASM_OUTPUT_REG_PUSH)
if (sval && svrtx != NULL_RTX && REG_P (svrtx))
- ASM_OUTPUT_REG_POP (file, REGNO (svrtx));
+ {
+ ASM_OUTPUT_REG_POP (file, REGNO (svrtx));
+ }
#endif
}
@@ -3373,6 +3377,10 @@ output_addr_const (FILE *file, rtx x)
output_operand_lossage ("floating constant misused");
break;
+ case CONST_FIXED:
+ fprintf (file, HOST_WIDE_INT_PRINT_HEX, CONST_FIXED_VALUE_LOW (x));
+ break;
+
case PLUS:
/* Some assemblers need integer constants to appear last (eg masm). */
if (GET_CODE (XEXP (x, 0)) == CONST_INT)
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 85e39038c8b..ecbb76776fd 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,217 @@
+2007-08-31 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/31879
+ PR fortran/31197
+ PR fortran/31258
+ PR fortran/32703
+ * gfortran.h : Add prototype for gfc_resolve_substring_charlen.
+ * resolve.c (gfc_resolve_substring_charlen): New function.
+ (resolve_ref): Call gfc_resolve_substring_charlen.
+ (gfc_resolve_character_operator): New function.
+ (gfc_resolve_expr): Call the new functions in cases where the
+ character length is missing.
+ * iresolve.c (cshift, eoshift, merge, pack, reshape, spread,
+ transpose, unpack): Call gfc_resolve_substring_charlen for
+ source expressions that are character and have a reference.
+ * trans.h (gfc_trans_init_string_length) Change name to
+ gfc_conv_string_length; modify references in trans-expr.c,
+ trans-array.c and trans-decl.c.
+ * trans-expr.c (gfc_trans_string_length): Handle case of no
+ backend_decl.
+ (gfc_conv_aliased_arg): Remove code for treating substrings
+ and replace with call to gfc_trans_string_length.
+ * trans-array.c (gfc_conv_expr_descriptor): Remove code for
+ treating strings and call gfc_trans_string_length instead.
+
+2007-08-30 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/33228
+ * interface.c (check_interface0): Improve error for external procs.
+ (check_sym_interfaces): Fix checking of module procedures.
+
+2007-08-29 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/32989
+ * iresolve.c (gfc_resolve_getarg): Handle non-default integer
+ kinds.
+ * check.c (gfc_check_getarg): New function
+ * intrinsic.h: Add prototype for gfc_check_getarg.
+ * intrinsic.c (add_subroutines): Add reference to gfc_check_getarg.
+ * intrinsic.texi (GETARG): Adjust documentation.
+
+2007-08-29 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+ Tobias Burnus <burnus@gcc.gnu.org>
+
+ PR fortran/33105
+ * intrinsic.c (add_functions): Add IS_IOSTAT_END and
+ IS_IOSTAT_EOR intrinsics.
+ * gfortran.h (gfc_isym_id): Add GFC_ISYM_IS_IOSTAT_END and
+ GFC_ISYM_IS_IOSTAT_EOR.
+ * trans-intrinsic.c (gfc_conv_has_intvalue): New function.
+ (gfc_conv_intrinsic_function): Call gfc_conv_has_intvalue for
+ GFC_ISYM_IS_IOSTAT_END and GFC_ISYM_IS_IOSTAT_EOR.
+ * intrinsic.texi: Add IS_IOSTAT_END and IS_IOSTAT_EOR.
+
+2007-08-28 Christopher D. Rickett <crickett@lanl.gov>
+
+ PR fortran/33215
+ * decl.c (build_sym): Pass number of identifiers on line to
+ set_binding_label.
+ (set_binding_label): Verify that only one identifier given if
+ NAME= specified, even if the given binding label has zero length.
+ (gfc_match_bind_c): Remove declaration for has_name_equals because
+ it hides the static global one that is needed.
+
+2007-08-29 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * trans-array.c (gfc_grow_array): Use gfc_call_realloc.
+ (gfc_array_allocate): Use gfc_allocate_with_status and
+ gfc_allocate_array_with_status.
+ (gfc_array_deallocate): Use gfc_deallocate_with_status.
+ (gfc_trans_dealloc_allocated): Use gfc_deallocate_with_status.
+ * trans-stmt.c (gfc_trans_allocate): Use gfc_allocate_with_status.
+ (gfc_trans_deallocate): Use gfc_deallocate_with_status.
+ * trans.c (gfc_allocate_with_status, gfc_allocate_array_with_status,
+ gfc_deallocate_with_status, gfc_call_realloc): New functions.
+ * trans.h (gfc_allocate_with_status, gfc_allocate_array_with_status,
+ gfc_deallocate_with_status, gfc_call_realloc): New prototypes.
+ (gfor_fndecl_internal_realloc, gfor_fndecl_allocate,
+ gfor_fndecl_allocate_array, gfor_fndecl_deallocate): Remove.
+ * f95-lang.c (gfc_init_builtin_functions): Create decl for
+ BUILT_IN_REALLOC.
+ * trans-decl.c (gfor_fndecl_internal_realloc,
+ gfor_fndecl_allocate, gfor_fndecl_allocate_array,
+ gfor_fndecl_deallocate): Remove function decls.
+ (gfc_build_builtin_function_decls): Likewise.
+
+2007-08-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/33055
+ Revert previous patch.
+
+2007-08-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/22244
+ * Make-lang.in (fortran/trans-types.o): Depend on $(FLAGS_H).
+ * trans-types.c: Include flags.h.
+ (gfc_get_nodesc_array_type): Add TYPE_DECL TYPE_NAME with
+ correct bounds and dimensions for packed arrays.
+
+2007-08-27 Tobias Burnus <burnus@net-b.de>
+
+ * simplify.c (gfc_simplify_lgamma): Fix mpfr_lgamma call.
+
+2007-08-26 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/33055
+ * trans-io.c (create_dummy_iostat): New function to create a unique
+ dummy variable expression to use with IOSTAT.
+ (gfc_trans_inquire): Use the new function to pass unit number error info
+ to run-time library if a regular IOSTAT variable was not given.
+
+2007-08-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gfortran.h (gfc_isym_id): Add GFC_ISYM_GAMMA and
+ GFC_ISYM_LGAMMA.
+
+2007-08-26 Asher Langton <langton2@llnl.gov>
+ Tobias Burnus <burnus@net-b.de>
+
+ * gfortran.h (gfc_option_t): Add flag_recursive.
+ * lang.opt: Add -frecursive option and update -fopenmp.
+ * invoke.texi (-frecursive): Document new option.
+ (-fopenmp,-fno-automatic,-fmax-stack-var-size): Update.
+ * options.c (gfc_init_options, gfc_post_options,
+ gfc_handle_option): Add -frecursive and modify -fopenmp.
+ (gfc_post_options): Add warning for conflicting flags.
+
+2007-08-26 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/31298
+ * module.c (mio_symbol_ref,mio_interface_rest): Return pointer_info.
+ (load_operator_interfaces): Support multible loading of an operator.
+
+2007-08-26 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/32985
+ * match.c (gfc_match_common): Remove SEQUENCE diagnostics.
+ * resolve.c (resolve_common_blocks): Add SEQUENCE diagnostics;
+ fix walking through the tree.
+
+2007-08-26 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/32980
+ * intrinsic.h (gfc_simplify_gamma,gfc_simplify_lgamma,
+ gfc_resolve_gamma,gfc_resolve_lgamma): New function declations.
+ * mathbuiltins.def: Define GAMMA and LGAMMA.
+ * intrinsic.c (add_functions): Add GAMMA, DGAMMA, LGAMMA, ALGAMA
+ and DLGAMA.
+ * simplify.c (gfc_simplify_gamma,gfc_simplify_lgamma): New functions.
+ * iresolve.c (gfc_resolve_gamma,gfc_resolve_lgamma): New functions.
+ * intrinsic.texi: Add documentation for GAMMA and LGAMMA.
+
+2007-08-26 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/33188
+ * parse.c (parse_derived): Support empty derived type
+ definitions for Fortran 2003.
+
+2007-08-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * trans-openmp.c (gfc_omp_privatize_by_reference): Constify.
+ * trans.h (gfc_omp_privatize_by_reference): Likewise.
+
+2007-08-24 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/33178
+ * intrinsic.c (gfc_intrinsic_func_interface): Fix initialization
+ expression check.
+
+2007-08-24 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/32972
+ * iresolve.c: Don't convert array masks.
+
+2007-08-24 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/33139
+ * trans-array.c (gfc_conv_expr_descriptor): Copy bounds for
+ whole-array pointer assignments.
+
+2007-08-23 Jakub Jelinek <jakub@redhat.com>
+
+ * decl.c (variable_decl): Don't share charlen structs if
+ length == NULL.
+ * trans-decl.c (create_function_arglist): Assert
+ f->sym->ts.cl->backend_decl is NULL instead of unsharing
+ charlen struct here.
+
+2007-08-23 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/33095
+ * trans-intrinsic.c (gfc_conv_intrinsic_minmax): Remove
+ runtime error checking.
+
+2007-08-22 Roger Sayle <roger@eyesopen.com>
+ Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
+
+ * match.c (intrinsic_operators): Delete.
+ (gfc_match_intrinsic_op): Rewrite matcher to avoid calling
+ gfc_match_strings.
+
+2007-08-22 Christopher D. Rickett <crickett@lanl.gov>
+
+ PR fortran/33020
+ * resolve.c (gfc_iso_c_sub_interface): Remove setting of type and
+ kind for optional SHAPE parameter of C_F_POINTER.
+
+2007-08-22 Janus Weil <jaydub66@gmail.com>
+
+ * decl.c (match_attr_spec): Pass on errors from gfc_match_bind_c.
+ (gfc_match_bind_c): Bugfix in check for NAME= with abstract interfaces.
+ (gfc_match_mopdproc): Bugfix to reject module procedures in
+ abstract interfaces.
+
2007-08-22 Kai Tietz <kai.tietz@onevision.com>
* f95-lang.c: (gfc_init_decl_processing): Choose sizetype by using
diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in
index 4a9590a2cae..30320a84810 100644
--- a/gcc/fortran/Make-lang.in
+++ b/gcc/fortran/Make-lang.in
@@ -311,7 +311,7 @@ fortran/trans-decl.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-decl.h \
$(CGRAPH_H) $(TARGET_H) $(FUNCTION_H) $(FLAGS_H) $(RTL_H) $(TREE_GIMPLE_H) \
$(TREE_DUMP_H)
fortran/trans-types.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-types.h \
- $(REAL_H) toplev.h $(TARGET_H)
+ $(REAL_H) toplev.h $(TARGET_H) $(FLAGS_H)
fortran/trans-const.o: $(GFORTRAN_TRANS_DEPS)
fortran/trans-expr.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
fortran/trans-stmt.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 634d6b4f05b..ed824feb6a5 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -3234,6 +3234,28 @@ gfc_check_getcwd_sub (gfc_expr *cwd, gfc_expr *status)
try
+gfc_check_getarg (gfc_expr *pos, gfc_expr *value)
+{
+ if (type_check (pos, 0, BT_INTEGER) == FAILURE)
+ return FAILURE;
+
+ if (pos->ts.kind > gfc_default_integer_kind)
+ {
+ gfc_error ("'%s' argument of '%s' intrinsic at %L must be of a kind "
+ "not wider than the default kind (%d)",
+ gfc_current_intrinsic_arg[0], gfc_current_intrinsic,
+ &pos->where, gfc_default_integer_kind);
+ return FAILURE;
+ }
+
+ if (type_check (value, 1, BT_CHARACTER) == FAILURE)
+ return FAILURE;
+
+ return SUCCESS;
+}
+
+
+try
gfc_check_getlog (gfc_expr *msg)
{
if (type_check (msg, 0, BT_CHARACTER) == FAILURE)
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index eb1e4236a3b..8b3566204c6 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -980,9 +980,10 @@ build_sym (const char *name, gfc_charlen *cl,
{
if (sym->binding_label[0] == '\0')
{
- /* Here, we're not checking the numIdents (the last param).
- This could be an error we're letting slip through! */
- if (set_binding_label (sym->binding_label, sym->name, 1) == FAILURE)
+ /* Set the binding label and verify that if a NAME= was specified
+ then only one identifier was in the entity-decl-list. */
+ if (set_binding_label (sym->binding_label, sym->name,
+ num_idents_on_line) == FAILURE)
return FAILURE;
}
}
@@ -1462,10 +1463,11 @@ variable_decl (int elem)
break;
/* Non-constant lengths need to be copied after the first
- element. */
+ element. Also copy assumed lengths. */
case MATCH_NO:
- if (elem > 1 && current_ts.cl->length
- && current_ts.cl->length->expr_type != EXPR_CONSTANT)
+ if (elem > 1
+ && (current_ts.cl->length == NULL
+ || current_ts.cl->length->expr_type != EXPR_CONSTANT))
{
cl = gfc_get_charlen ();
cl->next = gfc_current_ns->cl_list;
@@ -2549,8 +2551,11 @@ match_attr_spec (void)
/* Chomp the comma. */
peek_char = gfc_next_char ();
/* Try and match the bind(c). */
- if (gfc_match_bind_c (NULL) == MATCH_YES)
+ m = gfc_match_bind_c (NULL);
+ if (m == MATCH_YES)
d = DECL_IS_BIND_C;
+ else if (m == MATCH_ERROR)
+ goto cleanup;
}
}
@@ -2843,15 +2848,15 @@ cleanup:
try
set_binding_label (char *dest_label, const char *sym_name, int num_idents)
{
- if (curr_binding_label[0] != '\0')
+ if (num_idents > 1 && has_name_equals)
{
- if (num_idents > 1 || num_idents_on_line > 1)
- {
- gfc_error ("Multiple identifiers provided with "
- "single NAME= specifier at %C");
- return FAILURE;
- }
+ gfc_error ("Multiple identifiers provided with "
+ "single NAME= specifier at %C");
+ return FAILURE;
+ }
+ if (curr_binding_label[0] != '\0')
+ {
/* Binding label given; store in temp holder til have sym. */
strncpy (dest_label, curr_binding_label,
strlen (curr_binding_label) + 1);
@@ -4080,7 +4085,6 @@ gfc_match_bind_c (gfc_symbol *sym)
char binding_label[GFC_MAX_SYMBOL_LEN + 1];
match double_quote;
match single_quote;
- int has_name_equals = 0;
/* Initialize the flag that specifies whether we encountered a NAME=
specifier or not. */
@@ -4183,7 +4187,8 @@ gfc_match_bind_c (gfc_symbol *sym)
strncpy (sym->binding_label, sym->name, strlen (sym->name) + 1);
}
- if (has_name_equals && current_interface.type == INTERFACE_ABSTRACT)
+ if (has_name_equals && gfc_current_state () == COMP_INTERFACE
+ && current_interface.type == INTERFACE_ABSTRACT)
{
gfc_error ("NAME not allowed on BIND(C) for ABSTRACT INTERFACE at %C");
return MATCH_ERROR;
@@ -5327,7 +5332,8 @@ gfc_match_modproc (void)
if (gfc_state_stack->state != COMP_INTERFACE
|| gfc_state_stack->previous == NULL
- || current_interface.type == INTERFACE_NAMELESS)
+ || current_interface.type == INTERFACE_NAMELESS
+ || current_interface.type == INTERFACE_ABSTRACT)
{
gfc_error ("MODULE PROCEDURE at %C must be in a generic module "
"interface");
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index 1e1b640537e..05f6750218d 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -1036,6 +1036,12 @@ gfc_init_builtin_functions (void)
"malloc", false);
DECL_IS_MALLOC (built_in_decls[BUILT_IN_MALLOC]) = 1;
+ tmp = tree_cons (NULL_TREE, pvoid_type_node, void_list_node);
+ tmp = tree_cons (NULL_TREE, size_type_node, tmp);
+ ftype = build_function_type (pvoid_type_node, tmp);
+ gfc_define_builtin ("__builtin_realloc", ftype, BUILT_IN_REALLOC,
+ "realloc", false);
+
tmp = tree_cons (NULL_TREE, void_type_node, void_list_node);
ftype = build_function_type (integer_type_node, tmp);
gfc_define_builtin ("__builtin_isnan", ftype, BUILT_IN_ISNAN,
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 11d7adce8f7..5c8c56dd6ad 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -387,6 +387,7 @@ enum gfc_isym_id
GFC_ISYM_FSEEK,
GFC_ISYM_FSTAT,
GFC_ISYM_FTELL,
+ GFC_ISYM_GAMMA,
GFC_ISYM_GERROR,
GFC_ISYM_GETARG,
GFC_ISYM_GET_COMMAND,
@@ -418,6 +419,8 @@ enum gfc_isym_id
GFC_ISYM_IOR,
GFC_ISYM_IRAND,
GFC_ISYM_ISATTY,
+ GFC_ISYM_IS_IOSTAT_END,
+ GFC_ISYM_IS_IOSTAT_EOR,
GFC_ISYM_ISNAN,
GFC_ISYM_ISHFT,
GFC_ISYM_ISHFTC,
@@ -430,6 +433,7 @@ enum gfc_isym_id
GFC_ISYM_LBOUND,
GFC_ISYM_LEN,
GFC_ISYM_LEN_TRIM,
+ GFC_ISYM_LGAMMA,
GFC_ISYM_LGE,
GFC_ISYM_LGT,
GFC_ISYM_LINK,
@@ -1863,6 +1867,7 @@ typedef struct
int flag_openmp;
int flag_sign_zero;
int flag_module_private;
+ int flag_recursive;
int fpe;
@@ -2262,6 +2267,7 @@ try gfc_resolve_iterator (gfc_iterator *, bool);
try gfc_resolve_index (gfc_expr *, int);
try gfc_resolve_dim_arg (gfc_expr *);
int gfc_is_formal_arg (void);
+void gfc_resolve_substring_charlen (gfc_expr *);
match gfc_iso_c_sub_interface(gfc_code *, gfc_symbol *);
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 55cc641cf88..7bb5a25834f 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -988,9 +988,13 @@ check_interface0 (gfc_interface *p, const char *interface_name)
for (; p; p = p->next)
if (!p->sym->attr.function && !p->sym->attr.subroutine)
{
- gfc_error ("Procedure '%s' in %s at %L is neither function nor "
- "subroutine", p->sym->name, interface_name,
- &p->sym->declared_at);
+ if (p->sym->attr.external)
+ gfc_error ("Procedure '%s' in %s at %L has no explicit interface",
+ p->sym->name, interface_name, &p->sym->declared_at);
+ else
+ gfc_error ("Procedure '%s' in %s at %L is neither function nor "
+ "subroutine", p->sym->name, interface_name,
+ &p->sym->declared_at);
return 1;
}
p = psave;
@@ -1081,11 +1085,10 @@ check_sym_interfaces (gfc_symbol *sym)
for (p = sym->generic; p; p = p->next)
{
- if (!p->sym->attr.use_assoc && p->sym->attr.mod_proc
- && p->sym->attr.if_source != IFSRC_DECL)
+ if (p->sym->attr.mod_proc && p->sym->attr.if_source != IFSRC_DECL)
{
- gfc_error ("MODULE PROCEDURE '%s' at %L does not come "
- "from a module", p->sym->name, &p->where);
+ gfc_error ("'%s' at %L is not a module procedure",
+ p->sym->name, &p->where);
return;
}
}
diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c
index 3f999b4210c..0c5c1773332 100644
--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -1453,6 +1453,16 @@ add_functions (void)
make_generic ("fput", GFC_ISYM_FPUT, GFC_STD_GNU);
+ add_sym_1 ("gamma", GFC_ISYM_GAMMA, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_GNU,
+ gfc_check_fn_r, gfc_simplify_gamma, gfc_resolve_gamma,
+ x, BT_REAL, dr, REQUIRED);
+
+ add_sym_1 ("dgamma", GFC_ISYM_GAMMA, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_GNU,
+ gfc_check_fn_r, gfc_simplify_gamma, gfc_resolve_gamma,
+ x, BT_REAL, dr, REQUIRED);
+
+ make_generic ("gamma", GFC_ISYM_GAMMA, GFC_STD_GNU);
+
/* Unix IDs (g77 compatibility) */
add_sym_1 ("getcwd", GFC_ISYM_GETCWD, NO_CLASS, ACTUAL_NO, BT_INTEGER, di, GFC_STD_GNU,
NULL, NULL, gfc_resolve_getcwd,
@@ -1623,6 +1633,18 @@ add_functions (void)
make_generic ("isatty", GFC_ISYM_ISATTY, GFC_STD_GNU);
+ add_sym_1 ("is_iostat_end", GFC_ISYM_IS_IOSTAT_END,
+ CLASS_ELEMENTAL, ACTUAL_NO, BT_LOGICAL, dl, GFC_STD_F2003,
+ gfc_check_i, NULL, NULL, i, BT_INTEGER, 0, REQUIRED);
+
+ make_generic ("is_iostat_end", GFC_ISYM_IS_IOSTAT_END, GFC_STD_F2003);
+
+ add_sym_1 ("is_iostat_eor", GFC_ISYM_IS_IOSTAT_EOR,
+ CLASS_ELEMENTAL, ACTUAL_NO, BT_LOGICAL, dl, GFC_STD_F2003,
+ gfc_check_i, NULL, NULL, i, BT_INTEGER, 0, REQUIRED);
+
+ make_generic ("is_iostat_eor", GFC_ISYM_IS_IOSTAT_EOR, GFC_STD_F2003);
+
add_sym_1 ("isnan", GFC_ISYM_ISNAN, CLASS_ELEMENTAL, ACTUAL_NO, BT_LOGICAL,
dl, GFC_STD_GNU, gfc_check_isnan, NULL, NULL,
x, BT_REAL, 0, REQUIRED);
@@ -1690,6 +1712,21 @@ add_functions (void)
make_generic ("len_trim", GFC_ISYM_LEN_TRIM, GFC_STD_F95);
+ add_sym_1 ("lgamma", GFC_ISYM_LGAMMA, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_GNU,
+ gfc_check_fn_r, gfc_simplify_lgamma, gfc_resolve_lgamma,
+ x, BT_REAL, dr, REQUIRED);
+
+ add_sym_1 ("algama", GFC_ISYM_LGAMMA, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_GNU,
+ gfc_check_fn_r, gfc_simplify_lgamma, gfc_resolve_lgamma,
+ x, BT_REAL, dr, REQUIRED);
+
+ add_sym_1 ("dlgama", GFC_ISYM_LGAMMA, CLASS_ELEMENTAL, ACTUAL_NO, BT_REAL, dr, GFC_STD_GNU,
+ gfc_check_fn_r, gfc_simplify_lgamma, gfc_resolve_lgamma,
+ x, BT_REAL, dr, REQUIRED);
+
+ make_generic ("lgamma", GFC_ISYM_LGAMMA, GFC_STD_GNU);
+
+
add_sym_2 ("lge", GFC_ISYM_LGE, CLASS_ELEMENTAL, ACTUAL_NO, BT_LOGICAL, dl, GFC_STD_F77,
NULL, gfc_simplify_lge, NULL,
sta, BT_CHARACTER, dc, REQUIRED, stb, BT_CHARACTER, dc, REQUIRED);
@@ -2340,7 +2377,7 @@ add_subroutines (void)
*val = "value", *num = "number", *name = "name",
*trim_name = "trim_name", *ut = "unit", *han = "handler",
*sec = "seconds", *res = "result", *of = "offset", *md = "mode",
- *whence = "whence";
+ *whence = "whence", *pos = "pos";
int di, dr, dc, dl, ii;
@@ -2424,8 +2461,8 @@ add_subroutines (void)
REQUIRED);
add_sym_2s ("getarg", GFC_ISYM_GETARG, NO_CLASS, BT_UNKNOWN, 0, GFC_STD_GNU,
- NULL, NULL, gfc_resolve_getarg,
- c, BT_INTEGER, di, REQUIRED, vl, BT_CHARACTER, dc, REQUIRED);
+ gfc_check_getarg, NULL, gfc_resolve_getarg,
+ pos, BT_INTEGER, di, REQUIRED, val, BT_CHARACTER, dc, REQUIRED);
add_sym_1s ("getlog", GFC_ISYM_GETLOG, NO_CLASS, BT_UNKNOWN, 0, GFC_STD_GNU,
gfc_check_getlog, NULL, gfc_resolve_getlog, c, BT_CHARACTER,
@@ -3409,12 +3446,10 @@ got_specific:
(4) A reference to an elemental standard intrinsic function,
where each argument is an initialization expression */
- if (gfc_init_expr
- && isym->elemental
- && (expr->ts.type != BT_INTEGER || expr->ts.type != BT_CHARACTER)
- && gfc_notify_std (GFC_STD_F2003, "Extension: Evaluation of "
- "nonstandard initialization expression at %L",
- &expr->where) == FAILURE)
+ if (gfc_init_expr && isym->elemental && flag
+ && gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Elemental function "
+ "as initialization expression with non-integer/non-"
+ "character arguments at %L", &expr->where) == FAILURE)
return MATCH_ERROR;
return MATCH_YES;
diff --git a/gcc/fortran/intrinsic.h b/gcc/fortran/intrinsic.h
index cf242b8995d..1d2c6c1ab6b 100644
--- a/gcc/fortran/intrinsic.h
+++ b/gcc/fortran/intrinsic.h
@@ -154,6 +154,7 @@ try gfc_check_flush (gfc_expr *);
try gfc_check_free (gfc_expr *);
try gfc_check_fstat_sub (gfc_expr *, gfc_expr *, gfc_expr *);
try gfc_check_gerror (gfc_expr *);
+try gfc_check_getarg (gfc_expr *, gfc_expr *);
try gfc_check_getlog (gfc_expr *);
try gfc_check_move_alloc (gfc_expr *, gfc_expr *);
try gfc_check_mvbits (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *,
@@ -221,6 +222,7 @@ gfc_expr *gfc_simplify_exponent (gfc_expr *);
gfc_expr *gfc_simplify_float (gfc_expr *);
gfc_expr *gfc_simplify_floor (gfc_expr *, gfc_expr *);
gfc_expr *gfc_simplify_fraction (gfc_expr *);
+gfc_expr *gfc_simplify_gamma (gfc_expr *);
gfc_expr *gfc_simplify_huge (gfc_expr *);
gfc_expr *gfc_simplify_iachar (gfc_expr *, gfc_expr *);
gfc_expr *gfc_simplify_iand (gfc_expr *, gfc_expr *);
@@ -243,6 +245,7 @@ gfc_expr *gfc_simplify_kind (gfc_expr *);
gfc_expr *gfc_simplify_lbound (gfc_expr *, gfc_expr *, gfc_expr *);
gfc_expr *gfc_simplify_len (gfc_expr *, gfc_expr *);
gfc_expr *gfc_simplify_len_trim (gfc_expr *, gfc_expr *);
+gfc_expr *gfc_simplify_lgamma (gfc_expr *);
gfc_expr *gfc_simplify_lge (gfc_expr *, gfc_expr *);
gfc_expr *gfc_simplify_lgt (gfc_expr *, gfc_expr *);
gfc_expr *gfc_simplify_lle (gfc_expr *, gfc_expr *);
@@ -354,6 +357,7 @@ void gfc_resolve_fget (gfc_expr *, gfc_expr *);
void gfc_resolve_fputc (gfc_expr *, gfc_expr *, gfc_expr *);
void gfc_resolve_fput (gfc_expr *, gfc_expr *);
void gfc_resolve_g77_math1 (gfc_expr *, gfc_expr *);
+void gfc_resolve_gamma (gfc_expr *, gfc_expr *);
void gfc_resolve_getcwd (gfc_expr *, gfc_expr *);
void gfc_resolve_getgid (gfc_expr *);
void gfc_resolve_getpid (gfc_expr *);
@@ -384,6 +388,7 @@ void gfc_resolve_kill (gfc_expr *, gfc_expr *, gfc_expr *);
void gfc_resolve_lbound (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
void gfc_resolve_len (gfc_expr *, gfc_expr *, gfc_expr *);
void gfc_resolve_len_trim (gfc_expr *, gfc_expr *, gfc_expr *);
+void gfc_resolve_lgamma (gfc_expr *, gfc_expr *);
void gfc_resolve_link (gfc_expr *, gfc_expr *, gfc_expr *);
void gfc_resolve_loc (gfc_expr *, gfc_expr *);
void gfc_resolve_log (gfc_expr *, gfc_expr *);
diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi
index f09246cc95e..876015b4f87 100644
--- a/gcc/fortran/intrinsic.texi
+++ b/gcc/fortran/intrinsic.texi
@@ -121,6 +121,7 @@ Some basic guidelines for editing this document:
* @code{FSEEK}: FSEEK, Low level file positioning subroutine
* @code{FSTAT}: FSTAT, Get file status
* @code{FTELL}: FTELL, Current stream position
+* @code{GAMMA}: GAMMA, Gamma function
* @code{GERROR}: GERROR, Get last system error message
* @code{GETARG}: GETARG, Get command line arguments
* @code{GET_COMMAND}: GET_COMMAND, Get the entire command line
@@ -151,6 +152,8 @@ Some basic guidelines for editing this document:
* @code{INT8}: INT8, Convert to 64-bit integer type
* @code{IOR}: IOR, Bitwise logical or
* @code{IRAND}: IRAND, Integer pseudo-random number
+* @code{IS_IOSTAT_END}: IS_IOSTAT_END, Test for end-of-file value
+* @code{IS_IOSTAT_EOR}: IS_IOSTAT_EOR, Test for end-of-record value
* @code{ISATTY}: ISATTY, Whether a unit is a terminal device
* @code{ISHFT}: ISHFT, Shift bits
* @code{ISHFTC}: ISHFTC, Shift bits circularly
@@ -161,6 +164,7 @@ Some basic guidelines for editing this document:
* @code{LBOUND}: LBOUND, Lower dimension bounds of an array
* @code{LEN}: LEN, Length of a character entity
* @code{LEN_TRIM}: LEN_TRIM, Length of a character entity without trailing blank characters
+* @code{LGAMMA}: LGAMMA, Logarithm of the Gamma function
* @code{LGE}: LGE, Lexical greater than or equal
* @code{LGT}: LGT, Lexical greater than
* @code{LINK}: LINK, Create a hard link
@@ -4484,6 +4488,65 @@ END PROGRAM
+@node GAMMA
+@section @code{GAMMA} --- Gamma function
+@fnindex GAMMA
+@fnindex DGAMMA
+@cindex Gamma function
+@cindex Factorial function
+
+@table @asis
+@item @emph{Description}:
+@code{GAMMA(X)} computes Gamma (@math{\Gamma}) of @var{X}. For positive,
+integer values of @var{X} the Gamma function simplifies to the factorial
+function @math{\Gamma(x)=(x-1)!}.
+
+@tex
+$$
+\Gamma(x) = \int_0^\infty t^{x-1}{\rm e}^{-t}\,{\rm d}t
+$$
+@end tex
+
+@item @emph{Standard}:
+GNU Extension
+
+@item @emph{Class}:
+Elemental function
+
+@item @emph{Syntax}:
+@code{X = GAMMA(X)}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{X} @tab Shall be of type @code{REAL} and neither zero
+nor a negative integer.
+@end multitable
+
+@item @emph{Return value}:
+The return value is of type @code{REAL} of the same kind as @var{X}.
+
+@item @emph{Example}:
+@smallexample
+program test_gamma
+ real :: x = 1.0
+ x = gamma(x) ! returns 1.0
+end program test_gamma
+@end smallexample
+
+@item @emph{Specific names}:
+@multitable @columnfractions .20 .20 .20 .25
+@item Name @tab Argument @tab Return type @tab Standard
+@item @code{GAMMA(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab GNU Extension
+@item @code{DGAMMA(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU Extension
+@end multitable
+
+@item @emph{See also}:
+Logarithm of the Gamma function: @ref{LGAMMA}
+
+@end table
+
+
+
@node GERROR
@section @code{GERROR} --- Get last system error message
@fnindex GERROR
@@ -4546,21 +4609,22 @@ GNU extension
Subroutine
@item @emph{Syntax}:
-@code{CALL GETARG(N, ARG)}
+@code{CALL GETARG(POS, VALUE)}
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
-@item @var{N} @tab Shall be of type @code{INTEGER(4)}, @math{@var{N} \geq 0}
-@item @var{ARG} @tab Shall be of type @code{CHARACTER(*)}.
+@item @var{POS} @tab Shall be of type @code{INTEGER} and not wider than
+the default integer kind; @math{@var{POS} \geq 0}
+@item @var{VALUE} @tab Shall be of type @code{CHARACTER(*)}.
@end multitable
@item @emph{Return value}:
-After @code{GETARG} returns, the @var{ARG} argument holds the @var{N}th
-command line argument. If @var{ARG} can not hold the argument, it is
-truncated to fit the length of @var{ARG}. If there are less than @var{N}
-arguments specified at the command line, @var{ARG} will be filled with blanks.
-If @math{@var{N} = 0}, @var{ARG} is set to the name of the program (on systems
-that support this feature).
+After @code{GETARG} returns, the @var{VALUE} argument holds the
+@var{POS}th command line argument. If @var{VALUE} can not hold the
+argument, it is truncated to fit the length of @var{VALUE}. If there are
+less than @var{POS} arguments specified at the command line, @var{VALUE}
+will be filled with blanks. If @math{@var{POS} = 0}, @var{VALUE} is set
+to the name of the program (on systems that support this feature).
@item @emph{Example}:
@smallexample
@@ -5817,6 +5881,96 @@ end program test_irand
+@node IS_IOSTAT_END
+@section @code{IS_IOSTAT_END} --- Test for end-of-file value
+@fnindex IS_IOSTAT_END
+@cindex IOSTAT, end of file
+
+@table @asis
+@item @emph{Description}:
+@code{IS_IOSTAT_END} tests whether an variable has the value of the I/O
+status ``end of file''. The function is equivalent to comparing the variable
+with the @code{IOSTAT_END} parameter of the intrinsic module
+@code{ISO_FORTRAN_ENV}.
+
+@item @emph{Standard}:
+Fortran 2003.
+
+@item @emph{Class}:
+Elemental function
+
+@item @emph{Syntax}:
+@code{RESULT = IS_IOSTAT_END(I)}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{I} @tab Shall be of the type @code{INTEGER}.
+@end multitable
+
+@item @emph{Return value}:
+Returns a @code{LOGICAL} of the default kind, which @code{.TRUE.} if
+@var{I} has the value which indicates an end of file condition for
+IOSTAT= specifiers, and is @code{.FALSE.} otherwise.
+
+@item @emph{Example}:
+@smallexample
+PROGRAM iostat
+ IMPLICIT NONE
+ INTEGER :: stat, i
+ OPEN(88, FILE='test.dat')
+ READ(88, *, IOSTAT=stat) i
+ IF(IS_IOSTAT_END(stat)) STOP 'END OF FILE'
+END PROGRAM
+@end smallexample
+@end table
+
+
+
+@node IS_IOSTAT_EOR
+@section @code{IS_IOSTAT_EOR} --- Test for end-of-record value
+@fnindex IS_IOSTAT_EOR
+@cindex IOSTAT, end of record
+
+@table @asis
+@item @emph{Description}:
+@code{IS_IOSTAT_EOR} tests whether an variable has the value of the I/O
+status ``end of record''. The function is equivalent to comparing the
+variable with the @code{IOSTAT_EOR} parameter of the intrinsic module
+@code{ISO_FORTRAN_ENV}.
+
+@item @emph{Standard}:
+Fortran 2003.
+
+@item @emph{Class}:
+Elemental function
+
+@item @emph{Syntax}:
+@code{RESULT = IS_IOSTAT_EOR(I)}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{I} @tab Shall be of the type @code{INTEGER}.
+@end multitable
+
+@item @emph{Return value}:
+Returns a @code{LOGICAL} of the default kind, which @code{.TRUE.} if
+@var{I} has the value which indicates an end of file condition for
+IOSTAT= specifiers, and is @code{.FALSE.} otherwise.
+
+@item @emph{Example}:
+@smallexample
+PROGRAM iostat
+ IMPLICIT NONE
+ INTEGER :: stat, i(50)
+ OPEN(88, FILE='test.dat', FORM='UNFORMATTED')
+ READ(88, IOSTAT=stat) i
+ IF(IS_IOSTAT_EOR(stat)) STOP 'END OF RECORD'
+END PROGRAM
+@end smallexample
+@end table
+
+
+
@node ISATTY
@section @code{ISATTY} --- Whether a unit is a terminal device.
@fnindex ISATTY
@@ -6230,6 +6384,60 @@ The return value is of type @code{INTEGER} and of kind @var{KIND}. If
+@node LGAMMA
+@section @code{LGAMMA} --- Logarithm of the Gamma function
+@fnindex GAMMA
+@fnindex ALGAMA
+@fnindex DLGAMA
+@cindex Gamma function, logarithm of
+@cindex
+
+@table @asis
+@item @emph{Description}:
+@code{GAMMA(X)} computes the natural logrithm of the absolute value of the
+Gamma (@math{\Gamma}) function.
+
+@item @emph{Standard}:
+GNU Extension
+
+@item @emph{Class}:
+Elemental function
+
+@item @emph{Syntax}:
+@code{X = LGAMMA(X)}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{X} @tab Shall be of type @code{REAL} and neither zero
+nor a negative integer.
+@end multitable
+
+@item @emph{Return value}:
+The return value is of type @code{REAL} of the same kind as @var{X}.
+
+@item @emph{Example}:
+@smallexample
+program test_log_gamma
+ real :: x = 1.0
+ x = lgamma(x) ! returns 0.0
+end program test_log_gamma
+@end smallexample
+
+@item @emph{Specific names}:
+@multitable @columnfractions .20 .20 .20 .25
+@item Name @tab Argument @tab Return type @tab Standard
+@item @code{LGAMMA(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab GNU Extension
+@item @code{ALGAMA(X)} @tab @code{REAL(4) X} @tab @code{REAL(4)} @tab GNU Extension
+@item @code{DLGAMA(X)} @tab @code{REAL(8) X} @tab @code{REAL(8)} @tab GNU Extension
+@end multitable
+
+@item @emph{See also}:
+Gamma function: @ref{GAMMA}
+
+@end table
+
+
+
@node LGE
@section @code{LGE} --- Lexical greater than or equal
@fnindex LGE
diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi
index c68a2613960..e58cb8cbee7 100644
--- a/gcc/fortran/invoke.texi
+++ b/gcc/fortran/invoke.texi
@@ -156,7 +156,7 @@ and warnings}.
-fsecond-underscore @gol
-fbounds-check -fmax-stack-var-size=@var{n} @gol
-fpack-derived -frepack-arrays -fshort-enums -fexternal-blas @gol
--fblas-matmul-limit=@var{n}}
+-fblas-matmul-limit=@var{n} -frecursive}
@end table
@menu
@@ -296,7 +296,7 @@ and @code{c$omp}, @code{*$omp} and @code{!$omp} directives in fixed form,
@code{!$} conditional compilation sentinels in free form
and @code{c$}, @code{*$} and @code{!$} sentinels in fixed form,
and when linking arranges for the OpenMP runtime library to be linked
-in.
+in. The option @option{-fopenmp} implies @option{-frecursive}.
@item -frange-check
@opindex @code{frange-check}
@@ -710,10 +710,13 @@ it.
@opindex @code{fno-automatic}
@cindex @code{SAVE} statement
@cindex statement, @code{SAVE}
-Treat each program unit as if the @code{SAVE} statement was specified for
-every local variable and array referenced in it. Does not affect common
-blocks. (Some Fortran compilers provide this option under the name
-@option{-static}.)
+Treat each program unit (except those marked as RECURSIVE) as if the
+@code{SAVE} statement were specified for every local variable and array
+referenced in it. Does not affect common blocks. (Some Fortran compilers
+provide this option under the name @option{-static} or @option{-save}.)
+The default, which is @option{-fautomatic}, uses the stack for local
+variables smaller than the value given by @option{-fmax-stack-var-size}.
+Use the option @option{-frecursive} to use no static memory.
@item -ff2c
@opindex ff2c
@@ -865,7 +868,10 @@ substring references.
@item -fmax-stack-var-size=@var{n}
@opindex @code{fmax-stack-var-size}
This option specifies the size in bytes of the largest array that will be put
-on the stack.
+on the stack; if the size is exceeded static memory is used (except in
+procedures marked as RECURSIVE). Use the option @option{-frecursive} to
+allow for recursive procedures which do not have a RECURSIVE attribute or
+for parallel programs. Use @option{-fno-automatic} to never use the stack.
This option currently only affects local arrays declared with constant
bounds, and may not apply to all character variables.
@@ -919,6 +925,12 @@ geometric mean of the dimensions of the argument and result matrices.
The default value for @var{n} is 30.
+@item -frecursive
+@opindex @code{frecursive}
+Allow indirect recursion by forcing all local arrays to be allocated
+on the stack. This flag cannot be used together with
+@option{-fmax-stack-var-size=} or @option{-fno-automatic}.
+
@end table
@xref{Code Gen Options,,Options for Code Generation Conventions,
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index c030898a43b..38da76be71a 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -77,32 +77,18 @@ check_charlen_present (gfc_expr *source)
static void
resolve_mask_arg (gfc_expr *mask)
{
- int newkind;
- /* The mask can be kind 4 or 8 for the array case.
+ /* The mask can be any kind for an array.
For the scalar case, coerce it to kind=4 unconditionally
(because this is the only kind we have a library function
for). */
- newkind = 0;
-
- if (mask->rank == 0)
- {
- if (mask->ts.kind != 4)
- newkind = 4;
- }
- else
- {
- if (mask->ts.kind < 4)
- newkind = gfc_default_logical_kind;
- }
-
- if (newkind)
+ if (mask->rank == 0 && mask->ts.kind != 4)
{
gfc_typespec ts;
ts.type = BT_LOGICAL;
- ts.kind = newkind;
+ ts.kind = 4;
gfc_convert_type (mask, &ts, 2);
}
}
@@ -548,6 +534,9 @@ gfc_resolve_cshift (gfc_expr *f, gfc_expr *array, gfc_expr *shift,
{
int n;
+ if (array->ts.type == BT_CHARACTER && array->ref)
+ gfc_resolve_substring_charlen (array);
+
f->ts = array->ts;
f->rank = array->rank;
f->shape = gfc_copy_shape (array->shape, array->rank);
@@ -668,6 +657,9 @@ gfc_resolve_eoshift (gfc_expr *f, gfc_expr *array, gfc_expr *shift,
{
int n;
+ if (array->ts.type == BT_CHARACTER && array->ref)
+ gfc_resolve_substring_charlen (array);
+
f->ts = array->ts;
f->rank = array->rank;
f->shape = gfc_copy_shape (array->shape, array->rank);
@@ -771,6 +763,15 @@ gfc_resolve_g77_math1 (gfc_expr *f, gfc_expr *x)
void
+gfc_resolve_gamma (gfc_expr *f, gfc_expr *x)
+{
+ f->ts = x->ts;
+ f->value.function.name
+ = gfc_get_string ("__gamma_%d", x->ts.kind);
+}
+
+
+void
gfc_resolve_getcwd (gfc_expr *f, gfc_expr *n ATTRIBUTE_UNUSED)
{
f->ts.type = BT_INTEGER;
@@ -1128,6 +1129,15 @@ gfc_resolve_len_trim (gfc_expr *f, gfc_expr *string, gfc_expr *kind)
void
+gfc_resolve_lgamma (gfc_expr *f, gfc_expr *x)
+{
+ f->ts = x->ts;
+ f->value.function.name
+ = gfc_get_string ("__lgamma_%d", x->ts.kind);
+}
+
+
+void
gfc_resolve_link (gfc_expr *f, gfc_expr *p1 ATTRIBUTE_UNUSED,
gfc_expr *p2 ATTRIBUTE_UNUSED)
{
@@ -1378,6 +1388,12 @@ gfc_resolve_merge (gfc_expr *f, gfc_expr *tsource,
gfc_expr *fsource ATTRIBUTE_UNUSED,
gfc_expr *mask ATTRIBUTE_UNUSED)
{
+ if (tsource->ts.type == BT_CHARACTER && tsource->ref)
+ gfc_resolve_substring_charlen (tsource);
+
+ if (fsource->ts.type == BT_CHARACTER && fsource->ref)
+ gfc_resolve_substring_charlen (fsource);
+
if (tsource->ts.type == BT_CHARACTER)
check_charlen_present (tsource);
@@ -1586,6 +1602,9 @@ void
gfc_resolve_pack (gfc_expr *f, gfc_expr *array, gfc_expr *mask,
gfc_expr *vector ATTRIBUTE_UNUSED)
{
+ if (array->ts.type == BT_CHARACTER && array->ref)
+ gfc_resolve_substring_charlen (array);
+
f->ts = array->ts;
f->rank = 1;
@@ -1689,6 +1708,9 @@ gfc_resolve_reshape (gfc_expr *f, gfc_expr *source, gfc_expr *shape,
int kind;
int i;
+ if (source->ts.type == BT_CHARACTER && source->ref)
+ gfc_resolve_substring_charlen (source);
+
f->ts = source->ts;
gfc_array_size (shape, &rank);
@@ -1980,6 +2002,9 @@ void
gfc_resolve_spread (gfc_expr *f, gfc_expr *source, gfc_expr *dim,
gfc_expr *ncopies)
{
+ if (source->ts.type == BT_CHARACTER && source->ref)
+ gfc_resolve_substring_charlen (source);
+
if (source->ts.type == BT_CHARACTER)
check_charlen_present (source);
@@ -2254,6 +2279,10 @@ gfc_resolve_transfer (gfc_expr *f, gfc_expr *source ATTRIBUTE_UNUSED,
void
gfc_resolve_transpose (gfc_expr *f, gfc_expr *matrix)
{
+
+ if (matrix->ts.type == BT_CHARACTER && matrix->ref)
+ gfc_resolve_substring_charlen (matrix);
+
f->ts = matrix->ts;
f->rank = 2;
if (matrix->shape)
@@ -2380,6 +2409,9 @@ void
gfc_resolve_unpack (gfc_expr *f, gfc_expr *vector, gfc_expr *mask,
gfc_expr *field ATTRIBUTE_UNUSED)
{
+ if (vector->ts.type == BT_CHARACTER && vector->ref)
+ gfc_resolve_substring_charlen (vector);
+
f->ts = vector->ts;
f->rank = mask->rank;
resolve_mask_arg (mask);
@@ -2671,9 +2703,18 @@ void
gfc_resolve_getarg (gfc_code *c)
{
const char *name;
- int kind;
- kind = gfc_default_integer_kind;
- name = gfc_get_string (PREFIX ("getarg_i%d"), kind);
+
+ if (c->ext.actual->expr->ts.kind != gfc_default_integer_kind)
+ {
+ gfc_typespec ts;
+
+ ts.type = BT_INTEGER;
+ ts.kind = gfc_default_integer_kind;
+
+ gfc_convert_type (c->ext.actual->expr, &ts, 2);
+ }
+
+ name = gfc_get_string (PREFIX ("getarg_i%d"), gfc_default_integer_kind);
c->resolved_sym = gfc_get_intrinsic_sub_symbol (name);
}
diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
index 3072051a1f4..558cf657aac 100644
--- a/gcc/fortran/lang.opt
+++ b/gcc/fortran/lang.opt
@@ -218,7 +218,7 @@ Set default accessibility of module entities to PRIVATE.
fopenmp
Fortran
-Enable OpenMP
+Enable OpenMP (also sets frecursive)
fpack-derived
Fortran
@@ -240,6 +240,10 @@ frecord-marker=8
Fortran RejectNegative
Use an 8-byte record marker for unformatted files
+frecursive
+Fortran
+Allocate local variables on the stack to allow indirect recursion
+
frepack-arrays
Fortran
Copy array sections into a contiguous block on procedure entry
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 67fbd4fc503..dcf6ad1084b 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -26,39 +26,6 @@ along with GCC; see the file COPYING3. If not see
#include "match.h"
#include "parse.h"
-/* For matching and debugging purposes. Order matters here! The
- unary operators /must/ precede the binary plus and minus, or
- the expression parser breaks. */
-
-static mstring intrinsic_operators[] = {
- minit ("+", INTRINSIC_UPLUS),
- minit ("-", INTRINSIC_UMINUS),
- minit ("+", INTRINSIC_PLUS),
- minit ("-", INTRINSIC_MINUS),
- minit ("**", INTRINSIC_POWER),
- minit ("//", INTRINSIC_CONCAT),
- minit ("*", INTRINSIC_TIMES),
- minit ("/", INTRINSIC_DIVIDE),
- minit (".and.", INTRINSIC_AND),
- minit (".or.", INTRINSIC_OR),
- minit (".eqv.", INTRINSIC_EQV),
- minit (".neqv.", INTRINSIC_NEQV),
- minit (".eq.", INTRINSIC_EQ_OS),
- minit ("==", INTRINSIC_EQ),
- minit (".ne.", INTRINSIC_NE_OS),
- minit ("/=", INTRINSIC_NE),
- minit (".ge.", INTRINSIC_GE_OS),
- minit (">=", INTRINSIC_GE),
- minit (".le.", INTRINSIC_LE_OS),
- minit ("<=", INTRINSIC_LE),
- minit (".lt.", INTRINSIC_LT_OS),
- minit ("<", INTRINSIC_LT),
- minit (".gt.", INTRINSIC_GT_OS),
- minit (">", INTRINSIC_GT),
- minit (".not.", INTRINSIC_NOT),
- minit ("parens", INTRINSIC_PARENTHESES),
- minit (NULL, INTRINSIC_NONE)
-};
/* For debugging and diagnostic purposes. Return the textual representation
of the intrinsic operator OP. */
@@ -726,15 +693,224 @@ gfc_match_symbol (gfc_symbol **matched_symbol, int host_assoc)
match
gfc_match_intrinsic_op (gfc_intrinsic_op *result)
{
- gfc_intrinsic_op op;
+ locus orig_loc = gfc_current_locus;
+ int ch;
- op = (gfc_intrinsic_op) gfc_match_strings (intrinsic_operators);
+ gfc_gobble_whitespace ();
+ ch = gfc_next_char ();
+ switch (ch)
+ {
+ case '+':
+ /* Matched "+". */
+ *result = INTRINSIC_PLUS;
+ return MATCH_YES;
- if (op == INTRINSIC_NONE)
- return MATCH_NO;
+ case '-':
+ /* Matched "-". */
+ *result = INTRINSIC_MINUS;
+ return MATCH_YES;
- *result = op;
- return MATCH_YES;
+ case '=':
+ if (gfc_next_char () == '=')
+ {
+ /* Matched "==". */
+ *result = INTRINSIC_EQ;
+ return MATCH_YES;
+ }
+ break;
+
+ case '<':
+ if (gfc_peek_char () == '=')
+ {
+ /* Matched "<=". */
+ gfc_next_char ();
+ *result = INTRINSIC_LE;
+ return MATCH_YES;
+ }
+ /* Matched "<". */
+ *result = INTRINSIC_LT;
+ return MATCH_YES;
+
+ case '>':
+ if (gfc_peek_char () == '=')
+ {
+ /* Matched ">=". */
+ gfc_next_char ();
+ *result = INTRINSIC_GE;
+ return MATCH_YES;
+ }
+ /* Matched ">". */
+ *result = INTRINSIC_GT;
+ return MATCH_YES;
+
+ case '*':
+ if (gfc_peek_char () == '*')
+ {
+ /* Matched "**". */
+ gfc_next_char ();
+ *result = INTRINSIC_POWER;
+ return MATCH_YES;
+ }
+ /* Matched "*". */
+ *result = INTRINSIC_TIMES;
+ return MATCH_YES;
+
+ case '/':
+ ch = gfc_peek_char ();
+ if (ch == '=')
+ {
+ /* Matched "/=". */
+ gfc_next_char ();
+ *result = INTRINSIC_NE;
+ return MATCH_YES;
+ }
+ else if (ch == '/')
+ {
+ /* Matched "//". */
+ gfc_next_char ();
+ *result = INTRINSIC_CONCAT;
+ return MATCH_YES;
+ }
+ /* Matched "/". */
+ *result = INTRINSIC_DIVIDE;
+ return MATCH_YES;
+
+ case '.':
+ ch = gfc_next_char ();
+ switch (ch)
+ {
+ case 'a':
+ if (gfc_next_char () == 'n'
+ && gfc_next_char () == 'd'
+ && gfc_next_char () == '.')
+ {
+ /* Matched ".and.". */
+ *result = INTRINSIC_AND;
+ return MATCH_YES;
+ }
+ break;
+
+ case 'e':
+ if (gfc_next_char () == 'q')
+ {
+ ch = gfc_next_char ();
+ if (ch == '.')
+ {
+ /* Matched ".eq.". */
+ *result = INTRINSIC_EQ_OS;
+ return MATCH_YES;
+ }
+ else if (ch == 'v')
+ {
+ if (gfc_next_char () == '.')
+ {
+ /* Matched ".eqv.". */
+ *result = INTRINSIC_EQV;
+ return MATCH_YES;
+ }
+ }
+ }
+ break;
+
+ case 'g':
+ ch = gfc_next_char ();
+ if (ch == 'e')
+ {
+ if (gfc_next_char () == '.')
+ {
+ /* Matched ".ge.". */
+ *result = INTRINSIC_GE_OS;
+ return MATCH_YES;
+ }
+ }
+ else if (ch == 't')
+ {
+ if (gfc_next_char () == '.')
+ {
+ /* Matched ".gt.". */
+ *result = INTRINSIC_GT_OS;
+ return MATCH_YES;
+ }
+ }
+ break;
+
+ case 'l':
+ ch = gfc_next_char ();
+ if (ch == 'e')
+ {
+ if (gfc_next_char () == '.')
+ {
+ /* Matched ".le.". */
+ *result = INTRINSIC_LE_OS;
+ return MATCH_YES;
+ }
+ }
+ else if (ch == 't')
+ {
+ if (gfc_next_char () == '.')
+ {
+ /* Matched ".lt.". */
+ *result = INTRINSIC_LT_OS;
+ return MATCH_YES;
+ }
+ }
+ break;
+
+ case 'n':
+ ch = gfc_next_char ();
+ if (ch == 'e')
+ {
+ ch = gfc_next_char ();
+ if (ch == '.')
+ {
+ /* Matched ".ne.". */
+ *result = INTRINSIC_NE_OS;
+ return MATCH_YES;
+ }
+ else if (ch == 'q')
+ {
+ if (gfc_next_char () == 'v'
+ && gfc_next_char () == '.')
+ {
+ /* Matched ".neqv.". */
+ *result = INTRINSIC_NEQV;
+ return MATCH_YES;
+ }
+ }
+ }
+ else if (ch == 'o')
+ {
+ if (gfc_next_char () == 't'
+ && gfc_next_char () == '.')
+ {
+ /* Matched ".not.". */
+ *result = INTRINSIC_NOT;
+ return MATCH_YES;
+ }
+ }
+ break;
+
+ case 'o':
+ if (gfc_next_char () == 'r'
+ && gfc_next_char () == '.')
+ {
+ /* Matched ".or.". */
+ *result = INTRINSIC_OR;
+ return MATCH_YES;
+ }
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ gfc_current_locus = orig_loc;
+ return MATCH_NO;
}
@@ -2709,14 +2885,6 @@ gfc_match_common (void)
if (gfc_add_in_common (&sym->attr, sym->name, NULL) == FAILURE)
goto cleanup;
- /* Derived type names must have the SEQUENCE attribute. */
- if (sym->ts.type == BT_DERIVED && !sym->ts.derived->attr.sequence)
- {
- gfc_error ("Derived type variable in COMMON at %C does not "
- "have the SEQUENCE attribute");
- goto cleanup;
- }
-
if (tail != NULL)
tail->common_next = sym;
else
diff --git a/gcc/fortran/mathbuiltins.def b/gcc/fortran/mathbuiltins.def
index 0fc73688279..33e87d14290 100644
--- a/gcc/fortran/mathbuiltins.def
+++ b/gcc/fortran/mathbuiltins.def
@@ -30,3 +30,5 @@ DEFINE_MATH_BUILTIN (Y1, "y1", 0)
DEFINE_MATH_BUILTIN (YN, "yn", 2)
DEFINE_MATH_BUILTIN (ERF, "erf", 0)
DEFINE_MATH_BUILTIN (ERFC, "erfc", 0)
+DEFINE_MATH_BUILTIN (GAMMA, "gamma", 0)
+DEFINE_MATH_BUILTIN (LGAMMA,"lgamma", 0)
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 00f3674b597..0b01ee4c8cb 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -1391,7 +1391,8 @@ write_atom (atom_type atom, const void *v)
written. */
static void mio_expr (gfc_expr **);
-static void mio_symbol_ref (gfc_symbol **);
+pointer_info *mio_symbol_ref (gfc_symbol **);
+pointer_info *mio_interface_rest (gfc_interface **);
static void mio_symtree_ref (gfc_symtree **);
/* Read or write an enumerated value. On writing, we return the input
@@ -2247,7 +2248,7 @@ mio_formal_arglist (gfc_symbol *sym)
/* Save or restore a reference to a symbol node. */
-void
+pointer_info *
mio_symbol_ref (gfc_symbol **symp)
{
pointer_info *p;
@@ -2266,6 +2267,7 @@ mio_symbol_ref (gfc_symbol **symp)
if (p->u.rsym.state == UNUSED)
p->u.rsym.state = NEEDED;
}
+ return p;
}
@@ -2916,10 +2918,11 @@ mio_namelist (gfc_symbol *sym)
interfaces. Checking for duplicate and ambiguous interfaces has to
be done later when all symbols have been loaded. */
-static void
+pointer_info *
mio_interface_rest (gfc_interface **ip)
{
gfc_interface *tail, *p;
+ pointer_info *pi = NULL;
if (iomode == IO_OUTPUT)
{
@@ -2945,7 +2948,7 @@ mio_interface_rest (gfc_interface **ip)
p = gfc_get_interface ();
p->where = gfc_current_locus;
- mio_symbol_ref (&p->sym);
+ pi = mio_symbol_ref (&p->sym);
if (tail == NULL)
*ip = p;
@@ -2957,6 +2960,7 @@ mio_interface_rest (gfc_interface **ip)
}
mio_rparen ();
+ return pi;
}
@@ -3136,6 +3140,8 @@ load_operator_interfaces (void)
const char *p;
char name[GFC_MAX_SYMBOL_LEN + 1], module[GFC_MAX_SYMBOL_LEN + 1];
gfc_user_op *uop;
+ pointer_info *pi = NULL;
+ int n, i;
mio_lparen ();
@@ -3146,16 +3152,34 @@ load_operator_interfaces (void)
mio_internal_string (name);
mio_internal_string (module);
- /* Decide if we need to load this one or not. */
- p = find_use_name (name, true);
- if (p == NULL)
- {
- while (parse_atom () != ATOM_RPAREN);
- }
- else
+ n = number_use_names (name, true);
+ n = n ? n : 1;
+
+ for (i = 1; i <= n; i++)
{
- uop = gfc_get_uop (p);
- mio_interface_rest (&uop->operator);
+ /* Decide if we need to load this one or not. */
+ p = find_use_name_n (name, &i, true);
+
+ if (p == NULL)
+ {
+ while (parse_atom () != ATOM_RPAREN);
+ continue;
+ }
+
+ if (i == 1)
+ {
+ uop = gfc_get_uop (p);
+ pi = mio_interface_rest (&uop->operator);
+ }
+ else
+ {
+ if (gfc_find_uop (p, NULL))
+ continue;
+ uop = gfc_get_uop (p);
+ uop->operator = gfc_get_interface ();
+ uop->operator->where = gfc_current_locus;
+ add_fixup (pi->integer, &uop->operator->sym);
+ }
}
}
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index 0bea67d7eea..3ab736236be 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -86,7 +86,10 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED,
gfc_option.flag_f2c = 0;
gfc_option.flag_second_underscore = -1;
gfc_option.flag_implicit_none = 0;
- gfc_option.flag_max_stack_var_size = 32768;
+
+ /* Default value of flag_max_stack_var_size is set in gfc_post_options. */
+ gfc_option.flag_max_stack_var_size = -2;
+
gfc_option.flag_range_check = 1;
gfc_option.flag_pack_derived = 0;
gfc_option.flag_repack_arrays = 0;
@@ -103,6 +106,7 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED,
gfc_option.flag_d_lines = -1;
gfc_option.flag_openmp = 0;
gfc_option.flag_sign_zero = 1;
+ gfc_option.flag_recursive = 0;
gfc_option.fpe = 0;
@@ -290,6 +294,37 @@ gfc_post_options (const char **pfilename)
if (gfc_option.flag_second_underscore == -1)
gfc_option.flag_second_underscore = gfc_option.flag_f2c;
+ if (!gfc_option.flag_automatic && gfc_option.flag_max_stack_var_size != -2
+ && gfc_option.flag_max_stack_var_size != 0)
+ gfc_warning_now ("Flag -fno-automatic overwrites -fmax-stack-var-size=%d",
+ gfc_option.flag_max_stack_var_size);
+ else if (!gfc_option.flag_automatic && gfc_option.flag_recursive)
+ gfc_warning_now ("Flag -fno-automatic overwrites -frecursive");
+ else if (!gfc_option.flag_automatic && gfc_option.flag_openmp)
+ gfc_warning_now ("Flag -fno-automatic overwrites -frecursive implied by "
+ "-fopenmp");
+ else if (gfc_option.flag_max_stack_var_size != -2
+ && gfc_option.flag_recursive)
+ gfc_warning_now ("Flag -frecursive overwrites -fmax-stack-var-size=%d",
+ gfc_option.flag_max_stack_var_size);
+ else if (gfc_option.flag_max_stack_var_size != -2
+ && gfc_option.flag_openmp)
+ gfc_warning_now ("Flag -fmax-stack-var-size=%d overwrites -frecursive "
+ "implied by -fopenmp",
+ gfc_option.flag_max_stack_var_size);
+
+ /* Implied -frecursive; implemented as -fmax-stack-var-size=-1. */
+ if (gfc_option.flag_max_stack_var_size == -2 && gfc_option.flag_openmp)
+ gfc_option.flag_max_stack_var_size = -1;
+
+ /* Set default. */
+ if (gfc_option.flag_max_stack_var_size == -2)
+ gfc_option.flag_max_stack_var_size = 32768;
+
+ /* Implement -frecursive as -fmax-stack-var-size=-1. */
+ if (gfc_option.flag_recursive)
+ gfc_option.flag_max_stack_var_size = -1;
+
/* Implement -fno-automatic as -fmax-stack-var-size=0. */
if (!gfc_option.flag_automatic)
gfc_option.flag_max_stack_var_size = 0;
@@ -698,6 +733,11 @@ gfc_handle_option (size_t scode, const char *arg, int value)
MAX_SUBRECORD_LENGTH);
gfc_option.max_subrecord_length = value;
+ break;
+
+ case OPT_frecursive:
+ gfc_option.flag_recursive = 1;
+ break;
}
return result;
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 835b05a97e2..df7f68f156e 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -1544,11 +1544,11 @@ parse_derived (void)
case ST_END_TYPE:
compiling_type = 0;
- if (!seen_component)
- {
- gfc_error ("Derived type definition at %C has no components");
- error_flag = 1;
- }
+ if (!seen_component
+ && (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Derived type "
+ "definition at %C without components")
+ == FAILURE))
+ error_flag = 1;
accept_statement (ST_END_TYPE);
break;
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index ae15d16c188..424acfc6829 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -606,49 +606,58 @@ resolve_entries (gfc_namespace *ns)
static void
resolve_common_blocks (gfc_symtree *common_root)
{
- gfc_symtree *symtree;
- gfc_symbol *sym;
+ gfc_symbol *sym, *csym;
- if (common_root == NULL)
- return;
+ if (common_root == NULL)
+ return;
- for (symtree = common_root; symtree->left; symtree = symtree->left);
+ if (common_root->left)
+ resolve_common_blocks (common_root->left);
+ if (common_root->right)
+ resolve_common_blocks (common_root->right);
- for (; symtree; symtree = symtree->right)
- {
- gfc_find_symbol (symtree->name, gfc_current_ns, 0, &sym);
- if (sym == NULL)
- continue;
+ for (csym = common_root->n.common->head; csym; csym = csym->common_next)
+ {
+ if (csym->ts.type == BT_DERIVED
+ && !(csym->ts.derived->attr.sequence
+ || csym->ts.derived->attr.is_bind_c))
+ {
+ gfc_error_now ("Derived type variable '%s' in COMMON at %L "
+ "has neither the SEQUENCE nor the BIND(C) "
+ "attribute", csym->name,
+ &csym->declared_at);
+ }
+ else if (csym->ts.type == BT_DERIVED
+ && csym->ts.derived->attr.alloc_comp)
+ {
+ gfc_error_now ("Derived type variable '%s' in COMMON at %L "
+ "has an ultimate component that is "
+ "allocatable", csym->name,
+ &csym->declared_at);
+ }
+ }
- if (sym->attr.flavor == FL_PARAMETER)
- {
- gfc_error ("COMMON block '%s' at %L is used as PARAMETER at %L",
- sym->name, &symtree->n.common->where,
- &sym->declared_at);
- }
+ gfc_find_symbol (common_root->name, gfc_current_ns, 0, &sym);
+ if (sym == NULL)
+ return;
- if (sym->attr.intrinsic)
- {
- gfc_error ("COMMON block '%s' at %L is also an intrinsic "
- "procedure", sym->name,
- &symtree->n.common->where);
- }
- else if (sym->attr.result
- ||(sym->attr.function && gfc_current_ns->proc_name == sym))
- {
- gfc_notify_std (GFC_STD_F2003, "Fortran 2003: COMMON block '%s' "
- "at %L that is also a function result", sym->name,
- &symtree->n.common->where);
- }
- else if (sym->attr.flavor == FL_PROCEDURE
- && sym->attr.proc != PROC_INTERNAL
- && sym->attr.proc != PROC_ST_FUNCTION)
- {
- gfc_notify_std (GFC_STD_F2003, "Fortran 2003: COMMON block '%s' "
- "at %L that is also a global procedure", sym->name,
- &symtree->n.common->where);
- }
- }
+ if (sym->attr.flavor == FL_PARAMETER)
+ gfc_error ("COMMON block '%s' at %L is used as PARAMETER at %L",
+ sym->name, &common_root->n.common->where, &sym->declared_at);
+
+ if (sym->attr.intrinsic)
+ gfc_error ("COMMON block '%s' at %L is also an intrinsic procedure",
+ sym->name, &common_root->n.common->where);
+ else if (sym->attr.result
+ ||(sym->attr.function && gfc_current_ns->proc_name == sym))
+ gfc_notify_std (GFC_STD_F2003, "Fortran 2003: COMMON block '%s' at %L "
+ "that is also a function result", sym->name,
+ &common_root->n.common->where);
+ else if (sym->attr.flavor == FL_PROCEDURE && sym->attr.proc != PROC_INTERNAL
+ && sym->attr.proc != PROC_ST_FUNCTION)
+ gfc_notify_std (GFC_STD_F2003, "Fortran 2003: COMMON block '%s' at %L "
+ "that is also a global procedure", sym->name,
+ &common_root->n.common->where);
}
@@ -2351,11 +2360,6 @@ gfc_iso_c_sub_interface (gfc_code *c, gfc_symbol *sym)
formal args) before resolving. */
gfc_procedure_use (sym, &c->ext.actual, &(c->loc));
- /* Give the optional SHAPE formal arg a type now that we've done our
- initial checking against the actual. */
- if (sym->intmod_sym_id == ISOCBINDING_F_POINTER)
- sym->formal->next->next->sym->ts.type = BT_INTEGER;
-
if ((sym->intmod_sym_id == ISOCBINDING_F_POINTER) ||
(sym->intmod_sym_id == ISOCBINDING_F_PROCPOINTER))
{
@@ -2396,13 +2400,6 @@ gfc_iso_c_sub_interface (gfc_code *c, gfc_symbol *sym)
/* the 1 means to add the optional arg to formal list */
new_sym = get_iso_c_sym (sym, name, binding_label, 1);
- /* Set the kind for the SHAPE array to that of the actual
- (if given). */
- if (c->ext.actual != NULL && c->ext.actual->next != NULL
- && c->ext.actual->next->expr->rank != 0)
- new_sym->formal->next->next->sym->ts.kind =
- c->ext.actual->next->next->expr->ts.kind;
-
/* for error reporting, say it's declared where the original was */
new_sym->declared_at = sym->declared_at;
}
@@ -3538,6 +3535,70 @@ resolve_substring (gfc_ref *ref)
}
+/* This function supplies missing substring charlens. */
+
+void
+gfc_resolve_substring_charlen (gfc_expr *e)
+{
+ gfc_ref *char_ref;
+ gfc_expr *start, *end;
+
+ for (char_ref = e->ref; char_ref; char_ref = char_ref->next)
+ if (char_ref->type == REF_SUBSTRING)
+ break;
+
+ if (!char_ref)
+ return;
+
+ gcc_assert (char_ref->next == NULL);
+
+ if (e->ts.cl)
+ {
+ if (e->ts.cl->length)
+ gfc_free_expr (e->ts.cl->length);
+ else if (e->expr_type == EXPR_VARIABLE
+ && e->symtree->n.sym->attr.dummy)
+ return;
+ }
+
+ e->ts.type = BT_CHARACTER;
+ e->ts.kind = gfc_default_character_kind;
+
+ if (!e->ts.cl)
+ {
+ e->ts.cl = gfc_get_charlen ();
+ e->ts.cl->next = gfc_current_ns->cl_list;
+ gfc_current_ns->cl_list = e->ts.cl;
+ }
+
+ if (char_ref->u.ss.start)
+ start = gfc_copy_expr (char_ref->u.ss.start);
+ else
+ start = gfc_int_expr (1);
+
+ if (char_ref->u.ss.end)
+ end = gfc_copy_expr (char_ref->u.ss.end);
+ else if (e->expr_type == EXPR_VARIABLE)
+ end = gfc_copy_expr (e->symtree->n.sym->ts.cl->length);
+ else
+ end = NULL;
+
+ if (!start || !end)
+ return;
+
+ /* Length = (end - start +1). */
+ e->ts.cl->length = gfc_subtract (end, start);
+ e->ts.cl->length = gfc_add (e->ts.cl->length, gfc_int_expr (1));
+
+ e->ts.cl->length->ts.type = BT_INTEGER;
+ e->ts.cl->length->ts.kind = gfc_charlen_int_kind;;
+
+ /* Make sure that the length is simplified. */
+ gfc_simplify_expr (e->ts.cl->length, 1);
+ gfc_resolve_expr (e->ts.cl->length);
+}
+
+
/* Resolve subtype references. */
static try
@@ -3911,6 +3972,78 @@ check_host_association (gfc_expr *e)
}
+static void
+gfc_resolve_character_operator (gfc_expr *e)
+{
+ gfc_expr *op1 = e->value.op.op1;
+ gfc_expr *op2 = e->value.op.op2;
+ gfc_expr *e1 = NULL;
+ gfc_expr *e2 = NULL;
+
+ gcc_assert (e->value.op.operator == INTRINSIC_CONCAT);
+
+ if (op1->ts.cl && op1->ts.cl->length)
+ e1 = gfc_copy_expr (op1->ts.cl->length);
+ else if (op1->expr_type == EXPR_CONSTANT)
+ e1 = gfc_int_expr (op1->value.character.length);
+
+ if (op2->ts.cl && op2->ts.cl->length)
+ e2 = gfc_copy_expr (op2->ts.cl->length);
+ else if (op2->expr_type == EXPR_CONSTANT)
+ e2 = gfc_int_expr (op2->value.character.length);
+
+ e->ts.cl = gfc_get_charlen ();
+ e->ts.cl->next = gfc_current_ns->cl_list;
+ gfc_current_ns->cl_list = e->ts.cl;
+
+ if (!e1 || !e2)
+ return;
+
+ e->ts.cl->length = gfc_add (e1, e2);
+ e->ts.cl->length->ts.type = BT_INTEGER;
+ e->ts.cl->length->ts.kind = gfc_charlen_int_kind;;
+ gfc_simplify_expr (e->ts.cl->length, 0);
+ gfc_resolve_expr (e->ts.cl->length);
+
+ return;
+}
+
+
+/* Ensure that an character expression has a charlen and, if possible, a
+ length expression. */
+
+static void
+fixup_charlen (gfc_expr *e)
+{
+ /* The cases fall through so that changes in expression type and the need
+ for multiple fixes are picked up. In all circumstances, a charlen should
+ be available for the middle end to hang a backend_decl on. */
+ switch (e->expr_type)
+ {
+ case EXPR_OP:
+ gfc_resolve_character_operator (e);
+
+ case EXPR_ARRAY:
+ if (e->expr_type == EXPR_ARRAY)
+ gfc_resolve_character_array_constructor (e);
+
+ case EXPR_SUBSTRING:
+ if (!e->ts.cl && e->ref)
+ gfc_resolve_substring_charlen (e);
+
+ default:
+ if (!e->ts.cl)
+ {
+ e->ts.cl = gfc_get_charlen ();
+ e->ts.cl->next = gfc_current_ns->cl_list;
+ gfc_current_ns->cl_list = e->ts.cl;
+ }
+
+ break;
+ }
+}
+
+
/* Resolve an expression. That is, make sure that types of operands agree
with their operators, intrinsic operators are converted to function calls
for overloaded types and unresolved function references are resolved. */
@@ -3940,6 +4073,11 @@ gfc_resolve_expr (gfc_expr *e)
if (t == SUCCESS)
expression_rank (e);
}
+
+ if (e->ts.type == BT_CHARACTER && e->ts.cl == NULL && e->ref
+ && e->ref->type != REF_SUBSTRING)
+ gfc_resolve_substring_charlen (e);
+
break;
case EXPR_SUBSTRING:
@@ -3988,6 +4126,9 @@ gfc_resolve_expr (gfc_expr *e)
gfc_internal_error ("gfc_resolve_expr(): Bad expression type");
}
+ if (e->ts.type == BT_CHARACTER && t == SUCCESS && !e->ts.cl)
+ fixup_charlen (e);
+
return t;
}
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index a395b04a599..3fa52500344 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -1183,6 +1183,24 @@ gfc_simplify_fraction (gfc_expr *x)
gfc_expr *
+gfc_simplify_gamma (gfc_expr *x)
+{
+ gfc_expr *result;
+
+ if (x->expr_type != EXPR_CONSTANT)
+ return NULL;
+
+ result = gfc_constant_result (x->ts.type, x->ts.kind, &x->where);
+
+ gfc_set_model_kind (x->ts.kind);
+
+ mpfr_gamma (result->value.real, x->value.real, GFC_RND_MODE);
+
+ return range_check (result, "GAMMA");
+}
+
+
+gfc_expr *
gfc_simplify_huge (gfc_expr *e)
{
gfc_expr *result;
@@ -2212,6 +2230,28 @@ gfc_simplify_len_trim (gfc_expr *e, gfc_expr *kind)
return range_check (result, "LEN_TRIM");
}
+gfc_expr *
+gfc_simplify_lgamma (gfc_expr *x __attribute__((unused)))
+{
+#if MPFR_VERSION >= MPFR_VERSION_NUM(2,3,0)
+ gfc_expr *result;
+ int sg;
+
+ if (x->expr_type != EXPR_CONSTANT)
+ return NULL;
+
+ result = gfc_constant_result (x->ts.type, x->ts.kind, &x->where);
+
+ gfc_set_model_kind (x->ts.kind);
+
+ mpfr_lgamma (result->value.real, &sg, x->value.real, GFC_RND_MODE);
+
+ return range_check (result, "LGAMMA");
+#else
+ return NULL;
+#endif
+}
+
gfc_expr *
gfc_simplify_lge (gfc_expr *a, gfc_expr *b)
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index f6b4751fb7c..69be8efb2f3 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -843,17 +843,11 @@ gfc_grow_array (stmtblock_t * pblock, tree desc, tree extra)
/* Calculate the new array size. */
size = TYPE_SIZE_UNIT (gfc_get_element_type (TREE_TYPE (desc)));
tmp = build2 (PLUS_EXPR, gfc_array_index_type, ubound, gfc_index_one_node);
- arg1 = build2 (MULT_EXPR, gfc_array_index_type, tmp,
- fold_convert (gfc_array_index_type, size));
+ arg1 = build2 (MULT_EXPR, size_type_node, fold_convert (size_type_node, tmp),
+ fold_convert (size_type_node, size));
- /* Pick the realloc function. */
- if (gfc_index_integer_kind == 4 || gfc_index_integer_kind == 8)
- tmp = gfor_fndecl_internal_realloc;
- else
- gcc_unreachable ();
-
- /* Set the new data pointer. */
- tmp = build_call_expr (tmp, 2, arg0, arg1);
+ /* Call the realloc() function. */
+ tmp = gfc_call_realloc (pblock, arg0, arg1);
gfc_conv_descriptor_data_set (pblock, desc, tmp);
}
@@ -1381,7 +1375,7 @@ get_array_ctor_all_strlen (stmtblock_t *block, gfc_expr *e, tree *len)
if (*len && INTEGER_CST_P (*len))
return;
- if (!e->ref && e->ts.cl->length
+ if (!e->ref && e->ts.cl && e->ts.cl->length
&& e->ts.cl->length->expr_type == EXPR_CONSTANT)
{
/* This is easy. */
@@ -1645,17 +1639,6 @@ gfc_trans_array_constructor (gfc_loopinfo * loop, gfc_ss * ss)
if (!ss->string_length)
gfc_todo_error ("complex character array constructors");
- /* It is surprising but still possible to wind up with expressions that
- lack a character length.
- TODO Find the offending part of the front end and cure this properly.
- Concatenation involving arrays is the main culprit. */
- if (!ss->expr->ts.cl)
- {
- ss->expr->ts.cl = gfc_get_charlen ();
- ss->expr->ts.cl->next = gfc_current_ns->cl_list;
- gfc_current_ns->cl_list = ss->expr->ts.cl->next;
- }
-
ss->expr->ts.cl->backend_decl = ss->string_length;
type = gfc_get_character_type_len (ss->expr->ts.kind, ss->string_length);
@@ -3571,7 +3554,6 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree pstat)
{
tree tmp;
tree pointer;
- tree allocate;
tree offset;
tree size;
gfc_expr **lower;
@@ -3629,22 +3611,11 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree pstat)
pointer = gfc_conv_descriptor_data_get (se->expr);
STRIP_NOPS (pointer);
- if (TYPE_PRECISION (gfc_array_index_type) == 32 ||
- TYPE_PRECISION (gfc_array_index_type) == 64)
- {
- if (allocatable_array)
- allocate = gfor_fndecl_allocate_array;
- else
- allocate = gfor_fndecl_allocate;
- }
- else
- gcc_unreachable ();
-
/* The allocate_array variants take the old pointer as first argument. */
if (allocatable_array)
- tmp = build_call_expr (allocate, 3, pointer, size, pstat);
+ tmp = gfc_allocate_array_with_status (&se->pre, pointer, size, pstat);
else
- tmp = build_call_expr (allocate, 2, size, pstat);
+ tmp = gfc_allocate_with_status (&se->pre, size, pstat);
tmp = build2 (MODIFY_EXPR, void_type_node, pointer, tmp);
gfc_add_expr_to_block (&se->pre, tmp);
@@ -3680,7 +3651,7 @@ gfc_array_deallocate (tree descriptor, tree pstat)
STRIP_NOPS (var);
/* Parameter is the address of the data component. */
- tmp = build_call_expr (gfor_fndecl_deallocate, 2, var, pstat);
+ tmp = gfc_deallocate_with_status (var, pstat, false);
gfc_add_expr_to_block (&block, tmp);
/* Zero the data pointer. */
@@ -3927,7 +3898,7 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody)
if (sym->ts.type == BT_CHARACTER
&& onstack && !INTEGER_CST_P (sym->ts.cl->backend_decl))
{
- gfc_trans_init_string_length (sym->ts.cl, &block);
+ gfc_conv_string_length (sym->ts.cl, &block);
gfc_trans_vla_type_sizes (sym, &block);
@@ -3951,7 +3922,7 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody)
if (sym->ts.type == BT_CHARACTER
&& !INTEGER_CST_P (sym->ts.cl->backend_decl))
- gfc_trans_init_string_length (sym->ts.cl, &block);
+ gfc_conv_string_length (sym->ts.cl, &block);
size = gfc_trans_array_bounds (type, sym, &offset, &block);
@@ -4017,7 +3988,7 @@ gfc_trans_g77_array (gfc_symbol * sym, tree body)
if (sym->ts.type == BT_CHARACTER
&& TREE_CODE (sym->ts.cl->backend_decl) == VAR_DECL)
- gfc_trans_init_string_length (sym->ts.cl, &block);
+ gfc_conv_string_length (sym->ts.cl, &block);
/* Evaluate the bounds of the array. */
gfc_trans_array_bounds (type, sym, &offset, &block);
@@ -4109,7 +4080,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
if (sym->ts.type == BT_CHARACTER
&& TREE_CODE (sym->ts.cl->backend_decl) == VAR_DECL)
- gfc_trans_init_string_length (sym->ts.cl, &block);
+ gfc_conv_string_length (sym->ts.cl, &block);
checkparm = (sym->as->type == AS_EXPLICIT && flag_bounds_check);
@@ -4548,63 +4519,18 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
loop.temp_ss = gfc_get_ss ();
loop.temp_ss->type = GFC_SS_TEMP;
loop.temp_ss->next = gfc_ss_terminator;
+
+ if (expr->ts.type == BT_CHARACTER && !expr->ts.cl->backend_decl)
+ gfc_conv_string_length (expr->ts.cl, &se->pre);
+
+ loop.temp_ss->data.temp.type = gfc_typenode_for_spec (&expr->ts);
+
if (expr->ts.type == BT_CHARACTER)
- {
- if (expr->ts.cl == NULL)
- {
- /* This had better be a substring reference! */
- gfc_ref *char_ref = expr->ref;
- for (; char_ref; char_ref = char_ref->next)
- if (char_ref->type == REF_SUBSTRING)
- {
- mpz_t char_len;
- expr->ts.cl = gfc_get_charlen ();
- expr->ts.cl->next = char_ref->u.ss.length->next;
- char_ref->u.ss.length->next = expr->ts.cl;
-
- mpz_init_set_ui (char_len, 1);
- mpz_add (char_len, char_len,
- char_ref->u.ss.end->value.integer);
- mpz_sub (char_len, char_len,
- char_ref->u.ss.start->value.integer);
- expr->ts.cl->backend_decl
- = gfc_conv_mpz_to_tree (char_len,
- gfc_default_character_kind);
- /* Cast is necessary for *-charlen refs. */
- expr->ts.cl->backend_decl
- = convert (gfc_charlen_type_node,
- expr->ts.cl->backend_decl);
- mpz_clear (char_len);
- break;
- }
- gcc_assert (char_ref != NULL);
- loop.temp_ss->data.temp.type
- = gfc_typenode_for_spec (&expr->ts);
- loop.temp_ss->string_length = expr->ts.cl->backend_decl;
- }
- else if (expr->ts.cl->length
- && expr->ts.cl->length->expr_type == EXPR_CONSTANT)
- {
- gfc_conv_const_charlen (expr->ts.cl);
- loop.temp_ss->data.temp.type
- = gfc_typenode_for_spec (&expr->ts);
- loop.temp_ss->string_length
- = TYPE_SIZE_UNIT (loop.temp_ss->data.temp.type);
- }
- else
- {
- loop.temp_ss->data.temp.type
- = gfc_typenode_for_spec (&expr->ts);
- loop.temp_ss->string_length = expr->ts.cl->backend_decl;
- }
- se->string_length = loop.temp_ss->string_length;
- }
+ loop.temp_ss->string_length = expr->ts.cl->backend_decl;
else
- {
- loop.temp_ss->data.temp.type
- = gfc_typenode_for_spec (&expr->ts);
- loop.temp_ss->string_length = NULL;
- }
+ loop.temp_ss->string_length = NULL;
+
+ se->string_length = loop.temp_ss->string_length;
loop.temp_ss->data.temp.dimen = loop.dimen;
gfc_add_ss_to_loop (&loop, loop.temp_ss);
}
@@ -4712,7 +4638,10 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
tmp = gfc_conv_descriptor_dtype (parm);
gfc_add_modify_expr (&loop.pre, tmp, gfc_get_dtype (parmtype));
- if (se->direct_byref)
+ /* Set offset for assignments to pointer only to zero if it is not
+ the full array. */
+ if (se->direct_byref
+ && info->ref && info->ref->u.ar.type != AR_FULL)
base = gfc_index_zero_node;
else if (GFC_ARRAY_TYPE_P (TREE_TYPE (desc)))
base = gfc_evaluate_now (gfc_conv_array_offset (desc), &loop.pre);
@@ -4763,12 +4692,11 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
from = loop.from[dim];
to = loop.to[dim];
- /* If we have an array section or are assigning to a pointer,
- make sure that the lower bound is 1. References to the full
+ /* If we have an array section or are assigning make sure that
+ the lower bound is 1. References to the full
array should otherwise keep the original bounds. */
if ((!info->ref
- || info->ref->u.ar.type != AR_FULL
- || se->direct_byref)
+ || info->ref->u.ar.type != AR_FULL)
&& !integer_onep (from))
{
tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type,
@@ -4788,7 +4716,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
stride = fold_build2 (MULT_EXPR, gfc_array_index_type,
stride, info->stride[dim]);
- if (se->direct_byref)
+ if (se->direct_byref && info->ref && info->ref->u.ar.type != AR_FULL)
{
base = fold_build2 (MINUS_EXPR, TREE_TYPE (base),
base, stride);
@@ -4824,7 +4752,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
}
if ((se->direct_byref || GFC_ARRAY_TYPE_P (TREE_TYPE (desc)))
- && !se->data_not_needed)
+ && !se->data_not_needed)
{
/* Set the offset. */
tmp = gfc_conv_descriptor_offset (parm);
@@ -4996,7 +4924,6 @@ tree
gfc_trans_dealloc_allocated (tree descriptor)
{
tree tmp;
- tree ptr;
tree var;
stmtblock_t block;
@@ -5004,13 +4931,11 @@ gfc_trans_dealloc_allocated (tree descriptor)
var = gfc_conv_descriptor_data_get (descriptor);
STRIP_NOPS (var);
- tmp = gfc_create_var (gfc_array_index_type, NULL);
- ptr = build_fold_addr_expr (tmp);
- /* Call array_deallocate with an int* present in the second argument.
+ /* Call array_deallocate with an int * present in the second argument.
Although it is ignored here, it's presence ensures that arrays that
are already deallocated are ignored. */
- tmp = build_call_expr (gfor_fndecl_deallocate, 2, var, ptr);
+ tmp = gfc_deallocate_with_status (var, NULL_TREE, true);
gfc_add_expr_to_block (&block, tmp);
/* Zero the data pointer. */
@@ -5337,7 +5262,7 @@ gfc_trans_deferred_array (gfc_symbol * sym, tree body)
if (sym->ts.type == BT_CHARACTER
&& !INTEGER_CST_P (sym->ts.cl->backend_decl))
{
- gfc_trans_init_string_length (sym->ts.cl, &fnblock);
+ gfc_conv_string_length (sym->ts.cl, &fnblock);
gfc_trans_vla_type_sizes (sym, &fnblock);
}
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index e9b94802190..109a18707b4 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -73,10 +73,6 @@ tree gfc_static_ctors;
/* Function declarations for builtin library functions. */
-tree gfor_fndecl_internal_realloc;
-tree gfor_fndecl_allocate;
-tree gfor_fndecl_allocate_array;
-tree gfor_fndecl_deallocate;
tree gfor_fndecl_pause_numeric;
tree gfor_fndecl_pause_string;
tree gfor_fndecl_stop_numeric;
@@ -1458,25 +1454,8 @@ create_function_arglist (gfc_symbol * sym)
if (!f->sym->ts.cl->length)
{
TREE_USED (length) = 1;
- if (!f->sym->ts.cl->backend_decl)
- f->sym->ts.cl->backend_decl = length;
- else
- {
- /* there is already another variable using this
- gfc_charlen node, build a new one for this variable
- and chain it into the list of gfc_charlens.
- This happens for e.g. in the case
- CHARACTER(*)::c1,c2
- since CHARACTER declarations on the same line share
- the same gfc_charlen node. */
- gfc_charlen *cl;
-
- cl = gfc_get_charlen ();
- cl->backend_decl = length;
- cl->next = f->sym->ts.cl->next;
- f->sym->ts.cl->next = cl;
- f->sym->ts.cl = cl;
- }
+ gcc_assert (!f->sym->ts.cl->backend_decl);
+ f->sym->ts.cl->backend_decl = length;
}
hidden_typelist = TREE_CHAIN (hidden_typelist);
@@ -2290,35 +2269,10 @@ void
gfc_build_builtin_function_decls (void)
{
tree gfc_int4_type_node = gfc_get_int_type (4);
- tree gfc_pint4_type_node = build_pointer_type (gfc_int4_type_node);
-
- gfor_fndecl_internal_realloc =
- gfc_build_library_function_decl (get_identifier
- (PREFIX("internal_realloc")),
- pvoid_type_node, 2, pvoid_type_node,
- gfc_array_index_type);
-
- gfor_fndecl_allocate =
- gfc_build_library_function_decl (get_identifier (PREFIX("allocate")),
- pvoid_type_node, 2,
- gfc_array_index_type, gfc_pint4_type_node);
- DECL_IS_MALLOC (gfor_fndecl_allocate) = 1;
-
- gfor_fndecl_allocate_array =
- gfc_build_library_function_decl (get_identifier (PREFIX("allocate_array")),
- pvoid_type_node, 3, pvoid_type_node,
- gfc_array_index_type, gfc_pint4_type_node);
- DECL_IS_MALLOC (gfor_fndecl_allocate_array) = 1;
-
- gfor_fndecl_deallocate =
- gfc_build_library_function_decl (get_identifier (PREFIX("deallocate")),
- void_type_node, 2, pvoid_type_node,
- gfc_pint4_type_node);
gfor_fndecl_stop_numeric =
gfc_build_library_function_decl (get_identifier (PREFIX("stop_numeric")),
void_type_node, 1, gfc_int4_type_node);
-
/* Stop doesn't return. */
TREE_THIS_VOLATILE (gfor_fndecl_stop_numeric) = 1;
@@ -2420,7 +2374,7 @@ gfc_trans_dummy_character (gfc_symbol *sym, gfc_charlen *cl, tree fnbody)
gfc_start_block (&body);
/* Evaluate the string length expression. */
- gfc_trans_init_string_length (cl, &body);
+ gfc_conv_string_length (cl, &body);
gfc_trans_vla_type_sizes (sym, &body);
@@ -2444,7 +2398,7 @@ gfc_trans_auto_character_variable (gfc_symbol * sym, tree fnbody)
gfc_start_block (&body);
/* Evaluate the string length expression. */
- gfc_trans_init_string_length (sym->ts.cl, &body);
+ gfc_conv_string_length (sym->ts.cl, &body);
gfc_trans_vla_type_sizes (sym, &body);
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 02bd91d2860..99f180a1771 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -220,10 +220,9 @@ gfc_get_expr_charlen (gfc_expr *e)
value. */
void
-gfc_trans_init_string_length (gfc_charlen * cl, stmtblock_t * pblock)
+gfc_conv_string_length (gfc_charlen * cl, stmtblock_t * pblock)
{
gfc_se se;
- tree tmp;
gfc_init_se (&se, NULL);
gfc_conv_expr_type (&se, cl->length, gfc_charlen_type_node);
@@ -231,8 +230,10 @@ gfc_trans_init_string_length (gfc_charlen * cl, stmtblock_t * pblock)
build_int_cst (gfc_charlen_type_node, 0));
gfc_add_block_to_block (pblock, &se.pre);
- tmp = cl->backend_decl;
- gfc_add_modify_expr (pblock, tmp, se.expr);
+ if (cl->backend_decl)
+ gfc_add_modify_expr (pblock, cl->backend_decl, se.expr);
+ else
+ cl->backend_decl = gfc_evaluate_now (se.expr, pblock);
}
@@ -1823,6 +1824,9 @@ gfc_conv_aliased_arg (gfc_se * parmse, gfc_expr * expr,
gfc_conv_ss_startstride (&loop);
/* Build an ss for the temporary. */
+ if (expr->ts.type == BT_CHARACTER && !expr->ts.cl->backend_decl)
+ gfc_conv_string_length (expr->ts.cl, &parmse->pre);
+
base_type = gfc_typenode_for_spec (&expr->ts);
if (GFC_ARRAY_TYPE_P (base_type)
|| GFC_DESCRIPTOR_TYPE_P (base_type))
@@ -1833,39 +1837,11 @@ gfc_conv_aliased_arg (gfc_se * parmse, gfc_expr * expr,
loop.temp_ss->data.temp.type = base_type;
if (expr->ts.type == BT_CHARACTER)
- {
- gfc_ref *char_ref = expr->ref;
-
- for (; char_ref; char_ref = char_ref->next)
- if (char_ref->type == REF_SUBSTRING)
- {
- gfc_se tmp_se;
-
- expr->ts.cl = gfc_get_charlen ();
- expr->ts.cl->next = char_ref->u.ss.length->next;
- char_ref->u.ss.length->next = expr->ts.cl;
-
- gfc_init_se (&tmp_se, NULL);
- gfc_conv_expr_type (&tmp_se, char_ref->u.ss.end,
- gfc_array_index_type);
- tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type,
- tmp_se.expr, gfc_index_one_node);
- tmp = gfc_evaluate_now (tmp, &parmse->pre);
- gfc_init_se (&tmp_se, NULL);
- gfc_conv_expr_type (&tmp_se, char_ref->u.ss.start,
- gfc_array_index_type);
- tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type,
- tmp, tmp_se.expr);
- tmp = fold_convert (gfc_charlen_type_node, tmp);
- expr->ts.cl->backend_decl = tmp;
-
- break;
- }
- loop.temp_ss->data.temp.type
- = gfc_typenode_for_spec (&expr->ts);
- loop.temp_ss->string_length = expr->ts.cl->backend_decl;
- }
+ loop.temp_ss->string_length = expr->ts.cl->backend_decl;
+ else
+ loop.temp_ss->string_length = NULL;
+ parmse->string_length = loop.temp_ss->string_length;
loop.temp_ss->data.temp.dimen = loop.dimen;
loop.temp_ss->next = gfc_ss_terminator;
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 2e8b8a010ac..3c43a8432b0 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -1420,10 +1420,9 @@ gfc_conv_intrinsic_ttynam (gfc_se * se, gfc_expr * expr)
/* Get the minimum/maximum value of all the parameters.
minmax (a1, a2, a3, ...)
{
- if (a2 .op. a1 || isnan(a1))
+ mvar = a1;
+ if (a2 .op. mvar || isnan(mvar))
mvar = a2;
- else
- mvar = a1;
if (a3 .op. mvar || isnan(mvar))
mvar = a3;
...
@@ -1436,17 +1435,14 @@ gfc_conv_intrinsic_ttynam (gfc_se * se, gfc_expr * expr)
static void
gfc_conv_intrinsic_minmax (gfc_se * se, gfc_expr * expr, int op)
{
- tree limit;
tree tmp;
tree mvar;
tree val;
tree thencase;
- tree elsecase;
tree *args;
tree type;
gfc_actual_arglist *argexpr;
- unsigned int i;
- unsigned int nargs;
+ unsigned int i, nargs;
nargs = gfc_intrinsic_argument_list_length (expr);
args = alloca (sizeof (tree) * nargs);
@@ -1454,50 +1450,15 @@ gfc_conv_intrinsic_minmax (gfc_se * se, gfc_expr * expr, int op)
gfc_conv_intrinsic_function_args (se, expr, args, nargs);
type = gfc_typenode_for_spec (&expr->ts);
- /* The first and second arguments should be present, if they are
- optional dummy arguments. */
argexpr = expr->value.function.actual;
- if (argexpr->expr->expr_type == EXPR_VARIABLE
- && argexpr->expr->symtree->n.sym->attr.optional
- && TREE_CODE (args[0]) == INDIRECT_REF)
- {
- /* Check the first argument. */
- tree cond;
- char *msg;
-
- asprintf (&msg, "First argument of '%s' intrinsic should be present",
- expr->symtree->n.sym->name);
- cond = build2 (EQ_EXPR, boolean_type_node, TREE_OPERAND (args[0], 0),
- build_int_cst (TREE_TYPE (TREE_OPERAND (args[0], 0)), 0));
- gfc_trans_runtime_check (cond, &se->pre, &expr->where, msg);
- gfc_free (msg);
- }
-
- if (argexpr->next->expr->expr_type == EXPR_VARIABLE
- && argexpr->next->expr->symtree->n.sym->attr.optional
- && TREE_CODE (args[1]) == INDIRECT_REF)
- {
- /* Check the second argument. */
- tree cond;
- char *msg;
-
- asprintf (&msg, "Second argument of '%s' intrinsic should be present",
- expr->symtree->n.sym->name);
- cond = build2 (EQ_EXPR, boolean_type_node, TREE_OPERAND (args[1], 0),
- build_int_cst (TREE_TYPE (TREE_OPERAND (args[1], 0)), 0));
- gfc_trans_runtime_check (cond, &se->pre, &expr->where, msg);
- gfc_free (msg);
- }
-
- limit = args[0];
- if (TREE_TYPE (limit) != type)
- limit = convert (type, limit);
+ if (TREE_TYPE (args[0]) != type)
+ args[0] = convert (type, args[0]);
/* Only evaluate the argument once. */
- if (TREE_CODE (limit) != VAR_DECL && !TREE_CONSTANT (limit))
- limit = gfc_evaluate_now (limit, &se->pre);
+ if (TREE_CODE (args[0]) != VAR_DECL && !TREE_CONSTANT (args[0]))
+ args[0] = gfc_evaluate_now (args[0], &se->pre);
mvar = gfc_create_var (type, "M");
- elsecase = build2_v (MODIFY_EXPR, mvar, limit);
+ gfc_add_modify_expr (&se->pre, mvar, args[0]);
for (i = 1, argexpr = argexpr->next; i < nargs; i++)
{
tree cond, isnan;
@@ -1505,7 +1466,7 @@ gfc_conv_intrinsic_minmax (gfc_se * se, gfc_expr * expr, int op)
val = args[i];
/* Handle absent optional arguments by ignoring the comparison. */
- if (i > 0 && argexpr->expr->expr_type == EXPR_VARIABLE
+ if (argexpr->expr->expr_type == EXPR_VARIABLE
&& argexpr->expr->symtree->n.sym->attr.optional
&& TREE_CODE (val) == INDIRECT_REF)
cond = build2 (NE_EXPR, boolean_type_node, TREE_OPERAND (val, 0),
@@ -1521,25 +1482,23 @@ gfc_conv_intrinsic_minmax (gfc_se * se, gfc_expr * expr, int op)
thencase = build2_v (MODIFY_EXPR, mvar, convert (type, val));
- tmp = build2 (op, boolean_type_node, convert (type, val), limit);
+ tmp = build2 (op, boolean_type_node, convert (type, val), mvar);
/* FIXME: When the IEEE_ARITHMETIC module is implemented, the call to
__builtin_isnan might be made dependent on that module being loaded,
to help performance of programs that don't rely on IEEE semantics. */
- if (FLOAT_TYPE_P (TREE_TYPE (limit)))
+ if (FLOAT_TYPE_P (TREE_TYPE (mvar)))
{
- isnan = build_call_expr (built_in_decls[BUILT_IN_ISNAN], 1, limit);
+ isnan = build_call_expr (built_in_decls[BUILT_IN_ISNAN], 1, mvar);
tmp = fold_build2 (TRUTH_OR_EXPR, boolean_type_node, tmp,
fold_convert (boolean_type_node, isnan));
}
- tmp = build3_v (COND_EXPR, tmp, thencase, elsecase);
+ tmp = build3_v (COND_EXPR, tmp, thencase, build_empty_stmt ());
if (cond != NULL_TREE)
tmp = build3_v (COND_EXPR, cond, tmp, build_empty_stmt ());
gfc_add_expr_to_block (&se->pre, tmp);
- elsecase = build_empty_stmt ();
- limit = mvar;
argexpr = argexpr->next;
}
se->expr = mvar;
@@ -2800,6 +2759,22 @@ gfc_conv_intrinsic_isnan (gfc_se * se, gfc_expr * expr)
se->expr = fold_convert (gfc_typenode_for_spec (&expr->ts), se->expr);
}
+
+/* Intrinsics IS_IOSTAT_END and IS_IOSTAT_EOR just need to compare
+ their argument against a constant integer value. */
+
+static void
+gfc_conv_has_intvalue (gfc_se * se, gfc_expr * expr, const int value)
+{
+ tree arg;
+
+ gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
+ se->expr = fold_build2 (EQ_EXPR, gfc_typenode_for_spec (&expr->ts),
+ arg, build_int_cst (TREE_TYPE (arg), value));
+}
+
+
+
/* MERGE (tsource, fsource, mask) = mask ? tsource : fsource. */
static void
@@ -3952,6 +3927,14 @@ gfc_conv_intrinsic_function (gfc_se * se, gfc_expr * expr)
gfc_conv_intrinsic_bitop (se, expr, BIT_IOR_EXPR);
break;
+ case GFC_ISYM_IS_IOSTAT_END:
+ gfc_conv_has_intvalue (se, expr, -1);
+ break;
+
+ case GFC_ISYM_IS_IOSTAT_EOR:
+ gfc_conv_has_intvalue (se, expr, -2);
+ break;
+
case GFC_ISYM_ISNAN:
gfc_conv_intrinsic_isnan (se, expr);
break;
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index 1af10369824..047c2b82ca5 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -40,7 +40,7 @@ along with GCC; see the file COPYING3. If not see
than the DECL itself. */
bool
-gfc_omp_privatize_by_reference (tree decl)
+gfc_omp_privatize_by_reference (const_tree decl)
{
tree type = TREE_TYPE (decl);
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 47e08229fe9..f900ec52f4b 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -3565,11 +3565,7 @@ gfc_trans_allocate (gfc_code * code)
TREE_USED (error_label) = 1;
}
else
- {
- pstat = integer_zero_node;
- stat = error_label = NULL_TREE;
- }
-
+ pstat = stat = error_label = NULL_TREE;
for (al = code->ext.alloc_list; al != NULL; al = al->next)
{
@@ -3590,7 +3586,7 @@ gfc_trans_allocate (gfc_code * code)
if (expr->ts.type == BT_CHARACTER && tmp == NULL_TREE)
tmp = se.string_length;
- tmp = build_call_expr (gfor_fndecl_allocate, 2, tmp, pstat);
+ tmp = gfc_allocate_with_status (&se.pre, tmp, pstat);
tmp = build2 (MODIFY_EXPR, void_type_node, se.expr,
fold_convert (TREE_TYPE (se.expr), tmp));
gfc_add_expr_to_block (&se.pre, tmp);
@@ -3679,10 +3675,7 @@ gfc_trans_deallocate (gfc_code * code)
gfc_add_modify_expr (&block, astat, build_int_cst (TREE_TYPE (astat), 0));
}
else
- {
- pstat = apstat = null_pointer_node;
- stat = astat = NULL_TREE;
- }
+ pstat = apstat = stat = astat = NULL_TREE;
for (al = code->ext.alloc_list; al != NULL; al = al->next)
{
@@ -3720,7 +3713,7 @@ gfc_trans_deallocate (gfc_code * code)
tmp = gfc_array_deallocate (se.expr, pstat);
else
{
- tmp = build_call_expr (gfor_fndecl_deallocate, 2, se.expr, pstat);
+ tmp = gfc_deallocate_with_status (se.expr, pstat, false);
gfc_add_expr_to_block (&se.pre, tmp);
tmp = build2 (MODIFY_EXPR, void_type_node,
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index e1cac5de9df..b7c9c53bf21 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see
#include "trans-types.h"
#include "trans-const.h"
#include "real.h"
+#include "flags.h"
#if (GFC_MAX_DIMENSIONS < 10)
@@ -1232,7 +1233,7 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed)
{
/* Fill in the stride and bound components of the type. */
if (known_stride)
- tmp = gfc_conv_mpz_to_tree (stride, gfc_index_integer_kind);
+ tmp = gfc_conv_mpz_to_tree (stride, gfc_index_integer_kind);
else
tmp = NULL_TREE;
GFC_TYPE_ARRAY_STRIDE (type, n) = tmp;
@@ -1330,6 +1331,24 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed)
mpz_clear (stride);
mpz_clear (delta);
+ /* In debug info represent packed arrays as multi-dimensional
+ if they have rank > 1 and with proper bounds, instead of flat
+ arrays. */
+ if (known_stride && write_symbols != NO_DEBUG)
+ {
+ tree gtype = etype, rtype, type_decl;
+
+ for (n = as->rank - 1; n >= 0; n--)
+ {
+ rtype = build_range_type (gfc_array_index_type,
+ GFC_TYPE_ARRAY_LBOUND (type, n),
+ GFC_TYPE_ARRAY_UBOUND (type, n));
+ gtype = build_array_type (gtype, rtype);
+ }
+ TYPE_NAME (type) = type_decl = build_decl (TYPE_DECL, NULL, gtype);
+ DECL_ORIGINAL_TYPE (type_decl) = gtype;
+ }
+
if (packed != PACKED_STATIC || !known_stride)
{
/* For dummy arrays and automatic (heap allocated) arrays we
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 7092ac8cd0a..1113e80fdc3 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -473,6 +473,222 @@ gfc_call_malloc (stmtblock_t * block, tree type, tree size)
return res;
}
+/* The status variable of allocate statement is set to ERROR_ALLOCATION
+ when the allocation wasn't successful. This value needs to be kept in
+ sync with libgfortran/libgfortran.h. */
+#define ERROR_ALLOCATION 5014
+
+/* Allocate memory, using an optional status argument.
+
+ This function follows the following pseudo-code:
+
+ void *
+ allocate (size_t size, integer_type* stat)
+ {
+ void *newmem;
+
+ if (stat)
+ *stat = 0;
+
+ // The only time this can happen is the size wraps around.
+ if (size < 0)
+ {
+ if (stat)
+ {
+ *stat = ERROR_ALLOCATION;
+ newmem = NULL;
+ }
+ else
+ runtime_error ("Attempt to allocate negative amount of memory. "
+ "Possible integer overflow");
+ }
+ else
+ {
+ newmem = malloc (MAX (size, 1));
+ if (newmem == NULL)
+ {
+ if (stat)
+ *stat = ERROR_ALLOCATION;
+ else
+ runtime_error ("Out of memory");
+ }
+ }
+
+ return newmem;
+ } */
+tree
+gfc_allocate_with_status (stmtblock_t * block, tree size, tree status)
+{
+ stmtblock_t alloc_block;
+ tree res, tmp, error, msg, cond;
+ tree status_type = status ? TREE_TYPE (TREE_TYPE (status)) : NULL_TREE;
+
+ /* Evaluate size only once, and make sure it has the right type. */
+ size = gfc_evaluate_now (size, block);
+ if (TREE_TYPE (size) != TREE_TYPE (size_type_node))
+ size = fold_convert (size_type_node, size);
+
+ /* Create a variable to hold the result. */
+ res = gfc_create_var (pvoid_type_node, NULL);
+
+ /* Set the optional status variable to zero. */
+ if (status != NULL_TREE && !integer_zerop (status))
+ {
+ tmp = fold_build2 (MODIFY_EXPR, status_type,
+ build1 (INDIRECT_REF, status_type, status),
+ build_int_cst (status_type, 0));
+ tmp = fold_build3 (COND_EXPR, void_type_node,
+ fold_build2 (NE_EXPR, boolean_type_node,
+ status, build_int_cst (status_type, 0)),
+ tmp, build_empty_stmt ());
+ gfc_add_expr_to_block (block, tmp);
+ }
+
+ /* Generate the block of code handling (size < 0). */
+ msg = gfc_build_addr_expr (pchar_type_node, gfc_build_cstring_const
+ ("Attempt to allocate negative amount of memory. "
+ "Possible integer overflow"));
+ error = build_call_expr (gfor_fndecl_runtime_error, 1, msg);
+
+ if (status != NULL_TREE && !integer_zerop (status))
+ {
+ /* Set the status variable if it's present. */
+ stmtblock_t set_status_block;
+
+ gfc_start_block (&set_status_block);
+ gfc_add_modify_expr (&set_status_block,
+ build1 (INDIRECT_REF, status_type, status),
+ build_int_cst (status_type, ERROR_ALLOCATION));
+ gfc_add_modify_expr (&set_status_block, res,
+ build_int_cst (pvoid_type_node, 0));
+
+ tmp = fold_build2 (EQ_EXPR, boolean_type_node, status,
+ build_int_cst (status_type, 0));
+ error = fold_build3 (COND_EXPR, void_type_node, tmp, error,
+ gfc_finish_block (&set_status_block));
+ }
+
+ /* The allocation itself. */
+ gfc_start_block (&alloc_block);
+ gfc_add_modify_expr (&alloc_block, res,
+ build_call_expr (built_in_decls[BUILT_IN_MALLOC], 1,
+ fold_build2 (MAX_EXPR, size_type_node,
+ size,
+ build_int_cst (size_type_node, 1))));
+
+ msg = gfc_build_addr_expr (pchar_type_node,
+ gfc_build_cstring_const ("Out of memory"));
+ tmp = build_call_expr (gfor_fndecl_os_error, 1, msg);
+
+ if (status != NULL_TREE && !integer_zerop (status))
+ {
+ /* Set the status variable if it's present. */
+ tree tmp2;
+
+ cond = fold_build2 (EQ_EXPR, boolean_type_node, status,
+ build_int_cst (status_type, 0));
+ tmp2 = fold_build2 (MODIFY_EXPR, status_type,
+ build1 (INDIRECT_REF, status_type, status),
+ build_int_cst (status_type, ERROR_ALLOCATION));
+ tmp = fold_build3 (COND_EXPR, void_type_node, cond, tmp,
+ tmp2);
+ }
+
+ tmp = fold_build3 (COND_EXPR, void_type_node,
+ fold_build2 (EQ_EXPR, boolean_type_node, res,
+ build_int_cst (pvoid_type_node, 0)),
+ tmp, build_empty_stmt ());
+ gfc_add_expr_to_block (&alloc_block, tmp);
+
+ cond = fold_build2 (LT_EXPR, boolean_type_node, size,
+ build_int_cst (TREE_TYPE (size), 0));
+ tmp = fold_build3 (COND_EXPR, void_type_node, cond, error,
+ gfc_finish_block (&alloc_block));
+ gfc_add_expr_to_block (block, tmp);
+
+ return res;
+}
+
+
+/* Generate code for an ALLOCATE statement when the argument is an
+ allocatable array. If the array is currently allocated, it is an
+ error to allocate it again.
+
+ This function follows the following pseudo-code:
+
+ void *
+ allocate_array (void *mem, size_t size, integer_type *stat)
+ {
+ if (mem == NULL)
+ return allocate (size, stat);
+ else
+ {
+ if (stat)
+ {
+ free (mem);
+ mem = allocate (size, stat);
+ *stat = ERROR_ALLOCATION;
+ return mem;
+ }
+ else
+ runtime_error ("Attempting to allocate already allocated array");
+ } */
+tree
+gfc_allocate_array_with_status (stmtblock_t * block, tree mem, tree size,
+ tree status)
+{
+ stmtblock_t alloc_block;
+ tree res, tmp, null_mem, alloc, error, msg;
+ tree type = TREE_TYPE (mem);
+
+ if (TREE_TYPE (size) != TREE_TYPE (size_type_node))
+ size = fold_convert (size_type_node, size);
+
+ /* Create a variable to hold the result. */
+ res = gfc_create_var (pvoid_type_node, NULL);
+ null_mem = fold_build2 (EQ_EXPR, boolean_type_node, mem,
+ build_int_cst (type, 0));
+
+ /* If mem is NULL, we call gfc_allocate_with_status. */
+ gfc_start_block (&alloc_block);
+ tmp = gfc_allocate_with_status (&alloc_block, size, status);
+ gfc_add_modify_expr (&alloc_block, res, fold_convert (type, tmp));
+ alloc = gfc_finish_block (&alloc_block);
+
+ /* Otherwise, we issue a runtime error or set the status variable. */
+ msg = gfc_build_addr_expr (pchar_type_node, gfc_build_cstring_const
+ ("Attempting to allocate already allocated array"));
+ error = build_call_expr (gfor_fndecl_runtime_error, 1, msg);
+
+ if (status != NULL_TREE && !integer_zerop (status))
+ {
+ tree status_type = TREE_TYPE (TREE_TYPE (status));
+ stmtblock_t set_status_block;
+
+ gfc_start_block (&set_status_block);
+ tmp = build_call_expr (built_in_decls[BUILT_IN_FREE], 1,
+ fold_convert (pvoid_type_node, mem));
+ gfc_add_expr_to_block (&set_status_block, tmp);
+
+ tmp = gfc_allocate_with_status (&set_status_block, size, status);
+ gfc_add_modify_expr (&set_status_block, res, fold_convert (type, tmp));
+
+ gfc_add_modify_expr (&set_status_block,
+ build1 (INDIRECT_REF, status_type, status),
+ build_int_cst (status_type, ERROR_ALLOCATION));
+
+ tmp = fold_build2 (EQ_EXPR, boolean_type_node, status,
+ build_int_cst (status_type, 0));
+ error = fold_build3 (COND_EXPR, void_type_node, tmp, error,
+ gfc_finish_block (&set_status_block));
+ }
+
+ tmp = fold_build3 (COND_EXPR, void_type_node, null_mem, alloc, error);
+ gfc_add_expr_to_block (block, tmp);
+
+ return res;
+}
+
/* Free a given variable, if it's not NULL. */
tree
@@ -497,6 +713,163 @@ gfc_call_free (tree var)
}
+
+/* User-deallocate; we emit the code directly from the front-end, and the
+ logic is the same as the previous library function:
+
+ void
+ deallocate (void *pointer, GFC_INTEGER_4 * stat)
+ {
+ if (!pointer)
+ {
+ if (stat)
+ *stat = 1;
+ else
+ runtime_error ("Attempt to DEALLOCATE unallocated memory.");
+ }
+ else
+ {
+ free (pointer);
+ if (stat)
+ *stat = 0;
+ }
+ }
+
+ In this front-end version, status doesn't have to be GFC_INTEGER_4.
+ Moreover, if CAN_FAIL is true, then we will not emit a runtime error,
+ even when no status variable is passed to us (this is used for
+ unconditional deallocation generated by the front-end at end of
+ each procedure). */
+tree
+gfc_deallocate_with_status (tree pointer, tree status, bool can_fail)
+{
+ stmtblock_t null, non_null;
+ tree cond, tmp, error, msg;
+
+ cond = fold_build2 (EQ_EXPR, boolean_type_node, pointer,
+ build_int_cst (TREE_TYPE (pointer), 0));
+
+ /* When POINTER is NULL, we set STATUS to 1 if it's present, otherwise
+ we emit a runtime error. */
+ gfc_start_block (&null);
+ if (!can_fail)
+ {
+ msg = gfc_build_addr_expr (pchar_type_node, gfc_build_cstring_const
+ ("Attempt to DEALLOCATE unallocated memory."));
+ error = build_call_expr (gfor_fndecl_runtime_error, 1, msg);
+ }
+ else
+ error = build_empty_stmt ();
+
+ if (status != NULL_TREE && !integer_zerop (status))
+ {
+ tree status_type = TREE_TYPE (TREE_TYPE (status));
+ tree cond2;
+
+ cond2 = fold_build2 (NE_EXPR, boolean_type_node, status,
+ build_int_cst (TREE_TYPE (status), 0));
+ tmp = fold_build2 (MODIFY_EXPR, status_type,
+ build1 (INDIRECT_REF, status_type, status),
+ build_int_cst (status_type, 1));
+ error = fold_build3 (COND_EXPR, void_type_node, cond2, tmp, error);
+ }
+
+ gfc_add_expr_to_block (&null, error);
+
+ /* When POINTER is not NULL, we free it. */
+ gfc_start_block (&non_null);
+ tmp = build_call_expr (built_in_decls[BUILT_IN_FREE], 1,
+ fold_convert (pvoid_type_node, pointer));
+ gfc_add_expr_to_block (&non_null, tmp);
+
+ if (status != NULL_TREE && !integer_zerop (status))
+ {
+ /* We set STATUS to zero if it is present. */
+ tree status_type = TREE_TYPE (TREE_TYPE (status));
+ tree cond2;
+
+ cond2 = fold_build2 (NE_EXPR, boolean_type_node, status,
+ build_int_cst (TREE_TYPE (status), 0));
+ tmp = fold_build2 (MODIFY_EXPR, status_type,
+ build1 (INDIRECT_REF, status_type, status),
+ build_int_cst (status_type, 0));
+ tmp = fold_build3 (COND_EXPR, void_type_node, cond2, tmp,
+ build_empty_stmt ());
+ gfc_add_expr_to_block (&non_null, tmp);
+ }
+
+ return fold_build3 (COND_EXPR, void_type_node, cond,
+ gfc_finish_block (&null), gfc_finish_block (&non_null));
+}
+
+
+/* Reallocate MEM so it has SIZE bytes of data. This behaves like the
+ following pseudo-code:
+
+void *
+internal_realloc (void *mem, size_t size)
+{
+ if (size < 0)
+ runtime_error ("Attempt to allocate a negative amount of memory.");
+ mem = realloc (mem, size);
+ if (!mem && size != 0)
+ _gfortran_os_error ("Out of memory");
+
+ if (size == 0)
+ return NULL;
+
+ return mem;
+} */
+tree
+gfc_call_realloc (stmtblock_t * block, tree mem, tree size)
+{
+ tree msg, res, negative, zero, null_result, tmp;
+ tree type = TREE_TYPE (mem);
+
+ size = gfc_evaluate_now (size, block);
+
+ if (TREE_TYPE (size) != TREE_TYPE (size_type_node))
+ size = fold_convert (size_type_node, size);
+
+ /* Create a variable to hold the result. */
+ res = gfc_create_var (type, NULL);
+
+ /* size < 0 ? */
+ negative = fold_build2 (LT_EXPR, boolean_type_node, size,
+ build_int_cst (size_type_node, 0));
+ msg = gfc_build_addr_expr (pchar_type_node, gfc_build_cstring_const
+ ("Attempt to allocate a negative amount of memory."));
+ tmp = fold_build3 (COND_EXPR, void_type_node, negative,
+ build_call_expr (gfor_fndecl_runtime_error, 1, msg),
+ build_empty_stmt ());
+ gfc_add_expr_to_block (block, tmp);
+
+ /* Call realloc and check the result. */
+ tmp = build_call_expr (built_in_decls[BUILT_IN_REALLOC], 2,
+ fold_convert (pvoid_type_node, mem), size);
+ gfc_add_modify_expr (block, res, fold_convert (type, tmp));
+ null_result = fold_build2 (EQ_EXPR, boolean_type_node, res,
+ build_int_cst (pvoid_type_node, 0));
+ zero = fold_build2 (EQ_EXPR, boolean_type_node, size,
+ build_int_cst (size_type_node, 0));
+ null_result = fold_build2 (TRUTH_AND_EXPR, boolean_type_node, null_result,
+ zero);
+ msg = gfc_build_addr_expr (pchar_type_node,
+ gfc_build_cstring_const ("Out of memory"));
+ tmp = fold_build3 (COND_EXPR, void_type_node, null_result,
+ build_call_expr (gfor_fndecl_os_error, 1, msg),
+ build_empty_stmt ());
+ gfc_add_expr_to_block (block, tmp);
+
+ /* if (size == 0) then the result is NULL. */
+ tmp = fold_build2 (MODIFY_EXPR, type, res, build_int_cst (type, 0));
+ tmp = fold_build3 (COND_EXPR, void_type_node, zero, tmp,
+ build_empty_stmt ());
+ gfc_add_expr_to_block (block, tmp);
+
+ return res;
+}
+
/* Add a statement to a block. */
void
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index 829551e7b45..389d0378ff0 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -340,7 +340,7 @@ tree gfc_conv_string_tmp (gfc_se *, tree, tree);
/* Get the string length variable belonging to an expression. */
tree gfc_get_expr_charlen (gfc_expr *);
/* Initialize a string length variable. */
-void gfc_trans_init_string_length (gfc_charlen *, stmtblock_t *);
+void gfc_conv_string_length (gfc_charlen *, stmtblock_t *);
/* Ensure type sizes can be gimplified. */
void gfc_trans_vla_type_sizes (gfc_symbol *, stmtblock_t *);
@@ -450,6 +450,18 @@ tree gfc_call_free (tree);
/* Allocate memory after performing a few checks. */
tree gfc_call_malloc (stmtblock_t *, tree, tree);
+/* Allocate memory for arrays, with optional status variable. */
+tree gfc_allocate_array_with_status (stmtblock_t *, tree, tree, tree);
+
+/* Allocate memory, with optional status variable. */
+tree gfc_allocate_with_status (stmtblock_t *, tree, tree);
+
+/* Generate code to deallocate an array. */
+tree gfc_deallocate_with_status (tree, tree, bool);
+
+/* Generate code to call realloc(). */
+tree gfc_call_realloc (stmtblock_t *, tree, tree);
+
/* Generate code for an assignment, includes scalarization. */
tree gfc_trans_assignment (gfc_expr *, gfc_expr *, bool);
@@ -474,7 +486,7 @@ tree gfc_truthvalue_conversion (tree);
tree gfc_builtin_function (tree);
/* In trans-openmp.c */
-bool gfc_omp_privatize_by_reference (tree);
+bool gfc_omp_privatize_by_reference (const_tree);
enum omp_clause_default_kind gfc_omp_predetermined_sharing (tree);
tree gfc_omp_clause_default_ctor (tree, tree);
bool gfc_omp_disregard_value_expr (tree, bool);
@@ -483,10 +495,6 @@ struct gimplify_omp_ctx;
void gfc_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *, tree);
/* Runtime library function decls. */
-extern GTY(()) tree gfor_fndecl_internal_realloc;
-extern GTY(()) tree gfor_fndecl_allocate;
-extern GTY(()) tree gfor_fndecl_allocate_array;
-extern GTY(()) tree gfor_fndecl_deallocate;
extern GTY(()) tree gfor_fndecl_pause_numeric;
extern GTY(()) tree gfor_fndecl_pause_string;
extern GTY(()) tree gfor_fndecl_stop_numeric;
diff --git a/gcc/function.c b/gcc/function.c
index edbef6c15a9..015ad131f8b 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1742,17 +1742,17 @@ struct tree_opt_pass pass_instantiate_virtual_regs =
EXP may be a type node or an expression (whose type is tested). */
int
-aggregate_value_p (tree exp, tree fntype)
+aggregate_value_p (const_tree exp, const_tree fntype)
{
int i, regno, nregs;
rtx reg;
- tree type = (TYPE_P (exp)) ? exp : TREE_TYPE (exp);
+ const_tree type = (TYPE_P (exp)) ? exp : TREE_TYPE (exp);
/* DECL node associated with FNTYPE when relevant, which we might need to
check for by-invisible-reference returns, typically for CALL_EXPR input
EXPressions. */
- tree fndecl = NULL_TREE;
+ const_tree fndecl = NULL_TREE;
if (fntype)
switch (TREE_CODE (fntype))
diff --git a/gcc/gcse.c b/gcc/gcse.c
index be026615094..af10db68530 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -1187,6 +1187,7 @@ want_to_gcse_p (rtx x)
case SUBREG:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case CALL:
return 0;
@@ -1283,6 +1284,7 @@ oprs_unchanged_p (const_rtx x, const_rtx insn, int avail_p)
case CONST:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case LABEL_REF:
@@ -2265,6 +2267,7 @@ oprs_not_set_p (const_rtx x, const_rtx insn)
case CONST:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case LABEL_REF:
@@ -2533,6 +2536,7 @@ compute_transp (const_rtx x, int indx, sbitmap *bmap, int set_p)
case CONST:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case LABEL_REF:
@@ -5568,6 +5572,7 @@ extract_mentioned_regs_helper (rtx x, rtx accum)
case CONST:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case LABEL_REF:
diff --git a/gcc/genemit.c b/gcc/genemit.c
index e8c3f48c3fd..caf808e99c9 100644
--- a/gcc/genemit.c
+++ b/gcc/genemit.c
@@ -257,6 +257,7 @@ gen_exp (rtx x, enum rtx_code subroutine_type, char *used)
return;
case CONST_DOUBLE:
+ case CONST_FIXED:
/* These shouldn't be written in MD files. Instead, the appropriate
routines in varasm.c should be called. */
gcc_unreachable ();
diff --git a/gcc/gengenrtl.c b/gcc/gengenrtl.c
index e824ea684c8..89d3011796b 100644
--- a/gcc/gengenrtl.c
+++ b/gcc/gengenrtl.c
@@ -156,7 +156,8 @@ special_rtx (int idx)
static int
excluded_rtx (int idx)
{
- return (strcmp (defs[idx].enumname, "CONST_DOUBLE") == 0);
+ return ((strcmp (defs[idx].enumname, "CONST_DOUBLE") == 0)
+ || (strcmp (defs[idx].enumname, "CONST_FIXED") == 0));
}
/* Place a list of all format specifiers we use into the array FORMAT. */
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index a8702a61efb..ac7c8429fb0 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -357,8 +357,8 @@ call_alloc (void **slot, void *state_p)
static int
compare_ptr_data (const void *p1_p, const void *p2_p)
{
- struct ptr_data *p1 = *(struct ptr_data *const *)p1_p;
- struct ptr_data *p2 = *(struct ptr_data *const *)p2_p;
+ const struct ptr_data *const p1 = *(const struct ptr_data *const *)p1_p;
+ const struct ptr_data *const p2 = *(const struct ptr_data *const *)p2_p;
return (((size_t)p1->new_addr > (size_t)p2->new_addr)
- ((size_t)p1->new_addr < (size_t)p2->new_addr));
}
@@ -794,7 +794,7 @@ static htab_t loc_hash;
static hashval_t
hash_descriptor (const void *p)
{
- const struct loc_descriptor *d = p;
+ const struct loc_descriptor *const d = p;
return htab_hash_pointer (d->function) | d->line;
}
@@ -802,8 +802,8 @@ hash_descriptor (const void *p)
static int
eq_descriptor (const void *p1, const void *p2)
{
- const struct loc_descriptor *d = p1;
- const struct loc_descriptor *d2 = p2;
+ const struct loc_descriptor *const d = p1;
+ const struct loc_descriptor *const d2 = p2;
return (d->file == d2->file && d->line == d2->line
&& d->function == d2->function);
@@ -822,7 +822,7 @@ struct ptr_hash_entry
static hashval_t
hash_ptr (const void *p)
{
- const struct ptr_hash_entry *d = p;
+ const struct ptr_hash_entry *const d = p;
return htab_hash_pointer (d->ptr);
}
@@ -830,7 +830,7 @@ hash_ptr (const void *p)
static int
eq_ptr (const void *p1, const void *p2)
{
- const struct ptr_hash_entry *p = p1;
+ const struct ptr_hash_entry *const p = p1;
return (p->ptr == p2);
}
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index cea79919965..aed8ab76949 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -3654,8 +3654,16 @@ gimplify_modify_expr (tree *expr_p, tree *pre_p, tree *post_p, bool want_value)
|| TREE_CODE (*expr_p) == GIMPLE_MODIFY_STMT
|| TREE_CODE (*expr_p) == INIT_EXPR);
- /* For zero sized types only gimplify the left hand side and right hand side
- as statements and throw away the assignment. */
+ /* See if any simplifications can be done based on what the RHS is. */
+ ret = gimplify_modify_expr_rhs (expr_p, from_p, to_p, pre_p, post_p,
+ want_value);
+ if (ret != GS_UNHANDLED)
+ return ret;
+
+ /* For zero sized types only gimplify the left hand side and right hand
+ side as statements and throw away the assignment. Do this after
+ gimplify_modify_expr_rhs so we handle TARGET_EXPRs of addressable
+ types properly. */
if (zero_sized_type (TREE_TYPE (*from_p)))
{
gimplify_stmt (from_p);
@@ -3666,12 +3674,6 @@ gimplify_modify_expr (tree *expr_p, tree *pre_p, tree *post_p, bool want_value)
return GS_ALL_DONE;
}
- /* See if any simplifications can be done based on what the RHS is. */
- ret = gimplify_modify_expr_rhs (expr_p, from_p, to_p, pre_p, post_p,
- want_value);
- if (ret != GS_UNHANDLED)
- return ret;
-
/* If the value being copied is of variable width, compute the length
of the copy into a WITH_SIZE_EXPR. Note that we need to do this
before gimplifying any of the operands so that we can resolve any
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 27b040fa112..18a5efe03e2 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -328,7 +328,7 @@ static int clock_var;
/* Number of instructions in current scheduling region. */
static int rgn_n_insns;
-static int may_trap_exp (rtx, int);
+static int may_trap_exp (const_rtx, int);
/* Nonzero iff the address is comprised from at most 1 register. */
#define CONST_BASED_ADDRESS_P(x) \
@@ -342,7 +342,7 @@ static int may_trap_exp (rtx, int);
as found by analyzing insn's expression. */
static int
-may_trap_exp (rtx x, int is_store)
+may_trap_exp (const_rtx x, int is_store)
{
enum rtx_code code;
@@ -415,7 +415,7 @@ may_trap_exp (rtx x, int is_store)
being either PFREE or PRISKY. */
int
-haifa_classify_insn (rtx insn)
+haifa_classify_insn (const_rtx insn)
{
rtx pat = PATTERN (insn);
int tmp_class = TRAP_FREE;
@@ -499,7 +499,7 @@ static int rank_for_schedule (const void *, const void *);
static void swap_sort (rtx *, int);
static void queue_insn (rtx, int);
static int schedule_insn (rtx);
-static int find_set_reg_weight (rtx);
+static int find_set_reg_weight (const_rtx);
static void find_insn_reg_weight (basic_block);
static void find_insn_reg_weight1 (rtx);
static void adjust_priority (rtx);
@@ -1358,7 +1358,7 @@ get_ebb_head_tail (basic_block beg, basic_block end, rtx *headp, rtx *tailp)
/* Return nonzero if there are no real insns in the range [ HEAD, TAIL ]. */
int
-no_real_insns_p (rtx head, rtx tail)
+no_real_insns_p (const_rtx head, const_rtx tail)
{
while (head != NEXT_INSN (tail))
{
@@ -1408,7 +1408,7 @@ rm_other_notes (rtx head, rtx tail)
a new register is not needed. */
static int
-find_set_reg_weight (rtx x)
+find_set_reg_weight (const_rtx x)
{
if (GET_CODE (x) == CLOBBER
&& register_operand (SET_DEST (x), VOIDmode))
@@ -4017,7 +4017,7 @@ change_pattern (rtx insn, rtx new_pat)
/* Return true if INSN can potentially be speculated with type DS. */
bool
-sched_insn_is_legitimate_for_speculation_p (rtx insn, ds_t ds)
+sched_insn_is_legitimate_for_speculation_p (const_rtx insn, ds_t ds)
{
if (HAS_INTERNAL_DEP (insn))
return false;
diff --git a/gcc/hooks.c b/gcc/hooks.c
index c101d3ca81d..289275e8441 100644
--- a/gcc/hooks.c
+++ b/gcc/hooks.c
@@ -71,16 +71,16 @@ hook_bool_mode_false (enum machine_mode mode ATTRIBUTE_UNUSED)
/* Generic hook that takes (enum machine_mode, rtx) and returns false. */
bool
-hook_bool_mode_rtx_false (enum machine_mode mode ATTRIBUTE_UNUSED,
- rtx value ATTRIBUTE_UNUSED)
+hook_bool_mode_const_rtx_false (enum machine_mode mode ATTRIBUTE_UNUSED,
+ const_rtx value ATTRIBUTE_UNUSED)
{
return false;
}
/* Generic hook that takes (enum machine_mode, rtx) and returns true. */
bool
-hook_bool_mode_rtx_true (enum machine_mode mode ATTRIBUTE_UNUSED,
- rtx value ATTRIBUTE_UNUSED)
+hook_bool_mode_const_rtx_true (enum machine_mode mode ATTRIBUTE_UNUSED,
+ const_rtx value ATTRIBUTE_UNUSED)
{
return true;
}
@@ -93,19 +93,19 @@ hook_void_FILEptr_constcharptr (FILE *a ATTRIBUTE_UNUSED, const char *b ATTRIBUT
/* Used for the TARGET_ASM_CAN_OUTPUT_MI_THUNK hook. */
bool
-hook_bool_tree_hwi_hwi_tree_false (tree a ATTRIBUTE_UNUSED,
- HOST_WIDE_INT b ATTRIBUTE_UNUSED,
- HOST_WIDE_INT c ATTRIBUTE_UNUSED,
- tree d ATTRIBUTE_UNUSED)
+hook_bool_const_tree_hwi_hwi_const_tree_false (const_tree a ATTRIBUTE_UNUSED,
+ HOST_WIDE_INT b ATTRIBUTE_UNUSED,
+ HOST_WIDE_INT c ATTRIBUTE_UNUSED,
+ const_tree d ATTRIBUTE_UNUSED)
{
return false;
}
bool
-hook_bool_tree_hwi_hwi_tree_true (tree a ATTRIBUTE_UNUSED,
- HOST_WIDE_INT b ATTRIBUTE_UNUSED,
- HOST_WIDE_INT c ATTRIBUTE_UNUSED,
- tree d ATTRIBUTE_UNUSED)
+hook_bool_const_tree_hwi_hwi_const_tree_true (const_tree a ATTRIBUTE_UNUSED,
+ HOST_WIDE_INT b ATTRIBUTE_UNUSED,
+ HOST_WIDE_INT c ATTRIBUTE_UNUSED,
+ const_tree d ATTRIBUTE_UNUSED)
{
return true;
}
@@ -126,23 +126,23 @@ hook_bool_size_t_constcharptr_int_true (size_t a ATTRIBUTE_UNUSED,
}
bool
-default_can_output_mi_thunk_no_vcall (tree a ATTRIBUTE_UNUSED,
+default_can_output_mi_thunk_no_vcall (const_tree a ATTRIBUTE_UNUSED,
HOST_WIDE_INT b ATTRIBUTE_UNUSED,
HOST_WIDE_INT c,
- tree d ATTRIBUTE_UNUSED)
+ const_tree d ATTRIBUTE_UNUSED)
{
return c == 0;
}
int
-hook_int_tree_0 (tree a ATTRIBUTE_UNUSED)
+hook_int_const_tree_0 (const_tree a ATTRIBUTE_UNUSED)
{
return 0;
}
/* ??? Used for comp_type_attributes, which ought to return bool. */
int
-hook_int_tree_tree_1 (tree a ATTRIBUTE_UNUSED, tree b ATTRIBUTE_UNUSED)
+hook_int_const_tree_const_tree_1 (const_tree a ATTRIBUTE_UNUSED, const_tree b ATTRIBUTE_UNUSED)
{
return 1;
}
@@ -202,6 +202,12 @@ hook_bool_tree_true (tree a ATTRIBUTE_UNUSED)
}
bool
+hook_bool_const_tree_true (const_tree a ATTRIBUTE_UNUSED)
+{
+ return true;
+}
+
+bool
hook_bool_tree_tree_false (tree a ATTRIBUTE_UNUSED, tree b ATTRIBUTE_UNUSED)
{
return false;
@@ -266,7 +272,7 @@ hook_tree_tree_tree_tree_3rd_identity (tree a ATTRIBUTE_UNUSED,
/* Generic hook that takes a tree and returns a NULL string. */
const char *
-hook_constcharptr_tree_null (tree t ATTRIBUTE_UNUSED)
+hook_constcharptr_const_tree_null (const_tree t ATTRIBUTE_UNUSED)
{
return NULL;
}
@@ -287,29 +293,29 @@ hook_tree_tree_tree_null (tree t0 ATTRIBUTE_UNUSED, tree t1 ATTRIBUTE_UNUSED)
/* Generic hook that takes a rtx and returns a NULL string. */
const char *
-hook_constcharptr_rtx_null (rtx r ATTRIBUTE_UNUSED)
+hook_constcharptr_const_rtx_null (const_rtx r ATTRIBUTE_UNUSED)
{
return NULL;
}
const char *
-hook_constcharptr_tree_tree_null (tree t0 ATTRIBUTE_UNUSED,
- tree t1 ATTRIBUTE_UNUSED)
+hook_constcharptr_const_tree_const_tree_null (const_tree t0 ATTRIBUTE_UNUSED,
+ const_tree t1 ATTRIBUTE_UNUSED)
{
return NULL;
}
const char *
-hook_constcharptr_int_tree_null (int i ATTRIBUTE_UNUSED,
- tree t0 ATTRIBUTE_UNUSED)
+hook_constcharptr_int_const_tree_null (int i ATTRIBUTE_UNUSED,
+ const_tree t0 ATTRIBUTE_UNUSED)
{
return NULL;
}
const char *
-hook_constcharptr_int_tree_tree_null (int i ATTRIBUTE_UNUSED,
- tree t0 ATTRIBUTE_UNUSED,
- tree t1 ATTRIBUTE_UNUSED)
+hook_constcharptr_int_const_tree_const_tree_null (int i ATTRIBUTE_UNUSED,
+ const_tree t0 ATTRIBUTE_UNUSED,
+ const_tree t1 ATTRIBUTE_UNUSED)
{
return NULL;
}
diff --git a/gcc/hooks.h b/gcc/hooks.h
index 6000cbb3344..838a4223fe3 100644
--- a/gcc/hooks.h
+++ b/gcc/hooks.h
@@ -28,15 +28,20 @@ extern bool hook_bool_void_false (void);
extern bool hook_bool_void_true (void);
extern bool hook_bool_bool_false (bool);
extern bool hook_bool_mode_false (enum machine_mode);
-extern bool hook_bool_mode_rtx_false (enum machine_mode, rtx);
-extern bool hook_bool_mode_rtx_true (enum machine_mode, rtx);
+extern bool hook_bool_mode_const_rtx_false (enum machine_mode, const_rtx);
+extern bool hook_bool_mode_const_rtx_true (enum machine_mode, const_rtx);
extern bool hook_bool_tree_false (tree);
extern bool hook_bool_const_tree_false (const_tree);
extern bool hook_bool_tree_true (tree);
-extern bool hook_bool_tree_hwi_hwi_tree_false (tree, HOST_WIDE_INT, HOST_WIDE_INT,
- tree);
-extern bool hook_bool_tree_hwi_hwi_tree_true (tree, HOST_WIDE_INT, HOST_WIDE_INT,
- tree);
+extern bool hook_bool_const_tree_true (const_tree);
+extern bool hook_bool_const_tree_hwi_hwi_const_tree_false (const_tree,
+ HOST_WIDE_INT,
+ HOST_WIDE_INT,
+ const_tree);
+extern bool hook_bool_const_tree_hwi_hwi_const_tree_true (const_tree,
+ HOST_WIDE_INT,
+ HOST_WIDE_INT,
+ const_tree);
extern bool hook_bool_rtx_false (rtx);
extern bool hook_bool_uintp_uintp_false (unsigned int *, unsigned int *);
extern bool hook_bool_rtx_int_int_intp_false (rtx, int, int, int *);
@@ -51,8 +56,8 @@ extern void hook_void_FILEptr_constcharptr (FILE *, const char *);
extern void hook_void_tree (tree);
extern void hook_void_tree_treeptr (tree, tree *);
-extern int hook_int_tree_0 (tree);
-extern int hook_int_tree_tree_1 (tree, tree);
+extern int hook_int_const_tree_0 (const_tree);
+extern int hook_int_const_tree_const_tree_1 (const_tree, const_tree);
extern int hook_int_rtx_0 (rtx);
extern int hook_int_size_t_constcharptr_int_0 (size_t, const char *, int);
extern int hook_int_void_no_regs (void);
@@ -63,16 +68,16 @@ extern tree hook_tree_tree_tree_bool_null (tree, tree, bool);
extern unsigned hook_uint_uint_constcharptrptr_0 (unsigned, const char **);
-extern bool default_can_output_mi_thunk_no_vcall (tree, HOST_WIDE_INT,
- HOST_WIDE_INT, tree);
+extern bool default_can_output_mi_thunk_no_vcall (const_tree, HOST_WIDE_INT,
+ HOST_WIDE_INT, const_tree);
extern rtx hook_rtx_rtx_identity (rtx);
extern rtx hook_rtx_rtx_null (rtx);
extern rtx hook_rtx_tree_int_null (tree, int);
-extern const char *hook_constcharptr_tree_null (tree);
-extern const char *hook_constcharptr_rtx_null (rtx);
-extern const char *hook_constcharptr_tree_tree_null (tree, tree);
-extern const char *hook_constcharptr_int_tree_null (int, tree);
-extern const char *hook_constcharptr_int_tree_tree_null (int, tree, tree);
+extern const char *hook_constcharptr_const_tree_null (const_tree);
+extern const char *hook_constcharptr_const_rtx_null (const_rtx);
+extern const char *hook_constcharptr_const_tree_const_tree_null (const_tree, const_tree);
+extern const char *hook_constcharptr_int_const_tree_null (int, const_tree);
+extern const char *hook_constcharptr_int_const_tree_const_tree_null (int, const_tree, const_tree);
#endif
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index cea9dec60a4..644a5e1c6ed 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -1534,6 +1534,7 @@ noce_get_alt_condition (struct noce_if_info *if_info, rtx target,
/* First, look to see if we put a constant in a register. */
prev_insn = prev_nonnote_insn (if_info->cond_earliest);
if (prev_insn
+ && BLOCK_NUM (prev_insn) == BLOCK_NUM (if_info->cond_earliest)
&& INSN_P (prev_insn)
&& GET_CODE (PATTERN (prev_insn)) == SET)
{
@@ -1772,6 +1773,7 @@ noce_try_abs (struct noce_if_info *if_info)
{
rtx set, insn = prev_nonnote_insn (earliest);
if (insn
+ && BLOCK_NUM (insn) == BLOCK_NUM (earliest)
&& (set = single_set (insn))
&& rtx_equal_p (SET_DEST (set), c))
{
@@ -2198,6 +2200,7 @@ noce_process_if_block (struct noce_if_info *if_info)
COND_EARLIEST to JUMP. Make sure the relevant data is still
intact. */
if (! insn_b
+ || BLOCK_NUM (insn_b) != BLOCK_NUM (if_info->cond_earliest)
|| !NONJUMP_INSN_P (insn_b)
|| (set_b = single_set (insn_b)) == NULL_RTX
|| ! rtx_equal_p (x, SET_DEST (set_b))
@@ -2650,6 +2653,7 @@ noce_find_if_block (basic_block test_bb,
basic_block then_bb, else_bb, join_bb;
bool then_else_reversed = false;
rtx jump, cond;
+ rtx cond_earliest;
struct noce_if_info if_info;
/* We only ever should get here before reload. */
@@ -2725,7 +2729,7 @@ noce_find_if_block (basic_block test_bb,
/* If this is not a standard conditional jump, we can't parse it. */
cond = noce_get_condition (jump,
- &if_info.cond_earliest,
+ &cond_earliest,
then_else_reversed);
if (!cond)
return FALSE;
@@ -2741,6 +2745,7 @@ noce_find_if_block (basic_block test_bb,
if_info.else_bb = else_bb;
if_info.join_bb = join_bb;
if_info.cond = cond;
+ if_info.cond_earliest = cond_earliest;
if_info.jump = jump;
if_info.then_else_reversed = then_else_reversed;
diff --git a/gcc/integrate.c b/gcc/integrate.c
index ed5be51815b..7eb29f20303 100644
--- a/gcc/integrate.c
+++ b/gcc/integrate.c
@@ -69,15 +69,15 @@ static void set_block_abstract_flags (tree, int);
/* Return false if the function FNDECL cannot be inlined on account of its
attributes, true otherwise. */
bool
-function_attribute_inlinable_p (tree fndecl)
+function_attribute_inlinable_p (const_tree fndecl)
{
if (targetm.attribute_table)
{
- tree a;
+ const_tree a;
for (a = DECL_ATTRIBUTES (fndecl); a; a = TREE_CHAIN (a))
{
- tree name = TREE_PURPOSE (a);
+ const_tree name = TREE_PURPOSE (a);
int i;
for (i = 0; targetm.attribute_table[i].name != NULL; i++)
diff --git a/gcc/integrate.h b/gcc/integrate.h
index 12dfc90d0f8..c074047084d 100644
--- a/gcc/integrate.h
+++ b/gcc/integrate.h
@@ -32,5 +32,5 @@ extern void allocate_initial_values (rtx *);
/* Check whether there's any attribute in a function declaration that
makes the function uninlinable. Returns false if it finds any,
true otherwise. */
-extern bool function_attribute_inlinable_p (tree);
+extern bool function_attribute_inlinable_p (const_tree);
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index f74ebf8c9f1..647ec9faded 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -1529,7 +1529,7 @@ compute_inline_parameters (void)
&eni_inlining_weights);
if (node->local.inlinable && !node->local.disregard_inline_limits)
node->local.disregard_inline_limits
- = disregard_inline_limits_p (current_function_decl);
+ = DECL_DISREGARD_INLINE_LIMITS (current_function_decl);
if (flag_really_no_inline && !node->local.disregard_inline_limits)
node->local.inlinable = 0;
/* Inlining characteristics are maintained by the cgraph_mark_inline. */
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index ade35fc2f40..b69d19aaa90 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,11 @@
+2007-08-28 Tom Tromey <tromey@redhat.com>
+
+ * Make-lang.in (java.tags): Don't tag '*.y' files.
+
+2007-08-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * lang.c (java_decl_ok_for_sibcall): Likewise.
+
2007-08-21 Paul Brook <paul@codesourcery.com>
Nathan Sidwell <nathan@codesourcery.com>
Mark Mitchell <mark@codesourcery.com>
diff --git a/gcc/java/Make-lang.in b/gcc/java/Make-lang.in
index f58f170a120..004dc918102 100644
--- a/gcc/java/Make-lang.in
+++ b/gcc/java/Make-lang.in
@@ -123,7 +123,7 @@ java.rest.encap:
java.tags: force
- cd $(srcdir)/java; etags -o TAGS.sub *.y *.c *.h --language=none \
+ cd $(srcdir)/java; etags -o TAGS.sub *.c *.h --language=none \
--regex='/DEFTREECODE [(]\([A-Z_]+\)/\1/' java-tree.def; \
etags --include TAGS.sub --include ../TAGS.sub
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index dc685eb75dc..3dd7017997d 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -59,7 +59,7 @@ static int merge_init_test_initialization (void * *, void *);
static int inline_init_test_initialization (void * *, void *);
static bool java_dump_tree (void *, tree);
static void dump_compound_expr (dump_info_p, tree);
-static bool java_decl_ok_for_sibcall (tree);
+static bool java_decl_ok_for_sibcall (const_tree);
static tree java_get_callee_fndecl (const_tree);
static void java_clear_binding_stack (void);
@@ -894,7 +894,7 @@ java_dump_tree (void *dump_info, tree t)
SecurityManager.getClassContext(). */
static bool
-java_decl_ok_for_sibcall (tree decl)
+java_decl_ok_for_sibcall (const_tree decl)
{
return (decl != NULL && DECL_CONTEXT (decl) == output_class
&& DECL_INLINE (decl));
diff --git a/gcc/jump.c b/gcc/jump.c
index d0092f42988..959b79af54b 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -233,7 +233,8 @@ mark_all_labels (rtx f)
description should define REVERSIBLE_CC_MODE and REVERSE_CONDITION macros
to help this function avoid overhead in these cases. */
enum rtx_code
-reversed_comparison_code_parts (enum rtx_code code, rtx arg0, rtx arg1, rtx insn)
+reversed_comparison_code_parts (enum rtx_code code, const_rtx arg0,
+ const_rtx arg1, const_rtx insn)
{
enum machine_mode mode;
@@ -290,7 +291,7 @@ reversed_comparison_code_parts (enum rtx_code code, rtx arg0, rtx arg1, rtx insn
if (GET_MODE_CLASS (mode) == MODE_CC || CC0_P (arg0))
{
- rtx prev;
+ const_rtx prev;
/* Try to search for the comparison to determine the real mode.
This code is expensive, but with sane machine description it
will be never used, since REVERSIBLE_CC_MODE will return true
@@ -298,9 +299,9 @@ reversed_comparison_code_parts (enum rtx_code code, rtx arg0, rtx arg1, rtx insn
if (! insn)
return UNKNOWN;
- for (prev = prev_nonnote_insn (insn);
+ for (prev = const_prev_nonnote_insn (insn);
prev != 0 && !LABEL_P (prev);
- prev = prev_nonnote_insn (prev))
+ prev = const_prev_nonnote_insn (prev))
{
const_rtx set = set_of (arg0, prev);
if (set && GET_CODE (set) == SET
@@ -346,7 +347,7 @@ reversed_comparison_code_parts (enum rtx_code code, rtx arg0, rtx arg1, rtx insn
/* A wrapper around the previous function to take COMPARISON as rtx
expression. This simplifies many callers. */
enum rtx_code
-reversed_comparison_code (rtx comparison, rtx insn)
+reversed_comparison_code (const_rtx comparison, const_rtx insn)
{
if (!COMPARISON_P (comparison))
return UNKNOWN;
@@ -358,7 +359,7 @@ reversed_comparison_code (rtx comparison, rtx insn)
/* Return comparison with reversed code of EXP.
Return NULL_RTX in case we fail to do the reversal. */
rtx
-reversed_comparison (rtx exp, enum machine_mode mode)
+reversed_comparison (const_rtx exp, enum machine_mode mode)
{
enum rtx_code reversed_code = reversed_comparison_code (exp, NULL_RTX);
if (reversed_code == UNKNOWN)
@@ -789,7 +790,7 @@ any_condjump_p (const_rtx insn)
/* Return the label of a conditional jump. */
rtx
-condjump_label (rtx insn)
+condjump_label (const_rtx insn)
{
rtx x = pc_set (insn);
@@ -1419,7 +1420,7 @@ invert_jump (rtx jump, rtx nlabel, int delete_unused)
reversed. */
int
-rtx_renumbered_equal_p (rtx x, rtx y)
+rtx_renumbered_equal_p (const_rtx x, const_rtx y)
{
int i;
const enum rtx_code code = GET_CODE (x);
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index 05d8f4b74ba..4c4be49581d 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -59,7 +59,7 @@ extern bool lhd_warn_unused_global_decl (const_tree);
extern void lhd_incomplete_type_error (const_tree, const_tree);
extern tree lhd_type_promotes_to (tree);
extern void lhd_register_builtin_type (tree, const char *);
-extern bool lhd_decl_ok_for_sibcall (tree);
+extern bool lhd_decl_ok_for_sibcall (const_tree);
extern const char *lhd_comdat_group (tree);
extern tree lhd_expr_size (const_tree);
extern size_t lhd_tree_size (enum tree_code);
@@ -68,7 +68,6 @@ extern tree lhd_expr_to_decl (tree, bool *, bool *, bool *);
extern tree lhd_builtin_function (tree decl);
/* Declarations of default tree inlining hooks. */
-extern int lhd_tree_inlining_cannot_inline_tree_fn (tree *);
extern void lhd_initialize_diagnostics (struct diagnostic_context *);
extern tree lhd_callgraph_analyze_expr (tree *, int *, tree);
@@ -131,13 +130,10 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
#define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE NULL
/* Tree inlining hooks. */
-#define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
- lhd_tree_inlining_cannot_inline_tree_fn
#define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P \
hook_bool_tree_tree_false
#define LANG_HOOKS_TREE_INLINING_INITIALIZER { \
- LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN, \
LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P, \
}
@@ -208,7 +204,7 @@ extern tree lhd_make_node (enum tree_code);
#define LANG_HOOKS_WRITE_GLOBALS write_global_declarations
#define LANG_HOOKS_DECL_OK_FOR_SIBCALL lhd_decl_ok_for_sibcall
#define LANG_HOOKS_COMDAT_GROUP lhd_comdat_group
-#define LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE hook_bool_tree_false
+#define LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE hook_bool_const_tree_false
#define LANG_HOOKS_OMP_PREDETERMINED_SHARING lhd_omp_predetermined_sharing
#define LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR hook_bool_tree_bool_false
#define LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE hook_bool_tree_bool_false
diff --git a/gcc/langhooks.c b/gcc/langhooks.c
index 56680c94082..b8e7aaacc27 100644
--- a/gcc/langhooks.c
+++ b/gcc/langhooks.c
@@ -276,20 +276,6 @@ lhd_types_compatible_p (tree x, tree y)
return TYPE_MAIN_VARIANT (x) == TYPE_MAIN_VARIANT (y);
}
-/* lang_hooks.tree_inlining.cannot_inline_tree_fn is called to
- determine whether there are language-specific reasons for not
- inlining a given function. */
-
-int
-lhd_tree_inlining_cannot_inline_tree_fn (tree *fnp)
-{
- if (flag_really_no_inline
- && lookup_attribute ("always_inline", DECL_ATTRIBUTES (*fnp)) == NULL)
- return 1;
-
- return 0;
-}
-
/* lang_hooks.tree_dump.dump_tree: Dump language-specific parts of tree
nodes. Returns nonzero if it does not want the usual dumping of the
second argument. */
@@ -344,7 +330,7 @@ lhd_tree_size (enum tree_code c ATTRIBUTE_UNUSED)
sibcall. */
bool
-lhd_decl_ok_for_sibcall (tree decl ATTRIBUTE_UNUSED)
+lhd_decl_ok_for_sibcall (const_tree decl ATTRIBUTE_UNUSED)
{
return true;
}
@@ -494,6 +480,9 @@ add_builtin_function (const char *name,
TREE_PUBLIC (decl) = 1;
DECL_EXTERNAL (decl) = 1;
DECL_BUILT_IN_CLASS (decl) = cl;
+
+ DECL_FUNCTION_CODE (decl) = -1;
+ gcc_assert (DECL_FUNCTION_CODE (decl) >= function_code);
DECL_FUNCTION_CODE (decl) = function_code;
if (library_name)
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index a25371c05ee..2b3517e5072 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -35,7 +35,6 @@ typedef void (*lang_print_tree_hook) (FILE *, tree, int indent);
struct lang_hooks_for_tree_inlining
{
- int (*cannot_inline_tree_fn) (tree *);
bool (*var_mod_type_p) (tree, tree);
};
@@ -167,7 +166,7 @@ struct lang_hooks_for_decls
void (*final_write_globals) (void);
/* True if this decl may be called via a sibcall. */
- bool (*ok_for_sibcall) (tree);
+ bool (*ok_for_sibcall) (const_tree);
/* Return the COMDAT group into which this DECL should be placed.
It is known that the DECL belongs in *some* COMDAT group when
@@ -180,7 +179,7 @@ struct lang_hooks_for_decls
/* True if OpenMP should privatize what this DECL points to rather
than the DECL itself. */
- bool (*omp_privatize_by_reference) (tree);
+ bool (*omp_privatize_by_reference) (const_tree);
/* Return sharing kind if OpenMP sharing attribute of DECL is
predetermined, OMP_CLAUSE_DEFAULT_UNSPECIFIED otherwise. */
diff --git a/gcc/local-alloc.c b/gcc/local-alloc.c
index c42b7149145..dc56ca47917 100644
--- a/gcc/local-alloc.c
+++ b/gcc/local-alloc.c
@@ -538,6 +538,7 @@ equiv_init_varies_p (rtx x)
case CONST:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case LABEL_REF:
@@ -655,6 +656,7 @@ contains_replace_regs (rtx x)
case LABEL_REF:
case SYMBOL_REF:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case PC:
case CC0:
@@ -703,6 +705,7 @@ memref_referenced_p (rtx memref, rtx x)
case LABEL_REF:
case SYMBOL_REF:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case PC:
case CC0:
diff --git a/gcc/loop-doloop.c b/gcc/loop-doloop.c
index 162ef4ad58a..6e33a4f9ba0 100644
--- a/gcc/loop-doloop.c
+++ b/gcc/loop-doloop.c
@@ -69,35 +69,59 @@ along with GCC; see the file COPYING3. If not see
if it is not a decrement and branch jump insn. */
rtx
-doloop_condition_get (rtx pattern)
+doloop_condition_get (rtx doloop_pat)
{
rtx cmp;
rtx inc;
rtx reg;
rtx inc_src;
rtx condition;
+ rtx pattern;
- /* The canonical doloop pattern we expect is:
+ /* The canonical doloop pattern we expect has one of the following
+ forms:
- (parallel [(set (pc) (if_then_else (condition)
- (label_ref (label))
- (pc)))
- (set (reg) (plus (reg) (const_int -1)))
- (additional clobbers and uses)])
+ 1) (parallel [(set (pc) (if_then_else (condition)
+ (label_ref (label))
+ (pc)))
+ (set (reg) (plus (reg) (const_int -1)))
+ (additional clobbers and uses)])
- Some targets (IA-64) wrap the set of the loop counter in
- an if_then_else too.
+ The branch must be the first entry of the parallel (also required
+ by jump.c), and the second entry of the parallel must be a set of
+ the loop counter register. Some targets (IA-64) wrap the set of
+ the loop counter in an if_then_else too.
- In summary, the branch must be the first entry of the
- parallel (also required by jump.c), and the second
- entry of the parallel must be a set of the loop counter
- register. */
+ 2) (set (reg) (plus (reg) (const_int -1))
+ (set (pc) (if_then_else (reg != 0)
+ (label_ref (label))
+ (pc))). */
+
+ pattern = PATTERN (doloop_pat);
if (GET_CODE (pattern) != PARALLEL)
- return 0;
+ {
+ rtx cond;
+
+ /* We expect the decrement to immediately precede the branch. */
- cmp = XVECEXP (pattern, 0, 0);
- inc = XVECEXP (pattern, 0, 1);
+ if ((PREV_INSN (doloop_pat) == NULL_RTX)
+ || !INSN_P (PREV_INSN (doloop_pat)))
+ return 0;
+
+ cmp = pattern;
+ inc = PATTERN (PREV_INSN (doloop_pat));
+ /* We expect the condition to be of the form (reg != 0) */
+ cond = XEXP (SET_SRC (cmp), 0);
+ if (GET_CODE (cond) != NE || XEXP (cond, 1) != const0_rtx)
+ return 0;
+
+ }
+ else
+ {
+ cmp = XVECEXP (pattern, 0, 0);
+ inc = XVECEXP (pattern, 0, 1);
+ }
/* Check for (set (reg) (something)). */
if (GET_CODE (inc) != SET)
@@ -139,7 +163,29 @@ doloop_condition_get (rtx pattern)
if ((XEXP (condition, 0) == reg)
|| (GET_CODE (XEXP (condition, 0)) == PLUS
&& XEXP (XEXP (condition, 0), 0) == reg))
+ {
+ if (GET_CODE (pattern) != PARALLEL)
+ /* The second form we expect:
+
+ (set (reg) (plus (reg) (const_int -1))
+ (set (pc) (if_then_else (reg != 0)
+ (label_ref (label))
+ (pc))).
+
+ is equivalent to the following:
+
+ (parallel [(set (pc) (if_then_else (reg != 1)
+ (label_ref (label))
+ (pc)))
+ (set (reg) (plus (reg) (const_int -1)))
+ (additional clobbers and uses)])
+
+ So we return that form instead.
+ */
+ condition = gen_rtx_fmt_ee (NE, VOIDmode, inc_src, const1_rtx);
+
return condition;
+ }
/* ??? If a machine uses a funny comparison, we could return a
canonicalized form here. */
@@ -597,9 +643,7 @@ doloop_optimize (struct loop *loop)
{
while (NEXT_INSN (doloop_pat) != NULL_RTX)
doloop_pat = NEXT_INSN (doloop_pat);
- if (JUMP_P (doloop_pat))
- doloop_pat = PATTERN (doloop_pat);
- else
+ if (!JUMP_P (doloop_pat))
doloop_pat = NULL_RTX;
}
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index ebd3810ace8..d6ca8eb6af0 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -185,6 +185,7 @@ check_maybe_invariant (rtx x)
{
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case SYMBOL_REF:
case CONST:
case LABEL_REF:
@@ -283,6 +284,7 @@ hash_invariant_expr_1 (rtx insn, rtx x)
{
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case SYMBOL_REF:
case CONST:
case LABEL_REF:
@@ -343,6 +345,7 @@ invariant_expr_equal_p (rtx insn1, rtx e1, rtx insn2, rtx e2)
{
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case SYMBOL_REF:
case CONST:
case LABEL_REF:
@@ -641,6 +644,7 @@ find_defs (struct loop *loop, basic_block *body)
if (dump_file)
{
+ df_dump_region (dump_file);
fprintf (dump_file, "*****starting processing of loop ******\n");
print_rtl_with_bb (dump_file, get_insns ());
fprintf (dump_file, "*****ending processing of loop ******\n");
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c
index 173cd68bbba..81e9a5625ec 100644
--- a/gcc/loop-iv.c
+++ b/gcc/loop-iv.c
@@ -280,7 +280,7 @@ iv_analysis_loop_init (struct loop *loop)
df_set_blocks (blocks);
df_analyze ();
if (dump_file)
- df_dump (dump_file);
+ df_dump_region (dump_file);
check_iv_ref_table_size ();
BITMAP_FREE (blocks);
diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c
index 73c4adc84b0..7e9f6aa1a69 100644
--- a/gcc/modulo-sched.c
+++ b/gcc/modulo-sched.c
@@ -82,8 +82,21 @@ along with GCC; see the file COPYING3. If not see
perform modulo variable expansion for live ranges that span more than
II cycles (i.e. use register copies to prevent a def from overwriting
itself before reaching the use).
-*/
+ SMS works with countable loops (1) whose control part can be easily
+ decoupled from the rest of the loop and (2) whose loop count can
+ be easily adjusted. This is because we peel a constant number of
+ iterations into a prologue and epilogue for which we want to avoid
+ emitting the control part, and a kernel which is to iterate that
+ constant number of iterations less than the original loop. So the
+ control part should be a set of insns clearly identified and having
+ its own iv, not otherwise used in the loop (at-least for now), which
+ initializes a register before the loop to the number of iterations.
+ Currently SMS relies on the do-loop pattern to recognize such loops,
+ where (1) the control part comprises of all insns defining and/or
+ using a certain 'count' register and (2) the loop count can be
+ adjusted by modifying this register prior to the loop.
+ TODO: Rely on cfgloop analysis instead. */
/* This page defines partial-schedule structures and functions for
modulo scheduling. */
@@ -182,10 +195,11 @@ static int sms_order_nodes (ddg_ptr, int, int * result);
static void set_node_sched_params (ddg_ptr);
static partial_schedule_ptr sms_schedule_by_order (ddg_ptr, int, int, int *);
static void permute_partial_schedule (partial_schedule_ptr ps, rtx last);
-static void generate_prolog_epilog (partial_schedule_ptr ,struct loop * loop, rtx);
+static void generate_prolog_epilog (partial_schedule_ptr, struct loop *loop,
+ rtx, rtx);
static void duplicate_insns_of_cycles (partial_schedule_ptr ps,
int from_stage, int to_stage,
- int is_prolog);
+ int is_prolog, rtx count_reg);
#define SCHED_ASAP(x) (((node_sched_params_ptr)(x)->aux.info)->asap)
#define SCHED_TIME(x) (((node_sched_params_ptr)(x)->aux.info)->time)
@@ -261,20 +275,22 @@ static struct sched_info sms_sched_info =
};
-/* Return the register decremented and tested in INSN,
- or zero if it is not a decrement-and-branch insn. */
-
+/* Given HEAD and TAIL which are the first and last insns in a loop;
+ return the register which controls the loop. Return zero if it has
+ more than one occurrence in the loop besides the control part or the
+ do-loop pattern is not of the form we expect. */
static rtx
-doloop_register_get (rtx insn ATTRIBUTE_UNUSED)
+doloop_register_get (rtx head ATTRIBUTE_UNUSED, rtx tail ATTRIBUTE_UNUSED)
{
#ifdef HAVE_doloop_end
- rtx pattern, reg, condition;
+ rtx reg, condition, insn;
+ bool found = false;
- if (! JUMP_P (insn))
+ if (!JUMP_P (tail))
return NULL_RTX;
- pattern = PATTERN (insn);
- condition = doloop_condition_get (pattern);
+ /* TODO: Free SMS's dependence on doloop_condition_get. */
+ condition = doloop_condition_get (tail);
if (! condition)
return NULL_RTX;
@@ -286,6 +302,29 @@ doloop_register_get (rtx insn ATTRIBUTE_UNUSED)
else
gcc_unreachable ();
+ /* Check that the COUNT_REG has no other occurrences in the loop
+ until the decrement. We assume the control part consists of
+ either a single (parallel) branch-on-count or a (non-parallel)
+ branch immediately preceded by a single (decrement) insn. */
+ for (insn = head; insn != PREV_INSN (tail); insn = NEXT_INSN (insn))
+ if ((found = reg_mentioned_p (reg, insn)) == true)
+ break;
+ if (found)
+ {
+ if (dump_file)
+ fprintf (dump_file, "SMS count_reg found outside control\n");
+
+ return NULL_RTX;
+ }
+ /* One last check in case the do-loop pattern is parallel. */
+ if (GET_CODE (PATTERN (tail)) == PARALLEL)
+ if (reg_mentioned_p (reg, PREV_INSN (tail)))
+ {
+ if (dump_file)
+ fprintf (dump_file, "SMS count_reg found outside control\n");
+
+ return NULL_RTX;
+ }
return reg;
#else
return NULL_RTX;
@@ -583,7 +622,7 @@ permute_partial_schedule (partial_schedule_ptr ps, rtx last)
static void
duplicate_insns_of_cycles (partial_schedule_ptr ps, int from_stage,
- int to_stage, int for_prolog)
+ int to_stage, int for_prolog, rtx count_reg)
{
int row;
ps_insn_ptr ps_ij;
@@ -595,6 +634,13 @@ duplicate_insns_of_cycles (partial_schedule_ptr ps, int from_stage,
int j, i_reg_moves;
rtx reg_move = NULL_RTX;
+ /* Do not duplicate any insn which refers to count_reg as it
+ belongs to the control part.
+ TODO: This should be done by analyzing the control part of
+ the loop. */
+ if (reg_mentioned_p (count_reg, u_node->insn))
+ continue;
+
if (for_prolog)
{
/* SCHED_STAGE (u_node) >= from_stage == 0. Generate increasing
@@ -643,23 +689,35 @@ duplicate_insns_of_cycles (partial_schedule_ptr ps, int from_stage,
/* Generate the instructions (including reg_moves) for prolog & epilog. */
static void
-generate_prolog_epilog (partial_schedule_ptr ps, struct loop * loop, rtx count_reg)
+generate_prolog_epilog (partial_schedule_ptr ps, struct loop *loop,
+ rtx count_reg, rtx count_init)
{
int i;
int last_stage = PS_STAGE_COUNT (ps) - 1;
edge e;
-
+
/* Generate the prolog, inserting its insns on the loop-entry edge. */
start_sequence ();
- if (count_reg)
- /* Generate a subtract instruction at the beginning of the prolog to
- adjust the loop count by STAGE_COUNT. */
- emit_insn (gen_sub2_insn (count_reg, GEN_INT (last_stage)));
+ if (!count_init)
+ {
+ /* Generate instructions at the beginning of the prolog to
+ adjust the loop count by STAGE_COUNT. If loop count is constant
+ (count_init), this constant is adjusted by STAGE_COUNT in
+ generate_prolog_epilog function. */
+ rtx sub_reg = NULL_RTX;
+
+ sub_reg = expand_simple_binop (GET_MODE (count_reg), MINUS,
+ count_reg, GEN_INT (last_stage),
+ count_reg, 1, OPTAB_DIRECT);
+ gcc_assert (REG_P (sub_reg));
+ if (REGNO (sub_reg) != REGNO (count_reg))
+ emit_move_insn (count_reg, sub_reg);
+ }
for (i = 0; i < last_stage; i++)
- duplicate_insns_of_cycles (ps, 0, i, 1);
-
+ duplicate_insns_of_cycles (ps, 0, i, 1, count_reg);
+
/* Put the prolog on the entry edge. */
e = loop_preheader_edge (loop);
split_edge_and_insert (e, get_insns ());
@@ -670,8 +728,8 @@ generate_prolog_epilog (partial_schedule_ptr ps, struct loop * loop, rtx count_r
start_sequence ();
for (i = 0; i < last_stage; i++)
- duplicate_insns_of_cycles (ps, i + 1, last_stage, 0);
-
+ duplicate_insns_of_cycles (ps, i + 1, last_stage, 0, count_reg);
+
/* Put the epilogue on the exit edge. */
gcc_assert (single_exit (loop));
e = single_exit (loop);
@@ -907,20 +965,27 @@ sms_schedule (void)
}
/* Make sure this is a doloop. */
- if ( !(count_reg = doloop_register_get (tail)))
+ if ( !(count_reg = doloop_register_get (head, tail)))
continue;
/* Don't handle BBs with calls or barriers, or !single_set insns,
or auto-increment insns (to avoid creating invalid reg-moves
for the auto-increment insns).
- ??? Should handle auto-increment insns. */
- for (insn = head; insn != NEXT_INSN (tail); insn = NEXT_INSN (insn))
- if (CALL_P (insn)
- || BARRIER_P (insn)
- || (INSN_P (insn) && !JUMP_P (insn)
- && !single_set (insn) && GET_CODE (PATTERN (insn)) != USE)
- || (FIND_REG_INC_NOTE (insn, NULL_RTX) != 0))
- break;
+ ??? Should handle auto-increment insns.
+ ??? Should handle insns defining subregs. */
+ for (insn = head; insn != NEXT_INSN (tail); insn = NEXT_INSN (insn))
+ {
+ rtx set;
+
+ if (CALL_P (insn)
+ || BARRIER_P (insn)
+ || (INSN_P (insn) && !JUMP_P (insn)
+ && !single_set (insn) && GET_CODE (PATTERN (insn)) != USE)
+ || (FIND_REG_INC_NOTE (insn, NULL_RTX) != 0)
+ || (INSN_P (insn) && (set = single_set (insn))
+ && GET_CODE (SET_DEST (set)) == SUBREG))
+ break;
+ }
if (insn != NEXT_INSN (tail))
{
@@ -932,8 +997,11 @@ sms_schedule (void)
fprintf (dump_file, "SMS loop-with-barrier\n");
else if (FIND_REG_INC_NOTE (insn, NULL_RTX) != 0)
fprintf (dump_file, "SMS reg inc\n");
- else
- fprintf (dump_file, "SMS loop-with-not-single-set\n");
+ else if ((INSN_P (insn) && !JUMP_P (insn)
+ && !single_set (insn) && GET_CODE (PATTERN (insn)) != USE))
+ fprintf (dump_file, "SMS loop-with-not-single-set\n");
+ else
+ fprintf (dump_file, "SMS loop with subreg in lhs\n");
print_rtl_single (dump_file, insn);
}
@@ -998,7 +1066,7 @@ sms_schedule (void)
/* In case of th loop have doloop register it gets special
handling. */
count_init = NULL_RTX;
- if ((count_reg = doloop_register_get (tail)))
+ if ((count_reg = doloop_register_get (head, tail)))
{
basic_block pre_header;
@@ -1072,7 +1140,10 @@ sms_schedule (void)
the closing_branch was scheduled and should appear in the last (ii-1)
row. Otherwise, we are free to schedule the branch, and we let nodes
that were scheduled at the first PS_MIN_CYCLE cycle appear in the first
- row; this should reduce stage_count to minimum. */
+ row; this should reduce stage_count to minimum.
+ TODO: Revisit the issue of scheduling the insns of the
+ control part relative to the branch when the control part
+ has more than one insn. */
normalize_sched_times (ps);
rotate_partial_schedule (ps, PS_MIN_CYCLE (ps));
set_columns_for_ps (ps);
@@ -1111,11 +1182,8 @@ sms_schedule (void)
if (dump_file)
print_node_sched_params (dump_file, g->num_nodes, g);
/* Generate prolog and epilog. */
- if (count_reg && !count_init)
- generate_prolog_epilog (ps, loop, count_reg);
- else
- generate_prolog_epilog (ps, loop, NULL_RTX);
-
+ generate_prolog_epilog (ps, loop, count_reg, count_init);
+
free_undo_replace_buff (reg_move_replaces);
}
diff --git a/gcc/optabs.c b/gcc/optabs.c
index bf15d4f925b..f2b47fc4f68 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -256,7 +256,7 @@ widen_operand (rtx op, enum machine_mode mode, enum machine_mode oldmode,
or division) but probably ought to be relied on more widely
throughout the expander. */
optab
-optab_for_tree_code (enum tree_code code, tree type)
+optab_for_tree_code (enum tree_code code, const_tree type)
{
bool trapv;
switch (code)
@@ -5563,7 +5563,7 @@ set_conv_libfunc (convert_optab optable, enum machine_mode tmode,
convert_optab_handler (optable, tmode, fmode)->libfunc = 0;
}
-/* Call this once to initialize the contents of the optabs
+/* Call this to initialize the contents of the optabs
appropriately for the current target machine. */
void
diff --git a/gcc/optabs.h b/gcc/optabs.h
index 57cc4ff2361..c5b4a3db415 100644
--- a/gcc/optabs.h
+++ b/gcc/optabs.h
@@ -667,7 +667,7 @@ enum can_compare_purpose
/* Return the optab used for computing the given operation on the type
given by the second argument. */
-extern optab optab_for_tree_code (enum tree_code, tree);
+extern optab optab_for_tree_code (enum tree_code, const_tree);
/* Nonzero if a compare of mode MODE can be done straightforwardly
(without splitting it into pieces). */
diff --git a/gcc/output.h b/gcc/output.h
index 87d5a8610ff..ae8404e7fe1 100644
--- a/gcc/output.h
+++ b/gcc/output.h
@@ -378,7 +378,7 @@ extern bool first_function_block_is_cold;
/* Decide whether DECL needs to be in a writable section.
RELOC is the same as for SELECT_SECTION. */
-extern bool decl_readonly_section (tree, int);
+extern bool decl_readonly_section (const_tree, int);
/* This can be used to compute RELOC for the function above, when
given a constant expression. */
@@ -579,7 +579,7 @@ extern unsigned int default_section_type_flags (tree, const char *, int);
extern bool have_global_bss_p (void);
extern void default_no_named_section (const char *, unsigned int, tree);
extern void default_elf_asm_named_section (const char *, unsigned int, tree);
-extern enum section_category categorize_decl_for_section (tree, int);
+extern enum section_category categorize_decl_for_section (const_tree, int);
extern void default_coff_asm_named_section (const char *, unsigned int, tree);
extern void default_pe_asm_named_section (const char *, unsigned int, tree);
@@ -602,9 +602,9 @@ extern section *default_elf_select_rtx_section (enum machine_mode, rtx,
extern void default_encode_section_info (tree, rtx, int);
extern const char *default_strip_name_encoding (const char *);
extern void default_asm_output_anchor (rtx);
-extern bool default_use_anchors_for_symbol_p (rtx);
-extern bool default_binds_local_p (tree);
-extern bool default_binds_local_p_1 (tree, int);
+extern bool default_use_anchors_for_symbol_p (const_rtx);
+extern bool default_binds_local_p (const_tree);
+extern bool default_binds_local_p_1 (const_tree, int);
extern void default_globalize_label (FILE *, const char *);
extern void default_globalize_decl_name (FILE *, tree);
extern void default_emit_unwind_label (FILE *, tree, int, int);
diff --git a/gcc/passes.c b/gcc/passes.c
index 1ec6b0a2c0d..1a34752fa71 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -762,13 +762,13 @@ init_optimization_passes (void)
NEXT_PASS (pass_machine_reorg);
NEXT_PASS (pass_cleanup_barriers);
NEXT_PASS (pass_delay_slots);
- NEXT_PASS (pass_df_finish);
NEXT_PASS (pass_split_for_shorten_branches);
NEXT_PASS (pass_convert_to_eh_region_ranges);
NEXT_PASS (pass_shorten_branches);
NEXT_PASS (pass_set_nothrow_function_flags);
NEXT_PASS (pass_final);
}
+ NEXT_PASS (pass_df_finish);
}
NEXT_PASS (pass_clean_state);
*p = NULL;
diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c
index 0f2f67b5668..3cbd7ebae0d 100644
--- a/gcc/postreload-gcse.c
+++ b/gcc/postreload-gcse.c
@@ -522,6 +522,7 @@ oprs_unchanged_p (rtx x, rtx insn, bool after_insn)
case CONST:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case LABEL_REF:
diff --git a/gcc/predict.c b/gcc/predict.c
index dbdfce4efdd..0cf6b9606bc 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -162,7 +162,7 @@ probably_never_executed_bb_p (const_basic_block bb)
PREDICTOR. */
bool
-rtl_predicted_by_p (basic_block bb, enum br_predictor predictor)
+rtl_predicted_by_p (const_basic_block bb, enum br_predictor predictor)
{
rtx note;
if (!INSN_P (BB_END (bb)))
@@ -183,7 +183,7 @@ static struct pointer_map_t *bb_predictions;
PREDICTOR. */
bool
-tree_predicted_by_p (basic_block bb, enum br_predictor predictor)
+tree_predicted_by_p (const_basic_block bb, enum br_predictor predictor)
{
struct edge_prediction *i;
void **preds = pointer_map_contains (bb_predictions, bb);
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
index 2891967390e..a946312c091 100644
--- a/gcc/print-rtl.c
+++ b/gcc/print-rtl.c
@@ -749,14 +749,10 @@ print_rtl_single (FILE *outf, const_rtx x)
{
outfile = outf;
sawclose = 0;
- if (! flag_dump_unnumbered)
- {
- fputs (print_rtx_head, outfile);
- print_rtx (x);
- putc ('\n', outf);
- return 1;
- }
- return 0;
+ fputs (print_rtx_head, outfile);
+ print_rtx (x);
+ putc ('\n', outf);
+ return 1;
}
diff --git a/gcc/read-rtl.c b/gcc/read-rtl.c
index 15fa503115c..fbb67b47785 100644
--- a/gcc/read-rtl.c
+++ b/gcc/read-rtl.c
@@ -21,7 +21,7 @@ along with GCC; see the file COPYING3. If not see
#include "bconfig.h"
-/* Disable rtl checking; it conflicts with the macro handling. */
+/* Disable rtl checking; it conflicts with the iterator handling. */
#undef ENABLE_RTL_CHECKING
#include "system.h"
@@ -41,17 +41,17 @@ struct map_value {
const char *string;
};
-/* Maps a macro or attribute name to a list of (integer, string) pairs.
+/* Maps an iterator or attribute name to a list of (integer, string) pairs.
The integers are mode or code values; the strings are either C conditions
or attribute values. */
struct mapping {
- /* The name of the macro or attribute. */
+ /* The name of the iterator or attribute. */
const char *name;
- /* The group (modes or codes) to which the macro or attribute belongs. */
- struct macro_group *group;
+ /* The group (modes or codes) to which the iterator or attribute belongs. */
+ struct iterator_group *group;
- /* Gives a unique number to the attribute or macro. Numbers are
+ /* Gives a unique number to the attribute or iterator. Numbers are
allocated consecutively, starting at 0. */
int index;
@@ -59,13 +59,13 @@ struct mapping {
struct map_value *values;
};
-/* A structure for abstracting the common parts of code and mode macros. */
-struct macro_group {
- /* Tables of "mapping" structures, one for attributes and one for macros. */
- htab_t attrs, macros;
+/* A structure for abstracting the common parts of code and mode iterators. */
+struct iterator_group {
+ /* Tables of "mapping" structures, one for attributes and one for iterators. */
+ htab_t attrs, iterators;
/* The number of "real" modes or codes (and by extension, the first
- number available for use as a macro placeholder). */
+ number available for use as an iterator placeholder). */
int num_builtins;
/* Treat the given string as the name of a standard mode or code and
@@ -73,10 +73,10 @@ struct macro_group {
int (*find_builtin) (const char *, FILE *);
/* Return true if the given rtx uses the given mode or code. */
- bool (*uses_macro_p) (rtx, int);
+ bool (*uses_iterator_p) (rtx, int);
/* Make the given rtx use the given mode or code. */
- void (*apply_macro) (rtx, int);
+ void (*apply_iterator) (rtx, int);
};
/* Associates PTR (which can be a string, etc.) with the file location
@@ -87,9 +87,9 @@ struct ptr_loc {
int lineno;
};
-/* A structure used to pass data from read_rtx to apply_macro_traverse
+/* A structure used to pass data from read_rtx to apply_iterator_traverse
via htab_traverse. */
-struct macro_traverse_data {
+struct iterator_traverse_data {
/* Instruction queue. */
rtx queue;
/* Attributes seen for modes. */
@@ -100,7 +100,7 @@ struct macro_traverse_data {
const char *unknown_mode_attr;
};
-/* If CODE is the number of a code macro, return a real rtx code that
+/* If CODE is the number of a code iterator, return a real rtx code that
has the same format. Return CODE otherwise. */
#define BELLWETHER_CODE(CODE) \
((CODE) < NUM_RTX_CODE ? CODE : bellwether_codes[CODE - NUM_RTX_CODE])
@@ -109,23 +109,23 @@ static void fatal_with_file_and_line (FILE *, const char *, ...)
ATTRIBUTE_PRINTF_2 ATTRIBUTE_NORETURN;
static void fatal_expected_char (FILE *, int, int) ATTRIBUTE_NORETURN;
static int find_mode (const char *, FILE *);
-static bool uses_mode_macro_p (rtx, int);
-static void apply_mode_macro (rtx, int);
+static bool uses_mode_iterator_p (rtx, int);
+static void apply_mode_iterator (rtx, int);
static int find_code (const char *, FILE *);
-static bool uses_code_macro_p (rtx, int);
-static void apply_code_macro (rtx, int);
-static const char *apply_macro_to_string (const char *, struct mapping *, int);
-static rtx apply_macro_to_rtx (rtx, struct mapping *, int,
- struct map_value *, FILE *, const char **);
-static bool uses_macro_p (rtx, struct mapping *);
+static bool uses_code_iterator_p (rtx, int);
+static void apply_code_iterator (rtx, int);
+static const char *apply_iterator_to_string (const char *, struct mapping *, int);
+static rtx apply_iterator_to_rtx (rtx, struct mapping *, int,
+ struct map_value *, FILE *, const char **);
+static bool uses_iterator_p (rtx, struct mapping *);
static const char *add_condition_to_string (const char *, const char *);
static void add_condition_to_rtx (rtx, const char *);
-static int apply_macro_traverse (void **, void *);
-static struct mapping *add_mapping (struct macro_group *, htab_t t,
+static int apply_iterator_traverse (void **, void *);
+static struct mapping *add_mapping (struct iterator_group *, htab_t t,
const char *, FILE *);
static struct map_value **add_map_value (struct map_value **,
int, const char *);
-static void initialize_macros (void);
+static void initialize_iterators (void);
static void read_name (char *, FILE *);
static hashval_t leading_ptr_hash (const void *);
static int leading_ptr_eq_p (const void *, const void *);
@@ -140,14 +140,14 @@ static int def_name_eq_p (const void *, const void *);
static void read_constants (FILE *infile, char *tmp_char);
static void read_conditions (FILE *infile, char *tmp_char);
static void validate_const_int (FILE *, const char *);
-static int find_macro (struct macro_group *, const char *, FILE *);
-static struct mapping *read_mapping (struct macro_group *, htab_t, FILE *);
-static void check_code_macro (struct mapping *, FILE *);
+static int find_iterator (struct iterator_group *, const char *, FILE *);
+static struct mapping *read_mapping (struct iterator_group *, htab_t, FILE *);
+static void check_code_iterator (struct mapping *, FILE *);
static rtx read_rtx_1 (FILE *, struct map_value **);
static rtx read_rtx_variadic (FILE *, struct map_value **, rtx);
-/* The mode and code macro structures. */
-static struct macro_group modes, codes;
+/* The mode and code iterator structures. */
+static struct iterator_group modes, codes;
/* Index I is the value of BELLWETHER_CODE (I + NUM_RTX_CODE). */
static enum rtx_code *bellwether_codes;
@@ -222,7 +222,7 @@ fatal_expected_char (FILE *infile, int expected_c, int actual_c)
expected_c, actual_c);
}
-/* Implementations of the macro_group callbacks for modes. */
+/* Implementations of the iterator_group callbacks for modes. */
static int
find_mode (const char *name, FILE *infile)
@@ -237,18 +237,18 @@ find_mode (const char *name, FILE *infile)
}
static bool
-uses_mode_macro_p (rtx x, int mode)
+uses_mode_iterator_p (rtx x, int mode)
{
return (int) GET_MODE (x) == mode;
}
static void
-apply_mode_macro (rtx x, int mode)
+apply_mode_iterator (rtx x, int mode)
{
PUT_MODE (x, (enum machine_mode) mode);
}
-/* Implementations of the macro_group callbacks for codes. */
+/* Implementations of the iterator_group callbacks for codes. */
static int
find_code (const char *name, FILE *infile)
@@ -263,42 +263,42 @@ find_code (const char *name, FILE *infile)
}
static bool
-uses_code_macro_p (rtx x, int code)
+uses_code_iterator_p (rtx x, int code)
{
return (int) GET_CODE (x) == code;
}
static void
-apply_code_macro (rtx x, int code)
+apply_code_iterator (rtx x, int code)
{
PUT_CODE (x, (enum rtx_code) code);
}
/* Map a code or mode attribute string P to the underlying string for
- MACRO and VALUE. */
+ ITERATOR and VALUE. */
static struct map_value *
-map_attr_string (const char *p, struct mapping *macro, int value)
+map_attr_string (const char *p, struct mapping *iterator, int value)
{
const char *attr;
struct mapping *m;
struct map_value *v;
- /* If there's a "macro:" prefix, check whether the macro name matches.
+ /* If there's a "iterator:" prefix, check whether the iterator name matches.
Set ATTR to the start of the attribute name. */
attr = strchr (p, ':');
if (attr == 0)
attr = p;
else
{
- if (strncmp (p, macro->name, attr - p) != 0
- || macro->name[attr - p] != 0)
+ if (strncmp (p, iterator->name, attr - p) != 0
+ || iterator->name[attr - p] != 0)
return 0;
attr++;
}
/* Find the attribute specification. */
- m = (struct mapping *) htab_find (macro->group->attrs, &attr);
+ m = (struct mapping *) htab_find (iterator->group->attrs, &attr);
if (m == 0)
return 0;
@@ -312,7 +312,7 @@ map_attr_string (const char *p, struct mapping *macro, int value)
/* Given an attribute string used as a machine mode, return an index
to store in the machine mode to be translated by
- apply_macro_to_rtx. */
+ apply_iterator_to_rtx. */
static unsigned int
mode_attr_index (struct map_value **mode_maps, const char *string)
@@ -332,27 +332,27 @@ mode_attr_index (struct map_value **mode_maps, const char *string)
*mode_maps = mv;
/* We return a code which we can map back into this string: the
- number of machine modes + the number of mode macros + the index
+ number of machine modes + the number of mode iterators + the index
we just used. */
- return MAX_MACHINE_MODE + htab_elements (modes.macros) + mv->number;
+ return MAX_MACHINE_MODE + htab_elements (modes.iterators) + mv->number;
}
/* Apply MODE_MAPS to the top level of X, expanding cases where an
- attribute is used for a mode. MACRO is the current macro we are
+ attribute is used for a mode. ITERATOR is the current iterator we are
expanding, and VALUE is the value to which we are expanding it.
INFILE is used for error messages. This sets *UNKNOWN to true if
we find a mode attribute which has not yet been defined, and does
not change it otherwise. */
static void
-apply_mode_maps (rtx x, struct map_value *mode_maps, struct mapping *macro,
+apply_mode_maps (rtx x, struct map_value *mode_maps, struct mapping *iterator,
int value, FILE *infile, const char **unknown)
{
unsigned int offset;
int indx;
struct map_value *pm;
- offset = MAX_MACHINE_MODE + htab_elements (modes.macros);
+ offset = MAX_MACHINE_MODE + htab_elements (modes.iterators);
if (GET_MODE (x) < offset)
return;
@@ -363,7 +363,7 @@ apply_mode_maps (rtx x, struct map_value *mode_maps, struct mapping *macro,
{
struct map_value *v;
- v = map_attr_string (pm->string, macro, value);
+ v = map_attr_string (pm->string, iterator, value);
if (v)
PUT_MODE (x, (enum machine_mode) find_mode (v->string, infile));
else
@@ -373,12 +373,12 @@ apply_mode_maps (rtx x, struct map_value *mode_maps, struct mapping *macro,
}
}
-/* Given that MACRO is being expanded as VALUE, apply the appropriate
+/* Given that ITERATOR is being expanded as VALUE, apply the appropriate
string substitutions to STRING. Return the new string if any changes
were needed, otherwise return STRING itself. */
static const char *
-apply_macro_to_string (const char *string, struct mapping *macro, int value)
+apply_iterator_to_string (const char *string, struct mapping *iterator, int value)
{
char *base, *copy, *p, *start, *end;
struct map_value *v;
@@ -392,7 +392,7 @@ apply_macro_to_string (const char *string, struct mapping *macro, int value)
p = start + 1;
*end = 0;
- v = map_attr_string (p, macro, value);
+ v = map_attr_string (p, iterator, value);
*end = '>';
if (v == 0)
continue;
@@ -413,18 +413,18 @@ apply_macro_to_string (const char *string, struct mapping *macro, int value)
return string;
}
-/* Return a copy of ORIGINAL in which all uses of MACRO have been
+/* Return a copy of ORIGINAL in which all uses of ITERATOR have been
replaced by VALUE. MODE_MAPS holds information about attribute
strings used for modes. INFILE is used for error messages. This
sets *UNKNOWN_MODE_ATTR to the value of an unknown mode attribute,
and does not change it otherwise. */
static rtx
-apply_macro_to_rtx (rtx original, struct mapping *macro, int value,
- struct map_value *mode_maps, FILE *infile,
- const char **unknown_mode_attr)
+apply_iterator_to_rtx (rtx original, struct mapping *iterator, int value,
+ struct map_value *mode_maps, FILE *infile,
+ const char **unknown_mode_attr)
{
- struct macro_group *group;
+ struct iterator_group *group;
const char *format_ptr;
int i, j;
rtx x;
@@ -439,12 +439,12 @@ apply_macro_to_rtx (rtx original, struct mapping *macro, int value,
memcpy (x, original, RTX_CODE_SIZE (bellwether_code));
/* Change the mode or code itself. */
- group = macro->group;
- if (group->uses_macro_p (x, macro->index + group->num_builtins))
- group->apply_macro (x, value);
+ group = iterator->group;
+ if (group->uses_iterator_p (x, iterator->index + group->num_builtins))
+ group->apply_iterator (x, value);
if (mode_maps)
- apply_mode_maps (x, mode_maps, macro, value, infile, unknown_mode_attr);
+ apply_mode_maps (x, mode_maps, iterator, value, infile, unknown_mode_attr);
/* Change each string and recursively change each rtx. */
format_ptr = GET_RTX_FORMAT (bellwether_code);
@@ -452,18 +452,18 @@ apply_macro_to_rtx (rtx original, struct mapping *macro, int value,
switch (format_ptr[i])
{
case 'T':
- XTMPL (x, i) = apply_macro_to_string (XTMPL (x, i), macro, value);
+ XTMPL (x, i) = apply_iterator_to_string (XTMPL (x, i), iterator, value);
break;
case 'S':
case 's':
- XSTR (x, i) = apply_macro_to_string (XSTR (x, i), macro, value);
+ XSTR (x, i) = apply_iterator_to_string (XSTR (x, i), iterator, value);
break;
case 'e':
- XEXP (x, i) = apply_macro_to_rtx (XEXP (x, i), macro, value,
- mode_maps, infile,
- unknown_mode_attr);
+ XEXP (x, i) = apply_iterator_to_rtx (XEXP (x, i), iterator, value,
+ mode_maps, infile,
+ unknown_mode_attr);
break;
case 'V':
@@ -472,10 +472,10 @@ apply_macro_to_rtx (rtx original, struct mapping *macro, int value,
{
XVEC (x, i) = rtvec_alloc (XVECLEN (original, i));
for (j = 0; j < XVECLEN (x, i); j++)
- XVECEXP (x, i, j) = apply_macro_to_rtx (XVECEXP (original, i, j),
- macro, value, mode_maps,
- infile,
- unknown_mode_attr);
+ XVECEXP (x, i, j) = apply_iterator_to_rtx (XVECEXP (original, i, j),
+ iterator, value, mode_maps,
+ infile,
+ unknown_mode_attr);
}
break;
@@ -485,20 +485,20 @@ apply_macro_to_rtx (rtx original, struct mapping *macro, int value,
return x;
}
-/* Return true if X (or some subexpression of X) uses macro MACRO. */
+/* Return true if X (or some subexpression of X) uses iterator ITERATOR. */
static bool
-uses_macro_p (rtx x, struct mapping *macro)
+uses_iterator_p (rtx x, struct mapping *iterator)
{
- struct macro_group *group;
+ struct iterator_group *group;
const char *format_ptr;
int i, j;
if (x == 0)
return false;
- group = macro->group;
- if (group->uses_macro_p (x, macro->index + group->num_builtins))
+ group = iterator->group;
+ if (group->uses_iterator_p (x, iterator->index + group->num_builtins))
return true;
format_ptr = GET_RTX_FORMAT (BELLWETHER_CODE (GET_CODE (x)));
@@ -506,7 +506,7 @@ uses_macro_p (rtx x, struct mapping *macro)
switch (format_ptr[i])
{
case 'e':
- if (uses_macro_p (XEXP (x, i), macro))
+ if (uses_iterator_p (XEXP (x, i), iterator))
return true;
break;
@@ -514,7 +514,7 @@ uses_macro_p (rtx x, struct mapping *macro)
case 'E':
if (XVEC (x, i))
for (j = 0; j < XVECLEN (x, i); j++)
- if (uses_macro_p (XVECEXP (x, i, j), macro))
+ if (uses_iterator_p (XVECEXP (x, i, j), iterator))
return true;
break;
@@ -566,37 +566,37 @@ add_condition_to_rtx (rtx x, const char *extra)
}
/* A htab_traverse callback. Search the EXPR_LIST given by DATA
- for rtxes that use the macro in *SLOT. Replace each such rtx
+ for rtxes that use the iterator in *SLOT. Replace each such rtx
with a list of expansions. */
static int
-apply_macro_traverse (void **slot, void *data)
+apply_iterator_traverse (void **slot, void *data)
{
- struct macro_traverse_data *mtd = (struct macro_traverse_data *) data;
- struct mapping *macro;
+ struct iterator_traverse_data *mtd = (struct iterator_traverse_data *) data;
+ struct mapping *iterator;
struct map_value *v;
rtx elem, new_elem, original, x;
- macro = (struct mapping *) *slot;
+ iterator = (struct mapping *) *slot;
for (elem = mtd->queue; elem != 0; elem = XEXP (elem, 1))
- if (uses_macro_p (XEXP (elem, 0), macro))
+ if (uses_iterator_p (XEXP (elem, 0), iterator))
{
- /* For each macro we expand, we set UNKNOWN_MODE_ATTR to NULL.
- If apply_macro_rtx finds an unknown attribute for a mode,
+ /* For each iterator we expand, we set UNKNOWN_MODE_ATTR to NULL.
+ If apply_iterator_rtx finds an unknown attribute for a mode,
it will set it to the attribute. We want to know whether
the attribute is unknown after we have expanded all
- possible macros, so setting it to NULL here gives us the
+ possible iterators, so setting it to NULL here gives us the
right result when the hash table traversal is complete. */
mtd->unknown_mode_attr = NULL;
original = XEXP (elem, 0);
- for (v = macro->values; v != 0; v = v->next)
+ for (v = iterator->values; v != 0; v = v->next)
{
- x = apply_macro_to_rtx (original, macro, v->number,
- mtd->mode_maps, mtd->infile,
- &mtd->unknown_mode_attr);
+ x = apply_iterator_to_rtx (original, iterator, v->number,
+ mtd->mode_maps, mtd->infile,
+ &mtd->unknown_mode_attr);
add_condition_to_rtx (x, v->string);
- if (v != macro->values)
+ if (v != iterator->values)
{
/* Insert a new EXPR_LIST node after ELEM and put the
new expansion there. */
@@ -616,7 +616,7 @@ apply_macro_traverse (void **slot, void *data)
is the file that defined the mapping. */
static struct mapping *
-add_mapping (struct macro_group *group, htab_t table,
+add_mapping (struct iterator_group *group, htab_t table,
const char *name, FILE *infile)
{
struct mapping *m;
@@ -657,7 +657,7 @@ add_map_value (struct map_value **end_ptr, int number, const char *string)
/* Do one-time initialization of the mode and code attributes. */
static void
-initialize_macros (void)
+initialize_iterators (void)
{
struct mapping *lower, *upper;
struct map_value **lower_ptr, **upper_ptr;
@@ -665,18 +665,18 @@ initialize_macros (void)
int i;
modes.attrs = htab_create (13, def_hash, def_name_eq_p, 0);
- modes.macros = htab_create (13, def_hash, def_name_eq_p, 0);
+ modes.iterators = htab_create (13, def_hash, def_name_eq_p, 0);
modes.num_builtins = MAX_MACHINE_MODE;
modes.find_builtin = find_mode;
- modes.uses_macro_p = uses_mode_macro_p;
- modes.apply_macro = apply_mode_macro;
+ modes.uses_iterator_p = uses_mode_iterator_p;
+ modes.apply_iterator = apply_mode_iterator;
codes.attrs = htab_create (13, def_hash, def_name_eq_p, 0);
- codes.macros = htab_create (13, def_hash, def_name_eq_p, 0);
+ codes.iterators = htab_create (13, def_hash, def_name_eq_p, 0);
codes.num_builtins = NUM_RTX_CODE;
codes.find_builtin = find_code;
- codes.uses_macro_p = uses_code_macro_p;
- codes.apply_macro = apply_code_macro;
+ codes.uses_iterator_p = uses_code_iterator_p;
+ codes.apply_iterator = apply_code_iterator;
lower = add_mapping (&modes, modes.attrs, "mode", 0);
upper = add_mapping (&modes, modes.attrs, "MODE", 0);
@@ -1284,11 +1284,11 @@ validate_const_int (FILE *infile, const char *string)
identifier. INFILE is the file that contained NAME. */
static int
-find_macro (struct macro_group *group, const char *name, FILE *infile)
+find_iterator (struct iterator_group *group, const char *name, FILE *infile)
{
struct mapping *m;
- m = (struct mapping *) htab_find (group->macros, &name);
+ m = (struct mapping *) htab_find (group->iterators, &name);
if (m != 0)
return m->index + group->num_builtins;
return group->find_builtin (name, infile);
@@ -1305,7 +1305,7 @@ find_macro (struct macro_group *group, const char *name, FILE *infile)
(which belongs to GROUP) and return it. */
static struct mapping *
-read_mapping (struct macro_group *group, htab_t table, FILE *infile)
+read_mapping (struct iterator_group *group, htab_t table, FILE *infile)
{
char tmp_char[256];
struct mapping *m;
@@ -1356,24 +1356,24 @@ read_mapping (struct macro_group *group, htab_t table, FILE *infile)
return m;
}
-/* Check newly-created code macro MACRO to see whether every code has the
- same format. Initialize the macro's entry in bellwether_codes. */
+/* Check newly-created code iterator ITERATOR to see whether every code has the
+ same format. Initialize the iterator's entry in bellwether_codes. */
static void
-check_code_macro (struct mapping *macro, FILE *infile)
+check_code_iterator (struct mapping *iterator, FILE *infile)
{
struct map_value *v;
enum rtx_code bellwether;
- bellwether = (enum rtx_code) macro->values->number;
- for (v = macro->values->next; v != 0; v = v->next)
+ bellwether = (enum rtx_code) iterator->values->number;
+ for (v = iterator->values->next; v != 0; v = v->next)
if (strcmp (GET_RTX_FORMAT (bellwether), GET_RTX_FORMAT (v->number)) != 0)
- fatal_with_file_and_line (infile, "code macro `%s' combines "
- "different rtx formats", macro->name);
+ fatal_with_file_and_line (infile, "code iterator `%s' combines "
+ "different rtx formats", iterator->name);
bellwether_codes = XRESIZEVEC (enum rtx_code, bellwether_codes,
- macro->index + 1);
- bellwether_codes[macro->index] = bellwether;
+ iterator->index + 1);
+ bellwether_codes[iterator->index] = bellwether;
}
/* Read an rtx in printed representation from INFILE and store its
@@ -1394,7 +1394,7 @@ read_rtx (FILE *infile, rtx *x, int *lineno)
/* Do one-time initialization. */
if (queue_head == 0)
{
- initialize_macros ();
+ initialize_iterators ();
obstack_init (&string_obstack);
queue_head = rtx_alloc (EXPR_LIST);
ptr_locs = htab_create (161, leading_ptr_hash, leading_ptr_eq_p, 0);
@@ -1407,7 +1407,7 @@ read_rtx (FILE *infile, rtx *x, int *lineno)
if (queue_next == 0)
{
struct map_value *mode_maps;
- struct macro_traverse_data mtd;
+ struct iterator_traverse_data mtd;
rtx from_file;
c = read_skip_spaces (infile);
@@ -1431,8 +1431,8 @@ read_rtx (FILE *infile, rtx *x, int *lineno)
mtd.mode_maps = mode_maps;
mtd.infile = infile;
mtd.unknown_mode_attr = mode_maps ? mode_maps->string : NULL;
- htab_traverse (modes.macros, apply_macro_traverse, &mtd);
- htab_traverse (codes.macros, apply_macro_traverse, &mtd);
+ htab_traverse (modes.iterators, apply_iterator_traverse, &mtd);
+ htab_traverse (codes.iterators, apply_iterator_traverse, &mtd);
if (mtd.unknown_mode_attr)
fatal_with_file_and_line (infile,
"undefined attribute '%s' used for mode",
@@ -1447,7 +1447,7 @@ read_rtx (FILE *infile, rtx *x, int *lineno)
}
/* Subroutine of read_rtx that reads one construct from INFILE but
- doesn't apply any macros. */
+ doesn't apply any iterators. */
static rtx
read_rtx_1 (FILE *infile, struct map_value **mode_maps)
@@ -1504,9 +1504,9 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps)
read_mapping (&modes, modes.attrs, infile);
goto again;
}
- if (strcmp (tmp_char, "define_mode_macro") == 0)
+ if (strcmp (tmp_char, "define_mode_iterator") == 0)
{
- read_mapping (&modes, modes.macros, infile);
+ read_mapping (&modes, modes.iterators, infile);
goto again;
}
if (strcmp (tmp_char, "define_code_attr") == 0)
@@ -1514,12 +1514,13 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps)
read_mapping (&codes, codes.attrs, infile);
goto again;
}
- if (strcmp (tmp_char, "define_code_macro") == 0)
+ if (strcmp (tmp_char, "define_code_iterator") == 0)
{
- check_code_macro (read_mapping (&codes, codes.macros, infile), infile);
+ check_code_iterator (read_mapping (&codes, codes.iterators, infile),
+ infile);
goto again;
}
- real_code = (enum rtx_code) find_macro (&codes, tmp_char, infile);
+ real_code = (enum rtx_code) find_iterator (&codes, tmp_char, infile);
bellwether_code = BELLWETHER_CODE (real_code);
/* If we end up with an insn expression then we free this space below. */
@@ -1537,7 +1538,7 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps)
read_name (tmp_char, infile);
if (tmp_char[0] != '<' || tmp_char[strlen (tmp_char) - 1] != '>')
- mode = find_macro (&modes, tmp_char, infile);
+ mode = find_iterator (&modes, tmp_char, infile);
else
mode = mode_attr_index (mode_maps, tmp_char);
PUT_MODE (return_rtx, (enum machine_mode) mode);
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 217c43e5eb9..1fbd322aaf4 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -249,7 +249,7 @@ static rtx not_a_num;
/* Forward declarations */
-static int stack_regs_mentioned_p (rtx pat);
+static int stack_regs_mentioned_p (const_rtx pat);
static void pop_stack (stack, int);
static rtx *get_true_reg (rtx *);
@@ -276,7 +276,7 @@ static rtx next_flags_user (rtx);
/* Return nonzero if any stack register is mentioned somewhere within PAT. */
static int
-stack_regs_mentioned_p (rtx pat)
+stack_regs_mentioned_p (const_rtx pat)
{
const char *fmt;
int i;
@@ -305,7 +305,7 @@ stack_regs_mentioned_p (rtx pat)
/* Return nonzero if INSN mentions stacked registers, else return zero. */
int
-stack_regs_mentioned (rtx insn)
+stack_regs_mentioned (const_rtx insn)
{
unsigned int uid, max;
int test;
diff --git a/gcc/regclass.c b/gcc/regclass.c
index b9fc2ea116a..689f91ebf75 100644
--- a/gcc/regclass.c
+++ b/gcc/regclass.c
@@ -81,7 +81,7 @@ HARD_REG_SET fixed_reg_set;
/* Data for initializing the above. */
-static const char initial_fixed_regs[] = FIXED_REGISTERS;
+static char initial_fixed_regs[] = FIXED_REGISTERS;
/* Indexed by hard register number, contains 1 for registers
that are fixed use or are clobbered by function calls.
@@ -100,7 +100,7 @@ HARD_REG_SET losing_caller_save_reg_set;
/* Data for initializing the above. */
-static const char initial_call_used_regs[] = CALL_USED_REGISTERS;
+static char initial_call_used_regs[] = CALL_USED_REGISTERS;
/* This is much like call_used_regs, except it doesn't have to
be a superset of FIXED_REGISTERS. This vector indicates
@@ -108,7 +108,8 @@ static const char initial_call_used_regs[] = CALL_USED_REGISTERS;
regs_invalidated_by_call. */
#ifdef CALL_REALLY_USED_REGISTERS
-char call_really_used_regs[] = CALL_REALLY_USED_REGISTERS;
+static char initial_call_really_used_regs[] = CALL_REALLY_USED_REGISTERS;
+char call_really_used_regs[FIRST_PSEUDO_REGISTER];
#endif
#ifdef CALL_REALLY_USED_REGISTERS
@@ -192,7 +193,11 @@ enum reg_class reg_class_superunion[N_REG_CLASSES][N_REG_CLASSES];
/* Array containing all of the register names. */
-const char * reg_names[] = REGISTER_NAMES;
+const char * reg_names[FIRST_PSEUDO_REGISTER];
+
+/* Data for initializing the above. */
+
+const char * initial_reg_names[] = REGISTER_NAMES;
/* Array containing all of the register class names. */
@@ -230,6 +235,9 @@ static move_table *may_move_in_cost[MAX_MACHINE_MODE];
static move_table *may_move_out_cost[MAX_MACHINE_MODE];
+/* Keep track of the last mode we initialized move costs for. */
+static int last_mode_for_init_move_cost;
+
#ifdef FORBIDDEN_INC_DEC_CLASSES
/* These are the classes that regs which are auto-incremented or decremented
@@ -298,19 +306,12 @@ init_reg_sets (void)
SET_HARD_REG_BIT (reg_class_contents[i], j);
}
- /* Sanity check: make sure the target macros FIXED_REGISTERS and
- CALL_USED_REGISTERS had the right number of initializers. */
- gcc_assert (sizeof fixed_regs == sizeof initial_fixed_regs);
- gcc_assert (sizeof call_used_regs == sizeof initial_call_used_regs);
-
- memcpy (fixed_regs, initial_fixed_regs, sizeof fixed_regs);
- memcpy (call_used_regs, initial_call_used_regs, sizeof call_used_regs);
memset (global_regs, 0, sizeof global_regs);
-#ifdef REG_ALLOC_ORDER
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- inv_reg_alloc_order[reg_alloc_order[i]] = i;
-#endif
+ /* Processing of command-line options like -ffixed needs to know the
+ initial set of register names, so initialize that now. */
+ gcc_assert (sizeof reg_names == sizeof initial_reg_names);
+ memcpy (reg_names, initial_reg_names, sizeof reg_names);
}
/* Initialize may_move_cost and friends for mode M. */
@@ -319,7 +320,6 @@ static void
init_move_cost (enum machine_mode m)
{
static unsigned short last_move_cost[N_REG_CLASSES][N_REG_CLASSES];
- static int last_mode = -1;
bool all_match = true;
unsigned int i, j;
@@ -339,14 +339,14 @@ init_move_cost (enum machine_mode m)
all_match &= (last_move_cost[i][j] == cost);
last_move_cost[i][j] = cost;
}
- if (all_match && last_mode != -1)
+ if (all_match && last_mode_for_init_move_cost != -1)
{
- move_cost[m] = move_cost[last_mode];
- may_move_in_cost[m] = may_move_in_cost[last_mode];
- may_move_out_cost[m] = may_move_out_cost[last_mode];
+ move_cost[m] = move_cost[last_mode_for_init_move_cost];
+ may_move_in_cost[m] = may_move_in_cost[last_mode_for_init_move_cost];
+ may_move_out_cost[m] = may_move_out_cost[last_mode_for_init_move_cost];
return;
}
- last_mode = m;
+ last_mode_for_init_move_cost = m;
move_cost[m] = (move_table *)xmalloc (sizeof (move_table)
* N_REG_CLASSES);
may_move_in_cost[m] = (move_table *)xmalloc (sizeof (move_table)
@@ -412,6 +412,31 @@ init_reg_sets_1 (void)
unsigned int i, j;
unsigned int /* enum machine_mode */ m;
+ /* Sanity check: make sure the target macros FIXED_REGISTERS and
+ CALL_USED_REGISTERS had the right number of initializers. */
+ gcc_assert (sizeof fixed_regs == sizeof initial_fixed_regs);
+ gcc_assert (sizeof call_used_regs == sizeof initial_call_used_regs);
+
+ memcpy (fixed_regs, initial_fixed_regs, sizeof fixed_regs);
+ memcpy (call_used_regs, initial_call_used_regs, sizeof call_used_regs);
+
+ /* Likewise for call_really_used_regs. */
+#ifdef CALL_REALLY_USED_REGISTERS
+ gcc_assert (sizeof call_really_used_regs
+ == sizeof initial_call_really_used_regs);
+ memcpy (call_really_used_regs, initial_call_really_used_regs,
+ sizeof call_really_used_regs);
+#endif
+
+ /* And similarly for reg_names. */
+ gcc_assert (sizeof reg_names == sizeof initial_reg_names);
+ memcpy (reg_names, initial_reg_names, sizeof reg_names);
+
+#ifdef REG_ALLOC_ORDER
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ inv_reg_alloc_order[reg_alloc_order[i]] = i;
+#endif
+
/* This macro allows the fixed or call-used registers
and the register classes to depend on target flags. */
@@ -431,6 +456,7 @@ init_reg_sets_1 (void)
reg_class_subunion[I][J] gets the largest-numbered reg-class
that is contained in the union of classes I and J. */
+ memset (reg_class_subunion, 0, sizeof reg_class_subunion);
for (i = 0; i < N_REG_CLASSES; i++)
{
for (j = 0; j < N_REG_CLASSES; j++)
@@ -453,6 +479,7 @@ init_reg_sets_1 (void)
reg_class_superunion[I][J] gets the smallest-numbered reg-class
containing the union of classes I and J. */
+ memset (reg_class_superunion, 0, sizeof reg_class_superunion);
for (i = 0; i < N_REG_CLASSES; i++)
{
for (j = 0; j < N_REG_CLASSES; j++)
@@ -511,6 +538,7 @@ init_reg_sets_1 (void)
CLEAR_HARD_REG_SET (call_used_reg_set);
CLEAR_HARD_REG_SET (call_fixed_reg_set);
CLEAR_HARD_REG_SET (regs_invalidated_by_call);
+ CLEAR_HARD_REG_SET (losing_caller_save_reg_set);
memcpy (call_fixed_regs, fixed_regs, sizeof call_fixed_regs);
@@ -564,6 +592,18 @@ init_reg_sets_1 (void)
SET_HARD_REG_BIT (regs_invalidated_by_call, i);
}
+ /* Preserve global registers if called more than once. */
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ {
+ if (global_regs[i])
+ {
+ fixed_regs[i] = call_used_regs[i] = call_fixed_regs[i] = 1;
+ SET_HARD_REG_BIT (fixed_reg_set, i);
+ SET_HARD_REG_BIT (call_used_reg_set, i);
+ SET_HARD_REG_BIT (call_fixed_reg_set, i);
+ }
+ }
+
memset (have_regs_of_mode, 0, sizeof (have_regs_of_mode));
memset (contains_reg_of_mode, 0, sizeof (contains_reg_of_mode));
for (m = 0; m < (unsigned int) MAX_MACHINE_MODE; m++)
@@ -582,14 +622,36 @@ init_reg_sets_1 (void)
have_regs_of_mode [m] = 1;
}
}
+
+ /* Reset move_cost and friends, making sure we only free shared
+ table entries once. */
+ for (i = 0; i < MAX_MACHINE_MODE; i++)
+ if (move_cost[i])
+ {
+ for (j = 0; j < i && move_cost[i] != move_cost[j]; j++)
+ ;
+ if (i == j)
+ {
+ free (move_cost[i]);
+ free (may_move_in_cost[i]);
+ free (may_move_out_cost[i]);
+ }
+ }
+ memset (move_cost, 0, sizeof move_cost);
+ memset (may_move_in_cost, 0, sizeof may_move_in_cost);
+ memset (may_move_out_cost, 0, sizeof may_move_out_cost);
+ last_mode_for_init_move_cost = -1;
}
/* Compute the table of register modes.
These values are used to record death information for individual registers
- (as opposed to a multi-register mode). */
+ (as opposed to a multi-register mode).
+ This function might be invoked more than once, if the target has support
+ for changing register usage conventions on a per-function basis.
+*/
void
-init_reg_modes_once (void)
+init_reg_modes_target (void)
{
int i, j;
@@ -611,8 +673,10 @@ init_reg_modes_once (void)
}
}
-/* Finish initializing the register sets and
- initialize the register modes. */
+/* Finish initializing the register sets and initialize the register modes.
+ This function might be invoked more than once, if the target has support
+ for changing register usage conventions on a per-function basis.
+*/
void
init_regs (void)
@@ -782,11 +846,11 @@ fix_register (const char *name, int fixed, int call_used)
}
else
{
- fixed_regs[i] = fixed;
- call_used_regs[i] = call_used;
+ initial_fixed_regs[i] = fixed;
+ initial_call_used_regs[i] = call_used;
#ifdef CALL_REALLY_USED_REGISTERS
if (fixed == 0)
- call_really_used_regs[i] = call_used;
+ initial_call_really_used_regs[i] = call_used;
#endif
}
}
@@ -1157,6 +1221,7 @@ init_reg_autoinc (void)
#ifdef FORBIDDEN_INC_DEC_CLASSES
int i;
+ memset (forbidden_inc_dec_class, 0, sizeof forbidden_inc_dec_class);
for (i = 0; i < N_REG_CLASSES; i++)
{
rtx r = gen_rtx_raw_REG (VOIDmode, 0);
@@ -2244,6 +2309,7 @@ reg_scan_mark_refs (rtx x, rtx insn)
case CONST:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case CC0:
case PC:
diff --git a/gcc/regrename.c b/gcc/regrename.c
index 29f8e763d92..68a3e68f78e 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -654,6 +654,7 @@ scan_rtx (rtx insn, rtx *loc, enum reg_class cl,
case CONST:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case LABEL_REF:
diff --git a/gcc/reload.c b/gcc/reload.c
index 06ce96bfd38..60e36ffc6c5 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -2210,6 +2210,7 @@ operands_match_p (rtx x, rtx y)
{
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
return 0;
case LABEL_REF:
@@ -5142,6 +5143,7 @@ subst_reg_equivs (rtx ad, rtx insn)
case CONST_INT:
case CONST:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case LABEL_REF:
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 319ba13f1f7..41789696685 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -448,7 +448,8 @@ static int reloads_conflict (int, int);
static rtx gen_reload (rtx, rtx, int, enum reload_type);
static rtx emit_insn_if_valid_for_reload (rtx);
-/* Initialize the reload pass once per compilation. */
+/* Initialize the reload pass. This is called at the beginning of compilation
+ and may be called again if the target is reinitialized. */
void
init_reload (void)
@@ -2411,6 +2412,7 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
{
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case CONST:
case SYMBOL_REF:
@@ -2804,6 +2806,7 @@ elimination_effects (rtx x, enum machine_mode mem_mode)
{
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case CONST:
case SYMBOL_REF:
@@ -3952,6 +3955,7 @@ scan_paradoxical_subregs (rtx x)
case SYMBOL_REF:
case LABEL_REF:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR: /* shouldn't happen, but just in case. */
case CC0:
case PC:
diff --git a/gcc/resource.c b/gcc/resource.c
index 77a9e7e81ef..7cb4d2ae490 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -222,6 +222,7 @@ mark_referenced_resources (rtx x, struct resources *res,
case CONST:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case PC:
case SYMBOL_REF:
@@ -638,6 +639,7 @@ mark_set_resources (rtx x, struct resources *res, int in_dest,
case USE:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case LABEL_REF:
case SYMBOL_REF:
diff --git a/gcc/rtl.c b/gcc/rtl.c
index 9d487b93985..edf393f29d2 100644
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -110,7 +110,7 @@ const enum rtx_class rtx_class[NUM_RTX_CODE] = {
const unsigned char rtx_code_size[NUM_RTX_CODE] = {
#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) \
- ((ENUM) == CONST_INT || (ENUM) == CONST_DOUBLE \
+ ((ENUM) == CONST_INT || (ENUM) == CONST_DOUBLE || (ENUM) == CONST_FIXED\
? RTX_HDR_SIZE + (sizeof FORMAT - 1) * sizeof (HOST_WIDE_INT) \
: RTX_HDR_SIZE + (sizeof FORMAT - 1) * sizeof (rtunion)),
@@ -234,6 +234,7 @@ copy_rtx (rtx orig)
case REG:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case CODE_LABEL:
@@ -374,6 +375,7 @@ rtx_equal_p (const_rtx x, const_rtx y)
case SCRATCH:
case CONST_DOUBLE:
case CONST_INT:
+ case CONST_FIXED:
return 0;
default:
diff --git a/gcc/rtl.def b/gcc/rtl.def
index 1131b3ad84f..9dee20016e3 100644
--- a/gcc/rtl.def
+++ b/gcc/rtl.def
@@ -323,6 +323,9 @@ DEF_RTL_EXPR(RESX, "resx", "i", RTX_EXTRA)
/* numeric integer constant */
DEF_RTL_EXPR(CONST_INT, "const_int", "w", RTX_CONST_OBJ)
+/* fixed-point constant */
+DEF_RTL_EXPR(CONST_FIXED, "const_fixed", "www", RTX_CONST_OBJ)
+
/* numeric floating point constant.
Operands hold the value. They are all 'w' and there may be from 2 to 6;
see real.h. */
@@ -452,8 +455,18 @@ DEF_RTL_EXPR(NEG, "neg", "e", RTX_UNARY)
DEF_RTL_EXPR(MULT, "mult", "ee", RTX_COMM_ARITH)
+/* Multiplication with signed saturation */
+DEF_RTL_EXPR(SS_MULT, "ss_mult", "ee", RTX_COMM_ARITH)
+/* Multiplication with unsigned saturation */
+DEF_RTL_EXPR(US_MULT, "us_mult", "ee", RTX_COMM_ARITH)
+
/* Operand 0 divided by operand 1. */
DEF_RTL_EXPR(DIV, "div", "ee", RTX_BIN_ARITH)
+/* Division with signed saturation */
+DEF_RTL_EXPR(SS_DIV, "ss_div", "ee", RTX_BIN_ARITH)
+/* Division with unsigned saturation */
+DEF_RTL_EXPR(US_DIV, "us_div", "ee", RTX_BIN_ARITH)
+
/* Remainder of operand 0 divided by operand 1. */
DEF_RTL_EXPR(MOD, "mod", "ee", RTX_BIN_ARITH)
@@ -576,6 +589,37 @@ DEF_RTL_EXPR(UNSIGNED_FLOAT, "unsigned_float", "e", RTX_UNARY)
Value is defined only when the operand's value is an integer. */
DEF_RTL_EXPR(UNSIGNED_FIX, "unsigned_fix", "e", RTX_UNARY)
+/* Conversions involving fractional fixed-point types without saturation,
+ including:
+ fractional to fractional (of different precision),
+ signed integer to fractional,
+ fractional to signed integer,
+ floating point to fractional,
+ fractional to floating point.
+ NOTE: fractional can be either signed or unsigned for conversions. */
+DEF_RTL_EXPR(FRACT_CONVERT, "fract_convert", "e", RTX_UNARY)
+
+/* Conversions involving fractional fixed-point types and unsigned integer
+ without saturation, including:
+ unsigned integer to fractional,
+ fractional to unsigned integer.
+ NOTE: fractional can be either signed or unsigned for conversions. */
+DEF_RTL_EXPR(UNSIGNED_FRACT_CONVERT, "unsigned_fract_convert", "e", RTX_UNARY)
+
+/* Conversions involving fractional fixed-point types with saturation,
+ including:
+ fractional to fractional (of different precision),
+ signed integer to fractional,
+ floating point to fractional.
+ NOTE: fractional can be either signed or unsigned for conversions. */
+DEF_RTL_EXPR(SAT_FRACT, "sat_fract", "e", RTX_UNARY)
+
+/* Conversions involving fractional fixed-point types and unsigned integer
+ with saturation, including:
+ unsigned integer to fractional.
+ NOTE: fractional can be either signed or unsigned for conversions. */
+DEF_RTL_EXPR(UNSIGNED_SAT_FRACT, "unsigned_sat_fract", "e", RTX_UNARY)
+
/* Absolute value */
DEF_RTL_EXPR(ABS, "abs", "e", RTX_UNARY)
@@ -662,6 +706,8 @@ DEF_RTL_EXPR(SS_MINUS, "ss_minus", "ee", RTX_BIN_ARITH)
/* Negation with signed saturation. */
DEF_RTL_EXPR(SS_NEG, "ss_neg", "e", RTX_UNARY)
+/* Negation with unsigned saturation. */
+DEF_RTL_EXPR(US_NEG, "us_neg", "e", RTX_UNARY)
/* Absolute value with signed saturation. */
DEF_RTL_EXPR(SS_ABS, "ss_abs", "e", RTX_UNARY)
@@ -669,6 +715,9 @@ DEF_RTL_EXPR(SS_ABS, "ss_abs", "e", RTX_UNARY)
/* Shift left with signed saturation. */
DEF_RTL_EXPR(SS_ASHIFT, "ss_ashift", "ee", RTX_BIN_ARITH)
+/* Shift left with unsigned saturation. */
+DEF_RTL_EXPR(US_ASHIFT, "us_ashift", "ee", RTX_BIN_ARITH)
+
/* Operand 0 minus operand 1, with unsigned saturation. */
DEF_RTL_EXPR(US_MINUS, "us_minus", "ee", RTX_BIN_ARITH)
diff --git a/gcc/rtl.h b/gcc/rtl.h
index ff884b314a4..85996585848 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "input.h"
#include "real.h"
#include "vec.h"
+#include "fixed-value.h"
#include "alias.h"
#undef FFS /* Some systems predefine this symbol; don't let it interfere. */
@@ -308,6 +309,7 @@ struct rtx_def GTY((chain_next ("RTX_NEXT (&%h)"),
HOST_WIDE_INT hwint[1];
struct block_symbol block_sym;
struct real_value rv;
+ struct fixed_value fv;
} GTY ((special ("rtx_def"), desc ("GET_CODE (&%0)"))) u;
};
@@ -530,6 +532,13 @@ struct rtvec_def GTY(()) {
__LINE__, __FUNCTION__); \
&_rtx->u.rv; })
+#define XCNMPFV(RTX, C, M) __extension__ \
+({ __typeof (RTX) const _rtx = (RTX); \
+ if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M)) \
+ rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__, \
+ __LINE__, __FUNCTION__); \
+ &_rtx->u.fv; })
+
#define BLOCK_SYMBOL_CHECK(RTX) __extension__ \
({ __typeof (RTX) const _symbol = (RTX); \
const unsigned int flags = RTL_CHECKC1 (_symbol, 1, SYMBOL_REF).rt_int; \
@@ -574,6 +583,7 @@ extern void rtvec_check_failed_bounds (const_rtvec, int, const char *, int,
#define XCMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
#define XCNMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
#define XCNMPRV(RTX, C, M) (&(RTX)->u.rv)
+#define XCNMPFV(RTX, C, M) (&(RTX)->u.fv)
#define BLOCK_SYMBOL_CHECK(RTX) (&(RTX)->u.block_sym)
#endif
@@ -1011,6 +1021,13 @@ rhs_regno (const_rtx x)
#define CONST_DOUBLE_REAL_VALUE(r) \
((const struct real_value *) XCNMPRV (r, CONST_DOUBLE, VOIDmode))
+#define CONST_FIXED_VALUE(r) \
+ ((const struct fixed_value *) XCNMPFV (r, CONST_FIXED, VOIDmode))
+#define CONST_FIXED_VALUE_HIGH(r) \
+ ((HOST_WIDE_INT) (CONST_FIXED_VALUE(r)->data.high))
+#define CONST_FIXED_VALUE_LOW(r) \
+ ((HOST_WIDE_INT) (CONST_FIXED_VALUE(r)->data.low))
+
/* For a CONST_VECTOR, return element #n. */
#define CONST_VECTOR_ELT(RTX, N) XCVECEXP (RTX, 0, N, CONST_VECTOR)
@@ -1576,16 +1593,26 @@ extern rtx make_jump_insn_raw (rtx);
extern void add_function_usage_to (rtx, rtx);
extern rtx last_call_insn (void);
extern rtx previous_insn (rtx);
+extern const_rtx const_previous_insn (const_rtx);
extern rtx next_insn (rtx);
+extern const_rtx const_next_insn (const_rtx);
extern rtx prev_nonnote_insn (rtx);
+extern const_rtx const_prev_nonnote_insn (const_rtx);
extern rtx next_nonnote_insn (rtx);
+extern const_rtx const_next_nonnote_insn (const_rtx);
extern rtx prev_real_insn (rtx);
+extern const_rtx const_prev_real_insn (const_rtx);
extern rtx next_real_insn (rtx);
+extern const_rtx const_next_real_insn (const_rtx);
extern rtx prev_active_insn (rtx);
+extern const_rtx const_prev_active_insn (const_rtx);
extern rtx next_active_insn (rtx);
+extern const_rtx const_next_active_insn (const_rtx);
extern int active_insn_p (const_rtx);
extern rtx prev_label (rtx);
+extern const_rtx const_prev_label (const_rtx);
extern rtx next_label (rtx);
+extern const_rtx const_next_label (const_rtx);
extern rtx skip_consecutive_labels (rtx);
extern rtx next_cc0_user (rtx);
extern rtx prev_cc0_setter (rtx);
@@ -1646,7 +1673,7 @@ extern rtx simplify_subreg (enum machine_mode, rtx, enum machine_mode,
extern rtx simplify_gen_subreg (enum machine_mode, rtx, enum machine_mode,
unsigned int);
extern rtx simplify_replace_rtx (rtx, const_rtx, rtx);
-extern rtx simplify_rtx (rtx);
+extern rtx simplify_rtx (const_rtx);
extern rtx avoid_constant_pool_reference (rtx);
extern bool mode_signbit_p (enum machine_mode, const_rtx);
@@ -1691,9 +1718,9 @@ extern int reg_used_between_p (const_rtx, const_rtx, const_rtx);
extern int reg_set_between_p (const_rtx, const_rtx, const_rtx);
extern int commutative_operand_precedence (rtx);
extern bool swap_commutative_operands_p (rtx, rtx);
-extern int modified_between_p (rtx, rtx, rtx);
+extern int modified_between_p (const_rtx, const_rtx, const_rtx);
extern int no_labels_between_p (const_rtx, const_rtx);
-extern int modified_in_p (rtx, rtx);
+extern int modified_in_p (const_rtx, const_rtx);
extern int reg_set_p (const_rtx, const_rtx);
extern rtx single_set_2 (const_rtx, const_rtx);
extern int multiple_sets (const_rtx);
@@ -1704,6 +1731,7 @@ extern int refers_to_regno_p (unsigned int, unsigned int, const_rtx, rtx *);
extern int reg_overlap_mentioned_p (const_rtx, const_rtx);
extern const_rtx set_of (const_rtx, const_rtx);
extern void note_stores (const_rtx, void (*) (rtx, const_rtx, void *), void *);
+extern void const_note_stores (const_rtx, void (*) (const_rtx, const_rtx, const void *), const void *);
extern void note_uses (rtx *, void (*) (rtx *, void *), void *);
extern int dead_or_set_p (const_rtx, const_rtx);
extern int dead_or_set_regno_p (const_rtx, unsigned int);
@@ -1736,7 +1764,7 @@ extern int in_expr_list_p (const_rtx, const_rtx);
extern void remove_node_from_expr_list (const_rtx, rtx *);
extern int loc_mentioned_in_p (rtx *, const_rtx);
extern rtx find_first_parameter_load (rtx, rtx);
-extern bool keep_with_call_p (rtx);
+extern bool keep_with_call_p (const_rtx);
extern bool label_is_jump_target_p (const_rtx, const_rtx);
extern int insn_rtx_cost (rtx);
@@ -2011,7 +2039,7 @@ extern int condjump_p (const_rtx);
extern int any_condjump_p (const_rtx);
extern int any_uncondjump_p (const_rtx);
extern rtx pc_set (const_rtx);
-extern rtx condjump_label (rtx);
+extern rtx condjump_label (const_rtx);
extern int simplejump_p (const_rtx);
extern int returnjump_p (rtx);
extern int onlyjump_p (const_rtx);
@@ -2019,17 +2047,17 @@ extern int only_sets_cc0_p (const_rtx);
extern int sets_cc0_p (const_rtx);
extern int invert_jump_1 (rtx, rtx);
extern int invert_jump (rtx, rtx, int);
-extern int rtx_renumbered_equal_p (rtx, rtx);
+extern int rtx_renumbered_equal_p (const_rtx, const_rtx);
extern int true_regnum (const_rtx);
extern unsigned int reg_or_subregno (const_rtx);
extern int redirect_jump_1 (rtx, rtx);
extern void redirect_jump_2 (rtx, rtx, rtx, int, int);
extern int redirect_jump (rtx, rtx, int);
extern void rebuild_jump_labels (rtx);
-extern rtx reversed_comparison (rtx, enum machine_mode);
-extern enum rtx_code reversed_comparison_code (rtx, rtx);
-extern enum rtx_code reversed_comparison_code_parts (enum rtx_code, rtx,
- rtx, rtx);
+extern rtx reversed_comparison (const_rtx, enum machine_mode);
+extern enum rtx_code reversed_comparison_code (const_rtx, const_rtx);
+extern enum rtx_code reversed_comparison_code_parts (enum rtx_code, const_rtx,
+ const_rtx, const_rtx);
extern void delete_for_peephole (rtx, rtx);
extern int condjump_in_parallel_p (const_rtx);
@@ -2049,6 +2077,7 @@ extern int get_max_uid (void);
extern int in_sequence_p (void);
extern void force_next_line_note (void);
extern void init_emit (void);
+extern void init_emit_regs (void);
extern void init_emit_once (int);
extern void push_topmost_sequence (void);
extern void pop_topmost_sequence (void);
@@ -2158,7 +2187,7 @@ extern void build_insn_chain (rtx);
extern int reg_classes_intersect_p (enum reg_class, enum reg_class);
extern int reg_class_subset_p (enum reg_class, enum reg_class);
extern void globalize_reg (int);
-extern void init_reg_modes_once (void);
+extern void init_reg_modes_target (void);
extern void init_regs (void);
extern void init_fake_stack_mems (void);
extern void init_reg_sets (void);
@@ -2201,7 +2230,7 @@ extern rtx emit_library_call_value (rtx, rtx, enum libcall_type,
/* In varasm.c */
extern void init_varasm_once (void);
-extern enum tls_model decl_default_tls_model (tree);
+extern enum tls_model decl_default_tls_model (const_tree);
/* In rtl.c */
extern void traverse_md_constants (int (*) (void **, void *), void *);
@@ -2226,17 +2255,17 @@ extern int canon_true_dependence (const_rtx, enum machine_mode, rtx, const_rtx,
extern int read_dependence (const_rtx, const_rtx);
extern int anti_dependence (const_rtx, const_rtx);
extern int output_dependence (const_rtx, const_rtx);
-extern void init_alias_once (void);
+extern void init_alias_target (void);
extern void init_alias_analysis (void);
extern void end_alias_analysis (void);
-extern bool memory_modified_in_insn_p (rtx, rtx);
+extern bool memory_modified_in_insn_p (const_rtx, const_rtx);
extern rtx find_base_term (rtx);
extern rtx gen_hard_reg_clobber (enum machine_mode, unsigned int);
extern rtx get_reg_known_value (unsigned int);
extern bool get_reg_known_equiv_p (unsigned int);
#ifdef STACK_REGS
-extern int stack_regs_mentioned (rtx insn);
+extern int stack_regs_mentioned (const_rtx insn);
#endif
/* In toplev.c */
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index b86add0ceb4..4a4a62904b5 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -120,6 +120,7 @@ rtx_unstable_p (const_rtx x)
case CONST:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case LABEL_REF:
@@ -194,6 +195,7 @@ rtx_varies_p (const_rtx x, bool for_alias)
case CONST:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case LABEL_REF:
@@ -573,6 +575,7 @@ count_occurrences (const_rtx x, const_rtx find, int count_dest)
case REG:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case CODE_LABEL:
@@ -659,6 +662,7 @@ reg_mentioned_p (const_rtx reg, const_rtx in)
case CONST_INT:
case CONST_VECTOR:
case CONST_DOUBLE:
+ case CONST_FIXED:
/* These are kept unique for a given value. */
return 0;
@@ -840,9 +844,9 @@ reg_set_p (const_rtx reg, const_rtx insn)
X contains a MEM; this routine does usememory aliasing. */
int
-modified_between_p (rtx x, rtx start, rtx end)
+modified_between_p (const_rtx x, const_rtx start, const_rtx end)
{
- enum rtx_code code = GET_CODE (x);
+ const enum rtx_code code = GET_CODE (x);
const char *fmt;
int i, j;
rtx insn;
@@ -854,6 +858,7 @@ modified_between_p (rtx x, rtx start, rtx end)
{
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case CONST:
case SYMBOL_REF:
@@ -902,9 +907,9 @@ modified_between_p (rtx x, rtx start, rtx end)
does use memory aliasing. */
int
-modified_in_p (rtx x, rtx insn)
+modified_in_p (const_rtx x, const_rtx insn)
{
- enum rtx_code code = GET_CODE (x);
+ const enum rtx_code code = GET_CODE (x);
const char *fmt;
int i, j;
@@ -912,6 +917,7 @@ modified_in_p (rtx x, rtx insn)
{
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case CONST:
case SYMBOL_REF:
@@ -1406,41 +1412,49 @@ reg_overlap_mentioned_p (const_rtx x, const_rtx in)
If the item being stored in or clobbered is a SUBREG of a hard register,
the SUBREG will be passed. */
+#define NOTE_STORES_BODY(NOTE_STORES_FN) do { \
+ int i; \
+ if (GET_CODE (x) == COND_EXEC) \
+ x = COND_EXEC_CODE (x); \
+ if (GET_CODE (x) == SET || GET_CODE (x) == CLOBBER) \
+ { \
+ rtx dest = SET_DEST (x); \
+ while ((GET_CODE (dest) == SUBREG \
+ && (!REG_P (SUBREG_REG (dest)) \
+ || REGNO (SUBREG_REG (dest)) >= FIRST_PSEUDO_REGISTER)) \
+ || GET_CODE (dest) == ZERO_EXTRACT \
+ || GET_CODE (dest) == STRICT_LOW_PART) \
+ dest = XEXP (dest, 0); \
+ /* If we have a PARALLEL, SET_DEST is a list of EXPR_LIST expressions, \
+ each of whose first operand is a register. */ \
+ if (GET_CODE (dest) == PARALLEL) \
+ { \
+ for (i = XVECLEN (dest, 0) - 1; i >= 0; i--) \
+ if (XEXP (XVECEXP (dest, 0, i), 0) != 0) \
+ (*fun) (XEXP (XVECEXP (dest, 0, i), 0), x, data); \
+ } \
+ else \
+ (*fun) (dest, x, data); \
+ } \
+ else if (GET_CODE (x) == PARALLEL) \
+ for (i = XVECLEN (x, 0) - 1; i >= 0; i--) \
+ NOTE_STORES_FN (XVECEXP (x, 0, i), fun, data); \
+} while (0)
+
void
note_stores (const_rtx x, void (*fun) (rtx, const_rtx, void *), void *data)
{
- int i;
+ NOTE_STORES_BODY(note_stores);
+}
- if (GET_CODE (x) == COND_EXEC)
- x = COND_EXEC_CODE (x);
+void
+const_note_stores (const_rtx x, void (*fun) (const_rtx, const_rtx, const void *), const void *data)
+{
+ NOTE_STORES_BODY(const_note_stores);
+}
- if (GET_CODE (x) == SET || GET_CODE (x) == CLOBBER)
- {
- rtx dest = SET_DEST (x);
-
- while ((GET_CODE (dest) == SUBREG
- && (!REG_P (SUBREG_REG (dest))
- || REGNO (SUBREG_REG (dest)) >= FIRST_PSEUDO_REGISTER))
- || GET_CODE (dest) == ZERO_EXTRACT
- || GET_CODE (dest) == STRICT_LOW_PART)
- dest = XEXP (dest, 0);
-
- /* If we have a PARALLEL, SET_DEST is a list of EXPR_LIST expressions,
- each of whose first operand is a register. */
- if (GET_CODE (dest) == PARALLEL)
- {
- for (i = XVECLEN (dest, 0) - 1; i >= 0; i--)
- if (XEXP (XVECEXP (dest, 0, i), 0) != 0)
- (*fun) (XEXP (XVECEXP (dest, 0, i), 0), x, data);
- }
- else
- (*fun) (dest, x, data);
- }
+#undef NOTE_STORES_BODY
- else if (GET_CODE (x) == PARALLEL)
- for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
- note_stores (XVECEXP (x, 0, i), fun, data);
-}
/* Like notes_stores, but call FUN for each expression that is being
referenced in PBODY, a pointer to the PATTERN of an insn. We only call
@@ -1974,6 +1988,7 @@ volatile_insn_p (const_rtx x)
case CONST_INT:
case CONST:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case CC0:
case PC:
@@ -2038,6 +2053,7 @@ volatile_refs_p (const_rtx x)
case CONST_INT:
case CONST:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case CC0:
case PC:
@@ -2100,6 +2116,7 @@ side_effects_p (const_rtx x)
case CONST_INT:
case CONST:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case CC0:
case PC:
@@ -2189,6 +2206,7 @@ may_trap_p_1 (const_rtx x, unsigned flags)
/* Handle these cases quickly. */
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case LABEL_REF:
@@ -2388,6 +2406,7 @@ inequality_comparisons_p (const_rtx x)
case CC0:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case CONST:
case LABEL_REF:
@@ -2637,6 +2656,7 @@ computed_jump_p_1 (const_rtx x)
case CONST:
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case REG:
@@ -2873,6 +2893,8 @@ commutative_operand_precedence (rtx op)
return -8;
if (code == CONST_DOUBLE)
return -7;
+ if (code == CONST_FIXED)
+ return -7;
op = avoid_constant_pool_reference (op);
code = GET_CODE (op);
@@ -2883,6 +2905,8 @@ commutative_operand_precedence (rtx op)
return -6;
if (code == CONST_DOUBLE)
return -5;
+ if (code == CONST_FIXED)
+ return -5;
return -4;
case RTX_EXTRA:
@@ -3347,7 +3371,7 @@ find_first_parameter_load (rtx call_insn, rtx boundary)
call instruction. */
bool
-keep_with_call_p (rtx insn)
+keep_with_call_p (const_rtx insn)
{
rtx set;
@@ -3368,7 +3392,7 @@ keep_with_call_p (rtx insn)
if we can break or not. */
if (SET_DEST (set) == stack_pointer_rtx)
{
- rtx i2 = next_nonnote_insn (insn);
+ const_rtx i2 = const_next_nonnote_insn (insn);
if (i2 && keep_with_call_p (i2))
return true;
}
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index dd74e29dcb5..c0d9f5588e5 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -418,7 +418,7 @@ static bitmap_head *anti_dependency_cache;
static bitmap_head *spec_dependency_cache;
static int cache_size;
-static int deps_may_trap_p (rtx);
+static int deps_may_trap_p (const_rtx);
static void add_dependence_list (rtx, rtx, int, enum reg_note);
static void add_dependence_list_and_free (rtx, rtx *, int, enum reg_note);
static void delete_all_dependences (rtx);
@@ -429,8 +429,8 @@ static void sched_analyze_1 (struct deps *, rtx, rtx);
static void sched_analyze_2 (struct deps *, rtx, rtx);
static void sched_analyze_insn (struct deps *, rtx, rtx);
-static rtx sched_get_condition (rtx);
-static int conditions_mutex_p (rtx, rtx);
+static rtx sched_get_condition (const_rtx);
+static int conditions_mutex_p (const_rtx, const_rtx);
static enum DEPS_ADJUST_RESULT maybe_add_or_update_dep_1 (dep_t, bool,
rtx, rtx);
@@ -446,13 +446,13 @@ static void check_dep (dep_t, bool);
/* Return nonzero if a load of the memory reference MEM can cause a trap. */
static int
-deps_may_trap_p (rtx mem)
+deps_may_trap_p (const_rtx mem)
{
- rtx addr = XEXP (mem, 0);
+ const_rtx addr = XEXP (mem, 0);
if (REG_P (addr) && REGNO (addr) >= FIRST_PSEUDO_REGISTER)
{
- rtx t = get_reg_known_value (REGNO (addr));
+ const_rtx t = get_reg_known_value (REGNO (addr));
if (t)
addr = t;
}
@@ -462,7 +462,7 @@ deps_may_trap_p (rtx mem)
/* Find the condition under which INSN is executed. */
static rtx
-sched_get_condition (rtx insn)
+sched_get_condition (const_rtx insn)
{
rtx pat = PATTERN (insn);
rtx src;
@@ -498,7 +498,7 @@ sched_get_condition (rtx insn)
/* Return nonzero if conditions COND1 and COND2 can never be both true. */
static int
-conditions_mutex_p (rtx cond1, rtx cond2)
+conditions_mutex_p (const_rtx cond1, const_rtx cond2)
{
if (COMPARISON_P (cond1)
&& COMPARISON_P (cond2)
@@ -512,7 +512,7 @@ conditions_mutex_p (rtx cond1, rtx cond2)
/* Return true if insn1 and insn2 can never depend on one another because
the conditions under which they are executed are mutually exclusive. */
bool
-sched_insns_conditions_mutex_p (rtx insn1, rtx insn2)
+sched_insns_conditions_mutex_p (const_rtx insn1, const_rtx insn2)
{
rtx cond1, cond2;
@@ -542,7 +542,7 @@ sched_insns_conditions_mutex_p (rtx insn1, rtx insn2)
This function is used to switch sd_iterator to the next list.
!!! For internal use only. Might consider moving it to sched-int.h. */
void
-sd_next_list (rtx insn, sd_list_types_def *types_ptr,
+sd_next_list (const_rtx insn, sd_list_types_def *types_ptr,
deps_list_t *list_ptr, bool *resolved_p_ptr)
{
sd_list_types_def types = *types_ptr;
@@ -587,7 +587,7 @@ sd_next_list (rtx insn, sd_list_types_def *types_ptr,
/* Return the summary size of INSN's lists defined by LIST_TYPES. */
int
-sd_lists_size (rtx insn, sd_list_types_def list_types)
+sd_lists_size (const_rtx insn, sd_list_types_def list_types)
{
int size = 0;
@@ -605,7 +605,7 @@ sd_lists_size (rtx insn, sd_list_types_def list_types)
/* Return true if INSN's lists defined by LIST_TYPES are all empty. */
bool
-sd_lists_empty_p (rtx insn, sd_list_types_def list_types)
+sd_lists_empty_p (const_rtx insn, sd_list_types_def list_types)
{
return sd_lists_size (insn, list_types) == 0;
}
@@ -1680,6 +1680,7 @@ sched_analyze_2 (struct deps *deps, rtx x, rtx insn)
{
case CONST_INT:
case CONST_DOUBLE:
+ case CONST_FIXED:
case CONST_VECTOR:
case SYMBOL_REF:
case CONST:
diff --git a/gcc/sched-int.h b/gcc/sched-int.h
index ec5f8205a47..d23fc82d807 100644
--- a/gcc/sched-int.h
+++ b/gcc/sched-int.h
@@ -811,7 +811,7 @@ enum INSN_TRAP_CLASS
extern void print_insn (char *, rtx, int);
/* Functions in sched-deps.c. */
-extern bool sched_insns_conditions_mutex_p (rtx, rtx);
+extern bool sched_insns_conditions_mutex_p (const_rtx, const_rtx);
extern void add_dependence (rtx, rtx, enum reg_note);
extern void sched_analyze (struct deps *, rtx, rtx);
extern bool deps_pools_are_empty_p (void);
@@ -829,9 +829,9 @@ extern ds_t ds_merge (ds_t, ds_t);
extern void debug_ds (ds_t);
/* Functions in haifa-sched.c. */
-extern int haifa_classify_insn (rtx);
+extern int haifa_classify_insn (const_rtx);
extern void get_ebb_head_tail (basic_block, basic_block, rtx *, rtx *);
-extern int no_real_insns_p (rtx, rtx);
+extern int no_real_insns_p (const_rtx, const_rtx);
extern void rm_other_notes (rtx, rtx);
@@ -845,7 +845,7 @@ extern void sched_finish (void);
extern int try_ready (rtx);
extern void * xrecalloc (void *, size_t, size_t, size_t);
-extern bool sched_insn_is_legitimate_for_speculation_p (rtx, ds_t);
+extern bool sched_insn_is_legitimate_for_speculation_p (const_rtx, ds_t);
extern void unlink_bb_notes (basic_block, basic_block);
extern void add_block (basic_block, basic_block);
extern rtx bb_note (basic_block);
@@ -882,7 +882,7 @@ extern void debug_dependencies (rtx, rtx);
/* A type to hold above flags. */
typedef int sd_list_types_def;
-extern void sd_next_list (rtx, sd_list_types_def *, deps_list_t *, bool *);
+extern void sd_next_list (const_rtx, sd_list_types_def *, deps_list_t *, bool *);
/* Iterator to walk through, resolve and delete dependencies. */
struct _sd_iterator
@@ -980,8 +980,8 @@ sd_iterator_next (sd_iterator_def *it_ptr)
sd_iterator_cond (&(ITER), &(DEP)); \
sd_iterator_next (&(ITER)))
-extern int sd_lists_size (rtx, sd_list_types_def);
-extern bool sd_lists_empty_p (rtx, sd_list_types_def);
+extern int sd_lists_size (const_rtx, sd_list_types_def);
+extern bool sd_lists_empty_p (const_rtx, sd_list_types_def);
extern void sd_init_insn (rtx);
extern void sd_finish_insn (rtx);
extern dep_t sd_find_dep_between (rtx, rtx, bool);
diff --git a/gcc/sched-vis.c b/gcc/sched-vis.c
index 7ce0f0cc640..8f4597247e5 100644
--- a/gcc/sched-vis.c
+++ b/gcc/sched-vis.c
@@ -447,6 +447,10 @@ print_value (char *buf, const_rtx x, int verbose)
(unsigned HOST_WIDE_INT) CONST_DOUBLE_HIGH (x));
cur = safe_concat (buf, cur, t);
break;
+ case CONST_FIXED:
+ fixed_to_decimal (t, CONST_FIXED_VALUE (x), sizeof (t));
+ cur = safe_concat (buf, cur, t);
+ break;
case CONST_STRING:
cur = safe_concat (buf, cur, "\"");
cur = safe_concat (buf, cur, XSTR (x, 0));
diff --git a/gcc/sdbout.c b/gcc/sdbout.c
index cf655936034..6d9689ceff0 100644
--- a/gcc/sdbout.c
+++ b/gcc/sdbout.c
@@ -259,7 +259,7 @@ do { fprintf (asm_out_file, "\t.tag\t"); \
/* Set the sdb tag identifier string for TYPE to NAME. */
#define SET_KNOWN_TYPE_TAG(TYPE, NAME) \
- TYPE_SYMTAB_POINTER (TYPE) = (char *)(NAME)
+ TYPE_SYMTAB_POINTER (TYPE) = (const char *)(NAME)
/* Return the name (a string) of the struct, union or enum tag
described by the TREE_LIST node LINK. This is 0 for an anonymous one. */
@@ -312,7 +312,7 @@ const struct gcc_debug_hooks sdb_debug_hooks =
sdbout_end_source_file, /* end_source_file */
sdbout_begin_block, /* begin_block */
sdbout_end_block, /* end_block */
- debug_true_tree, /* ignore_block */
+ debug_true_const_tree, /* ignore_block */
sdbout_source_line, /* source_line */
#ifdef MIPS_DEBUGGING_INFO
/* Defer on MIPS systems so that parameter descriptions follow
@@ -580,7 +580,7 @@ plain_type_1 (tree type, int level)
case QUAL_UNION_TYPE:
case ENUMERAL_TYPE:
{
- char *tag;
+ const char *tag;
#ifdef SDB_ALLOW_FORWARD_REFERENCES
sdbout_record_type_name (type);
#endif
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index d9cf023c7c2..857b7412343 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -583,7 +583,8 @@ simplify_unary_operation_1 (enum rtx_code code, enum machine_mode mode, rtx op)
/* (neg (lt x 0)) is (ashiftrt X C) if STORE_FLAG_VALUE is 1. */
/* (neg (lt x 0)) is (lshiftrt X C) if STORE_FLAG_VALUE is -1. */
if (GET_CODE (op) == LT
- && XEXP (op, 1) == const0_rtx)
+ && XEXP (op, 1) == const0_rtx
+ && SCALAR_INT_MODE_P (GET_MODE (XEXP (op, 0))))
{
enum machine_mode inner = GET_MODE (XEXP (op, 0));
int isize = GET_MODE_BITSIZE (inner);
@@ -1148,6 +1149,7 @@ simplify_const_unary_operation (enum rtx_code code, enum machine_mode mode,
case SS_TRUNCATE:
case US_TRUNCATE:
case SS_NEG:
+ case US_NEG:
return 0;
default:
@@ -2564,6 +2566,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
case ASHIFT:
case SS_ASHIFT:
+ case US_ASHIFT:
if (trueop1 == CONST0_RTX (mode))
return op0;
if (trueop0 == CONST0_RTX (mode) && ! side_effects_p (op1))
@@ -2643,6 +2646,10 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
case US_PLUS:
case SS_MINUS:
case US_MINUS:
+ case SS_MULT:
+ case US_MULT:
+ case SS_DIV:
+ case US_DIV:
/* ??? There are simplifications that can be done. */
return 0;
@@ -2658,6 +2665,85 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
if (GET_CODE (trueop0) == CONST_VECTOR)
return CONST_VECTOR_ELT (trueop0, INTVAL (XVECEXP
(trueop1, 0, 0)));
+
+ /* Extract a scalar element from a nested VEC_SELECT expression
+ (with optional nested VEC_CONCAT expression). Some targets
+ (i386) extract scalar element from a vector using chain of
+ nested VEC_SELECT expressions. When input operand is a memory
+ operand, this operation can be simplified to a simple scalar
+ load from an offseted memory address. */
+ if (GET_CODE (trueop0) == VEC_SELECT)
+ {
+ rtx op0 = XEXP (trueop0, 0);
+ rtx op1 = XEXP (trueop0, 1);
+
+ enum machine_mode opmode = GET_MODE (op0);
+ int elt_size = GET_MODE_SIZE (GET_MODE_INNER (opmode));
+ int n_elts = GET_MODE_SIZE (opmode) / elt_size;
+
+ int i = INTVAL (XVECEXP (trueop1, 0, 0));
+ int elem;
+
+ rtvec vec;
+ rtx tmp_op, tmp;
+
+ gcc_assert (GET_CODE (op1) == PARALLEL);
+ gcc_assert (i < n_elts);
+
+ /* Select element, pointed by nested selector. */
+ elem = INTVAL (XVECEXP (op1, 0, i));
+
+ /* Handle the case when nested VEC_SELECT wraps VEC_CONCAT. */
+ if (GET_CODE (op0) == VEC_CONCAT)
+ {
+ rtx op00 = XEXP (op0, 0);
+ rtx op01 = XEXP (op0, 1);
+
+ enum machine_mode mode00, mode01;
+ int n_elts00, n_elts01;
+
+ mode00 = GET_MODE (op00);
+ mode01 = GET_MODE (op01);
+
+ /* Find out number of elements of each operand. */
+ if (VECTOR_MODE_P (mode00))
+ {
+ elt_size = GET_MODE_SIZE (GET_MODE_INNER (mode00));
+ n_elts00 = GET_MODE_SIZE (mode00) / elt_size;
+ }
+ else
+ n_elts00 = 1;
+
+ if (VECTOR_MODE_P (mode01))
+ {
+ elt_size = GET_MODE_SIZE (GET_MODE_INNER (mode01));
+ n_elts01 = GET_MODE_SIZE (mode01) / elt_size;
+ }
+ else
+ n_elts01 = 1;
+
+ gcc_assert (n_elts == n_elts00 + n_elts01);
+
+ /* Select correct operand of VEC_CONCAT
+ and adjust selector. */
+ if (elem < n_elts01)
+ tmp_op = op00;
+ else
+ {
+ tmp_op = op01;
+ elem -= n_elts00;
+ }
+ }
+ else
+ tmp_op = op0;
+
+ vec = rtvec_alloc (1);
+ RTVEC_ELT (vec, 0) = GEN_INT (elem);
+
+ tmp = gen_rtx_fmt_ee (code, mode,
+ tmp_op, gen_rtx_PARALLEL (VOIDmode, vec));
+ return tmp;
+ }
}
else
{
@@ -3273,7 +3359,12 @@ simplify_const_binary_operation (enum rtx_code code, enum machine_mode mode,
case US_PLUS:
case SS_MINUS:
case US_MINUS:
+ case SS_MULT:
+ case US_MULT:
+ case SS_DIV:
+ case US_DIV:
case SS_ASHIFT:
+ case US_ASHIFT:
/* ??? There are simplifications that can be done. */
return 0;
@@ -4386,8 +4477,9 @@ simplify_ternary_operation (enum rtx_code code, enum machine_mode mode,
return 0;
}
-/* Evaluate a SUBREG of a CONST_INT or CONST_DOUBLE or CONST_VECTOR,
- returning another CONST_INT or CONST_DOUBLE or CONST_VECTOR.
+/* Evaluate a SUBREG of a CONST_INT or CONST_DOUBLE or CONST_FIXED
+ or CONST_VECTOR,
+ returning another CONST_INT or CONST_DOUBLE or CONST_FIXED or CONST_VECTOR.
Works by unpacking OP into a collection of 8-bit values
represented as a little-endian array of 'unsigned char', selecting by BYTE,
@@ -4525,6 +4617,25 @@ simplify_immed_subreg (enum machine_mode outermode, rtx op,
*vp++ = 0;
}
break;
+
+ case CONST_FIXED:
+ if (elem_bitsize <= HOST_BITS_PER_WIDE_INT)
+ {
+ for (i = 0; i < elem_bitsize; i += value_bit)
+ *vp++ = CONST_FIXED_VALUE_LOW (el) >> i;
+ }
+ else
+ {
+ for (i = 0; i < HOST_BITS_PER_WIDE_INT; i += value_bit)
+ *vp++ = CONST_FIXED_VALUE_LOW (el) >> i;
+ for (; i < 2 * HOST_BITS_PER_WIDE_INT && i < elem_bitsize;
+ i += value_bit)
+ *vp++ = CONST_FIXED_VALUE_HIGH (el)
+ >> (i - HOST_BITS_PER_WIDE_INT);
+ for (; i < elem_bitsize; i += value_bit)
+ *vp++ = 0;
+ }
+ break;
default:
gcc_unreachable ();
@@ -4643,6 +4754,28 @@ simplify_immed_subreg (enum machine_mode outermode, rtx op,
elems[elem] = CONST_DOUBLE_FROM_REAL_VALUE (r, outer_submode);
}
break;
+
+ case MODE_FRACT:
+ case MODE_UFRACT:
+ case MODE_ACCUM:
+ case MODE_UACCUM:
+ {
+ FIXED_VALUE_TYPE f;
+ f.data.low = 0;
+ f.data.high = 0;
+ f.mode = outer_submode;
+
+ for (i = 0;
+ i < HOST_BITS_PER_WIDE_INT && i < elem_bitsize;
+ i += value_bit)
+ f.data.low |= (HOST_WIDE_INT)(*vp++ & value_mask) << i;
+ for (; i < elem_bitsize; i += value_bit)
+ f.data.high |= ((HOST_WIDE_INT)(*vp++ & value_mask)
+ << (i - HOST_BITS_PER_WIDE_INT));
+
+ elems[elem] = CONST_FIXED_FROM_FIXED_VALUE (f, outer_submode);
+ }
+ break;
default:
gcc_unreachable ();
@@ -4677,6 +4810,7 @@ simplify_subreg (enum machine_mode outermode, rtx op,
if (GET_CODE (op) == CONST_INT
|| GET_CODE (op) == CONST_DOUBLE
+ || GET_CODE (op) == CONST_FIXED
|| GET_CODE (op) == CONST_VECTOR)
return simplify_immed_subreg (outermode, op, innermode, byte);
@@ -5019,10 +5153,10 @@ simplify_gen_subreg (enum machine_mode outermode, rtx op,
simplification and 1 for tree simplification. */
rtx
-simplify_rtx (rtx x)
+simplify_rtx (const_rtx x)
{
- enum rtx_code code = GET_CODE (x);
- enum machine_mode mode = GET_MODE (x);
+ const enum rtx_code code = GET_CODE (x);
+ const enum machine_mode mode = GET_MODE (x);
switch (GET_RTX_CLASS (code))
{
diff --git a/gcc/system.h b/gcc/system.h
index 46da3817d80..0225d8b8302 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -774,10 +774,17 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
execv, et al. Another valid use would be in an allocation function
that creates const objects that need to be initialized. Most other
cases should be viewed with extreme caution. */
-#ifdef __GNUC__
+
+#if defined(__GNUC__) && GCC_VERSION != 4000
+/* GCC 4.0.x has a bug where it may ICE on this expression. */
#define CONST_CAST(X) ((__extension__(union {__typeof(X)_q; void *_v;})(X))._v)
#else
#define CONST_CAST(X) ((void*)(X))
#endif
+/* Acivate -Wcast-qual as a warning (not an error/-Werror). */
+#if GCC_VERSION >= 4003
+#pragma GCC diagnostic warning "-Wcast-qual"
+#endif
+
#endif /* ! GCC_SYSTEM_H */
diff --git a/gcc/target-def.h b/gcc/target-def.h
index bdaf9f475a8..0ffad7c836a 100644
--- a/gcc/target-def.h
+++ b/gcc/target-def.h
@@ -142,7 +142,7 @@
#endif
#define TARGET_ASM_OUTPUT_MI_THUNK NULL
-#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_tree_hwi_hwi_tree_false
+#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_const_tree_hwi_hwi_const_tree_false
#if !defined(TARGET_HAVE_CTORS_DTORS)
# if defined(TARGET_ASM_CONSTRUCTOR) && defined(TARGET_ASM_DESTRUCTOR)
@@ -174,7 +174,7 @@
#endif
#ifndef TARGET_VALID_DLLIMPORT_ATTRIBUTE_P
-#define TARGET_VALID_DLLIMPORT_ATTRIBUTE_P hook_bool_tree_true
+#define TARGET_VALID_DLLIMPORT_ATTRIBUTE_P hook_bool_const_tree_true
#endif
#ifndef TARGET_HAVE_TLS
@@ -450,7 +450,7 @@
#endif
#ifndef TARGET_VECTOR_OPAQUE_P
-#define TARGET_VECTOR_OPAQUE_P hook_bool_tree_false
+#define TARGET_VECTOR_OPAQUE_P hook_bool_const_tree_false
#endif
/* In hooks.c. */
@@ -459,24 +459,24 @@
#define TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED hook_bool_bool_false
#define TARGET_CANNOT_FORCE_CONST_MEM hook_bool_rtx_false
#define TARGET_CANNOT_COPY_INSN_P NULL
-#define TARGET_COMMUTATIVE_P hook_bool_rtx_commutative_p
+#define TARGET_COMMUTATIVE_P hook_bool_const_rtx_commutative_p
#define TARGET_DELEGITIMIZE_ADDRESS hook_rtx_rtx_identity
-#define TARGET_USE_BLOCKS_FOR_CONSTANT_P hook_bool_mode_rtx_false
+#define TARGET_USE_BLOCKS_FOR_CONSTANT_P hook_bool_mode_const_rtx_false
#define TARGET_MIN_ANCHOR_OFFSET 0
#define TARGET_MAX_ANCHOR_OFFSET 0
#define TARGET_USE_ANCHORS_FOR_SYMBOL_P default_use_anchors_for_symbol_p
#define TARGET_FUNCTION_OK_FOR_SIBCALL hook_bool_tree_tree_false
-#define TARGET_COMP_TYPE_ATTRIBUTES hook_int_tree_tree_1
+#define TARGET_COMP_TYPE_ATTRIBUTES hook_int_const_tree_const_tree_1
#ifndef TARGET_SET_DEFAULT_TYPE_ATTRIBUTES
#define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES hook_void_tree
#endif
#define TARGET_INSERT_ATTRIBUTES hook_void_tree_treeptr
-#define TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P hook_bool_tree_false
-#define TARGET_MS_BITFIELD_LAYOUT_P hook_bool_tree_false
+#define TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P hook_bool_const_tree_false
+#define TARGET_MS_BITFIELD_LAYOUT_P hook_bool_const_tree_false
#define TARGET_ALIGN_ANON_BITFIELD hook_bool_void_false
#define TARGET_NARROW_VOLATILE_BITFIELD hook_bool_void_false
#define TARGET_RTX_COSTS hook_bool_rtx_int_int_intp_false
-#define TARGET_MANGLE_TYPE hook_constcharptr_tree_null
+#define TARGET_MANGLE_TYPE hook_constcharptr_const_tree_null
#define TARGET_ALLOCATE_INITIAL_VALUE NULL
#ifndef TARGET_INIT_LIBFUNCS
@@ -484,7 +484,7 @@
#endif
#ifndef TARGET_IN_SMALL_DATA_P
-#define TARGET_IN_SMALL_DATA_P hook_bool_tree_false
+#define TARGET_IN_SMALL_DATA_P hook_bool_const_tree_false
#endif
#ifndef TARGET_MANGLE_DECL_ASSEMBLER_NAME
@@ -499,9 +499,9 @@
#define TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN hook_invalid_arg_for_unprototyped_fn
#endif
-#define TARGET_INVALID_CONVERSION hook_constcharptr_tree_tree_null
-#define TARGET_INVALID_UNARY_OP hook_constcharptr_int_tree_null
-#define TARGET_INVALID_BINARY_OP hook_constcharptr_int_tree_tree_null
+#define TARGET_INVALID_CONVERSION hook_constcharptr_const_tree_const_tree_null
+#define TARGET_INVALID_UNARY_OP hook_constcharptr_int_const_tree_null
+#define TARGET_INVALID_BINARY_OP hook_constcharptr_int_const_tree_const_tree_null
#define TARGET_FIXED_CONDITION_CODE_REGS hook_bool_uintp_uintp_false
@@ -521,7 +521,7 @@
#define TARGET_MD_ASM_CLOBBERS hook_tree_tree_tree_tree_3rd_identity
-#define TARGET_DWARF_CALLING_CONVENTION hook_int_tree_0
+#define TARGET_DWARF_CALLING_CONVENTION hook_int_const_tree_0
#define TARGET_DWARF_HANDLE_FRAME_UNSPEC 0
@@ -532,13 +532,13 @@
#define TARGET_ARM_EABI_UNWINDER false
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_false
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_false
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_false
+#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_false
+#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_false
+#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_false
#define TARGET_STRUCT_VALUE_RTX hook_rtx_tree_int_null
#define TARGET_RETURN_IN_MEMORY default_return_in_memory
-#define TARGET_RETURN_IN_MSB hook_bool_tree_false
+#define TARGET_RETURN_IN_MSB hook_bool_const_tree_false
#define TARGET_EXPAND_BUILTIN_SAVEREGS default_expand_builtin_saveregs
#define TARGET_SETUP_INCOMING_VARARGS default_setup_incoming_varargs
diff --git a/gcc/target.h b/gcc/target.h
index d1af44335ac..e6cb8322e09 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -208,9 +208,9 @@ struct gcc_target
too much undo-able setup involved in invoking output_mi_thunk.
Could be fixed by making output_mi_thunk emit rtl instead of
text to the output file. */
- bool (* can_output_mi_thunk) (tree thunk_decl, HOST_WIDE_INT delta,
+ bool (* can_output_mi_thunk) (const_tree thunk_decl, HOST_WIDE_INT delta,
HOST_WIDE_INT vcall_offset,
- tree function_decl);
+ const_tree function_decl);
/* Output any boilerplate text needed at the beginning of a
translation unit. */
@@ -373,7 +373,7 @@ struct gcc_target
by the insn scheduler. It should return true if the check instruction
corresponding to the instruction passed as the parameter needs a
recovery block. */
- bool (* needs_block_p) (rtx);
+ bool (* needs_block_p) (const_rtx);
/* The following member value is a pointer to a function called
by the insn scheduler. It should return a pattern for the check
@@ -391,7 +391,7 @@ struct gcc_target
passed as the parameter, the insn will not be chosen to be
issued. This hook is used to discard speculative instructions,
that stand at the first position of the ready list. */
- bool (* first_cycle_multipass_dfa_lookahead_guard_spec) (rtx);
+ bool (* first_cycle_multipass_dfa_lookahead_guard_spec) (const_rtx);
/* The following member value is a pointer to a function that provides
information about the speculation capabilities of the target.
@@ -428,7 +428,7 @@ struct gcc_target
/* Return true if vector alignment is reachable (by peeling N
iterations) for the given type. */
- bool (* vector_alignment_reachable) (tree, bool);
+ bool (* vector_alignment_reachable) (const_tree, bool);
} vectorize;
/* The initial value of target_flags. */
@@ -467,7 +467,7 @@ struct gcc_target
/* Return zero if the attributes on TYPE1 and TYPE2 are incompatible,
one if they are compatible and two if they are nearly compatible
(which causes a warning to be generated). */
- int (* comp_type_attributes) (tree type1, tree type2);
+ int (* comp_type_attributes) (const_tree type1, const_tree type2);
/* Assign default attributes to the newly defined TYPE. */
void (* set_default_type_attributes) (tree type);
@@ -477,11 +477,11 @@ struct gcc_target
/* Return true if FNDECL (which has at least one machine attribute)
can be inlined despite its machine attributes, false otherwise. */
- bool (* function_attribute_inlinable_p) (tree fndecl);
+ bool (* function_attribute_inlinable_p) (const_tree fndecl);
/* Return true if bitfields in RECORD_TYPE should follow the
Microsoft Visual C++ bitfield layout rules. */
- bool (* ms_bitfield_layout_p) (tree record_type);
+ bool (* ms_bitfield_layout_p) (const_tree record_type);
/* True if the target supports decimal floating point. */
bool (* decimal_float_supported_p) (void);
@@ -519,7 +519,7 @@ struct gcc_target
/* For a vendor-specific TYPE, return a pointer to a statically-allocated
string containing the C++ mangling for TYPE. In all other cases, return
NULL. */
- const char * (* mangle_type) (tree type);
+ const char * (* mangle_type) (const_tree type);
/* Make any adjustments to libfunc names needed for this target. */
void (* init_libfuncs) (void);
@@ -550,20 +550,20 @@ struct gcc_target
bool (* cannot_copy_insn_p) (rtx);
/* True if X is considered to be commutative. */
- bool (* commutative_p) (rtx, int);
+ bool (* commutative_p) (const_rtx, int);
/* Given an address RTX, undo the effects of LEGITIMIZE_ADDRESS. */
rtx (* delegitimize_address) (rtx);
/* True if the given constant can be put into an object_block. */
- bool (* use_blocks_for_constant_p) (enum machine_mode, rtx);
+ bool (* use_blocks_for_constant_p) (enum machine_mode, const_rtx);
/* The minimum and maximum byte offsets for anchored addresses. */
HOST_WIDE_INT min_anchor_offset;
HOST_WIDE_INT max_anchor_offset;
/* True if section anchors can be used to access the given symbol. */
- bool (* use_anchors_for_symbol_p) (rtx);
+ bool (* use_anchors_for_symbol_p) (const_rtx);
/* True if it is OK to do sibling call optimization for the specified
call expression EXP. DECL will be the called function, or NULL if
@@ -571,11 +571,11 @@ struct gcc_target
bool (*function_ok_for_sibcall) (tree decl, tree exp);
/* True if EXP should be placed in a "small data" section. */
- bool (* in_small_data_p) (tree);
+ bool (* in_small_data_p) (const_tree);
/* True if EXP names an object for which name resolution must resolve
to the current module. */
- bool (* binds_local_p) (tree);
+ bool (* binds_local_p) (const_tree);
/* Modify and return the identifier of a DECL's external name,
originally identified by ID, as required by the target,
@@ -621,7 +621,7 @@ struct gcc_target
bool (* vector_mode_supported_p) (enum machine_mode mode);
/* True if a vector is opaque. */
- bool (* vector_opaque_p) (tree);
+ bool (* vector_opaque_p) (const_tree);
/* Compute a (partial) cost for rtx X. Return true if the complete
cost has been computed, and false if subexpressions should be
@@ -712,7 +712,7 @@ struct gcc_target
enum dwarf_calling_convention, but because of forward declarations
and not wanting to include dwarf2.h everywhere target.h is included
the function is being declared as an int. */
- int (* dwarf_calling_convention) (tree);
+ int (* dwarf_calling_convention) (const_tree);
/* This target hook allows the backend to emit frame-related insns that
contain UNSPECs or UNSPEC_VOLATILEs. The call frame debugging info
@@ -727,7 +727,7 @@ struct gcc_target
from VA_ARG_EXPR. LHS is left hand side of MODIFY_EXPR, RHS
is right hand side. Returns true if the statements doesn't need
to be checked for va_list references. */
- bool (* stdarg_optimize_hook) (struct stdarg_info *ai, tree lhs, tree rhs);
+ bool (* stdarg_optimize_hook) (struct stdarg_info *ai, const_tree lhs, const_tree rhs);
/* This target hook allows the operating system to override the DECL
that represents the external variable that contains the stack
@@ -740,27 +740,27 @@ struct gcc_target
/* Returns NULL if target supports the insn within a doloop block,
otherwise it returns an error message. */
- const char * (*invalid_within_doloop) (rtx);
+ const char * (*invalid_within_doloop) (const_rtx);
/* DECL is a variable or function with __attribute__((dllimport))
specified. Use this hook if the target needs to add extra validation
checks to handle_dll_attribute (). */
- bool (* valid_dllimport_attribute_p) (tree decl);
+ bool (* valid_dllimport_attribute_p) (const_tree decl);
/* Functions relating to calls - argument passing, returns, etc. */
struct calls {
- bool (*promote_function_args) (tree fntype);
- bool (*promote_function_return) (tree fntype);
- bool (*promote_prototypes) (tree fntype);
+ bool (*promote_function_args) (const_tree fntype);
+ bool (*promote_function_return) (const_tree fntype);
+ bool (*promote_prototypes) (const_tree fntype);
rtx (*struct_value_rtx) (tree fndecl, int incoming);
- bool (*return_in_memory) (tree type, tree fndecl);
- bool (*return_in_msb) (tree type);
+ bool (*return_in_memory) (const_tree type, const_tree fndecl);
+ bool (*return_in_msb) (const_tree type);
/* Return true if a parameter must be passed by reference. TYPE may
be null if this is a libcall. CA may be null if this query is
from __builtin_va_arg. */
bool (*pass_by_reference) (CUMULATIVE_ARGS *ca, enum machine_mode mode,
- tree type, bool named_arg);
+ const_tree type, bool named_arg);
rtx (*expand_builtin_saveregs) (void);
/* Returns pretend_argument_size. */
@@ -775,19 +775,19 @@ struct gcc_target
/* Given a complex type T, return true if a parameter of type T
should be passed as two scalars. */
- bool (* split_complex_arg) (tree type);
+ bool (* split_complex_arg) (const_tree type);
/* Return true if type T, mode MODE, may not be passed in registers,
but must be passed on the stack. */
/* ??? This predicate should be applied strictly after pass-by-reference.
Need audit to verify that this is the case. */
- bool (* must_pass_in_stack) (enum machine_mode mode, tree t);
+ bool (* must_pass_in_stack) (enum machine_mode mode, const_tree t);
/* Return true if type TYPE, mode MODE, which is passed by reference,
should have the object copy generated by the callee rather than
the caller. It is never called for TYPE requiring constructors. */
bool (* callee_copies) (CUMULATIVE_ARGS *ca, enum machine_mode mode,
- tree type, bool named);
+ const_tree type, bool named);
/* Return zero for arguments passed entirely on the stack or entirely
in registers. If passed in both, return the number of bytes passed
@@ -797,12 +797,13 @@ struct gcc_target
/* Return the diagnostic message string if function without a prototype
is not allowed for this 'val' argument; NULL otherwise. */
- const char *(*invalid_arg_for_unprototyped_fn) (tree typelist,
- tree funcdecl, tree val);
+ const char *(*invalid_arg_for_unprototyped_fn) (const_tree typelist,
+ const_tree funcdecl,
+ const_tree val);
/* Return an rtx for the return value location of the function
specified by FN_DECL_OR_TYPE with a return type of RET_TYPE. */
- rtx (*function_value) (tree ret_type, tree fn_decl_or_type,
+ rtx (*function_value) (const_tree ret_type, const_tree fn_decl_or_type,
bool outgoing);
/* Return an rtx for the argument pointer incoming to the
@@ -812,15 +813,15 @@ struct gcc_target
/* Return the diagnostic message string if conversion from FROMTYPE
to TOTYPE is not allowed, NULL otherwise. */
- const char *(*invalid_conversion) (tree fromtype, tree totype);
+ const char *(*invalid_conversion) (const_tree fromtype, const_tree totype);
/* Return the diagnostic message string if the unary operation OP is
not permitted on TYPE, NULL otherwise. */
- const char *(*invalid_unary_op) (int op, tree type);
+ const char *(*invalid_unary_op) (int op, const_tree type);
/* Return the diagnostic message string if the binary operation OP
is not permitted on TYPE1 and TYPE2, NULL otherwise. */
- const char *(*invalid_binary_op) (int op, tree type1, tree type2);
+ const char *(*invalid_binary_op) (int op, const_tree type1, const_tree type2);
/* Return the class for a secondary reload, and fill in extra information. */
enum reg_class (*secondary_reload) (bool, rtx, enum reg_class,
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 7e68289f721..b4469403c53 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -84,8 +84,8 @@ default_cc_modes_compatible (enum machine_mode m1, enum machine_mode m2)
}
bool
-default_return_in_memory (tree type,
- tree fntype ATTRIBUTE_UNUSED)
+default_return_in_memory (const_tree type,
+ const_tree fntype ATTRIBUTE_UNUSED)
{
#ifndef RETURN_IN_MEMORY
return (TYPE_MODE (type) == BLKmode);
@@ -229,7 +229,7 @@ default_cxx_get_cookie_size (tree type)
bool
hook_pass_by_reference_must_pass_in_stack (CUMULATIVE_ARGS *c ATTRIBUTE_UNUSED,
- enum machine_mode mode ATTRIBUTE_UNUSED, tree type ATTRIBUTE_UNUSED,
+ enum machine_mode mode ATTRIBUTE_UNUSED, const_tree type ATTRIBUTE_UNUSED,
bool named_arg ATTRIBUTE_UNUSED)
{
return targetm.calls.must_pass_in_stack (mode, type);
@@ -241,7 +241,7 @@ hook_pass_by_reference_must_pass_in_stack (CUMULATIVE_ARGS *c ATTRIBUTE_UNUSED,
bool
hook_callee_copies_named (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED,
- tree type ATTRIBUTE_UNUSED, bool named)
+ const_tree type ATTRIBUTE_UNUSED, bool named)
{
return named;
}
@@ -336,7 +336,7 @@ default_fixed_point_supported_p (void)
these cases. */
const char *
-default_invalid_within_doloop (rtx insn)
+default_invalid_within_doloop (const_rtx insn)
{
if (CALL_P (insn))
return "Function call in loop.";
@@ -382,7 +382,7 @@ bool
hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false (
CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED,
- tree type ATTRIBUTE_UNUSED, bool named ATTRIBUTE_UNUSED)
+ const_tree type ATTRIBUTE_UNUSED, bool named ATTRIBUTE_UNUSED)
{
return false;
}
@@ -391,7 +391,7 @@ bool
hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true (
CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED,
- tree type ATTRIBUTE_UNUSED, bool named ATTRIBUTE_UNUSED)
+ const_tree type ATTRIBUTE_UNUSED, bool named ATTRIBUTE_UNUSED)
{
return true;
}
@@ -412,9 +412,9 @@ hook_void_bitmap (bitmap regs ATTRIBUTE_UNUSED)
const char *
hook_invalid_arg_for_unprototyped_fn (
- tree typelist ATTRIBUTE_UNUSED,
- tree funcdecl ATTRIBUTE_UNUSED,
- tree val ATTRIBUTE_UNUSED)
+ const_tree typelist ATTRIBUTE_UNUSED,
+ const_tree funcdecl ATTRIBUTE_UNUSED,
+ const_tree val ATTRIBUTE_UNUSED)
{
return NULL;
}
@@ -510,14 +510,15 @@ default_hidden_stack_protect_fail (void)
}
bool
-hook_bool_rtx_commutative_p (rtx x, int outer_code ATTRIBUTE_UNUSED)
+hook_bool_const_rtx_commutative_p (const_rtx x,
+ int outer_code ATTRIBUTE_UNUSED)
{
return COMMUTATIVE_P (x);
}
rtx
-default_function_value (tree ret_type ATTRIBUTE_UNUSED,
- tree fn_decl_or_type,
+default_function_value (const_tree ret_type ATTRIBUTE_UNUSED,
+ const_tree fn_decl_or_type,
bool outgoing ATTRIBUTE_UNUSED)
{
/* The old interface doesn't handle receiving the function type. */
@@ -665,7 +666,7 @@ tree default_mangle_decl_assembler_name (tree decl ATTRIBUTE_UNUSED,
}
bool
-default_builtin_vector_alignment_reachable (tree type, bool is_packed)
+default_builtin_vector_alignment_reachable (const_tree type, bool is_packed)
{
if (is_packed)
return false;
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index 816b7fcf5f4..62d4ea4d748 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -22,7 +22,7 @@ extern void default_external_libcall (rtx);
extern enum machine_mode default_cc_modes_compatible (enum machine_mode,
enum machine_mode);
-extern bool default_return_in_memory (tree, tree);
+extern bool default_return_in_memory (const_tree, const_tree);
extern rtx default_expand_builtin_saveregs (void);
extern void default_setup_incoming_varargs (CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int);
@@ -47,9 +47,9 @@ extern tree default_cxx_guard_type (void);
extern tree default_cxx_get_cookie_size (tree);
extern bool hook_pass_by_reference_must_pass_in_stack
- (CUMULATIVE_ARGS *, enum machine_mode mode, tree, bool);
+ (CUMULATIVE_ARGS *, enum machine_mode mode, const_tree, bool);
extern bool hook_callee_copies_named
- (CUMULATIVE_ARGS *ca, enum machine_mode, tree, bool);
+ (CUMULATIVE_ARGS *ca, enum machine_mode, const_tree, bool);
extern void default_unwind_emit (FILE *, rtx);
@@ -57,7 +57,7 @@ extern bool default_scalar_mode_supported_p (enum machine_mode);
extern bool default_decimal_float_supported_p (void);
extern bool default_fixed_point_supported_p (void);
-extern const char * default_invalid_within_doloop (rtx);
+extern const char * default_invalid_within_doloop (const_rtx);
extern tree default_builtin_vectorized_function
(enum built_in_function, tree, tree);
@@ -66,7 +66,7 @@ extern tree default_builtin_vectorized_conversion (enum tree_code, tree);
extern tree default_builtin_reciprocal (enum built_in_function, bool, bool);
-extern bool default_builtin_vector_alignment_reachable (tree, bool);
+extern bool default_builtin_vector_alignment_reachable (const_tree, bool);
/* These are here, and not in hooks.[ch], because not all users of
hooks.h include tm.h, and thus we don't have CUMULATIVE_ARGS. */
@@ -75,15 +75,15 @@ extern bool hook_bool_CUMULATIVE_ARGS_false (CUMULATIVE_ARGS *);
extern bool hook_bool_CUMULATIVE_ARGS_true (CUMULATIVE_ARGS *);
extern bool hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false
- (CUMULATIVE_ARGS *, enum machine_mode, tree, bool);
+ (CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool);
extern bool hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true
- (CUMULATIVE_ARGS *, enum machine_mode, tree, bool);
+ (CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool);
extern int hook_int_CUMULATIVE_ARGS_mode_tree_bool_0
(CUMULATIVE_ARGS *, enum machine_mode, tree, bool);
extern const char *hook_invalid_arg_for_unprototyped_fn
- (tree, tree, tree);
-extern bool hook_bool_rtx_commutative_p (rtx, int);
-extern rtx default_function_value (tree, tree, bool);
+ (const_tree, const_tree, const_tree);
+extern bool hook_bool_const_rtx_commutative_p (const_rtx, int);
+extern rtx default_function_value (const_tree, const_tree, bool);
extern rtx default_internal_arg_pointer (void);
extern enum reg_class default_secondary_reload (bool, rtx, enum reg_class,
enum machine_mode,
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6068fa9db9b..cb25b9615f7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,411 @@
+2007-08-31 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/31879
+ * gfortran.dg/char_length_7.f90: New test.
+ * gfortran.dg/char_length_9.f90: New test.
+ * gfortran.dg/char_assign_1.f90: Add extra warning.
+
+ PR fortran/31197
+ PR fortran/31258
+ * gfortran.dg/char_length_8.f90: New test.
+
+2007-08-30 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ * gcc.target/powerpc/ppu-intrinsics.c: New testcase.
+
+2007-08-30 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/inline-24.c: New test.
+ * g++.dg/opt/inline11.C: New test.
+
+2007-08-30 Richard Guenther <rguenther@suse.de>
+
+ * gcc.target/i386/vectorize5.c: New testcase.
+
+2007-08-30 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/33228
+ * interface.c (check_interface0): Improve error for external procs.
+ (check_sym_interfaces): Fix checking of module procedures.
+
+2007-08-30 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/sync-2.c (AI_ALIGN): Define if not defined.
+ (AI): Add AI_ALIGN.
+ * gcc.dg/sync-3.c: New test.
+
+ PR middle-end/32758
+ * gcc.dg/cleanup-12.c: New test.
+
+2007-08-30 Uros Bizjak <ubizjak@gmail.com>
+
+ * lib/gcc-dg.exp (cleanup-profile-file): New procedure.
+ * gcc.dg/20021014-1.c: Use cleanup-profile-file.
+ * gcc.dg/gcc.dg/20021014-1.c: Ditto.
+ * gcc.dg/pr32450.c: Ditto.
+ * gcc.dg/nest.c: Ditto.
+ * gcc.dg/nested-func-4.c: Ditto.
+ * g++.old-deja/g++.law/profile1.C: Ditto.
+
+2007-08-29 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/32989
+ * gfortran.fortran-torture/execute/getarg_1.f90: Add check for
+ non-default integer kind arguments.
+
+2007-08-29 Tobias Burnus <burnus@gcc.gnu.org>
+
+ PR fortran/33105
+ * gfortran.dg/is_iostat_end_eor_1.f90: New test.
+
+2007-08-29 Uros Bizjak <ubizjak@gmail.com>
+
+ * gcc.dg/h8300-ice2.c: Remove target selector.
+
+2007-08-29 Christopher D. Rickett <crickett@lanl.gov>
+
+ PR fortran/33215
+ * gfortran.dg/binding_label_tests_15.f03: New test case.
+ * gfortran.dg/binding_label_tests_16.f03: Ditto.
+
+2007-08-29 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * gfortran.dg/alloc_comp_basics_1.f90: Update check.
+ * gfortran.dg/alloc_comp_constructor_1.f90: Update check.
+
+2007-08-29 Douglas Gregor <doug.gregor@gmail.com>
+
+ PR c++/33194
+ * g++.dg/other/canon-33194.C: New.
+
+2007-08-29 Rask Ingemann Lambertsen <rask@sygehus.dk>
+
+ * gcc.c-torture/execute/simd-1.c: Use SImode vector elements.
+ * gcc.c-torture/execute/pr23135.c: Likewise.
+
+2007-08-29 Uros Bizjak <ubizjak@gmail.com>
+
+ * gcc.dg/pr31344.c: Move to ...
+ * gcc.dg/dfp/pr31344.c: ... here.
+ * gcc.dg/sibcall-6.c: Simplify dg-skip-if directive.
+ * gcc.dg/20050503-1.c: Ditto.
+ * gcc.dg/20050111-1.c: Simplify i?86 and x86_64 dg-options directive.
+ * gcc.dg/20061127-1.c: Compile only for fpic targets.
+ * gcc.dg/20060801-1.c: Ditto.
+
+2007-08-29 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * gfortran.dg/isnan_1.f90: Add -mieee for sh.
+ * gfortran.dg/nan_1.f90: Likewise.
+
+2007-08-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/33055
+ Revert previous patch.
+
+2007-08-28 Nathan Sidwell <nathan@codesourcery.com>
+ Kazu Hirata <kazu@codesourcery.com>
+
+ * gcc.target/m68k/interrupt-1.c: New.
+
+2007-08-28 Rask Ingemann Lambertsen <rask@sygehus.dk>
+
+ * gcc.c-torture/compile/limits-blockid.c: Reduce testcase size to
+ 10000 for targets where "int" can't hold at least 100000.
+ * gcc.c-torture/compile/limits-enumconst.c: Likewise.
+ * gcc.dg/fold-eqandshift-1.c (INT_BITS): New.
+ (test5)(test6): Use it.
+ * gcc.dg/pr30744-1.c (r): Use pointer sized integer.
+ * gcc.dg/tree-ssa/foldaddr-1.c (foo): Likewise.
+ * gcc.dg/tree-ssa/loadpre6.c (main): Likewise.
+ * gcc.dg/tls/opt-5.c (__gen_tempname): Avoid overflowing 16-bit int.
+ * gcc.dg/attr-alloc_size.c (test): Likewise.
+
+2007-08-28 Paolo Carlini <pcarlini@suse.de>
+
+ PR c++/33209
+ * g++.dg/template/error29.C: New.
+
+2007-08-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/32596
+ * g++.dg/ext/visibility/anon5.C: New test.
+
+2007-08-28 Dominique d'Humieres <dominiq@lps.ens.fr>
+
+ * gfortran.dg/gamma_4.f90: Fix large-real kind selection.
+
+2007-08-28 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * gfortran.dg/gamma_1.f90: Remove large-real tests.
+ * gfortran.dg/gamma_2.f90: Remove large-real tests.
+ * gfortran.dg/gamma_4.f90: New: large-real tests.
+
+2007-08-28 Jason Merrill <jason@redhat.com>
+
+ PR c++/29000
+ * g++.dg/ext/stmtexpr12.C: New test.
+
+ PR c++/28558
+ * g++.dg/ext/attrib28.C: New test.
+
+2007-08-28 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/32661
+ * gcc.target/i386/pr32661.c: New test.
+
+2007-08-28 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/32370
+ * gcc.dg/pr32370.c: New test.
+
+ PR rtl-optimization/33148
+ * gcc.c-torture/compile/20070827-1.c: New test.
+
+ PR debug/32914
+ * d++.dg/debug/const3.C: New test.
+ * d++.dg/debug/const4.C: New test.
+ * d++.dg/debug/dwarf2/const1.C: New test.
+ * d++.dg/debug/dwarf2/const2.C: New test.
+ * d++.dg/debug/dwarf2/const2b.C: New test.
+
+2007-08-28 Mircea Namolaru <namolaru@il.ibm.com>
+ Vladimir Yanovsky <yanov@il.ibm.com>
+ Revital Eres <eres@il.ibm.com>
+ Andrey Belevantsev <abel@ispras.ru>
+
+ * gcc.dg/sms-1.c: New test.
+
+2007-08-27 Alexandre Oliva <aoliva@redhat.com>
+
+ * g++.dg/ext/gnu-inline-common.h: New.
+ * g++.dg/ext/gnu-inline-global-reject.C: New.
+ * g++.dg/ext/gnu-inline-global.C: New.
+ * g++.dg/ext/gnu-inline-namespace.C: New.
+ * g++.dg/ext/gnu-inline-anon-namespace.C: New.
+ * g++.dg/ext/gnu-inline-class.C: New.
+ * g++.dg/ext/gnu-inline-class-static.C: New.
+ * g++.dg/ext/gnu-inline-template-class.C: New.
+ * g++.dg/ext/gnu-inline-template-func.C: New.
+
+2007-08-27 Jason Merrill <jason@redhat.com>
+
+ PR c++/31337
+ * g++.dg/ext/stmtexpr11.C: New.
+
+2007-08-27 Kazu Hirata <kazu@codesourcery.com>
+
+ * lib/target-supports.exp (check_profiling_available):
+ Set profiling_available_saved to 0 on fido-*-elf.
+
+2007-08-27 Daniel Berlin <dberlin@dberlin.org>
+
+ PR tree-optimization/33173
+
+ * gcc.c-torture/compile/pr33173.c: New.
+
+2007-08-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/31385
+ * gcc.dg/dfp/pr31385.c: New.
+
+2007-08-27 Uros Bizjak <ubizjak@gmail.com>
+
+ * gcc.dg/unsigned-long-compare.c: Remove target selector.
+
+2007-08-27 Uros Bizjak <ubizjak@gmail.com>
+
+ * gcc.dg/arm-eabi1.c, gcc.dg/symbian1.c, cc.dg/symbian2.c,
+ gcc.dg/symbian3.c, gcc.dg/symbian4.c, gcc.dg/symbian5.c,
+ gcc.dg/20051215-1.c: Move to gcc.target/arm directory.
+ * gcc.dg/const-compare.c, gcc.dg/non-lazy-ptr-test.c,
+ gcc.dg/rs6000-leaf.c: Move to gcc.target/powerpc directory.
+ * gcc.dg/m68k-pic-1.c, gcc.dg/m68k-slp-ice.c: Move to
+ gcc.target/m68k directory.
+ * gcc.dg/i386-darwin-fpmath.c: Move to gcc.target/i386 directory.
+ * gcc.dg/cris-peep2-andu1.c, gcc.dg/cris-peep2-andu2.c,
+ gcc.dg/cris-peep2-xsrand.c, gcc.dg/cris-peep2-xsrand2.c: Move to
+ gcc.target/cris directory.
+ * gcc.dg/20020620-1.c: Move to gcc.target/mips directory.
+ * gcc.dg/bfin-longcall-1.c, gcc.dg/bfin-longcall-2.c: Move to
+ gcc.target/bfin directory.
+
+ * gcc.target/sh: New directory.
+ * gcc.target/sh/sh.exp: New file.
+ * gcc.dg/pr21255-1.c, gcc.dg/pr21255-2-mb.c, gcc.dg/pr21255-2-ml.c,
+ gcc.dg/pr21255-3.c, gcc.dg/pr21255-4.c, gcc.dg/sh4a-bitmovua.c,
+ gcc.dg/sh4a-cos.c, gcc.dg/sh4a-cosf.c, gcc.dg/sh4a-fprun.c,
+ gcc.dg/sh4a-fsrra.c, gcc.dg/sh4a-memmovua.c, gcc.dg/sh4a-sin.c,
+ gcc.dg/sh4a-sincosf.c, gcc.dg/sh4a-sinf.c gcc.dg/sh-relax.c,
+ gcc.dg/sh-relax-vxworks.c: Move to gcc.target/sh directory.
+
+2007-08-27 Uros Bizjak <ubizjak@gmail.com>
+
+ * gcc.target/i386/pow-1.c: Fix scan-assembler-not.
+ * gcc.target/i386/asm-3.c: Skip -fpic ilp32 targets only.
+ * gcc.target/i386/20020523-1.c: Require nonpic effective target.
+ * gcc.target/i386/local2.c: Ditto.
+ * gcc.target/i386/stack-prot-kernel.c: Ditto.
+ * gcc.target/i386/20011119-1.c: Ditto.
+ * gcc.target/i386/tailcall-1.c: Ditto. Check ilp32 targets only.
+ * gcc.target/i386/fastcall-1.c: Fix target selector.
+
+2007-08-26 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/33055
+ * gfortran.dg/negative_unit.f: Add new check
+ * gfortran.dg/negative_unit_int8.f: New. Same as above except use
+ -fdefault-integer-8.
+
+2007-08-26 Asher Langton <langton2@llnl.gov>
+
+ * gfortran.dg/recursive_stack.f90: New.
+ * gfortran.dg/openmp_stack.f90: New.
+
+2007-08-26 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/31298
+ * gfortran.dg/use_10.f90: New.
+
+2007-08-26 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/32985
+ * gfortran.dg/namelist_14.f90: Make test case valid.
+ * gfortran.dg/common_10.f90: New.
+
+2007-08-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR middle-end/33181
+ * gcc.dg/ifelse-2.c: New.
+
+2007-08-26 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/32980
+ * gfortran.dg/gamma_1.f90: New.
+ * gfortran.dg/gamma_2.f90: New.
+ * gfortran.dg/gamma_3.f90: New.
+
+2007-08-26 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/33188
+ * gfortran.dg/used_types_18.f90: New.
+
+2007-08-25 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/array-init-2.c: New test.
+
+2007-08-24 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/33178
+ * gfortran.dg/initialization_4.f90: Update dg-error.
+ * gfortran.dg/initialization_13.f90: New.
+
+2007-08-24 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/33166
+ * gcc.c-torture/compile/pr33166.c: New testcase.
+
+2007-08-24 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/33139
+ * gfortran.dg/pointer_assign_4.f90: New.
+ * gfortran.dg/shape_2.f90: Fix test case.
+ * gfortran.dg/char_result_4.f90: Ditto.
+
+2007-08-24 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/array-init-1.c: New test.
+
+ PR c++/32567
+ * g++.dg/parse/crash36.C: New test.
+
+2007-08-23 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gcc.dg/pr32721.c: Updated.
+
+2007-08-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/32573
+ PR middle-end/32946
+ * gcc.dg/pr32573.c: New test.
+
+ PR c++/32898
+ * g++.dg/lookup/ns3.C: New test.
+
+ * gfortran.dg/assumed_charlen_sharing.f90: New test.
+
+ PR c++/31941
+ * g++.dg/parse/crash37.C: New test.
+
+2007-08-23 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/17390
+ * gcc.target/i386/pr17390.c: New test.
+
+2007-08-23 Richard Guenther <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/builtin-fprintf-1.c: Adjust patterns.
+ * gcc.dg/tree-ssa/builtin-fprintf-chk-1.c: Likewise.
+ * gcc.dg/tree-ssa/builtin-printf-1.c: Likewise.
+ * gcc.dg/tree-ssa/builtin-printf-chk-1.c: Likewise.
+ * gcc.dg/tree-ssa/builtin-vfprintf-1.c: Likewise.
+ * gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c: Likewise.
+ * gcc.dg/tree-ssa/builtin-vprintf-1.c: Likewise.
+ * gcc.dg/tree-ssa/builtin-vprintf-chk-1.c: Likewise.
+
+2007-08-23 Uros Bizjak <ubizjak@gmail.com>
+
+ * gcc.target/s390: New directory.
+ * gcc.target/s390/s390.exp: New file.
+ * gcc.dg/20020926-1.c, gcc.dg/20030123-1.c, gcc.dg/20030129-1.c,
+ gcc.dg/20040305-1.c, gcc.dg/20041109-1.c, gcc.dg/20041216-1.c,
+ gcc.dg/20050409-1.c, gcc.dg/20050524-1.c, gcc.dg/20050824-1.c,
+ gcc.dg/pr20927.c, gcc.dg/pr24624.c, gcc.dg/pr27661.c: Move to
+ gcc.target/s390 directory.
+
+2007-08-23 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/32328
+ * testsuite/gcc.dg/pr32328.c: New testcase.
+
+2007-08-23 Rask Ingemann Lambertsen <rask@sygehus.dk>
+
+ * gcc.c-torture/execute/simd-4.x: Only run when stdint.h types are
+ available.
+
+2007-08-23 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/33095
+ * gfortran.dg/min_max_optional_5.f90: New test.
+ * gfortran.dg/min_max_optional_2.f90: Remove.
+ * gfortran.dg/min_max_optional_3.f90: Remove.
+ * gfortran.dg/min_max_optional_4.f90: Remove.
+
+2007-08-23 Paolo Bonzini <bonzini@gnu.org>
+
+ * gcc.target/i386/xorps-sse.c: New.
+ * gcc.target/i386/xorps-sse2.c: New.
+
+2007-08-23 Paolo Bonzini <bonzini@gnu.org>
+
+ * gcc.target/i386/cmov3.c: Fix scan-assembler.
+ * gcc.target/i386/cmov4.c: Fix scan-assembler.
+ * gcc.target/i386/xchg-2.c: Fix scan-assembler.
+
+2007-08-22 Christopher D. Rickett <crickett@lanl.gov>
+
+ PR fortran/33020
+ * gfortran.dg/c_f_pointer_shape_tests_2.f03: Update test to
+ include multiple kinds for SHAPE parameter within a single
+ namespace.
+ * gfortran.dg/c_f_pointer_shape_tests_2_driver.c: Ditto.
+ * gfortran.dg/c_f_pointer_shape_tests_3.f03: New test case.
+
+2007-08-22 Janus Weil <jaydub66@gmail.com>
+
+ * interface_abstract_1.f90: Extended test case.
+ * interface_abstract_3.f90: New test.
+
2007-08-21 Christian Bruel <christian.bruel@st.com>
* gcc.dg/fold-sub.c: New test.
@@ -102,7 +510,7 @@
2007-03-20 Pawel Sikora <pluto@pld-linux.org>
- * g++.dg/warn/Wnvdtor-2.C: New testcase.
+ * g++.dg/warn/Wnvdtor-2.C: New testcase.
2007-08-20 Dorit Nuzman <dorit@il.ibm.com>
@@ -161,7 +569,7 @@
* gcc.dg/vect/vect-outer-6.c: New test.
* gcc.dg/vect/vect-outer-fir.c: New test.
* gcc.dg/vect/vect-outer-fir-lb.c: New test.
- * gcc.dg/vect/costmodel/ppc/costmodel-vect-outer-fir.c: New test.
+ * gcc.dg/vect/costmodel/ppc/costmodel-vect-outer-fir.c: New test.
2007-08-19 Dorit Nuzman <dorit@il.ibm.com>
@@ -211,7 +619,8 @@
versioning for aliasing).
* testsuite/gcc.dg/vect/vect-35.c: Likewise.
- * testsuite/gcc.dg/vect/vect-iv-6.c: Fix test for vect_no_align targets.
+ * testsuite/gcc.dg/vect/vect-iv-6.c: Fix test for vect_no_align
+ targets.
* testsuite/gcc.dg/vect/vect-multitypes-11.c: Likewise.
2007-08-18 Tom Tromey <tromey@redhat.com>
@@ -537,8 +946,8 @@
PR middle-end/32813
* gfortran.fortran-torture/compile/emptyif-1.f90: New test.
- * lib/fortran-torture.exp (fortran-torture): Use TORTURE_OPTIONS instead
- of just -O.
+ * lib/fortran-torture.exp (fortran-torture): Use TORTURE_OPTIONS
+ instead of just -O.
2007-08-08 Richard Sandiford <richard@codesourcery.com>
@@ -588,7 +997,7 @@
* gfortran.dg/vect-5.f90: Likewise.
* lib/target-supports.exp (check_effective_target_natural_alignment):
Return false for darwin.
- (check_effective_target_vector_alignment_reachable_for_double): New.
+ (check_effective_target_vector_alignment_reachable_for_double): New.
2007-08-07 Andreas Krebbel <krebbel1@de.ibm.com>
@@ -651,7 +1060,7 @@
* gfortran.dg/isnan_1.f90: New test.
2007-08-05 Vladimir Yanovsky <yanov@il.ibm.com>
- Revital Eres <eres@il.ibm.com>
+ Revital Eres <eres@il.ibm.com>
* gcc.dg/sms-antideps.c: New test.
@@ -943,7 +1352,7 @@
* gfortran.dg/entry_11.f90: New test.
2007-07-29 Vladimir Yanovsky <yanov@il.ibm.com>
- Revital Eres <eres@il.ibm.com>
+ Revital Eres <eres@il.ibm.com>
* gfortran.dg/sms-1.f90: New test.
@@ -1390,7 +1799,7 @@
2007-07-16 Sandra Loosemore <sandra@codesourcery.com>
David Ung <davidu@mips.com>
- * gcc.target/mips/mips-sched-madd.c: New test case.
+ * gcc.target/mips/mips-sched-madd.c: New test case.
2007-07-15 Jerry DeLisle <jvdelisle@gcc.gnu.org>
diff --git a/gcc/testsuite/g++.dg/debug/const3.C b/gcc/testsuite/g++.dg/debug/const3.C
new file mode 100644
index 00000000000..375c548a3b3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/const3.C
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+typedef float FloatVect __attribute__((__vector_size__(16)));
+const FloatVect Foo = { 250000000.0, 0.0, 0.0, 0.0 };
diff --git a/gcc/testsuite/g++.dg/debug/const4.C b/gcc/testsuite/g++.dg/debug/const4.C
new file mode 100644
index 00000000000..ec8133d778a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/const4.C
@@ -0,0 +1,2 @@
+/* { dg-do compile } */
+const __complex__ int x = 2i;
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/const1.C b/gcc/testsuite/g++.dg/debug/dwarf2/const1.C
new file mode 100644
index 00000000000..be23c10bae1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/const1.C
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O -gdwarf-2 -dA" } */
+/* { dg-final { scan-assembler "DW_AT_const_value" } } */
+
+extern void x ();
+void (* const f) () = x;
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/const2.C b/gcc/testsuite/g++.dg/debug/dwarf2/const2.C
new file mode 100644
index 00000000000..27f4c265851
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/const2.C
@@ -0,0 +1,6 @@
+/* { dg-do compile { target powerpc_altivec_ok } } */
+/* { dg-options "-O -gdwarf-2 -dA -maltivec" } */
+/* { dg-final { scan-assembler "DW_AT_const_value" } } */
+
+typedef float FloatVect __attribute__((__vector_size__(16)));
+const FloatVect Foo = { 250000000.0, 0.0, 0.0, 0.0 };
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/const2b.C b/gcc/testsuite/g++.dg/debug/dwarf2/const2b.C
new file mode 100644
index 00000000000..593e080ac69
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/const2b.C
@@ -0,0 +1,6 @@
+/* { dg-do compile { target i386*-*-* } } */
+/* { dg-options "-O -gdwarf-2 -dA -msse" } */
+/* { dg-final { scan-assembler "DW_AT_const_value" } } */
+
+typedef float FloatVect __attribute__((__vector_size__(16)));
+const FloatVect Foo = { 250000000.0, 0.0, 0.0, 0.0 };
diff --git a/gcc/testsuite/g++.dg/ext/attrib28.C b/gcc/testsuite/g++.dg/ext/attrib28.C
new file mode 100644
index 00000000000..2f18d418418
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attrib28.C
@@ -0,0 +1,12 @@
+// PR c++/28558
+// { dg-options "" }
+
+struct A
+{
+ A(int) { }
+};
+
+int main()
+{
+ A a = (A __attribute__((unused)))0; // { dg-warning "attribute" }
+}
diff --git a/gcc/testsuite/g++.dg/ext/gnu-inline-anon-namespace.C b/gcc/testsuite/g++.dg/ext/gnu-inline-anon-namespace.C
new file mode 100644
index 00000000000..b33629dcfff
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/gnu-inline-anon-namespace.C
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */ // such that static functions are optimized out
+/* { dg-final { scan-assembler-not "func1" } } */
+/* { dg-final { scan-assembler-not "func2" } } */
+/* { dg-final { scan-assembler-not "func3" } } */
+/* { dg-final { scan-assembler-not "func4" } } */
+/* { dg-final { scan-assembler-not "func5" } } */
+
+namespace {
+#include "gnu-inline-global.C"
+}
diff --git a/gcc/testsuite/g++.dg/ext/gnu-inline-class-static.C b/gcc/testsuite/g++.dg/ext/gnu-inline-class-static.C
new file mode 100644
index 00000000000..f22a23c0ba6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/gnu-inline-class-static.C
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */ // such that static functions are optimized out
+/* { dg-final { scan-assembler "func1" } } */
+/* { dg-final { scan-assembler "func2" } } */
+/* { dg-final { scan-assembler-not "func3" } } */
+/* { dg-final { scan-assembler "func4" } } */
+/* { dg-final { scan-assembler "func5" } } */
+
+#undef IN_CLASS
+#define IN_CLASS gnu_test_static
+
+struct IN_CLASS {
+ static int func1(void);
+ static int func2(void);
+ static int func3(void);
+ static int func4(void);
+ static int func5(void);
+};
+
+#include "gnu-inline-global.C"
diff --git a/gcc/testsuite/g++.dg/ext/gnu-inline-class.C b/gcc/testsuite/g++.dg/ext/gnu-inline-class.C
new file mode 100644
index 00000000000..71a0b1e36c1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/gnu-inline-class.C
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */ // such that static functions are optimized out
+/* { dg-final { scan-assembler "func1" } } */
+/* { dg-final { scan-assembler "func2" } } */
+/* { dg-final { scan-assembler-not "func3" } } */
+/* { dg-final { scan-assembler "func4" } } */
+/* { dg-final { scan-assembler "func5" } } */
+
+#define IN_CLASS gnu_test
+
+struct IN_CLASS {
+ int func1(void);
+ int func2(void);
+ int func3(void);
+ int func4(void);
+ int func5(void);
+};
+
+#include "gnu-inline-global.C"
diff --git a/gcc/testsuite/g++.dg/ext/gnu-inline-common.h b/gcc/testsuite/g++.dg/ext/gnu-inline-common.h
new file mode 100644
index 00000000000..87455ae7a6c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/gnu-inline-common.h
@@ -0,0 +1,24 @@
+#ifndef gnu
+# define gnu_inline __attribute__((gnu_inline)) inline
+#endif
+
+#define declspec(spec, name) spec int name (void)
+#ifdef IN_CLASS
+# define decl(spec, name)
+#else
+# define decl(spec, name) defpfx declspec(spec, name);
+#endif
+#define def(spec, name, ret) defpfx declspec(spec, name) { return ret; }
+#define gnuindef(name, ret) def(gnu_inline, name, ret)
+
+#ifndef pfx
+# ifdef IN_CLASS
+# define pfx(x) IN_CLASS::x
+# else
+# define pfx(x) x
+# endif
+#endif
+
+#ifndef defpfx
+# define defpfx
+#endif
diff --git a/gcc/testsuite/g++.dg/ext/gnu-inline-global-reject.C b/gcc/testsuite/g++.dg/ext/gnu-inline-global-reject.C
new file mode 100644
index 00000000000..2f2b8f29a08
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/gnu-inline-global-reject.C
@@ -0,0 +1,55 @@
+/* Test __attribute__((gnu_inline)).
+
+ Check that we reject various forms of duplicate definitions.
+*/
+
+/* { dg-do compile } */
+
+#include "gnu-inline-common.h"
+
+#undef fn
+#define fn pfx(func_decl_inline_before)
+decl(inline, fn) // { dg-error "previous" "" }
+gnuindef(fn, 0) // { dg-error "redeclared" "" }
+
+#undef fn
+#define fn pfx(func_decl_inline_after)
+gnuindef(fn, 0) // { dg-error "previous" "" }
+decl(inline, fn) // { dg-error "redeclared" "" }
+
+#undef fn
+#define fn pfx(func_def_gnuin_redef)
+gnuindef(fn, 0) // { dg-error "previous" "" }
+gnuindef(fn, 1) // { dg-error "redefinition" "" }
+
+#undef fn
+#define fn pfx(func_def_inline_redef)
+def(inline, fn, 0) // { dg-error "previous" "" }
+def(inline, fn, 1) // { dg-error "redefinition" "" }
+
+#undef fn
+#define fn pfx(func_def_inline_after)
+gnuindef(fn, 0) // { dg-error "previous" "" }
+def(inline, fn, 1) // { dg-error "redeclare" "" }
+
+#undef fn
+#define fn pfx(func_def_inline_before)
+def(inline, fn, 0) // { dg-error "previous" "" }
+gnuindef(fn, 1) // { dg-error "redefinition" "" }
+
+#undef fn
+#define fn pfx(func_def_before)
+def(, fn, 0) // { dg-error "previous" "" }
+gnuindef(fn, 1) // { dg-error "redefinition" "" }
+
+#undef fn
+#define fn pfx(func_decl_static_inline_before)
+decl(static inline, fn) // { dg-error "previous" "" }
+gnuindef(fn, 0) // { dg-error "redeclared" "" }
+
+#undef fn
+#define fn pfx(func_def_static_inline_after)
+decl(static, fn)
+gnuindef(fn, 0) // { dg-error "previous" "" }
+decl(static, fn)
+def(static inline, fn, 1) // { dg-error "redeclare" "" }
diff --git a/gcc/testsuite/g++.dg/ext/gnu-inline-global.C b/gcc/testsuite/g++.dg/ext/gnu-inline-global.C
new file mode 100644
index 00000000000..f628073f9fe
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/gnu-inline-global.C
@@ -0,0 +1,50 @@
+/* Test __attribute__((gnu_inline)).
+
+ Check that __attribute__((gnu_inline)) has no effect, in the
+ absence of extern and/or inline.
+
+ Check that we don't get out-of-line definitions for extern inline
+ gnu_inline functions, regardless of declarations or definitions.
+
+ Check that such functions can be overridden by out-of-line
+ definitions.
+
+ */
+
+/* { dg-do compile } */
+/* { dg-options "-O" } */ // such that static functions are optimized out
+/* { dg-final { scan-assembler "func1" } } */
+/* { dg-final { scan-assembler "func2" } } */
+/* { dg-final { scan-assembler-not "func3" } } */
+/* { dg-final { scan-assembler "func4" } } */
+/* { dg-final { scan-assembler-not "func5" } } */
+
+#include "gnu-inline-common.h"
+
+#undef fn
+#define fn pfx(func1) // must be emitted out-of-line
+gnuindef(fn, 0)
+def(, fn, 2)
+
+#undef fn
+#define fn pfx(func2) // must be emitted out-of-line
+decl(extern, fn)
+gnuindef(fn, 0)
+def(, fn, 2)
+
+#undef fn
+#define fn pfx(func3) // must not be emitted
+decl(extern, fn)
+gnuindef(fn, 0)
+
+#undef fn
+#define fn pfx(func4) // must be emitted out-of-line
+decl(extern, fn)
+gnuindef(fn, 0)
+def(, fn, 1)
+
+#undef fn
+#define fn pfx(func5) // must NOT be emitted, because it's static and unused
+decl(static, fn)
+gnuindef(fn, 0)
+def(, fn, 1)
diff --git a/gcc/testsuite/g++.dg/ext/gnu-inline-namespace.C b/gcc/testsuite/g++.dg/ext/gnu-inline-namespace.C
new file mode 100644
index 00000000000..ce3fea6558d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/gnu-inline-namespace.C
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */ // such that static functions are optimized out
+/* { dg-final { scan-assembler "func1" } } */
+/* { dg-final { scan-assembler "func2" } } */
+/* { dg-final { scan-assembler-not "func3" } } */
+/* { dg-final { scan-assembler "func4" } } */
+/* { dg-final { scan-assembler-not "func5" } } */
+
+namespace gnu_test {
+#include "gnu-inline-global.C"
+}
diff --git a/gcc/testsuite/g++.dg/ext/gnu-inline-template-class.C b/gcc/testsuite/g++.dg/ext/gnu-inline-template-class.C
new file mode 100644
index 00000000000..9bf36a8d670
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/gnu-inline-template-class.C
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */ // such that static functions are optimized out
+/* { dg-final { scan-assembler "func1" } } */
+/* { dg-final { scan-assembler "func2" } } */
+/* { dg-final { scan-assembler-not "func3" } } */
+/* { dg-final { scan-assembler "func4" } } */
+/* { dg-final { scan-assembler "func5" } } */
+
+template <typename T> struct gnu_test {
+ int func1(void);
+ int func2(void);
+ int func3(void);
+ int func4(void);
+ int func5(void);
+};
+
+#define defpfx template <typename T>
+#define IN_CLASS gnu_test<T>
+
+#include "gnu-inline-global.C"
+
+template struct gnu_test<int>;
diff --git a/gcc/testsuite/g++.dg/ext/gnu-inline-template-func.C b/gcc/testsuite/g++.dg/ext/gnu-inline-template-func.C
new file mode 100644
index 00000000000..fb88a2a91f7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/gnu-inline-template-func.C
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */ // such that static functions are optimized out
+/* { dg-final { scan-assembler "func1" } } */
+/* { dg-final { scan-assembler "func2" } } */
+/* { dg-final { scan-assembler-not "func3" } } */
+/* { dg-final { scan-assembler "func4" } } */
+/* { dg-final { scan-assembler-not "func5" } } */
+
+#define defpfx template <typename T>
+
+#include "gnu-inline-global.C"
+
+template int func1<int>(void);
+template int func2<int>(void);
+template int func3<int>(void);
+template int func4<int>(void);
+template int func5<int>(void);
diff --git a/gcc/testsuite/g++.dg/ext/stmtexpr11.C b/gcc/testsuite/g++.dg/ext/stmtexpr11.C
new file mode 100644
index 00000000000..8b5c5f84768
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/stmtexpr11.C
@@ -0,0 +1,15 @@
+// PR c++/31337
+// { dg-options "" }
+
+struct A
+{
+ int i[0];
+ A();
+ A(const A&);
+ ~A();
+};
+
+void foo()
+{
+ A a = ({ A(); });
+}
diff --git a/gcc/testsuite/g++.dg/ext/stmtexpr12.C b/gcc/testsuite/g++.dg/ext/stmtexpr12.C
new file mode 100644
index 00000000000..c35f41b0cc5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/stmtexpr12.C
@@ -0,0 +1,7 @@
+// PR c++/29000
+// { dg-options "" }
+
+template<int> int foo()
+{
+ return ({foo;})==0; // { dg-error "insufficient context" }
+}
diff --git a/gcc/testsuite/g++.dg/ext/visibility/anon5.C b/gcc/testsuite/g++.dg/ext/visibility/anon5.C
new file mode 100644
index 00000000000..d069eeab661
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/visibility/anon5.C
@@ -0,0 +1,8 @@
+// PR c++/32596
+// { dg-do compile }
+
+namespace
+{
+ template<class T> inline void char_less(void) { }
+ template<> inline void char_less<char>(void) { }
+}
diff --git a/gcc/testsuite/g++.dg/lookup/exception1.C b/gcc/testsuite/g++.dg/lookup/exception1.C
index d99d1c1f76c..b5fcd0a6c4d 100644
--- a/gcc/testsuite/g++.dg/lookup/exception1.C
+++ b/gcc/testsuite/g++.dg/lookup/exception1.C
@@ -1,5 +1,5 @@
/* PR 2743 */
-/* {dg-do compile} */
+/* { dg-do compile } */
namespace ns {
class Exception
diff --git a/gcc/testsuite/g++.dg/lookup/ns3.C b/gcc/testsuite/g++.dg/lookup/ns3.C
new file mode 100644
index 00000000000..144cba73dae
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/ns3.C
@@ -0,0 +1,5 @@
+// PR c++/32898
+
+namespace N { }
+
+int N::i; // { dg-error "should have been declared inside" }
diff --git a/gcc/testsuite/g++.dg/opt/inline11.C b/gcc/testsuite/g++.dg/opt/inline11.C
new file mode 100644
index 00000000000..d9758176c61
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/inline11.C
@@ -0,0 +1,28 @@
+/* Verify that gnu_inline inlines disregard inlining limits. */
+/* { dg-do link } */
+/* { dg-options "-O2" } */
+
+extern int foo (int);
+extern int baz (int);
+
+extern inline __attribute__((gnu_inline))
+int foo (int x)
+{
+ int i;
+ if (!__builtin_constant_p (x))
+ {
+#define B(n) baz (1##n) + baz (2##n) + baz (3##n) \
+ + baz (4##n) + baz (5##n) + baz (6##n)
+#define C(n) B(1##n) + B(2##n) + B(3##n) + B(4##n) + B(5##n) + B(6##n)
+#define D(n) C(1##n) + C(2##n) + C(3##n) + C(4##n) + C(5##n) + C(6##n)
+ return D(0) + D(1) + D(2) + D(3) + D(4)
+ + D(5) + D(6) + D(7) + D(8) + D(9);
+ }
+ return 0;
+}
+
+int
+main (void)
+{
+ return foo (0);
+}
diff --git a/gcc/testsuite/g++.dg/other/canon-33194.C b/gcc/testsuite/g++.dg/other/canon-33194.C
new file mode 100644
index 00000000000..496aafe2c1c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/canon-33194.C
@@ -0,0 +1,21 @@
+// PR c++/33194
+void c_translate_location (
+ void (*fail) (
+ const char *fmt, ...)
+ __attribute__ ((noreturn,
+ format (printf, 1, 2)))
+ );
+
+
+struct dwflpp
+{
+ static void loc2c_error (const char *fmt, ...)
+ {
+ }
+
+ void
+ translate_location()
+ {
+ return c_translate_location (&loc2c_error);
+ }
+};
diff --git a/gcc/testsuite/g++.dg/parse/crash36.C b/gcc/testsuite/g++.dg/parse/crash36.C
new file mode 100644
index 00000000000..1e5ab8f2562
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/crash36.C
@@ -0,0 +1,11 @@
+// PR c++/32567
+// { dg-do compile }
+// { dg-options "-std=c++98" }
+
+template <typename... T> struct A // { dg-error "does not include variadic templates" }
+{
+ static T &t; // { dg-error "not expanded with|T" }
+ static const int i = sizeof (++t); // { dg-error "invalid use of template type parameter" }
+};
+
+int x[A <int>::i]; // { dg-error "is not an integral constant-expression" }
diff --git a/gcc/testsuite/g++.dg/parse/crash37.C b/gcc/testsuite/g++.dg/parse/crash37.C
new file mode 100644
index 00000000000..8320dfaa50f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/crash37.C
@@ -0,0 +1,15 @@
+// PR c++/31941
+// { dg-do compile }
+
+struct S
+{
+ S() throw () { }
+ virtual ~S () throw ();
+ virtual const char* what () const throw ();
+};
+
+const char *
+foo (S &e)
+{
+ return e.what ().c_str (); // { dg-error "c_str.*S::what.*which is of non-class type" }
+}
diff --git a/gcc/testsuite/g++.dg/template/error29.C b/gcc/testsuite/g++.dg/template/error29.C
new file mode 100644
index 00000000000..2e2291d7e87
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/error29.C
@@ -0,0 +1,5 @@
+// PR c++/33209
+
+template<typename T> void foo(int, T::x); // { dg-error "T::x" }
+
+template<template<typename> class T> void foo2(int, T<int>::x); // { dg-error "T<int>::x" }
diff --git a/gcc/testsuite/g++.old-deja/g++.law/profile1.C b/gcc/testsuite/g++.old-deja/g++.law/profile1.C
index 7f17a15de9f..ecd3b834c76 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/profile1.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/profile1.C
@@ -8,3 +8,5 @@ main()
{
printf ("PASS\n");
}
+
+/* { dg-final { cleanup-profile-file } } */
diff --git a/gcc/testsuite/gcc.c-torture/compile/20070827-1.c b/gcc/testsuite/gcc.c-torture/compile/20070827-1.c
new file mode 100644
index 00000000000..5dd009974ac
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20070827-1.c
@@ -0,0 +1,20 @@
+/* PR rtl-optimization/33148 */
+
+int
+foo (unsigned int *p, int *q, unsigned int w, unsigned int b)
+{
+ unsigned int i;
+ int mask;
+
+ if (q[0] < q[1])
+ mask = 0xff;
+ else
+ mask = 0;
+
+ for (i = 0; 8 * i < w; i++)
+ {
+ b ^= mask;
+ *p++ = b;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-blockid.c b/gcc/testsuite/gcc.c-torture/compile/limits-blockid.c
index 718c8673c2e..545dfe4dcb7 100644
--- a/gcc/testsuite/gcc.c-torture/compile/limits-blockid.c
+++ b/gcc/testsuite/gcc.c-torture/compile/limits-blockid.c
@@ -14,5 +14,9 @@
void q9_func(void)
{
+#if __INT_MAX__ >= 100000
LIM5(char t)
+#else
+ LIM4(char t)
+#endif
}
diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-enumconst.c b/gcc/testsuite/gcc.c-torture/compile/limits-enumconst.c
index 80ac342cd2f..975cafc833e 100644
--- a/gcc/testsuite/gcc.c-torture/compile/limits-enumconst.c
+++ b/gcc/testsuite/gcc.c-torture/compile/limits-enumconst.c
@@ -14,5 +14,9 @@
enum q21_enum
{
+#if __INT_MAX__ >= 100000
LIM5 (e)
+#else
+ LIM4 (e)
+#endif
};
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33166.c b/gcc/testsuite/gcc.c-torture/compile/pr33166.c
new file mode 100644
index 00000000000..a48c529c3fe
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr33166.c
@@ -0,0 +1,10 @@
+static void ConvertAddr (char *saddr, void **addr)
+{
+ *addr = (void *) &saddr;
+}
+void DefineSelf (char *addr)
+{
+ ConvertAddr (addr, (void **) &addr);
+ if (addr[0] == 127 && addr[3] == 1)
+ ;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33173.c b/gcc/testsuite/gcc.c-torture/compile/pr33173.c
new file mode 100644
index 00000000000..503c7afbdac
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr33173.c
@@ -0,0 +1,102 @@
+typedef long unsigned int size_t;
+typedef struct
+{
+}
+_G_fpos_t;
+extern int printf (__const char *__restrict __format, ...);
+extern size_t strlen (__const char *__s) __attribute__ ((__nothrow__))
+ __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+typedef struct rend_service_descriptor_t
+{
+ int patchlevel;
+ char status_tag[32];
+}
+tor_version_t;
+test_dir_format (void)
+{
+ tor_version_t ver1;
+ {
+ long v2 = (long) (ver1.patchlevel);
+ }
+ {
+ const char *v1 = (""), *v2 = (ver1.status_tag);
+ if (!__extension__ (
+ {
+ size_t __s1_len, __s2_len;
+ (__builtin_constant_p (v1)
+ && (__s1_len = strlen (v1), __s2_len =
+ (!((size_t) (const void *) ((v1) + 1) -
+ (size_t) (const void *) (v1) == 1)
+ || __s1_len >= 4)
+ &&
+ (!((size_t) (const void *) ((v2) + 1) -
+ (size_t) (const void *) (v2) == 1)
+ || __s2_len >= 4)) ? __builtin_strcmp (v1,
+ v2)
+ : (__builtin_constant_p (v1)
+ && ((size_t) (const void *) ((v1) + 1) -
+ __s1_len < 4) ? (__builtin_constant_p (v2)
+ &&
+ ((size_t) (const void *)
+ (size_t) (const void
+ *) (v2) ==
+ 1) ? __builtin_strcmp (v1,
+ v2)
+ : (__extension__ (
+ {
+ __const
+ char
+ *__s2
+ =
+ (__const
+ char
+ *)
+ (v2);
+ register
+ __result
+ =
+ (((__const unsigned char *) (__const char *) (v1))[0] - __s2[0]); if (__s1_len > 0 && __result == 0)
+ {
+ }
+ __result;}
+ ))):
+ (__builtin_constant_p (v2)
+ && ((size_t) (const void *) ((v2) + 1) -
+ __s2_len < 4) ? (__builtin_constant_p (v1)
+ && ((size_t) (const void *)
+ 1) ?
+ __builtin_strcmp (v1,
+ v2)
+ : (__extension__ (
+ {
+ __const
+ char
+ *__s1
+ =
+ (__const
+ char
+ *)
+ (__const
+ *)
+ (v1);
+ register
+ __result
+ =
+ ((__const unsigned char *) (__const char *) (v2))[0]; if (__s2_len > 0 && __result == 0)
+ {
+ if
+ (__s2_len
+ ==
+ 0)
+ {
+ }
+ }
+ __result;}
+ ))): __builtin_strcmp (v1,
+ v2))));}
+ ))
+ {
+ printf (".");
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr23135.c b/gcc/testsuite/gcc.c-torture/execute/pr23135.c
index a96f0a77a89..57b5f7cfa6c 100644
--- a/gcc/testsuite/gcc.c-torture/execute/pr23135.c
+++ b/gcc/testsuite/gcc.c-torture/execute/pr23135.c
@@ -7,7 +7,7 @@
typedef struct { char c[STACK_SIZE/2]; } big_t;
-typedef int __attribute__((vector_size (8))) vecint;
+typedef int __attribute__((mode(SI))) __attribute__((vector_size (8))) vecint;
typedef int __attribute__((mode(SI))) siint;
vecint i = { 150, 100 };
diff --git a/gcc/testsuite/gcc.c-torture/execute/simd-1.c b/gcc/testsuite/gcc.c-torture/execute/simd-1.c
index df9f1a90798..97d82069764 100644
--- a/gcc/testsuite/gcc.c-torture/execute/simd-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/simd-1.c
@@ -4,7 +4,7 @@
regardless of if the target has SIMD instructions.
*/
-typedef int __attribute__((vector_size (16))) vecint;
+typedef int __attribute__((mode(SI))) __attribute__((vector_size (16))) vecint;
typedef int __attribute__((mode(SI))) siint;
vecint i = { 150, 100, 150, 200 };
diff --git a/gcc/testsuite/gcc.c-torture/execute/simd-4.x b/gcc/testsuite/gcc.c-torture/execute/simd-4.x
new file mode 100644
index 00000000000..2e7510c6ddb
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/simd-4.x
@@ -0,0 +1,7 @@
+load_lib target-supports.exp
+
+if { [check_effective_target_stdint_types] } {
+ return 0
+}
+
+return 1;
diff --git a/gcc/testsuite/gcc.dg/20021014-1.c b/gcc/testsuite/gcc.dg/20021014-1.c
index dd8614c9f09..41aa3c37620 100644
--- a/gcc/testsuite/gcc.dg/20021014-1.c
+++ b/gcc/testsuite/gcc.dg/20021014-1.c
@@ -23,3 +23,5 @@ int main (void)
abort ();
exit (0);
}
+
+/* { dg-final { cleanup-profile-file } } */
diff --git a/gcc/testsuite/gcc.dg/20050111-1.c b/gcc/testsuite/gcc.dg/20050111-1.c
index 0cc4b7e195f..7cf04e806d6 100644
--- a/gcc/testsuite/gcc.dg/20050111-1.c
+++ b/gcc/testsuite/gcc.dg/20050111-1.c
@@ -1,10 +1,7 @@
/* PR middle-end/19084, rtl-optimization/19348 */
/* { dg-do compile } */
-/* The following ensures that this test is compiled with -O2, unless
- on i?86 or x86_64 with -m32 option. */
/* { dg-options "-O2" } */
-/* { dg-options "-O2 -march=i686" { target i?86-*-* x86_64-*-* } } */
-/* { dg-options "-O2" { target lp64 } } */
+/* { dg-options "-O2 -march=i686" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
unsigned int
foo (unsigned long long x)
diff --git a/gcc/testsuite/gcc.dg/20050503-1.c b/gcc/testsuite/gcc.dg/20050503-1.c
index 1ab93cad7bf..a6c6fa15fa8 100644
--- a/gcc/testsuite/gcc.dg/20050503-1.c
+++ b/gcc/testsuite/gcc.dg/20050503-1.c
@@ -2,7 +2,7 @@
Test whether tail call information is propagated through builtin
expanders. */
/* { dg-do compile } */
-/* { dg-skip-if "" { { i?86-*-* x86_64-*-* } && ilp32 } { "-fpic" "-fPIC" } { "" } } */
+/* { dg-skip-if "" { { i?86-*-* x86_64-*-* } && { ilp32 && fpic } } { "*" } { "" } } */
/* { dg-options "-O2" } */
typedef __SIZE_TYPE__ size_t;
diff --git a/gcc/testsuite/gcc.dg/20060801-1.c b/gcc/testsuite/gcc.dg/20060801-1.c
index 26cc7c21d85..c036acbec80 100644
--- a/gcc/testsuite/gcc.dg/20060801-1.c
+++ b/gcc/testsuite/gcc.dg/20060801-1.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target { lp64 } } } */
+/* { dg-do compile { target fpic } } */
+/* { dg-require-effective-target lp64 } */
/* { dg-options "-fPIC" } */
char *ptr = 0;
char array[100];
diff --git a/gcc/testsuite/gcc.dg/20061127-1.c b/gcc/testsuite/gcc.dg/20061127-1.c
index ec94dc8c3f8..0b70a5ae2b6 100644
--- a/gcc/testsuite/gcc.dg/20061127-1.c
+++ b/gcc/testsuite/gcc.dg/20061127-1.c
@@ -1,4 +1,5 @@
-/* { dg-do compile { target lp64 } } */
+/* { dg-do compile { target fpic } } */
+/* { dg-require-effective-target lp64 } */
/* { dg-options "-O1 -fPIC" } */
/* PR target/29319 */
diff --git a/gcc/testsuite/gcc.dg/arm-asm.c b/gcc/testsuite/gcc.dg/arm-asm.c
index dd99c68553f..1187d9eb466 100644
--- a/gcc/testsuite/gcc.dg/arm-asm.c
+++ b/gcc/testsuite/gcc.dg/arm-asm.c
@@ -1,6 +1,6 @@
/* ARM and Thumb asm statements should be able to access the constant
pool. */
-/* { dg-do compile { target arm*-*-* strongarm*-*-* xscale*-*-*} } */
+/* { dg-do compile { target arm*-*-* strongarm*-*-* xscale*-*-* } } */
extern unsigned x[];
unsigned *trapTable()
{
diff --git a/gcc/testsuite/gcc.dg/array-init-1.c b/gcc/testsuite/gcc.dg/array-init-1.c
new file mode 100644
index 00000000000..8b866cca3f3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/array-init-1.c
@@ -0,0 +1,24 @@
+/* Test that both arrays are initialized by store_by_pieces. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+struct A { char c[10]; };
+extern void baz (struct A *);
+
+void
+foo (void)
+{
+ struct A a = { "abcdefghi" };
+ baz (&a);
+}
+
+void
+bar (void)
+{
+ struct A a;
+ __builtin_strcpy (&a.c[0], "abcdefghi");
+ baz (&a);
+}
+
+/* { dg-final { scan-assembler-not "abcdefghi" { target i?86-*-* x86_64-*-* ia64-*-* } } } */
+/* { dg-final { scan-assembler-times "7523094288207667809\|6867666564636261\|1684234849\|64636261" 2 { target i?86-*-* x86_64-*-* ia64-*-* } } } */
diff --git a/gcc/testsuite/gcc.dg/array-init-2.c b/gcc/testsuite/gcc.dg/array-init-2.c
new file mode 100644
index 00000000000..9c425818fe5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/array-init-2.c
@@ -0,0 +1,51 @@
+/* Test array initializion by store_by_pieces. */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+struct A { char c[10]; };
+extern void abort (void);
+
+void
+__attribute__((noinline))
+check (struct A * a, int b)
+{
+ const char *p;
+ switch (b)
+ {
+ case 0:
+ p = "abcdefghi";
+ break;
+ case 1:
+ p = "j\0\0\0\0\0\0\0\0";
+ break;
+ case 2:
+ p = "kl\0\0\0\0\0\0\0";
+ break;
+ case 3:
+ p = "mnop\0\0\0\0\0";
+ break;
+ case 4:
+ p = "qrstuvwx\0";
+ break;
+ default:
+ abort ();
+ }
+ if (__builtin_memcmp (a->c, p, 10) != 0)
+ abort ();
+}
+
+int
+main (void)
+{
+ struct A a = { "abcdefghi" };
+ check (&a, 0);
+ struct A b = { "j" };
+ check (&b, 1);
+ struct A c = { "kl" };
+ check (&c, 2);
+ struct A d = { "mnop" };
+ check (&d, 3);
+ struct A e = { "qrstuvwx" };
+ check (&e, 4);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/attr-alloc_size.c b/gcc/testsuite/gcc.dg/attr-alloc_size.c
index e646e5e3f7f..47d7c005085 100644
--- a/gcc/testsuite/gcc.dg/attr-alloc_size.c
+++ b/gcc/testsuite/gcc.dg/attr-alloc_size.c
@@ -23,13 +23,13 @@ test (void)
p = malloc1 (6);
strcpy (p, "Hello");
strcpy (p, "Hello World"); /* { dg-warning "will always overflow" "strcpy" } */
- p = malloc2 (424242, 6);
+ p = malloc2 (__INT_MAX__ >= 1700000 ? 424242 : __INT_MAX__ / 4, 6);
strcpy (p, "World");
strcpy (p, "Hello World"); /* { dg-warning "will always overflow" "strcpy" } */
p = calloc1 (2, 5);
strcpy (p, "World");
strcpy (p, "Hello World"); /* { dg-warning "will always overflow" "strcpy" } */
- p = calloc2 (2, 424242, 5);
+ p = calloc2 (2, __INT_MAX__ >= 1700000 ? 424242 : __INT_MAX__ / 4, 5);
strcpy (p, "World");
strcpy (p, "Hello World"); /* { dg-warning "will always overflow" "strcpy" } */
}
diff --git a/gcc/testsuite/gcc.dg/attr-isr-trap_exit.c b/gcc/testsuite/gcc.dg/attr-isr-trap_exit.c
index 880db37ce73..7ea24c494f0 100644
--- a/gcc/testsuite/gcc.dg/attr-isr-trap_exit.c
+++ b/gcc/testsuite/gcc.dg/attr-isr-trap_exit.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target sh-*-* sh[1234ble]*-*-*} } */
+/* { dg-do compile { target sh-*-* sh[1234ble]*-*-* } } */
/* { dg-options "-O" } */
/* Check that trapa / interrput_handler attributes can paired in
either order. */
diff --git a/gcc/testsuite/gcc.dg/c99-tgmath-2.c b/gcc/testsuite/gcc.dg/c99-tgmath-2.c
index d162d4ac9ad..22435f3f9a4 100644
--- a/gcc/testsuite/gcc.dg/c99-tgmath-2.c
+++ b/gcc/testsuite/gcc.dg/c99-tgmath-2.c
@@ -11,4 +11,4 @@ float foo(float x)
return sin(x);
}
-/* {dg-final {scan-assembler "sinf" } } */
+/* { dg-final { scan-assembler "sinf" } } */
diff --git a/gcc/testsuite/gcc.dg/c99-tgmath-3.c b/gcc/testsuite/gcc.dg/c99-tgmath-3.c
index 4d0de1ee56b..d3eaca15aee 100644
--- a/gcc/testsuite/gcc.dg/c99-tgmath-3.c
+++ b/gcc/testsuite/gcc.dg/c99-tgmath-3.c
@@ -11,4 +11,4 @@ complex double foo(complex double x)
return exp(x);
}
-/* {dg-final {scan-assembler "cexp" } } */
+/* { dg-final { scan-assembler "cexp" } } */
diff --git a/gcc/testsuite/gcc.dg/c99-tgmath-4.c b/gcc/testsuite/gcc.dg/c99-tgmath-4.c
index e9e490bdec7..7d40449a773 100644
--- a/gcc/testsuite/gcc.dg/c99-tgmath-4.c
+++ b/gcc/testsuite/gcc.dg/c99-tgmath-4.c
@@ -11,4 +11,4 @@ complex double foo(complex float x, float y)
return pow(x, y);
}
-/* {dg-final {scan-assembler "cpowf" } } */
+/* { dg-final { scan-assembler "cpowf" } } */
diff --git a/gcc/testsuite/gcc.dg/cast-lvalue-2.c b/gcc/testsuite/gcc.dg/cast-lvalue-2.c
index ed6a2e69fe8..d4db4bd6ff3 100644
--- a/gcc/testsuite/gcc.dg/cast-lvalue-2.c
+++ b/gcc/testsuite/gcc.dg/cast-lvalue-2.c
@@ -10,4 +10,4 @@ foo (void)
{
(int) x = 1; /* { dg-bogus "warning" "warning in place of error" } */
}
-/* { dg-error "lvalue" "cast as lvalue" { target *-*-*} 11 } */
+/* { dg-error "lvalue" "cast as lvalue" { target *-*-* } 11 } */
diff --git a/gcc/testsuite/gcc.dg/cleanup-11.c b/gcc/testsuite/gcc.dg/cleanup-11.c
index 6e145c5f31c..d0c78d577b7 100644
--- a/gcc/testsuite/gcc.dg/cleanup-11.c
+++ b/gcc/testsuite/gcc.dg/cleanup-11.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target hppa*-*-hpux* *-*-linux* powerpc*-*-darwin* *-*-darwin[912]*} } */
+/* { dg-do run { target hppa*-*-hpux* *-*-linux* powerpc*-*-darwin* *-*-darwin[912]* } } */
/* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */
/* Verify that cleanups work with exception handling through realtime signal
frames on alternate stack. */
diff --git a/gcc/testsuite/gcc.dg/cleanup-12.c b/gcc/testsuite/gcc.dg/cleanup-12.c
new file mode 100644
index 00000000000..90de90ac831
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cleanup-12.c
@@ -0,0 +1,69 @@
+/* PR middle-end/32758 */
+/* HP-UX libunwind.so doesn't provide _UA_END_OF_STACK */
+/* { dg-do run } */
+/* { dg-options "-O2 -fexceptions" } */
+/* { dg-skip-if "" { "ia64-*-hpux11.*" } { "*" } { "" } } */
+/* Verify unwind info in presence of alloca. */
+
+#include <unwind.h>
+#include <stdlib.h>
+#include <string.h>
+
+static _Unwind_Reason_Code
+force_unwind_stop (int version, _Unwind_Action actions,
+ _Unwind_Exception_Class exc_class,
+ struct _Unwind_Exception *exc_obj,
+ struct _Unwind_Context *context,
+ void *stop_parameter)
+{
+ if (actions & _UA_END_OF_STACK)
+ abort ();
+ return _URC_NO_REASON;
+}
+
+static void force_unwind (void)
+{
+ struct _Unwind_Exception *exc = malloc (sizeof (*exc));
+ memset (&exc->exception_class, 0, sizeof (exc->exception_class));
+ exc->exception_cleanup = 0;
+
+#ifndef __USING_SJLJ_EXCEPTIONS__
+ _Unwind_ForcedUnwind (exc, force_unwind_stop, 0);
+#else
+ _Unwind_SjLj_ForcedUnwind (exc, force_unwind_stop, 0);
+#endif
+
+ abort ();
+}
+
+__attribute__((noinline))
+void foo (void *x __attribute__((unused)))
+{
+ force_unwind ();
+}
+
+__attribute__((noinline))
+int bar (unsigned int x)
+{
+ void *y = __builtin_alloca (x);
+ foo (y);
+ return 1;
+}
+
+static void handler (void *p __attribute__((unused)))
+{
+ exit (0);
+}
+
+__attribute__((noinline))
+static void doit ()
+{
+ char dummy __attribute__((cleanup (handler)));
+ bar (1024);
+}
+
+int main ()
+{
+ doit ();
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/cleanup-8.c b/gcc/testsuite/gcc.dg/cleanup-8.c
index 6f3ff6c511b..d2335606a21 100644
--- a/gcc/testsuite/gcc.dg/cleanup-8.c
+++ b/gcc/testsuite/gcc.dg/cleanup-8.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target hppa*-*-hpux* *-*-linux* powerpc*-*-darwin* *-*-darwin[912]*} } */
+/* { dg-do run { target hppa*-*-hpux* *-*-linux* powerpc*-*-darwin* *-*-darwin[912]* } } */
/* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */
/* Verify that cleanups work with exception handling through signal
frames. */
diff --git a/gcc/testsuite/gcc.dg/cleanup-9.c b/gcc/testsuite/gcc.dg/cleanup-9.c
index 93d0463aab8..b73125ace96 100644
--- a/gcc/testsuite/gcc.dg/cleanup-9.c
+++ b/gcc/testsuite/gcc.dg/cleanup-9.c
@@ -1,4 +1,4 @@
-/* { dg-do run { target hppa*-*-hpux* *-*-linux* powerpc*-*-darwin* *-*-darwin[912]*} } */
+/* { dg-do run { target hppa*-*-hpux* *-*-linux* powerpc*-*-darwin* *-*-darwin[912]* } } */
/* { dg-options "-fexceptions -fnon-call-exceptions -O2" } */
/* Verify that cleanups work with exception handling through realtime
signal frames. */
diff --git a/gcc/testsuite/gcc.dg/const-float128-ped.c b/gcc/testsuite/gcc.dg/const-float128-ped.c
index 52f0525dcd3..86a630cf951 100644
--- a/gcc/testsuite/gcc.dg/const-float128-ped.c
+++ b/gcc/testsuite/gcc.dg/const-float128-ped.c
@@ -1,5 +1,5 @@
/* Test 'q' suffix with -pedantic on __float128 type constants. */
-/* { dg-do compile { target { ia64-*-* || { { i?86-*-* x86_64-*-*} && lp64 } } } } */
+/* { dg-do compile { target { ia64-*-* || { { i?86-*-* x86_64-*-* } && lp64 } } } } */
/* { dg-options "-pedantic" } */
__float128 a = 123.456789q; /* { dg-warning "non-standard suffix on floating constant" } */
diff --git a/gcc/testsuite/gcc.dg/const-float128.c b/gcc/testsuite/gcc.dg/const-float128.c
index 1797e08bc30..146e0c9c986 100644
--- a/gcc/testsuite/gcc.dg/const-float128.c
+++ b/gcc/testsuite/gcc.dg/const-float128.c
@@ -1,5 +1,5 @@
/* Test 'q' and 'Q' suffixes on __float128 type constants. */
-/* { dg-do compile { target { ia64-*-* || { { i?86-*-* x86_64-*-*} && lp64 } } } } */
+/* { dg-do compile { target { ia64-*-* || { { i?86-*-* x86_64-*-* } && lp64 } } } } */
/* { dg-options "" } */
__float128 a = 123.456789q;
diff --git a/gcc/testsuite/gcc.dg/cpp/empty-include.c b/gcc/testsuite/gcc.dg/cpp/empty-include.c
index 6b5a47cbba7..f0f5b40bc1b 100644
--- a/gcc/testsuite/gcc.dg/cpp/empty-include.c
+++ b/gcc/testsuite/gcc.dg/cpp/empty-include.c
@@ -8,6 +8,6 @@
* We should get an error.
*/
-/* {dg-do preprocess} */
+/* { dg-do preprocess } */
#include "" /* { dg-error "empty" "error on empty filename in include" } */
int x; /* Otherwise we have an empty file and get more errors. */
diff --git a/gcc/testsuite/gcc.dg/pr31344.c b/gcc/testsuite/gcc.dg/dfp/pr31344.c
index a01439b7e0e..de76a72f937 100644
--- a/gcc/testsuite/gcc.dg/pr31344.c
+++ b/gcc/testsuite/gcc.dg/dfp/pr31344.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target dfp } } */
+/* { dg-do compile } */
/* { dg-options "-O -std=gnu99 -mtune=i386" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-options "-O -std=gnu99" } */
diff --git a/gcc/testsuite/gcc.dg/dfp/pr31385.c b/gcc/testsuite/gcc.dg/dfp/pr31385.c
new file mode 100644
index 00000000000..63a23c4bb75
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/pr31385.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -O2" } */
+
+typedef _Decimal32 fp_t;
+
+extern fp_t g(fp_t);
+
+fp_t
+bug(fp_t x)
+{
+ fp_t result;
+ int n;
+ fp_t f, f3, y, z;
+
+ n = 0;
+ y = 1.DF;
+ f = g(x);
+
+ if (f < 0.DF)
+ f = -f;
+
+ f3 = 2.DF;
+
+ z = (y + y + f / (y * y));
+ y = (z + z) / (9.DF) + f3 / (z * z);
+
+ result = y;
+
+ return (result);
+}
diff --git a/gcc/testsuite/gcc.dg/fold-eqandshift-1.c b/gcc/testsuite/gcc.dg/fold-eqandshift-1.c
index 34906bad020..055f398af0b 100644
--- a/gcc/testsuite/gcc.dg/fold-eqandshift-1.c
+++ b/gcc/testsuite/gcc.dg/fold-eqandshift-1.c
@@ -25,15 +25,25 @@ int test4(int d)
return (d >> 3) & 4;
}
+#if __INT_MAX__ == 32767
+#define INT_BITS 16
+#elif __INT_MAX__ == 2147483647
+#define INT_BITS 32
+#elif __INT_MAX__ == 9223372036854775807
+#define INT_BITS 64
+#else
+#error Please add support for your target here.
+#endif
+
void test5(int e)
{
- if ((e >> 31) & 64)
+ if ((e >> (INT_BITS - 1)) & 64)
foo();
}
void test6(unsigned int f)
{
- if ((f >> 31) & 64)
+ if ((f >> (INT_BITS - 1)) & 64)
foo();
}
diff --git a/gcc/testsuite/gcc.dg/h8300-ice2.c b/gcc/testsuite/gcc.dg/h8300-ice2.c
index 5dd746a42e9..216ea34c94c 100644
--- a/gcc/testsuite/gcc.dg/h8300-ice2.c
+++ b/gcc/testsuite/gcc.dg/h8300-ice2.c
@@ -1,4 +1,4 @@
-/*{dg-do compile target {h8300-*-*}} */
+/* { dg-do compile } */
/* ICE for signed/unsigned long and signed char comparison */
int main()
{
diff --git a/gcc/testsuite/gcc.dg/ifelse-2.c b/gcc/testsuite/gcc.dg/ifelse-2.c
new file mode 100644
index 00000000000..0210fcfa4b6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ifelse-2.c
@@ -0,0 +1,34 @@
+/*
+{ dg-do run }
+{ dg-options "-O2" }
+*/
+
+extern void abort (void);
+
+enum Status
+{
+ P_ON_LOWER = -4,
+ P_ON_UPPER = -2,
+ P_FREE = -1
+};
+
+void
+foo (enum Status *stat, double newUpper, double lower, double max)
+{
+ if (newUpper >= max)
+ *stat = P_FREE;
+ else if (newUpper == lower)
+ *stat = P_ON_LOWER;
+}
+
+int
+main ()
+{
+ enum Status stat = P_ON_UPPER;
+
+ foo (&stat, 5.0, -10.0, 10.0);
+
+ if (stat != P_ON_UPPER)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/inline-24.c b/gcc/testsuite/gcc.dg/inline-24.c
new file mode 100644
index 00000000000..d9758176c61
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/inline-24.c
@@ -0,0 +1,28 @@
+/* Verify that gnu_inline inlines disregard inlining limits. */
+/* { dg-do link } */
+/* { dg-options "-O2" } */
+
+extern int foo (int);
+extern int baz (int);
+
+extern inline __attribute__((gnu_inline))
+int foo (int x)
+{
+ int i;
+ if (!__builtin_constant_p (x))
+ {
+#define B(n) baz (1##n) + baz (2##n) + baz (3##n) \
+ + baz (4##n) + baz (5##n) + baz (6##n)
+#define C(n) B(1##n) + B(2##n) + B(3##n) + B(4##n) + B(5##n) + B(6##n)
+#define D(n) C(1##n) + C(2##n) + C(3##n) + C(4##n) + C(5##n) + C(6##n)
+ return D(0) + D(1) + D(2) + D(3) + D(4)
+ + D(5) + D(6) + D(7) + D(8) + D(9);
+ }
+ return 0;
+}
+
+int
+main (void)
+{
+ return foo (0);
+}
diff --git a/gcc/testsuite/gcc.dg/nest.c b/gcc/testsuite/gcc.dg/nest.c
index 7178bd82045..5734c11f1a3 100644
--- a/gcc/testsuite/gcc.dg/nest.c
+++ b/gcc/testsuite/gcc.dg/nest.c
@@ -24,3 +24,5 @@ int main (void)
abort ();
return 0;
}
+
+/* { dg-final { cleanup-profile-file } } */
diff --git a/gcc/testsuite/gcc.dg/nested-func-4.c b/gcc/testsuite/gcc.dg/nested-func-4.c
index 30826d885a6..36a8c405ce2 100644
--- a/gcc/testsuite/gcc.dg/nested-func-4.c
+++ b/gcc/testsuite/gcc.dg/nested-func-4.c
@@ -21,3 +21,5 @@ int main(void)
foo (2);
return 0;
}
+
+/* { dg-final { cleanup-profile-file } } */
diff --git a/gcc/testsuite/gcc.dg/pr30744-1.c b/gcc/testsuite/gcc.dg/pr30744-1.c
index f0734db60f2..a35c5526aa1 100644
--- a/gcc/testsuite/gcc.dg/pr30744-1.c
+++ b/gcc/testsuite/gcc.dg/pr30744-1.c
@@ -1,15 +1,16 @@
/* { dg-do compile } */
/* { dg-options "-O2" } */
+#include <stddef.h>
typedef struct {
- unsigned long unique;
+ ptrdiff_t unique;
} G;
void r(G* n)
{
- unsigned long p;
- if (((G *) ((void *)((~(unsigned long)(p))))) != ((void *)0)) {
- ((G *) ((void *)((~(unsigned long)(p)))))->unique = n->unique;
+ ptrdiff_t p;
+ if (((G *) ((void *)((~(ptrdiff_t)(p))))) != ((void *)0)) {
+ ((G *) ((void *)((~(ptrdiff_t)(p)))))->unique = n->unique;
}
}
diff --git a/gcc/testsuite/gcc.dg/pr32328.c b/gcc/testsuite/gcc.dg/pr32328.c
new file mode 100644
index 00000000000..69b08fc4fdf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr32328.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+struct barstruct { char const* some_string; };
+
+void changethepointer(struct barstruct**);
+
+void baz()
+{
+ struct barstruct bar1;
+ struct barstruct* barptr = &bar1;
+ changethepointer(&barptr);
+ barptr->some_string = "Everything OK";
+}
+
+/* { dg-final { scan-tree-dump "Everything OK" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/pr32370.c b/gcc/testsuite/gcc.dg/pr32370.c
new file mode 100644
index 00000000000..18afde21f0f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr32370.c
@@ -0,0 +1,24 @@
+/* PR middle-end/32370 */
+/* { dg-do compile { target i?86-*-* x86_64-*-* ia64-*-* } } */
+/* { dg-options "" { target ia64-*-* } } */
+/* { dg-options "-ffixed-esi" { target i?86-*-* x86_64-*-* } } */
+
+#if defined __i386__ || defined __x86_64__
+# define C "=S"
+#elif defined __ia64__
+# define C "=a"
+#endif
+
+unsigned int
+foo (unsigned long port)
+{
+ unsigned int v;
+ __asm__ __volatile__ ("" : C (v) : "Nd" (port)); /* { dg-error "while reloading\|has impossible" } */
+ return v;
+}
+
+void
+bar (void)
+{
+ foo (0);
+}
diff --git a/gcc/testsuite/gcc.dg/pr32450.c b/gcc/testsuite/gcc.dg/pr32450.c
index 4a1842e9b84..9606e3021ea 100644
--- a/gcc/testsuite/gcc.dg/pr32450.c
+++ b/gcc/testsuite/gcc.dg/pr32450.c
@@ -32,3 +32,5 @@ int main ()
add ();
return stack_pointer - 1;
}
+
+/* { dg-final { cleanup-profile-file } } */
diff --git a/gcc/testsuite/gcc.dg/pr32573.c b/gcc/testsuite/gcc.dg/pr32573.c
new file mode 100644
index 00000000000..d6897fbc22f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr32573.c
@@ -0,0 +1,30 @@
+/* PR tree-optimization/32573 */
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+int
+foo (void *x, long long *y)
+{
+ char a[256];
+ int i = 0;
+ long long b;
+ int c;
+ int d = 0;
+ int e = 0;
+ unsigned f = 0;
+ b = bar (x);
+ c = (unsigned) b;
+ while (d < b && d < 65557)
+ {
+ f = *(unsigned *) &a[0];
+ for (i = c - 4; i > 0; i--)
+ if (a[i + 0] == 0x50
+ && a[i + 1] == 0x4B
+ && a[i + 3] == 0x06)
+ {
+ e = 1;
+ break;
+ }
+ }
+ return !e;
+}
diff --git a/gcc/testsuite/gcc.dg/pr32721.c b/gcc/testsuite/gcc.dg/pr32721.c
index 392937ebbf6..bd67c79521e 100644
--- a/gcc/testsuite/gcc.dg/pr32721.c
+++ b/gcc/testsuite/gcc.dg/pr32721.c
@@ -14,5 +14,5 @@ spinlock1 = &spinlock[1];
while (*spinlock0);
}
-/* { dg-final { scan-tree-dump "= spinlock.0." "optimized" } } */
+/* { dg-final { scan-tree-dump "={v} spinlock.0." "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/pragma-isr-trap_exit.c b/gcc/testsuite/gcc.dg/pragma-isr-trap_exit.c
index 9b3233a36b5..00a0608ccb4 100644
--- a/gcc/testsuite/gcc.dg/pragma-isr-trap_exit.c
+++ b/gcc/testsuite/gcc.dg/pragma-isr-trap_exit.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target sh-*-* sh[1234ble]*-*-*} } */
+/* { dg-do compile { target sh-*-* sh[1234ble]*-*-* } } */
/* { dg-options "-O" } */
/* This test case will check whether trapa is generated only for isr. */
#pragma interrupt
diff --git a/gcc/testsuite/gcc.dg/pragma-isr.c b/gcc/testsuite/gcc.dg/pragma-isr.c
index 07d8fa7f1f9..e7565a68245 100644
--- a/gcc/testsuite/gcc.dg/pragma-isr.c
+++ b/gcc/testsuite/gcc.dg/pragma-isr.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target h8300-*-* sh-*-* sh[1234ble]*-*-*} } */
+/* { dg-do compile { target h8300-*-* sh-*-* sh[1234ble]*-*-* } } */
/* { dg-options "-O3" } */
/* Test case will check whether rte is generated for two ISRs*/
extern void foo();
diff --git a/gcc/testsuite/gcc.dg/pragma-isr2.c b/gcc/testsuite/gcc.dg/pragma-isr2.c
index 7dba7f9bf61..3e2e4bb38ba 100644
--- a/gcc/testsuite/gcc.dg/pragma-isr2.c
+++ b/gcc/testsuite/gcc.dg/pragma-isr2.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target h8300-*-* sh-*-* sh[1234ble]*-*-*} } */
+/* { dg-do compile { target h8300-*-* sh-*-* sh[1234ble]*-*-* } } */
/* { dg-options "-O" } */
/* This test case will check whether rte is generated only for isr. */
#pragma interrupt
diff --git a/gcc/testsuite/gcc.dg/sibcall-6.c b/gcc/testsuite/gcc.dg/sibcall-6.c
index ca26400ba33..f57f9c43781 100644
--- a/gcc/testsuite/gcc.dg/sibcall-6.c
+++ b/gcc/testsuite/gcc.dg/sibcall-6.c
@@ -6,8 +6,8 @@
Copyright (C) 2002 Free Software Foundation Inc.
Contributed by Andreas Bauer <baueran@in.tum.de> */
-/* { dg-do run { target i?86-*-* s390*-*-* x86_64-*-*} } */
-/* { dg-skip-if "" { { i?86-*-* x86_64-*-* } && ilp32 } { "-fpic" "-fPIC" } { "" } } */
+/* { dg-do run { target i?86-*-* x86_64-*-* s390*-*-* } } */
+/* { dg-skip-if "" { { i?86-*-* x86_64-*-* } && { ilp32 && fpic } } { "*" } { "" } } */
/* { dg-options "-O2 -foptimize-sibling-calls" } */
extern void abort (void);
diff --git a/gcc/testsuite/gcc.dg/sms-1.c b/gcc/testsuite/gcc.dg/sms-1.c
new file mode 100644
index 00000000000..d915ef54f2b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/sms-1.c
@@ -0,0 +1,38 @@
+/* The same test as loop-3c.c. It failed on ia64
+ due to not handling of subreg in the lhs that is fixed. */
+/* { dg-do run } */
+/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -w" } */
+
+
+#include <limits.h>
+
+void * a[255];
+
+f (m)
+{
+ int i;
+ int sh = 0x100;
+ i = m;
+ do
+ {
+ a[sh >>= 1] = ((unsigned)i << 3) + (char*)a;
+ i += 4;
+ }
+ while (i < INT_MAX/2 + 1 + 4 * 4);
+}
+
+main ()
+{
+ a[0x10] = 0;
+ a[0x08] = 0;
+ f (INT_MAX/2 + INT_MAX/4 + 2);
+ if (a[0x10] || a[0x08])
+ abort ();
+ a[0x10] = 0;
+ a[0x08] = 0;
+ f (INT_MAX/2 + 1);
+ if (! a[0x10] || a[0x08])
+ abort ();
+ exit (0);
+}
+
diff --git a/gcc/testsuite/gcc.dg/sync-2.c b/gcc/testsuite/gcc.dg/sync-2.c
index c82d66521ca..9849a705e27 100644
--- a/gcc/testsuite/gcc.dg/sync-2.c
+++ b/gcc/testsuite/gcc.dg/sync-2.c
@@ -8,7 +8,11 @@
extern void abort (void);
extern void *memcpy (void *, const void *, __SIZE_TYPE__);
-static char AI[18];
+#ifndef AI_ALIGN
+#define AI_ALIGN
+#endif
+
+static char AI[18] AI_ALIGN;
static char init_qi[18] = { 3,5,7,9,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0 };
static char test_qi[18] = { 3,5,7,9,1,4,22,-12,7,8,9,7,1,-12,7,8,9,7 };
diff --git a/gcc/testsuite/gcc.dg/sync-3.c b/gcc/testsuite/gcc.dg/sync-3.c
new file mode 100644
index 00000000000..bf8abb785de
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/sync-3.c
@@ -0,0 +1,10 @@
+/* { dg-do run } */
+/* { dg-require-effective-target sync_char_short } */
+/* { dg-options "-O2" } */
+/* { dg-options "-march=i486 -O2" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-options "-mcpu=v9 -O2" { target sparc*-*-* } } */
+
+/* Test functionality of the intrinsics for 'short' and 'char'. */
+
+#define AI_ALIGN __attribute__((__aligned__ (4)))
+#include "sync-2.c"
diff --git a/gcc/testsuite/gcc.dg/tls/opt-5.c b/gcc/testsuite/gcc.dg/tls/opt-5.c
index d8a686ddb46..ee71cad3c02 100644
--- a/gcc/testsuite/gcc.dg/tls/opt-5.c
+++ b/gcc/testsuite/gcc.dg/tls/opt-5.c
@@ -34,12 +34,12 @@ __gen_tempname (char *tmpl, int kind)
char *XXXXXX;
static uint64_t value;
uint64_t random_time_bits;
- unsigned int count;
+ unsigned long count;
int fd = -1;
int save_errno = __libc_errno;
struct stat64 st;
- unsigned int attempts_min = 62 * 62 * 62;
- unsigned int attempts = attempts_min < 238328 ? 238328 : attempts_min;
+ unsigned long attempts_min = 62L * 62L * 62L;
+ unsigned long attempts = attempts_min < 238328 ? 238328 : attempts_min;
len = strlen (tmpl);
if (len < 6 || strcmp(&tmpl[len - 6], "XXXXXX"))
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-1.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-1.c
index 5ad257b10c7..b08e1242bb8 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-1.c
@@ -32,7 +32,7 @@ void test (void)
/* { dg-final { scan-tree-dump "vi0.*fwrite.*\"hello\".*1, 5, fp.*vi1" "fab"} } */
/* { dg-final { scan-tree-dump "vi1.*fwrite.*\"hello\\\\n\".*1, 6, fp.*vi2" "fab"} } */
/* { dg-final { scan-tree-dump "vi2.*fputc.*fp.*vi3" "fab"} } */
-/* { dg-final { scan-tree-dump "vi3 = 0\[^\(\)\]*vi4 = 0" "fab"} } */
+/* { dg-final { scan-tree-dump "vi3 ={v} 0\[^\(\)\]*vi4 ={v} 0" "fab"} } */
/* { dg-final { scan-tree-dump "vi4.*fwrite.*\"hello\".*1, 5, fp.*vi5" "fab"} } */
/* { dg-final { scan-tree-dump "vi5.*fwrite.*\"hello\\\\n\".*1, 6, fp.*vi6" "fab"} } */
/* { dg-final { scan-tree-dump "vi6.*fputc.*fp.*vi7" "fab"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-chk-1.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-chk-1.c
index f55a78d00ea..93e38cb9a5f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-chk-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-fprintf-chk-1.c
@@ -32,7 +32,7 @@ void test (void)
/* { dg-final { scan-tree-dump "vi0.*fwrite.*\"hello\".*1, 5, fp.*vi1" "fab"} } */
/* { dg-final { scan-tree-dump "vi1.*fwrite.*\"hello\\\\n\".*1, 6, fp.*vi2" "fab"} } */
/* { dg-final { scan-tree-dump "vi2.*fputc.*fp.*vi3" "fab"} } */
-/* { dg-final { scan-tree-dump "vi3 = 0\[^\(\)\]*vi4 = 0" "fab"} } */
+/* { dg-final { scan-tree-dump "vi3 ={v} 0\[^\(\)\]*vi4 ={v} 0" "fab"} } */
/* { dg-final { scan-tree-dump "vi4.*fwrite.*\"hello\".*1, 5, fp.*vi5" "fab"} } */
/* { dg-final { scan-tree-dump "vi5.*fwrite.*\"hello\\\\n\".*1, 6, fp.*vi6" "fab"} } */
/* { dg-final { scan-tree-dump "vi6.*fputc.*fp.*vi7" "fab"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-1.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-1.c
index 07be245ff3f..a78d0880cf3 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-1.c
@@ -32,11 +32,11 @@ void test (void)
/* { dg-final { scan-tree-dump "vi0.*printf.*\"hello\".*vi1" "fab"} } */
/* { dg-final { scan-tree-dump "vi1.*puts.*\"hello\".*vi2" "fab"} } */
/* { dg-final { scan-tree-dump "vi2.*putchar.*vi3" "fab"} } */
-/* { dg-final { scan-tree-dump "vi3 = 0\[^\(\)\]*vi4 = 0" "fab"} } */
+/* { dg-final { scan-tree-dump "vi3 ={v} 0\[^\(\)\]*vi4 ={v} 0" "fab"} } */
/* { dg-final { scan-tree-dump "vi4.*printf.*\"hello\".*vi5" "fab"} } */
/* { dg-final { scan-tree-dump "vi5.*puts.*\"hello\".*vi6" "fab"} } */
/* { dg-final { scan-tree-dump "vi6.*putchar.*vi7" "fab"} } */
-/* { dg-final { scan-tree-dump "vi7 = 0\[^\(\)\]*vi8 = 0" "fab"} } */
+/* { dg-final { scan-tree-dump "vi7 ={v} 0\[^\(\)\]*vi8 ={v} 0" "fab"} } */
/* { dg-final { scan-tree-dump "vi8.*putchar.*vi9" "fab"} } */
/* { dg-final { scan-tree-dump "vi9.*puts.*\"hello\\\\n\".*via" "fab"} } */
/* { dg-final { cleanup-tree-dump "fab" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-chk-1.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-chk-1.c
index f4d75b3c369..2f85b28ed7a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-chk-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-printf-chk-1.c
@@ -32,11 +32,11 @@ void test (void)
/* { dg-final { scan-tree-dump "vi0.*__printf_chk.*1.*\"hello\".*vi1" "fab"} } */
/* { dg-final { scan-tree-dump "vi1.*puts.*\"hello\".*vi2" "fab"} } */
/* { dg-final { scan-tree-dump "vi2.*putchar.*vi3" "fab"} } */
-/* { dg-final { scan-tree-dump "vi3 = 0\[^\(\)\]*vi4 = 0" "fab"} } */
+/* { dg-final { scan-tree-dump "vi3 ={v} 0\[^\(\)\]*vi4 ={v} 0" "fab"} } */
/* { dg-final { scan-tree-dump "vi4.*__printf_chk.*1.*\"hello\".*vi5" "fab"} } */
/* { dg-final { scan-tree-dump "vi5.*puts.*\"hello\".*vi6" "fab"} } */
/* { dg-final { scan-tree-dump "vi6.*putchar.*vi7" "fab"} } */
-/* { dg-final { scan-tree-dump "vi7 = 0\[^\(\)\]*vi8 = 0" "fab"} } */
+/* { dg-final { scan-tree-dump "vi7 ={v} 0\[^\(\)\]*vi8 ={v} 0" "fab"} } */
/* { dg-final { scan-tree-dump "vi8.*putchar.*vi9" "fab"} } */
/* { dg-final { scan-tree-dump "vi9.*puts.*\"hello\\\\n\".*via" "fab"} } */
/* { dg-final { cleanup-tree-dump "fab" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-vfprintf-1.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-vfprintf-1.c
index 3a48e78da5a..1083f13bc32 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-vfprintf-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-vfprintf-1.c
@@ -32,7 +32,7 @@ test (va_list ap1, va_list ap2, va_list ap3, va_list ap4, va_list ap5,
/* { dg-final { scan-tree-dump "vi0.*fwrite.*\"hello\".*1, 5, fp.*vi1" "fab"} } */
/* { dg-final { scan-tree-dump "vi1.*fwrite.*\"hello\\\\n\".*1, 6, fp.*vi2" "fab"} } */
/* { dg-final { scan-tree-dump "vi2.*fputc.*fp.*vi3" "fab"} } */
-/* { dg-final { scan-tree-dump "vi3 = 0\[^\(\)\]*vi4 = 0" "fab"} } */
+/* { dg-final { scan-tree-dump "vi3 ={v} 0\[^\(\)\]*vi4 ={v} 0" "fab"} } */
/* { dg-final { scan-tree-dump "vi4.*vfprintf.*\"%s\".*vi5" "fab"} } */
/* { dg-final { scan-tree-dump "vi5.*vfprintf.*\"%c\".*vi6" "fab"} } */
/* { dg-final { scan-tree-dump "vi6.*vfprintf.*\"%s\\\\n\".*vi7" "fab"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c
index 9b9956174be..ce767d1a13a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-vfprintf-chk-1.c
@@ -32,7 +32,7 @@ test (va_list ap1, va_list ap2, va_list ap3, va_list ap4, va_list ap5,
/* { dg-final { scan-tree-dump "vi0.*fwrite.*\"hello\".*1, 5, fp.*vi1" "fab"} } */
/* { dg-final { scan-tree-dump "vi1.*fwrite.*\"hello\\\\n\".*1, 6, fp.*vi2" "fab"} } */
/* { dg-final { scan-tree-dump "vi2.*fputc.*fp.*vi3" "fab"} } */
-/* { dg-final { scan-tree-dump "vi3 = 0\[^\(\)\]*vi4 = 0" "fab"} } */
+/* { dg-final { scan-tree-dump "vi3 ={v} 0\[^\(\)\]*vi4 ={v} 0" "fab"} } */
/* { dg-final { scan-tree-dump "vi4.*__vfprintf_chk.*fp.*1.*\"%s\".*vi5" "fab"} } */
/* { dg-final { scan-tree-dump "vi5.*__vfprintf_chk.*fp.*1.*\"%c\".*vi6" "fab"} } */
/* { dg-final { scan-tree-dump "vi6.*__vfprintf_chk.*fp.*1.*\"%s\\\\n\".*vi7" "fab"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-vprintf-1.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-vprintf-1.c
index 5dea91618b9..416ee5b54ef 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-vprintf-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-vprintf-1.c
@@ -30,7 +30,7 @@ test (va_list ap1, va_list ap2, va_list ap3, va_list ap4, va_list ap5,
/* { dg-final { scan-tree-dump "vi0.*vprintf.*\"hello\".*vi1" "fab"} } */
/* { dg-final { scan-tree-dump "vi1.*puts.*\"hello\".*vi2" "fab"} } */
/* { dg-final { scan-tree-dump "vi2.*putchar.*vi3" "fab"} } */
-/* { dg-final { scan-tree-dump "vi3 = 0\[^\(\)\]*vi4 = 0" "fab"} } */
+/* { dg-final { scan-tree-dump "vi3 ={v} 0\[^\(\)\]*vi4 ={v} 0" "fab"} } */
/* { dg-final { scan-tree-dump "vi4.*vprintf.*\"%s\".*vi5" "fab"} } */
/* { dg-final { scan-tree-dump "vi5.*vprintf.*\"%c\".*vi6" "fab"} } */
/* { dg-final { scan-tree-dump "vi6.*vprintf.*\"%s\\\\n\".*vi7" "fab"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-vprintf-chk-1.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-vprintf-chk-1.c
index c3ccbfa08cf..567a3dfd114 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-vprintf-chk-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-vprintf-chk-1.c
@@ -30,7 +30,7 @@ test (va_list ap1, va_list ap2, va_list ap3, va_list ap4, va_list ap5,
/* { dg-final { scan-tree-dump "vi0.*__vprintf_chk.*1.*\"hello\".*vi1" "fab"} } */
/* { dg-final { scan-tree-dump "vi1.*puts.*\"hello\".*vi2" "fab"} } */
/* { dg-final { scan-tree-dump "vi2.*putchar.*vi3" "fab"} } */
-/* { dg-final { scan-tree-dump "vi3 = 0\[^\(\)\]*vi4 = 0" "fab"} } */
+/* { dg-final { scan-tree-dump "vi3 ={v} 0\[^\(\)\]*vi4 ={v} 0" "fab"} } */
/* { dg-final { scan-tree-dump "vi4.*__vprintf_chk.*1.*\"%s\".*vi5" "fab"} } */
/* { dg-final { scan-tree-dump "vi5.*__vprintf_chk.*1.*\"%c\".*vi6" "fab"} } */
/* { dg-final { scan-tree-dump "vi6.*__vprintf_chk.*1.*\"%s\\\\n\".*vi7" "fab"} } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-1.c b/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-1.c
index 2c040278436..a92498eb1f6 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/foldaddr-1.c
@@ -1,11 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-original" } */
-
+#include <stddef.h>
char *a;
int foo(char *b)
{
- return a+5+(long)b == (long)b+a;
+ return a+5+(ptrdiff_t)b == (ptrdiff_t)b+a;
}
/* Folding should have determined that the two addresses were
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loadpre6.c b/gcc/testsuite/gcc.dg/tree-ssa/loadpre6.c
index 28a71a8e63f..725f86b192f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/loadpre6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loadpre6.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-pre-stats" } */
+#include <stddef.h>
union tree_node;
typedef union tree_node *tree;
@@ -63,7 +64,7 @@ main (void)
for (i = 0; i < 2; i++)
{
unexpanded_var_list = malloc (sizeof (struct tree_list));
- unexpanded_var_list->list.value = (tree) (long unsigned) (i & 1);
+ unexpanded_var_list->list.value = (tree) (ptrdiff_t) (i & 1);
unexpanded_var_list->common.chain = last;
last = unexpanded_var_list;
}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr26421.c b/gcc/testsuite/gcc.dg/tree-ssa/pr26421.c
index d2d99baf0a1..ef5bc6a5341 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr26421.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr26421.c
@@ -16,5 +16,5 @@ int foo(void)
return a.i;
}
-/* { dg-final { scan-tree-dump-times "VDEF" 2 "salias" } } */
+/* { dg-final { scan-tree-dump-times "VDEF" 4 "salias" } } */
/* { dg-final { cleanup-tree-dump "salias" } } */
diff --git a/gcc/testsuite/gcc.dg/unsigned-long-compare.c b/gcc/testsuite/gcc.dg/unsigned-long-compare.c
index 1c5c69cf038..74e7638f1ce 100644
--- a/gcc/testsuite/gcc.dg/unsigned-long-compare.c
+++ b/gcc/testsuite/gcc.dg/unsigned-long-compare.c
@@ -6,7 +6,7 @@
expansion emits a function whose return is unbiased and needs
adjustment. */
/* Origin: Carlos O'Donell <carlos@codesourcery.com> */
-/* { dg-do run { target arm-*-*eabi* } } */
+/* { dg-do run } */
/* { dg-options "" } */
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.dg/20051215-1.c b/gcc/testsuite/gcc.target/arm/20051215-1.c
index 0bb06d9be3e..0bb06d9be3e 100644
--- a/gcc/testsuite/gcc.dg/20051215-1.c
+++ b/gcc/testsuite/gcc.target/arm/20051215-1.c
diff --git a/gcc/testsuite/gcc.dg/arm-eabi1.c b/gcc/testsuite/gcc.target/arm/eabi1.c
index 06af6710299..06af6710299 100644
--- a/gcc/testsuite/gcc.dg/arm-eabi1.c
+++ b/gcc/testsuite/gcc.target/arm/eabi1.c
diff --git a/gcc/testsuite/gcc.dg/symbian1.c b/gcc/testsuite/gcc.target/arm/symbian1.c
index 25e81281683..25e81281683 100644
--- a/gcc/testsuite/gcc.dg/symbian1.c
+++ b/gcc/testsuite/gcc.target/arm/symbian1.c
diff --git a/gcc/testsuite/gcc.dg/symbian2.c b/gcc/testsuite/gcc.target/arm/symbian2.c
index 98701636875..98701636875 100644
--- a/gcc/testsuite/gcc.dg/symbian2.c
+++ b/gcc/testsuite/gcc.target/arm/symbian2.c
diff --git a/gcc/testsuite/gcc.dg/symbian3.c b/gcc/testsuite/gcc.target/arm/symbian3.c
index 2f11d355b4d..2f11d355b4d 100644
--- a/gcc/testsuite/gcc.dg/symbian3.c
+++ b/gcc/testsuite/gcc.target/arm/symbian3.c
diff --git a/gcc/testsuite/gcc.dg/symbian4.c b/gcc/testsuite/gcc.target/arm/symbian4.c
index aede7f5c66c..aede7f5c66c 100644
--- a/gcc/testsuite/gcc.dg/symbian4.c
+++ b/gcc/testsuite/gcc.target/arm/symbian4.c
diff --git a/gcc/testsuite/gcc.dg/symbian5.c b/gcc/testsuite/gcc.target/arm/symbian5.c
index 0bde6b0cba3..0bde6b0cba3 100644
--- a/gcc/testsuite/gcc.dg/symbian5.c
+++ b/gcc/testsuite/gcc.target/arm/symbian5.c
diff --git a/gcc/testsuite/gcc.dg/bfin-longcall-1.c b/gcc/testsuite/gcc.target/bfin/longcall-1.c
index 138707e9e3f..138707e9e3f 100644
--- a/gcc/testsuite/gcc.dg/bfin-longcall-1.c
+++ b/gcc/testsuite/gcc.target/bfin/longcall-1.c
diff --git a/gcc/testsuite/gcc.dg/bfin-longcall-2.c b/gcc/testsuite/gcc.target/bfin/longcall-2.c
index 33189b01fd6..33189b01fd6 100644
--- a/gcc/testsuite/gcc.dg/bfin-longcall-2.c
+++ b/gcc/testsuite/gcc.target/bfin/longcall-2.c
diff --git a/gcc/testsuite/gcc.dg/20011127-1.c b/gcc/testsuite/gcc.target/cris/20011127-1.c
index ab781241a6d..ab781241a6d 100644
--- a/gcc/testsuite/gcc.dg/20011127-1.c
+++ b/gcc/testsuite/gcc.target/cris/20011127-1.c
diff --git a/gcc/testsuite/gcc.dg/asmreg-1.c b/gcc/testsuite/gcc.target/cris/asmreg-1.c
index 85827e9a9a3..85827e9a9a3 100644
--- a/gcc/testsuite/gcc.dg/asmreg-1.c
+++ b/gcc/testsuite/gcc.target/cris/asmreg-1.c
diff --git a/gcc/testsuite/gcc.dg/cris-peep2-andu1.c b/gcc/testsuite/gcc.target/cris/peep2-andu1.c
index 2e546e6256d..2e546e6256d 100644
--- a/gcc/testsuite/gcc.dg/cris-peep2-andu1.c
+++ b/gcc/testsuite/gcc.target/cris/peep2-andu1.c
diff --git a/gcc/testsuite/gcc.dg/cris-peep2-andu2.c b/gcc/testsuite/gcc.target/cris/peep2-andu2.c
index 4f687cc081c..4f687cc081c 100644
--- a/gcc/testsuite/gcc.dg/cris-peep2-andu2.c
+++ b/gcc/testsuite/gcc.target/cris/peep2-andu2.c
diff --git a/gcc/testsuite/gcc.dg/cris-peep2-xsrand.c b/gcc/testsuite/gcc.target/cris/peep2-xsrand.c
index 9cfe40fb6e1..9cfe40fb6e1 100644
--- a/gcc/testsuite/gcc.dg/cris-peep2-xsrand.c
+++ b/gcc/testsuite/gcc.target/cris/peep2-xsrand.c
diff --git a/gcc/testsuite/gcc.dg/cris-peep2-xsrand2.c b/gcc/testsuite/gcc.target/cris/peep2-xsrand2.c
index 30679b271cb..30679b271cb 100644
--- a/gcc/testsuite/gcc.dg/cris-peep2-xsrand2.c
+++ b/gcc/testsuite/gcc.target/cris/peep2-xsrand2.c
diff --git a/gcc/testsuite/gcc.target/i386/20011119-1.c b/gcc/testsuite/gcc.target/i386/20011119-1.c
index 6b815b05532..4dd657ef7fc 100644
--- a/gcc/testsuite/gcc.target/i386/20011119-1.c
+++ b/gcc/testsuite/gcc.target/i386/20011119-1.c
@@ -1,9 +1,7 @@
/* Test for reload failing to eliminate from argp to sp. */
/* { dg-do run } */
/* { dg-require-effective-target ilp32 } */
-/* { dg-require-effective-target fpic } */
-/* { dg-skip-if "" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */
-/* { dg-skip-if "PIC default" { "*-*-darwin*" } { "*" } { "" } } */
+/* { dg-require-effective-target nonpic } */
/* { dg-options "-O2 -fomit-frame-pointer" } */
static int ustrsize (const char *s);
diff --git a/gcc/testsuite/gcc.target/i386/20020523-1.c b/gcc/testsuite/gcc.target/i386/20020523-1.c
index c2ada6c50a1..0fb7edc7a76 100644
--- a/gcc/testsuite/gcc.target/i386/20020523-1.c
+++ b/gcc/testsuite/gcc.target/i386/20020523-1.c
@@ -1,10 +1,10 @@
/* PR target/6753
This testcase was miscompiled because sse_mov?fcc_const0*
patterns were missing earlyclobber. */
+
/* { dg-do run } */
-/* { dg-skip-if "" { ilp32 } { "-fpic" "-fPIC" } { "" } } */
-/* { dg-skip-if "PIC default" { *-*-darwin* } { "*" } { "" } } */
/* { dg-require-effective-target ilp32 } */
+/* { dg-require-effective-target nonpic } */
/* { dg-options "-march=pentium3 -msse -ffast-math -O2" } */
extern void abort (void);
diff --git a/gcc/testsuite/gcc.target/i386/asm-3.c b/gcc/testsuite/gcc.target/i386/asm-3.c
index b687c3851c5..be44e1d2359 100644
--- a/gcc/testsuite/gcc.target/i386/asm-3.c
+++ b/gcc/testsuite/gcc.target/i386/asm-3.c
@@ -1,8 +1,7 @@
/* PR inline-asm/6806 */
/* { dg-do run } */
-/* { dg-options "-O2" } */
/* { dg-skip-if "" { ilp32 } { "-fpic" "-fPIC" } { "" } } */
-/* { dg-skip-if "PIC default" { *-*-darwin* } { "*" } { "" } } */
+/* { dg-options "-O2" } */
extern void abort (void);
diff --git a/gcc/testsuite/gcc.target/i386/cmov3.c b/gcc/testsuite/gcc.target/i386/cmov3.c
index 30a5d1a0fa8..34df0aab7e4 100644
--- a/gcc/testsuite/gcc.target/i386/cmov3.c
+++ b/gcc/testsuite/gcc.target/i386/cmov3.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -march=k8" } */
-/* { dg-final { scan-assembler "cmov" } } */
+/* { dg-final { scan-assembler "cmov\[^3\]" } } */
/* This conditional move is fastest to be done using cmov. */
t(int a, int b)
diff --git a/gcc/testsuite/gcc.target/i386/cmov4.c b/gcc/testsuite/gcc.target/i386/cmov4.c
index f25313812f1..6a955eaebfd 100644
--- a/gcc/testsuite/gcc.target/i386/cmov4.c
+++ b/gcc/testsuite/gcc.target/i386/cmov4.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -march=k8" } */
-/* { dg-final { scan-assembler "cmov" } } */
+/* { dg-final { scan-assembler "cmov\[^4\]" } } */
/* Verify that if conversion happends for memory references. */
int ARCHnodes;
diff --git a/gcc/testsuite/gcc.dg/i386-darwin-fpmath.c b/gcc/testsuite/gcc.target/i386/darwin-fpmath.c
index 7db69467089..7db69467089 100644
--- a/gcc/testsuite/gcc.dg/i386-darwin-fpmath.c
+++ b/gcc/testsuite/gcc.target/i386/darwin-fpmath.c
diff --git a/gcc/testsuite/gcc.target/i386/fastcall-1.c b/gcc/testsuite/gcc.target/i386/fastcall-1.c
index c286ed3aec7..f60e68010b9 100644
--- a/gcc/testsuite/gcc.target/i386/fastcall-1.c
+++ b/gcc/testsuite/gcc.target/i386/fastcall-1.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target i386-pc-mingw32* i386-pc-cygwin* } } */
+/* { dg-do compile { target i?86-*-mingw32* i?86-*-cygwin* } } */
void
__attribute__ ((fastcall))
diff --git a/gcc/testsuite/gcc.target/i386/local2.c b/gcc/testsuite/gcc.target/i386/local2.c
index 23cd37cef7f..b6d960cbc12 100644
--- a/gcc/testsuite/gcc.target/i386/local2.c
+++ b/gcc/testsuite/gcc.target/i386/local2.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-require-effective-target nonpic } */
/* { dg-options "-O2 -funit-at-a-time -fomit-frame-pointer" } */
-/* { dg-skip-if "PR 25214" { ilp32 } { "-fpic" "-fPIC" } { "" } } */
/* { dg-final { scan-assembler-not "sub\[^\\n\]*sp" } } */
static __attribute__ ((noinline)) q ();
diff --git a/gcc/testsuite/gcc.target/i386/pow-1.c b/gcc/testsuite/gcc.target/i386/pow-1.c
index 3bb3fe0a906..2e1ac61bd79 100644
--- a/gcc/testsuite/gcc.target/i386/pow-1.c
+++ b/gcc/testsuite/gcc.target/i386/pow-1.c
@@ -21,4 +21,4 @@ double test4 (double x)
return __builtin_pow (x, -5./2.);
}
-/* { dg-final { scan-assembler-not "call" } } */
+/* { dg-final { scan-assembler-not "call\[ \t\]*pow" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr17390.c b/gcc/testsuite/gcc.target/i386/pr17390.c
new file mode 100644
index 00000000000..3cf22e6d0bd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr17390.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-O2 -ffast-math" } */
+
+double sgn (double __x)
+{
+ return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0);
+}
+
+/* { dg-final { scan-assembler-times "fnstsw" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr32661.c b/gcc/testsuite/gcc.target/i386/pr32661.c
new file mode 100644
index 00000000000..247ae131923
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr32661.c
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+typedef int __v4si __attribute__ ((__vector_size__ (16)));
+typedef float __v4sf __attribute__ ((__vector_size__ (16)));
+
+int fooSI_1(__v4si *val)
+{
+ return __builtin_ia32_vec_ext_v4si(*val, 1);
+}
+/* { dg-final { scan-assembler-not "pshufd" } } */
+
+int fooSI_2(__v4si *val)
+{
+ return __builtin_ia32_vec_ext_v4si(*val, 2);
+}
+/* { dg-final { scan-assembler-not "punpckhdq" } } */
+
+float fooSF_2(__v4sf *val)
+{
+ return __builtin_ia32_vec_ext_v4sf(*val, 2);
+}
+/* { dg-final { scan-assembler-not "unpckhps" } } */
+
+float fooSF_3(__v4sf *val)
+{
+ return __builtin_ia32_vec_ext_v4sf(*val, 3);
+}
+/* { dg-final { scan-assembler-not "shufps" } } */
diff --git a/gcc/testsuite/gcc.target/i386/stack-prot-kernel.c b/gcc/testsuite/gcc.target/i386/stack-prot-kernel.c
index e994cfa6bc1..4a93e333cdd 100644
--- a/gcc/testsuite/gcc.target/i386/stack-prot-kernel.c
+++ b/gcc/testsuite/gcc.target/i386/stack-prot-kernel.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target lp64 } */
-/* { dg-skip-if "darwin x86_64 is pic" { *-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target nonpic } */
/* { dg-options "-O2 -fstack-protector-all -mcmodel=kernel" } */
void test1 (int x)
diff --git a/gcc/testsuite/gcc.target/i386/tailcall-1.c b/gcc/testsuite/gcc.target/i386/tailcall-1.c
index 0e8c2f3c58a..e6ae990a5c1 100644
--- a/gcc/testsuite/gcc.target/i386/tailcall-1.c
+++ b/gcc/testsuite/gcc.target/i386/tailcall-1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
-/* { dg-skip-if "" { { i?86-*-* x86_64-*-* } && ilp32 } { "-fpic" "-fPIC" } { "" } } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-require-effective-target nonpic } */
/* { dg-options "-O2" } */
typedef unsigned int Cardinal;
diff --git a/gcc/testsuite/gcc.target/i386/vectorize5.c b/gcc/testsuite/gcc.target/i386/vectorize5.c
new file mode 100644
index 00000000000..38942404535
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/vectorize5.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-O2 -ftree-vectorize -mveclibabi=acml -ffast-math" } */
+
+double x[256];
+
+extern double sin(double);
+
+void foo(void)
+{
+ int i;
+
+ for (i=0; i<256; ++i)
+ x[i] = sin(x[i]);
+}
+
+/* { dg-final { scan-assembler "__vrd2_sin" } } */
diff --git a/gcc/testsuite/gcc.target/i386/xchg-2.c b/gcc/testsuite/gcc.target/i386/xchg-2.c
index 0853d14c1e7..f00fb0f2115 100644
--- a/gcc/testsuite/gcc.target/i386/xchg-2.c
+++ b/gcc/testsuite/gcc.target/i386/xchg-2.c
@@ -6,4 +6,4 @@ unsigned short good(unsigned short a)
return (a >> 8 | a << 8);
}
-/* { dg-final { scan-assembler "xchg" } } */
+/* { dg-final { scan-assembler "xchgb" } } */
diff --git a/gcc/testsuite/gcc.target/i386/xorps-sse.c b/gcc/testsuite/gcc.target/i386/xorps-sse.c
new file mode 100644
index 00000000000..e9c0a2e7395
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/xorps-sse.c
@@ -0,0 +1,14 @@
+/* Test that we generate xorps instruction when pxor is not available. */
+/* { dg-do compile } */
+/* { dg-options "-O -msse -mno-sse2" } */
+/* { dg-final { scan-assembler "xorps\[ \t\]" } } */
+
+#define vector __attribute__ ((vector_size (16)))
+
+vector int i(vector int f)
+{
+ vector int g = { 0x80000000, 0, 0x80000000, 0 };
+ vector int f_int = (vector int) f;
+ return (f_int ^ g);
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/xorps-sse2.c b/gcc/testsuite/gcc.target/i386/xorps-sse2.c
new file mode 100644
index 00000000000..3c268b4cbaa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/xorps-sse2.c
@@ -0,0 +1,15 @@
+/* Test that we generate xorps when the result is used in FP math. */
+/* { dg-do compile } */
+/* { dg-options "-O -msse2 -mno-sse3" } */
+/* { dg-final { scan-assembler "xorps\[ \t\]" { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-not "pxor" { xfail *-*-* } } } */
+
+#define vector __attribute__ ((vector_size (16)))
+
+vector float i(vector float f, vector float h)
+{
+ vector int g = { 0x80000000, 0, 0x80000000, 0 };
+ vector int f_int = (vector int) f;
+ return ((vector float) (f_int ^ g)) + h;
+}
+
diff --git a/gcc/testsuite/gcc.target/m68k/interrupt-1.c b/gcc/testsuite/gcc.target/m68k/interrupt-1.c
new file mode 100644
index 00000000000..443c13b460e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/m68k/interrupt-1.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler "j(ra|mp)\[ \t\]*interrupt_sibcall" } } */
+/* { dg-final { scan-assembler "j(b|)sr\[ \t\]*interrupt_call" } } */
+/* { dg-final { scan-assembler "j(ra|mp)\[ \t\]*normal_sibcall" } } */
+
+void normal_sibcall (void);
+void interrupt_call (void);
+void __attribute ((interrupt)) interrupt_sibcall (void);
+
+void normal (void)
+{
+ normal_sibcall ();
+}
+
+void __attribute ((interrupt)) interrupt (void)
+{
+ interrupt_call ();
+}
+
+void __attribute ((interrupt)) interrupt_2 (void)
+{
+ interrupt_sibcall ();
+}
diff --git a/gcc/testsuite/gcc.dg/m68k-pic-1.c b/gcc/testsuite/gcc.target/m68k/pic-1.c
index b8d3fe81aea..b8d3fe81aea 100644
--- a/gcc/testsuite/gcc.dg/m68k-pic-1.c
+++ b/gcc/testsuite/gcc.target/m68k/pic-1.c
diff --git a/gcc/testsuite/gcc.dg/m68k-slp-ice.c b/gcc/testsuite/gcc.target/m68k/slp-ice.c
index 61c7f9df3c0..61c7f9df3c0 100644
--- a/gcc/testsuite/gcc.dg/m68k-slp-ice.c
+++ b/gcc/testsuite/gcc.target/m68k/slp-ice.c
diff --git a/gcc/testsuite/gcc.dg/20020620-1.c b/gcc/testsuite/gcc.target/mips/20020620-1.c
index ea6b9d5a74f..ea6b9d5a74f 100644
--- a/gcc/testsuite/gcc.dg/20020620-1.c
+++ b/gcc/testsuite/gcc.target/mips/20020620-1.c
diff --git a/gcc/testsuite/gcc.dg/const-compare.c b/gcc/testsuite/gcc.target/powerpc/const-compare.c
index c9e50cfbbbb..c9e50cfbbbb 100644
--- a/gcc/testsuite/gcc.dg/const-compare.c
+++ b/gcc/testsuite/gcc.target/powerpc/const-compare.c
diff --git a/gcc/testsuite/gcc.dg/rs6000-leaf.c b/gcc/testsuite/gcc.target/powerpc/leaf.c
index 079418930da..079418930da 100644
--- a/gcc/testsuite/gcc.dg/rs6000-leaf.c
+++ b/gcc/testsuite/gcc.target/powerpc/leaf.c
diff --git a/gcc/testsuite/gcc.dg/non-lazy-ptr-test.c b/gcc/testsuite/gcc.target/powerpc/non-lazy-ptr-test.c
index 10cce470ab3..10cce470ab3 100644
--- a/gcc/testsuite/gcc.dg/non-lazy-ptr-test.c
+++ b/gcc/testsuite/gcc.target/powerpc/non-lazy-ptr-test.c
diff --git a/gcc/testsuite/gcc.target/powerpc/ppu-intrinsics.c b/gcc/testsuite/gcc.target/powerpc/ppu-intrinsics.c
new file mode 100644
index 00000000000..9af38884fb6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/ppu-intrinsics.c
@@ -0,0 +1,36 @@
+/* { dg-do link { target *-*-linux* } } */
+/* { dg-options "-W -Wall -mcpu=cell" } */
+/* Test some PPU intrinsics from <ppu_intrinsics.h>. */
+
+#include <ppu_intrinsics.h>
+
+int main ()
+{
+ double d, d1, d2;
+ float f, f1, f2;
+ unsigned long long ull, a, b;
+ long long ll;
+ int i;
+
+#ifdef __powerpc64__
+ ull = __rldcl (a, b, 3);
+ ull = __rldcr (a, b, 3);
+ ull = __rldic (a, 3, 4);
+ ull = __rldicl (a, 4, 5);
+ ull = __rldicr (a, 2, 3);
+ ull = __rldimi (a, b, 4, 6);
+#endif
+ ull = __rlwimi (a, b, 6, 9, 12);
+ ull = __rlwnm (a, b, 3, 5);
+ d = __fmul (d1, d2);
+ f = __fmuls (f1, f2);
+ f = __frsp (f);
+ d = __fcfid (ll);
+ d = __frsqrte (d1);
+ ll = __fctid (d);
+ ll = __fctidz (d);
+ i = __fctiw (d);
+ i = __fctiwz (d);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/20020926-1.c b/gcc/testsuite/gcc.target/s390/20020926-1.c
index 7a8c716dcb2..07106a623a5 100644
--- a/gcc/testsuite/gcc.dg/20020926-1.c
+++ b/gcc/testsuite/gcc.target/s390/20020926-1.c
@@ -1,7 +1,7 @@
/* Make sure that LEGITIMIZE_ADDRESS is called to handle
negative displacements. */
-/* { dg-do compile { target s390-*-* } } */
+/* { dg-do compile } */
/* { dg-options "-O2 -mesa" } */
int test (int *addr)
diff --git a/gcc/testsuite/gcc.dg/20030123-1.c b/gcc/testsuite/gcc.target/s390/20030123-1.c
index 319e4526a4a..96ac6f76ced 100644
--- a/gcc/testsuite/gcc.dg/20030123-1.c
+++ b/gcc/testsuite/gcc.target/s390/20030123-1.c
@@ -1,6 +1,6 @@
/* This used to ICE due to a reload bug on s390*. */
-/* { dg-do compile { target s390*-*-* } } */
+/* { dg-do compile } */
/* { dg-options "-O2 -fno-omit-frame-pointer" } */
extern void *alloca (__SIZE_TYPE__);
diff --git a/gcc/testsuite/gcc.dg/20030129-1.c b/gcc/testsuite/gcc.target/s390/20030129-1.c
index 0b745a901b1..1cbd8b48297 100644
--- a/gcc/testsuite/gcc.dg/20030129-1.c
+++ b/gcc/testsuite/gcc.target/s390/20030129-1.c
@@ -1,6 +1,6 @@
/* This used to ICE due to a reload bug on s390*. */
-/* { dg-do compile { target s390*-*-* } } */
+/* { dg-do compile } */
/* { dg-options "-O2" } */
int f (unsigned int);
diff --git a/gcc/testsuite/gcc.dg/20040305-1.c b/gcc/testsuite/gcc.target/s390/20040305-1.c
index d2c4da4296f..a241f041c8f 100644
--- a/gcc/testsuite/gcc.dg/20040305-1.c
+++ b/gcc/testsuite/gcc.target/s390/20040305-1.c
@@ -5,7 +5,7 @@
reordering which leads to an insn with wrong alias info.
The scheduler afterwards exchanges the mvc and st instructions
not recognizing the anti dependence. */
-/* { dg-do run { target s390-*-* } } */
+/* { dg-do run } */
/* { dg-options "-O3 -mtune=z990 -fno-inline" } */
extern void exit (int);
diff --git a/gcc/testsuite/gcc.dg/20041109-1.c b/gcc/testsuite/gcc.target/s390/20041109-1.c
index 8b072339dd8..bf768439cd1 100644
--- a/gcc/testsuite/gcc.dg/20041109-1.c
+++ b/gcc/testsuite/gcc.target/s390/20041109-1.c
@@ -1,6 +1,6 @@
/* This used to ICE due to a literal pool handling bug on s390x. */
-/* { dg-do compile { target s390*-*-* } } */
+/* { dg-do compile } */
/* { dg-options "-O2 -fno-omit-frame-pointer" } */
static struct table { int x; } table[3];
diff --git a/gcc/testsuite/gcc.dg/20041216-1.c b/gcc/testsuite/gcc.target/s390/20041216-1.c
index 3f892a2e375..492ee6c182b 100644
--- a/gcc/testsuite/gcc.dg/20041216-1.c
+++ b/gcc/testsuite/gcc.target/s390/20041216-1.c
@@ -2,7 +2,7 @@
because stabs referred to an optimized-away literal pool
entry. */
-/* { dg-do run { target s390*-*-* } } */
+/* { dg-do run } */
/* { dg-options "-O2 -fno-omit-frame-pointer -gstabs" } */
int main (void)
diff --git a/gcc/testsuite/gcc.dg/20050409-1.c b/gcc/testsuite/gcc.target/s390/20050409-1.c
index be85f71a6b7..4763afad36e 100644
--- a/gcc/testsuite/gcc.dg/20050409-1.c
+++ b/gcc/testsuite/gcc.target/s390/20050409-1.c
@@ -1,6 +1,6 @@
/* This used to ICE due to a regmove problem on s390. */
-/* { dg-do compile { target s390*-*-* } } */
+/* { dg-do compile } */
/* { dg-options "-O2" } */
diff --git a/gcc/testsuite/gcc.dg/20050524-1.c b/gcc/testsuite/gcc.target/s390/20050524-1.c
index f15c51d628a..7b94fd0f065 100644
--- a/gcc/testsuite/gcc.dg/20050524-1.c
+++ b/gcc/testsuite/gcc.target/s390/20050524-1.c
@@ -1,7 +1,7 @@
/* This test case used to abort due to a reload bug with
elimination offsets. */
-/* { dg-do run { target s390*-*-* } } */
+/* { dg-do run } */
/* { dg-options "-O2 -mpacked-stack" } */
extern void abort (void);
diff --git a/gcc/testsuite/gcc.dg/20050824-1.c b/gcc/testsuite/gcc.target/s390/20050824-1.c
index 4df79fb6ae7..c24e1e26f2d 100644
--- a/gcc/testsuite/gcc.dg/20050824-1.c
+++ b/gcc/testsuite/gcc.target/s390/20050824-1.c
@@ -1,7 +1,7 @@
/* Make sure that the S/390 specific shift_count_operand
predicate work properly. */
-/* { dg-do compile { target s390*-*-* } } */
+/* { dg-do compile } */
/* { dg-options "-O3" } */
unsigned long long
diff --git a/gcc/testsuite/gcc.dg/pr20927.c b/gcc/testsuite/gcc.target/s390/pr20927.c
index 55cda33e8c4..dbc990f151f 100644
--- a/gcc/testsuite/gcc.dg/pr20927.c
+++ b/gcc/testsuite/gcc.target/s390/pr20927.c
@@ -1,6 +1,6 @@
/* This caused an ICE on s390x due to a reload inheritance bug. */
-/* { dg-do compile { target s390*-*-* } } */
+/* { dg-do compile } */
/* { dg-options "-O2" } */
struct point { double x, y; };
diff --git a/gcc/testsuite/gcc.dg/pr24624.c b/gcc/testsuite/gcc.target/s390/pr24624.c
index fbfab0a6742..bc2070c4b79 100644
--- a/gcc/testsuite/gcc.dg/pr24624.c
+++ b/gcc/testsuite/gcc.target/s390/pr24624.c
@@ -1,6 +1,6 @@
/* This used to ICE due to a backend problem on s390. */
-/* { dg-do compile { target s390*-*-* } } */
+/* { dg-do compile } */
/* { dg-options "-O1 -mpacked-stack" } */
typedef unsigned int __u32;
diff --git a/gcc/testsuite/gcc.dg/pr27661.c b/gcc/testsuite/gcc.target/s390/pr27661.c
index 7660c822fb9..1ff6dcc7cec 100644
--- a/gcc/testsuite/gcc.dg/pr27661.c
+++ b/gcc/testsuite/gcc.target/s390/pr27661.c
@@ -1,6 +1,6 @@
/* This used to ICE on s390 due to a reload bug. */
-/* { dg-do compile { target s390*-*-* } } */
+/* { dg-do compile } */
/* { dg-options "-O2 -march=z990 -ftracer" } */
extern int memcmp (const void *s1, const void *s2, unsigned long n);
diff --git a/gcc/testsuite/gcc.target/s390/s390.exp b/gcc/testsuite/gcc.target/s390/s390.exp
new file mode 100644
index 00000000000..d693309861e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/s390.exp
@@ -0,0 +1,41 @@
+# Copyright (C) 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Exit immediately if this isn't a s390 target.
+if ![istarget s390*-*-*] then {
+ return
+}
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
+ "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.dg/pr21255-1.c b/gcc/testsuite/gcc.target/sh/pr21255-1.c
index 5d5b6d7f9a6..5d5b6d7f9a6 100644
--- a/gcc/testsuite/gcc.dg/pr21255-1.c
+++ b/gcc/testsuite/gcc.target/sh/pr21255-1.c
diff --git a/gcc/testsuite/gcc.dg/pr21255-2-mb.c b/gcc/testsuite/gcc.target/sh/pr21255-2-mb.c
index ac2ce687e1e..ac2ce687e1e 100644
--- a/gcc/testsuite/gcc.dg/pr21255-2-mb.c
+++ b/gcc/testsuite/gcc.target/sh/pr21255-2-mb.c
diff --git a/gcc/testsuite/gcc.dg/pr21255-2-ml.c b/gcc/testsuite/gcc.target/sh/pr21255-2-ml.c
index c63a573ea9d..c63a573ea9d 100644
--- a/gcc/testsuite/gcc.dg/pr21255-2-ml.c
+++ b/gcc/testsuite/gcc.target/sh/pr21255-2-ml.c
diff --git a/gcc/testsuite/gcc.dg/pr21255-3.c b/gcc/testsuite/gcc.target/sh/pr21255-3.c
index 7edd8cb7c1c..7edd8cb7c1c 100644
--- a/gcc/testsuite/gcc.dg/pr21255-3.c
+++ b/gcc/testsuite/gcc.target/sh/pr21255-3.c
diff --git a/gcc/testsuite/gcc.dg/pr21255-4.c b/gcc/testsuite/gcc.target/sh/pr21255-4.c
index c848c26c0e7..c848c26c0e7 100644
--- a/gcc/testsuite/gcc.dg/pr21255-4.c
+++ b/gcc/testsuite/gcc.target/sh/pr21255-4.c
diff --git a/gcc/testsuite/gcc.dg/sh-relax-vxworks.c b/gcc/testsuite/gcc.target/sh/sh-relax-vxworks.c
index f8c2ffef431..f8c2ffef431 100644
--- a/gcc/testsuite/gcc.dg/sh-relax-vxworks.c
+++ b/gcc/testsuite/gcc.target/sh/sh-relax-vxworks.c
diff --git a/gcc/testsuite/gcc.dg/sh-relax.c b/gcc/testsuite/gcc.target/sh/sh-relax.c
index 54422de46d2..54422de46d2 100644
--- a/gcc/testsuite/gcc.dg/sh-relax.c
+++ b/gcc/testsuite/gcc.target/sh/sh-relax.c
diff --git a/gcc/testsuite/gcc.target/sh/sh.exp b/gcc/testsuite/gcc.target/sh/sh.exp
new file mode 100644
index 00000000000..9389d4455b2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sh/sh.exp
@@ -0,0 +1,41 @@
+# Copyright (C) 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Exit immediately if this isn't a sh target.
+if ![istarget sh*-*-*] then {
+ return
+}
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
+ "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.dg/sh4a-bitmovua.c b/gcc/testsuite/gcc.target/sh/sh4a-bitmovua.c
index b7081bf7186..b7081bf7186 100644
--- a/gcc/testsuite/gcc.dg/sh4a-bitmovua.c
+++ b/gcc/testsuite/gcc.target/sh/sh4a-bitmovua.c
diff --git a/gcc/testsuite/gcc.dg/sh4a-cos.c b/gcc/testsuite/gcc.target/sh/sh4a-cos.c
index 198d41f8675..198d41f8675 100644
--- a/gcc/testsuite/gcc.dg/sh4a-cos.c
+++ b/gcc/testsuite/gcc.target/sh/sh4a-cos.c
diff --git a/gcc/testsuite/gcc.dg/sh4a-cosf.c b/gcc/testsuite/gcc.target/sh/sh4a-cosf.c
index f78c140d501..f78c140d501 100644
--- a/gcc/testsuite/gcc.dg/sh4a-cosf.c
+++ b/gcc/testsuite/gcc.target/sh/sh4a-cosf.c
diff --git a/gcc/testsuite/gcc.dg/sh4a-fprun.c b/gcc/testsuite/gcc.target/sh/sh4a-fprun.c
index 40c2b05aabb..40c2b05aabb 100644
--- a/gcc/testsuite/gcc.dg/sh4a-fprun.c
+++ b/gcc/testsuite/gcc.target/sh/sh4a-fprun.c
diff --git a/gcc/testsuite/gcc.dg/sh4a-fsrra.c b/gcc/testsuite/gcc.target/sh/sh4a-fsrra.c
index c8f04e4d2e2..c8f04e4d2e2 100644
--- a/gcc/testsuite/gcc.dg/sh4a-fsrra.c
+++ b/gcc/testsuite/gcc.target/sh/sh4a-fsrra.c
diff --git a/gcc/testsuite/gcc.dg/sh4a-memmovua.c b/gcc/testsuite/gcc.target/sh/sh4a-memmovua.c
index 68927929854..68927929854 100644
--- a/gcc/testsuite/gcc.dg/sh4a-memmovua.c
+++ b/gcc/testsuite/gcc.target/sh/sh4a-memmovua.c
diff --git a/gcc/testsuite/gcc.dg/sh4a-sin.c b/gcc/testsuite/gcc.target/sh/sh4a-sin.c
index 9f46f600763..9f46f600763 100644
--- a/gcc/testsuite/gcc.dg/sh4a-sin.c
+++ b/gcc/testsuite/gcc.target/sh/sh4a-sin.c
diff --git a/gcc/testsuite/gcc.dg/sh4a-sincos.c b/gcc/testsuite/gcc.target/sh/sh4a-sincos.c
index f4293797534..f4293797534 100644
--- a/gcc/testsuite/gcc.dg/sh4a-sincos.c
+++ b/gcc/testsuite/gcc.target/sh/sh4a-sincos.c
diff --git a/gcc/testsuite/gcc.dg/sh4a-sincosf.c b/gcc/testsuite/gcc.target/sh/sh4a-sincosf.c
index 42913dbd59e..42913dbd59e 100644
--- a/gcc/testsuite/gcc.dg/sh4a-sincosf.c
+++ b/gcc/testsuite/gcc.target/sh/sh4a-sincosf.c
diff --git a/gcc/testsuite/gcc.dg/sh4a-sinf.c b/gcc/testsuite/gcc.target/sh/sh4a-sinf.c
index 2a2343fd73a..2a2343fd73a 100644
--- a/gcc/testsuite/gcc.dg/sh4a-sinf.c
+++ b/gcc/testsuite/gcc.target/sh/sh4a-sinf.c
diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_basics_1.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_basics_1.f90
index a4617cbf01e..fc58bf44830 100644
--- a/gcc/testsuite/gfortran.dg/alloc_comp_basics_1.f90
+++ b/gcc/testsuite/gfortran.dg/alloc_comp_basics_1.f90
@@ -139,6 +139,6 @@ contains
end subroutine check_alloc2
end program alloc
-! { dg-final { scan-tree-dump-times "deallocate" 24 "original" } }
+! { dg-final { scan-tree-dump-times "builtin_free" 24 "original" } }
! { dg-final { cleanup-tree-dump "original" } }
! { dg-final { cleanup-modules "alloc_m" } }
diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_constructor_1.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_constructor_1.f90
index 9beca6d0b7f..969e703094c 100644
--- a/gcc/testsuite/gfortran.dg/alloc_comp_constructor_1.f90
+++ b/gcc/testsuite/gfortran.dg/alloc_comp_constructor_1.f90
@@ -104,5 +104,5 @@ contains
end function blaha
end program test_constructor
-! { dg-final { scan-tree-dump-times "deallocate" 18 "original" } }
+! { dg-final { scan-tree-dump-times "builtin_free" 19 "original" } }
! { dg-final { cleanup-tree-dump "original" } }
diff --git a/gcc/testsuite/gfortran.dg/assumed_charlen_sharing.f90 b/gcc/testsuite/gfortran.dg/assumed_charlen_sharing.f90
new file mode 100644
index 00000000000..0c1c38a87e2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/assumed_charlen_sharing.f90
@@ -0,0 +1,29 @@
+! This testcase was miscompiled, because ts.cl
+! in function bar was initially shared between both
+! dummy arguments. Although it was later unshared,
+! all expressions which copied ts.cl from bar2
+! before that used incorrectly bar1's length
+! instead of bar2.
+! { dg-do run }
+
+subroutine foo (foo1, foo2)
+ implicit none
+ integer, intent(in) :: foo2
+ character(*), intent(in) :: foo1(foo2)
+end subroutine foo
+
+subroutine bar (bar1, bar2)
+ implicit none
+ character(*), intent(in) :: bar1, bar2
+
+ call foo ((/ bar2 /), 1)
+end subroutine bar
+
+program test
+ character(80) :: str1
+ character(5) :: str2
+
+ str1 = 'String'
+ str2 = 'Strng'
+ call bar (str2, str1)
+end program test
diff --git a/gcc/testsuite/gfortran.dg/binding_label_tests_15.f03 b/gcc/testsuite/gfortran.dg/binding_label_tests_15.f03
new file mode 100644
index 00000000000..b1b4b5805ba
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/binding_label_tests_15.f03
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! Verify that an error is correctly reported if multiple identifiers are given
+! with a bind(c) statement that has a NAME= specifier.
+module m
+ use iso_c_binding
+ implicit none
+ integer(c_int), bind(C, name="") :: a,b ! { dg-error "Multiple identifiers" }
+ integer(c_int), bind(C, name="bob") :: c,d ! { dg-error "Multiple identifiers" }
+ integer(c_int) :: e,f
+ bind(c, name="foo") :: e,f ! { dg-error "Multiple identifiers" }
+end module m
+
diff --git a/gcc/testsuite/gfortran.dg/binding_label_tests_16.f03 b/gcc/testsuite/gfortran.dg/binding_label_tests_16.f03
new file mode 100644
index 00000000000..6b8f1f89bac
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/binding_label_tests_16.f03
@@ -0,0 +1,22 @@
+! { dg-do run }
+! Verify that the variables 'a' in both modules don't collide.
+module m
+ use iso_c_binding
+ implicit none
+ integer(c_int), save, bind(C, name="") :: a = 5
+end module m
+
+module n
+ use iso_c_binding
+ implicit none
+ integer(c_int), save, bind(C,name="") :: a = -5
+end module n
+
+program prog
+use m
+use n, b=>a
+implicit none
+ print *, a, b
+ if (a /= 5 .or. b /= -5) call abort()
+end program prog
+! { dg-final { cleanup-modules "m n" } }
diff --git a/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_2.f03 b/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_2.f03
index 5d6acc2f574..662908931b9 100644
--- a/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_2.f03
+++ b/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_2.f03
@@ -86,6 +86,29 @@ contains
if(myArrayPtr(i) /= (i-1)) call abort ()
end do
end subroutine test_short_1d
+
+ subroutine test_mixed(cPtr, num_elems) bind(c)
+ use, intrinsic :: iso_c_binding
+ type(c_ptr), value :: cPtr
+ integer(c_int), value :: num_elems
+ integer, dimension(:), pointer :: myArrayPtr
+ integer(c_int), dimension(1) :: shape1
+ integer(c_long_long), dimension(1) :: shape2
+ integer :: i
+
+ shape1(1) = num_elems
+ call c_f_pointer(cPtr, myArrayPtr, shape1)
+ do i = 1, num_elems
+ if(myArrayPtr(i) /= (i-1)) call abort ()
+ end do
+
+ nullify(myArrayPtr)
+ shape2(1) = num_elems
+ call c_f_pointer(cPtr, myArrayPtr, shape2)
+ do i = 1, num_elems
+ if(myArrayPtr(i) /= (i-1)) call abort ()
+ end do
+ end subroutine test_mixed
end module c_f_pointer_shape_tests_2
! { dg-final { cleanup-modules "c_f_pointer_shape_tests_2" } }
diff --git a/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_2_driver.c b/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_2_driver.c
index 686ae8fe289..1282beb12d7 100644
--- a/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_2_driver.c
+++ b/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_2_driver.c
@@ -7,6 +7,7 @@ void test_long_long_2d(int *array, int num_rows, int num_cols);
void test_long_1d(int *array, int num_elems);
void test_int_1d(int *array, int num_elems);
void test_short_1d(int *array, int num_elems);
+void test_mixed(int *array, int num_elems);
int main(int argc, char **argv)
{
@@ -36,6 +37,10 @@ int main(int argc, char **argv)
/* Test c_f_pointer where SHAPE is of type integer, kind=c_short. */
test_short_1d(my_array, NUM_ELEMS);
-
+
+ /* Test c_f_pointer where SHAPE is of type integer, kind=c_int and
+ kind=c_long_long. */
+ test_mixed(my_array, NUM_ELEMS);
+
return 0;
}
diff --git a/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_3.f03 b/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_3.f03
new file mode 100644
index 00000000000..31fd9381064
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/c_f_pointer_shape_tests_3.f03
@@ -0,0 +1,22 @@
+! { dg-do compile }
+! Verify that the type and rank of the SHAPE argument are enforced.
+module c_f_pointer_shape_tests_3
+ use, intrinsic :: iso_c_binding
+
+contains
+ subroutine sub0(my_c_array) bind(c)
+ type(c_ptr), value :: my_c_array
+ integer(c_int), dimension(:), pointer :: my_array_ptr
+
+ call c_f_pointer(my_c_array, my_array_ptr, (/ 10.0 /)) ! { dg-error "must be a rank 1 INTEGER array" }
+ end subroutine sub0
+
+ subroutine sub1(my_c_array) bind(c)
+ type(c_ptr), value :: my_c_array
+ integer(c_int), dimension(:), pointer :: my_array_ptr
+ integer(c_int), dimension(1,1) :: shape
+
+ shape(1,1) = 10
+ call c_f_pointer(my_c_array, my_array_ptr, shape) ! { dg-error "must be a rank 1 INTEGER array" }
+ end subroutine sub1
+end module c_f_pointer_shape_tests_3
diff --git a/gcc/testsuite/gfortran.dg/char_assign_1.f90 b/gcc/testsuite/gfortran.dg/char_assign_1.f90
index f2f36501e51..0d31cee7a15 100644
--- a/gcc/testsuite/gfortran.dg/char_assign_1.f90
+++ b/gcc/testsuite/gfortran.dg/char_assign_1.f90
@@ -11,7 +11,7 @@ character(len=2), dimension(5) :: p
character(len=3), dimension(5) :: q
y(:)%c = "abcdef" ! { dg-warning "in assignment \\(5/6\\)" }
-p(1) = y(1)%c(3:)
+p(1) = y(1)%c(3:) ! { dg-warning "in assignment \\(2/3\\)" }
if (p(1).ne."cd") call abort()
p(1) = y(1)%c ! { dg-warning "in assignment \\(2/5\\)" }
diff --git a/gcc/testsuite/gfortran.dg/char_length_7.f90 b/gcc/testsuite/gfortran.dg/char_length_7.f90
new file mode 100644
index 00000000000..221c84090f8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/char_length_7.f90
@@ -0,0 +1,32 @@
+! { dg-do run }
+! Test the fix for PR31879 in which the concatenation operators below
+! would cause ICEs because the character lengths were never resolved.
+!
+! Contributed by Vivek Rao <vivekrao4@yahoo.com>
+!
+module str_mod
+ character(3) :: mz(2) = (/"fgh","ijk"/)
+contains
+ function ccopy(yy) result(xy)
+ character (len=*), intent(in) :: yy(:)
+ character (len=5) :: xy(size(yy))
+ xy = yy
+ end function ccopy
+end module str_mod
+!
+program xx
+ use str_mod, only: ccopy, mz
+ implicit none
+ character(2) :: z = "zz"
+ character(3) :: zz(2) = (/"abc","cde"/)
+ character(2) :: ans(2)
+ integer :: i = 2, j = 3
+ if (any(ccopy("_&_"//(/"A","B"/)//"?") .ne. (/"_&_A?","_&_B?"/))) call abort ()
+ if (any(ccopy(z//zz) .ne. (/"zzabc","zzcde"/))) call abort ()
+ if (any(ccopy(z//zz(:)(1:2)) .ne. (/"zzab ","zzcd "/))) call abort ()
+ if (any(ccopy(z//mz(:)(2:3)) .ne. (/"zzgh ","zzjk "/))) call abort ()
+
+! This was another bug, uncovered when the PR was fixed.
+ if (any(ccopy(z//mz(:)(i:j)) .ne. (/"zzgh ","zzjk "/))) call abort ()
+end program xx
+! { dg-final { cleanup-modules "str_mod" } }
diff --git a/gcc/testsuite/gfortran.dg/char_length_8.f90 b/gcc/testsuite/gfortran.dg/char_length_8.f90
new file mode 100644
index 00000000000..dd91de3145f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/char_length_8.f90
@@ -0,0 +1,69 @@
+! { dg-do run }
+! Test the fix for PR31197 and PR31258 in which the substrings below
+! would cause ICEs because the character lengths were never resolved.
+!
+! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
+! and Thomas Koenig <tkoenig@gcc.gnu.org>
+!
+ CHARACTER(LEN=3), DIMENSION(10) :: Z
+ CHARACTER(LEN=3), DIMENSION(3,3) :: W
+ integer :: ctr = 0
+ call test_reshape
+ call test_eoshift
+ call test_cshift
+ call test_spread
+ call test_transpose
+ call test_pack
+ call test_unpack
+ call test_pr31197
+ if (ctr .ne. 8) call abort
+contains
+ subroutine test_reshape
+ Z(:)="123"
+ if (any (RESHAPE(Z(:)(2:2),(/5,2/)) .ne. "2")) call abort
+ ctr = ctr + 1
+ end subroutine
+ subroutine test_eoshift
+ CHARACTER(LEN=1), DIMENSION(10) :: chk
+ chk(1:8) = "5"
+ chk(9:10) = " "
+ Z(:)="456"
+ if (any (EOSHIFT(Z(:)(2:2),2) .ne. chk)) call abort
+ ctr = ctr + 1
+ END subroutine
+ subroutine test_cshift
+ Z(:)="901"
+ if (any (CSHIFT(Z(:)(2:2),2) .ne. "0")) call abort
+ ctr = ctr + 1
+ end subroutine
+ subroutine test_spread
+ Z(:)="789"
+ if (any (SPREAD(Z(:)(2:2),dim=1,ncopies=2) .ne. "8")) call abort
+ ctr = ctr + 1
+ end subroutine
+ subroutine test_transpose
+ W(:, :)="abc"
+ if (any (TRANSPOSE(W(:,:)(1:2)) .ne. "ab")) call abort
+ ctr = ctr + 1
+ end subroutine
+ subroutine test_pack
+ W(:, :)="def"
+ if (any (pack(W(:,:)(2:3),mask=.true.) .ne. "ef")) call abort
+ ctr = ctr + 1
+ end subroutine
+ subroutine test_unpack
+ logical, dimension(5,2) :: mask
+ Z(:)="hij"
+ mask = .true.
+ if (any (unpack(Z(:)(2:2),mask,' ') .ne. "i")) call abort
+ ctr = ctr + 1
+ end subroutine
+ subroutine test_pr31197
+ TYPE data
+ CHARACTER(LEN=3) :: A = "xyz"
+ END TYPE
+ TYPE(data), DIMENSION(10), TARGET :: T
+ if (any (TRANSPOSE(RESHAPE(T(:)%A(2:2),(/5,2/))) .ne. "y")) call abort
+ ctr = ctr + 1
+ end subroutine
+END
diff --git a/gcc/testsuite/gfortran.dg/char_length_9.f90 b/gcc/testsuite/gfortran.dg/char_length_9.f90
new file mode 100644
index 00000000000..dbec68cd8c3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/char_length_9.f90
@@ -0,0 +1,22 @@
+! { dg-do compile }
+! Test the fix for a regression caused by the first fix of PR31879.
+! Reported by Tobias Burnus <burnus@gcc.gnu.org>
+!
+MODULE input_val_types
+ IMPLICIT NONE
+ INTEGER, PARAMETER :: default_string_length=80
+ TYPE val_type
+ CHARACTER(len=default_string_length), DIMENSION(:), POINTER :: c_val
+ END TYPE val_type
+CONTAINS
+ SUBROUTINE val_get (val, c_val)
+ TYPE(val_type), POINTER :: val
+ CHARACTER(LEN=*), INTENT(out) :: c_val
+ INTEGER :: i, l_out
+ i=1
+ c_val((i-1)*default_string_length+1:MIN (l_out, i*default_string_length)) = &
+ val%c_val(i)(1:MIN (80, l_out-(i-1)*default_string_length))
+ END SUBROUTINE val_get
+END MODULE input_val_types
+
+! { dg-final { cleanup-modules "input_val_types" } }
diff --git a/gcc/testsuite/gfortran.dg/char_result_4.f90 b/gcc/testsuite/gfortran.dg/char_result_4.f90
index 0224f43c0b4..5e4f58e188b 100644
--- a/gcc/testsuite/gfortran.dg/char_result_4.f90
+++ b/gcc/testsuite/gfortran.dg/char_result_4.f90
@@ -22,12 +22,12 @@ program main
a = (/ (i + 5, i = 0, 4) /)
ap => a
- lower = 1
+ lower = lbound(a,dim=1)
call test (f1 (ap), 35)
call test (f2 (ap), 115)
call test (f3 (ap), 60)
- call test (f4 (ap, 5, 2), 21)
+ call test (f4 (ap, 104, 2), 21)
contains
function f1 (array)
integer, dimension (:), pointer :: array
@@ -37,13 +37,13 @@ contains
function f2 (array)
integer, dimension (:), pointer :: array
- character (len = array (2) + a (104) + 100) :: f2
+ character (len = array (101) + a (104) + 100) :: f2
f2 = ''
end function f2
function f3 (array)
integer, dimension (:), pointer :: array
- character (len = sum (double (array (2:)))) :: f3
+ character (len = sum (double (array (101:)))) :: f3
f3 = ''
end function f3
diff --git a/gcc/testsuite/gfortran.dg/common_10.f90 b/gcc/testsuite/gfortran.dg/common_10.f90
new file mode 100644
index 00000000000..cec443a5ca4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/common_10.f90
@@ -0,0 +1,55 @@
+use iso_c_binding
+implicit none
+
+type, bind(C) :: mytype1
+ integer(c_int) :: x
+ real(c_float) :: y
+end type mytype1
+
+type mytype2
+ sequence
+ integer :: x
+ real :: y
+end type mytype2
+
+type mytype3
+ integer :: x
+ real :: y
+end type mytype3
+
+type mytype4
+ sequence
+ integer, allocatable, dimension(:) :: x
+end type mytype4
+
+type mytype5
+ sequence
+ integer, pointer :: x
+ integer :: y
+end type mytype5
+
+type mytype6
+ sequence
+ type(mytype5) :: t
+end type mytype6
+
+type mytype7
+ sequence
+ type(mytype4) :: t
+end type mytype7
+
+common /a/ t1
+common /b/ t2
+common /c/ t3 ! { dg-error "has neither the SEQUENCE nor the BIND.C. attribute" }
+common /d/ t4 ! { dg-error "has an ultimate component that is allocatable" }
+common /e/ t5
+common /f/ t6
+common /f/ t7 ! { dg-error "has an ultimate component that is allocatable" }
+type(mytype1) :: t1
+type(mytype2) :: t2
+type(mytype3) :: t3
+type(mytype4) :: t4
+type(mytype5) :: t5
+type(mytype6) :: t6
+type(mytype7) :: t7
+end
diff --git a/gcc/testsuite/gfortran.dg/gamma_1.f90 b/gcc/testsuite/gfortran.dg/gamma_1.f90
new file mode 100644
index 00000000000..c2bbdb6abf1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gamma_1.f90
@@ -0,0 +1,27 @@
+! { dg-do run }
+!
+! Test the vendor intrinsic (d)gamma, lgamma and algama/dlgama
+! gamma is also part of the Fortran 2008 draft; lgamma is called
+! log_gamma in the Fortran 2008 draft.
+!
+! PR fortran/32980
+!
+program gamma_test
+implicit none
+intrinsic :: gamma, lgamma
+integer, parameter :: sp = kind(1.0)
+integer, parameter :: dp = kind(1.0d0)
+
+real(sp) :: rsp
+real(dp) :: rdp
+
+if (abs(gamma(1.0_sp) - 1.0_sp) > tiny(1.0_sp)) call abort()
+if (abs(gamma(1.0_dp) - 1.0_dp) > tiny(1.0_dp)) call abort()
+if (abs(dgamma(1.0_dp) - 1.0_dp) > tiny(1.0_dp)) call abort()
+
+if (abs(lgamma(1.0_sp)) > tiny(1.0_sp)) call abort()
+if (abs(lgamma(1.0_dp)) > tiny(1.0_dp)) call abort()
+if (abs(algama(1.0_sp)) > tiny(1.0_sp)) call abort()
+if (abs(dlgama(1.0_dp)) > tiny(1.0_dp)) call abort()
+end program gamma_test
+
diff --git a/gcc/testsuite/gfortran.dg/gamma_2.f90 b/gcc/testsuite/gfortran.dg/gamma_2.f90
new file mode 100644
index 00000000000..ca7432b4c5d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gamma_2.f90
@@ -0,0 +1,32 @@
+! { dg-do compile }
+! { dg-options "-std=f2003 -Wall" }
+!
+! Test the vendor intrinsic (d)gamma, lgamma and algama/dlgama
+! gamma is also part of the Fortran 2008 draft; lgamma is called
+! log_gamma in the Fortran 2008 draft.
+!
+! PR fortran/32980
+!
+subroutine foo()
+intrinsic :: gamma
+intrinsic :: dgamma
+intrinsic :: lgamma
+intrinsic :: algama
+intrinsic :: dlgama
+
+integer, parameter :: sp = kind(1.0)
+integer, parameter :: dp = kind(1.0d0)
+
+real(sp) :: rsp = 1.0_sp
+real(dp) :: rdp = 1.0_dp
+
+rsp = gamma(rsp) ! FIXME: "is not included in the selected standard"
+rdp = gamma(rdp) ! FIXME: "is not included in the selected standard"
+rdp = dgamma(rdp) ! { dg-error "is not included in the selected standard" }
+
+rsp = lgamma(rsp) ! FIXME: "is not included in the selected standard"
+rdp = lgamma(rdp) ! FIXME: "is not included in the selected standard"
+rsp = algama(rsp) ! { dg-error "is not included in the selected standard" }
+rdp = dlgama(rdp) ! { dg-error "is not included in the selected standard" }
+end subroutine foo
+end
diff --git a/gcc/testsuite/gfortran.dg/gamma_3.f90 b/gcc/testsuite/gfortran.dg/gamma_3.f90
new file mode 100644
index 00000000000..b35596fa5a9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gamma_3.f90
@@ -0,0 +1,27 @@
+! { dg-do compile }
+!
+! Test the vendor intrinsic (d)gamma, lgamma and algama/dlgama
+! gamma is also part of the Fortran 2008 draft; lgamma is called
+! log_gamma in the Fortran 2008 draft.
+!
+! PR fortran/32980
+!
+program gamma_test
+implicit none
+intrinsic :: gamma, lgamma
+real :: x
+
+x = gamma(cmplx(1.0,0.0)) ! { dg-error "is not consistent with a specific intrinsic interface" }
+x = dgamma(cmplx(1.0,0.0,kind(0d0))) ! { dg-error "must be REAL" }
+x = gamma(int(1)) ! { dg-error "is not consistent with a specific intrinsic interface" }
+x = dgamma(int(1)) ! { dg-error "must be REAL" }
+
+x = lgamma(cmplx(1.0,0.0)) ! { dg-error "is not consistent with a specific intrinsic interface" }
+x = algama(cmplx(1.0,0.0)) ! { dg-error "must be REAL" }
+x = dlgama(cmplx(1.0,0.0,kind(0d0))) ! { dg-error "must be REAL" }
+
+x = lgamma(int(1)) ! { dg-error "is not consistent with a specific intrinsic interface" }
+x = algama(int(1)) ! { dg-error "must be REAL" }
+x = dlgama(int(1)) ! { dg-error "must be REAL" }
+end program gamma_test
+
diff --git a/gcc/testsuite/gfortran.dg/gamma_4.f90 b/gcc/testsuite/gfortran.dg/gamma_4.f90
new file mode 100644
index 00000000000..a351f77958a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gamma_4.f90
@@ -0,0 +1,20 @@
+! { dg-do run }
+! { dg-require-effective-target fortran_large_real }
+!
+! Test the vendor intrinsic (d)gamma, lgamma and algama/dlgama
+! gamma is also part of the Fortran 2008 draft; lgamma is called
+! log_gamma in the Fortran 2008 draft.
+!
+! PR fortran/32980
+!
+program gamma_test
+implicit none
+intrinsic :: gamma, lgamma
+integer, parameter :: qp = selected_real_kind(precision (0.0_8) + 1)
+
+real(qp) :: rqp
+
+if (abs(gamma(1.0_qp) - 1.0_qp) > tiny(1.0_qp)) call abort()
+if (abs(lgamma(1.0_qp)) > tiny(1.0_qp)) call abort()
+end program gamma_test
+
diff --git a/gcc/testsuite/gfortran.dg/generic_14.f90 b/gcc/testsuite/gfortran.dg/generic_14.f90
new file mode 100644
index 00000000000..3198da1dafc
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/generic_14.f90
@@ -0,0 +1,105 @@
+! { dg-do compile }
+!
+! Check whether MODULE PROCEDUREs are properly treated
+! They need to be contained in a procedure, i.e. an
+! interface in another procedure is invalid; they may, however,
+! come from a use-associated procedure.
+! (The PROCEDURE statement allows also for non-module procedures
+! if there is an explicit interface.)
+!
+! PR fortran/33228
+!
+module inclmod
+ implicit none
+ interface
+ subroutine wrong1(a)
+ integer :: a
+ end subroutine wrong1
+ end interface
+ interface gen_incl
+ module procedure ok1
+ end interface gen_incl
+ external wrong2
+ external wrong3
+ real wrong3
+contains
+ subroutine ok1(f)
+ character :: f
+ end subroutine ok1
+end module inclmod
+
+module a
+ use inclmod
+ implicit none
+ interface gen
+ subroutine ok1_a(a,b)
+ integer :: a,b
+ end subroutine ok1_a
+ module procedure ok1, ok2_a
+ end interface gen
+contains
+ subroutine ok2_a(a,b,c)
+ integer :: a,b,c
+ end subroutine ok2_a
+end module a
+
+module b
+ use inclmod
+ interface gen_wrong_0
+ module procedure gen_incl ! { dg-error "Cannot change attributes" }
+ end interface gen_wrong_0
+end module b
+
+module c
+ use inclmod
+ interface gen_wrong_1
+ module procedure wrong1 ! { dg-error "is not a module procedure" }
+ end interface gen_wrong_1
+end module c
+
+module d
+ use inclmod
+ interface gen_wrong_2
+ module procedure wrong2 ! { dg-error "Cannot change attributes" }
+ end interface gen_wrong_2
+end module d
+
+module e
+ use inclmod
+ interface gen_wrong_3
+ module procedure wrong3 ! { dg-error "Cannot change attributes" }
+ end interface gen_wrong_3
+end module e
+
+module f
+ implicit none
+ interface
+ subroutine wrong_a(a)
+ integer :: a
+ end subroutine wrong_a
+ end interface
+ interface gen_wrong_4
+ module procedure wrong_a ! { dg-error "is not a module procedure" }
+ end interface gen_wrong_4
+end module f
+
+module g
+ implicit none
+ external wrong_b ! { dg-error "has no explicit interface" }
+ interface gen_wrong_5
+ module procedure wrong_b ! wrong, see above
+ end interface gen_wrong_5
+end module g
+
+module h
+ implicit none
+ external wrong_c ! { dg-error "has no explicit interface" }
+ real wrong_c
+ interface gen_wrong_6
+ module procedure wrong_c ! wrong, see above
+ end interface gen_wrong_6
+end module h
+
+end
+
+! { dg-final { cleanup-modules "a inclmod" } }
diff --git a/gcc/testsuite/gfortran.dg/generic_9.f90 b/gcc/testsuite/gfortran.dg/generic_9.f90
index 2bd143ff858..92dd65096c1 100644
--- a/gcc/testsuite/gfortran.dg/generic_9.f90
+++ b/gcc/testsuite/gfortran.dg/generic_9.f90
@@ -21,7 +21,7 @@ MODULE class_foo
USE class_foo_type, ONLY: foo, bar_init_set_int
INTERFACE foo_init
- MODULE PROCEDURE foo_init_default ! { dg-error "does not come from a module" }
+ MODULE PROCEDURE foo_init_default ! { dg-error "is not a module procedure" }
END INTERFACE
INTERFACE bar_init
diff --git a/gcc/testsuite/gfortran.dg/initialization_13.f90 b/gcc/testsuite/gfortran.dg/initialization_13.f90
new file mode 100644
index 00000000000..0cd6fa693f9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/initialization_13.f90
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! { dg-options "-std=f95" }
+!
+! PR fortran/33178
+!
+! Initialization expressions:
+! Fortran 95: Elemental functions w/ integer/character arguments
+! Fortran 2003: restriction lifted
+!
+integer :: a = sign(1,1) ! Ok F95
+real :: b = sign(1.,1.) ! { dg-error "Fortran 2003: Elemental function as initialization expression" }
+end
diff --git a/gcc/testsuite/gfortran.dg/initialization_4.f90 b/gcc/testsuite/gfortran.dg/initialization_4.f90
index 552a01f8748..24ccf9c6457 100644
--- a/gcc/testsuite/gfortran.dg/initialization_4.f90
+++ b/gcc/testsuite/gfortran.dg/initialization_4.f90
@@ -2,6 +2,6 @@
! initialization expression, even if -std=f95 was used
! { dg-do compile }
! { dg-options "-std=f95" }
-real, parameter :: pi = 4.0*Atan(1.0) ! { dg-error "Evaluation of nonstandard initialization expression" }
+real, parameter :: pi = 4.0*Atan(1.0) ! { dg-error "Fortran 2003: Elemental function as initialization expression" }
real, parameter :: three = 27.0**(1.0/3.0) ! { dg-error "Noninteger exponent in an initialization expression" }
end
diff --git a/gcc/testsuite/gfortran.dg/interface_abstract_1.f90 b/gcc/testsuite/gfortran.dg/interface_abstract_1.f90
index afb3d6a2aac..ab816bff7a1 100644
--- a/gcc/testsuite/gfortran.dg/interface_abstract_1.f90
+++ b/gcc/testsuite/gfortran.dg/interface_abstract_1.f90
@@ -12,4 +12,10 @@ abstract interface
subroutine real() ! { dg-error "cannot be the same as an intrinsic type" }
end subroutine real
end interface
+
+contains
+
+ subroutine sub() bind(C,name="subC")
+ end subroutine
+
end
diff --git a/gcc/testsuite/gfortran.dg/interface_abstract_3.f90 b/gcc/testsuite/gfortran.dg/interface_abstract_3.f90
new file mode 100644
index 00000000000..3008d104015
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/interface_abstract_3.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! test for C1204 of Fortran 2003 standard:
+! module procedure not allowed in abstract interface
+module m
+ abstract interface
+ module procedure p ! { dg-error "must be in a generic module interface" }
+ end interface
+contains
+ subroutine p()
+ end subroutine
+end module m
diff --git a/gcc/testsuite/gfortran.dg/is_iostat_end_eor_1.f90 b/gcc/testsuite/gfortran.dg/is_iostat_end_eor_1.f90
new file mode 100644
index 00000000000..dfa3a5c03c9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/is_iostat_end_eor_1.f90
@@ -0,0 +1,9 @@
+! { dg-do run }
+! Test for the Fortran 2003 intrinsics is_iostat_end & is_iostat_eor
+!
+program test
+ use iso_fortran_env
+ implicit none
+ if ((.not. is_iostat_end(IOSTAT_END)) .or. is_iostat_end(0)) call abort()
+ if ((.not. is_iostat_eor(IOSTAT_EOR)) .or. is_iostat_end(0)) call abort()
+end program test
diff --git a/gcc/testsuite/gfortran.dg/isnan_1.f90 b/gcc/testsuite/gfortran.dg/isnan_1.f90
index fc0a3d0d873..db8f5695cdf 100644
--- a/gcc/testsuite/gfortran.dg/isnan_1.f90
+++ b/gcc/testsuite/gfortran.dg/isnan_1.f90
@@ -1,6 +1,8 @@
! Test for the ISNAN intrinsic
!
! { dg-do run }
+! { dg-options "-pedantic-errors -mieee" { target sh*-*-* } }
+!
implicit none
real :: x
x = -1.0
diff --git a/gcc/testsuite/gfortran.dg/min_max_optional_2.f90 b/gcc/testsuite/gfortran.dg/min_max_optional_2.f90
deleted file mode 100644
index 51e0feee641..00000000000
--- a/gcc/testsuite/gfortran.dg/min_max_optional_2.f90
+++ /dev/null
@@ -1,13 +0,0 @@
-! { dg-do run }
-! { dg-shouldfail "" }
- program test
- if (m1(3,4) /= 4) call abort
- if (m1(3) /= 3) call abort
- print *, m1()
- contains
- integer function m1(a1,a2)
- integer, optional :: a1,a2
- m1 = max(a2, a1, 1, 2)
- end function m1
- end
-! { dg-output "First argument of 'max' intrinsic should be present" }
diff --git a/gcc/testsuite/gfortran.dg/min_max_optional_3.f90 b/gcc/testsuite/gfortran.dg/min_max_optional_3.f90
deleted file mode 100644
index e0e6e29d969..00000000000
--- a/gcc/testsuite/gfortran.dg/min_max_optional_3.f90
+++ /dev/null
@@ -1,14 +0,0 @@
-! { dg-do run }
-! { dg-shouldfail "" }
- program test
- if (m1(1,2,3,4) /= 1) call abort
- if (m1(1,2,3) /= 1) call abort
- if (m1(1,2) /= 1) call abort
- print *, m1(1)
- print *, m1()
- contains
- integer function m1(a1,a2,a3,a4)
- integer, optional :: a1,a2,a3,a4
- m1 = min(a1,a2,a3,a4) ! { dg-output "Second argument of 'min' intrinsic should be present" }
- end function m1
- end
diff --git a/gcc/testsuite/gfortran.dg/min_max_optional_4.f90 b/gcc/testsuite/gfortran.dg/min_max_optional_4.f90
deleted file mode 100644
index b749db0f8e3..00000000000
--- a/gcc/testsuite/gfortran.dg/min_max_optional_4.f90
+++ /dev/null
@@ -1,12 +0,0 @@
-! { dg-do run }
-! { dg-shouldfail "" }
-program test
- call foo("foo")
-contains
- subroutine foo(a, b, c, d)
- character(len=*), optional :: a, b, c, d
- integer :: i
- i = len_trim(min(a,b,c,d)) ! { dg-output "Second argument of 'MIN' intrinsic should be present" }
- print *, i
- end subroutine foo
-end
diff --git a/gcc/testsuite/gfortran.dg/min_max_optional_5.f90 b/gcc/testsuite/gfortran.dg/min_max_optional_5.f90
new file mode 100644
index 00000000000..ae3344f790f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/min_max_optional_5.f90
@@ -0,0 +1,21 @@
+! More tests for MIN/MAX with optional arguments
+! PR33095
+!
+! { dg-do run }
+ if (m1(3,4) /= 4) call abort
+ if (m1(3) /= 3) call abort
+ if (m1() /= 2) call abort
+
+ if (m1(3,4) /= 4) call abort
+ if (m1(3) /= 3) call abort
+contains
+ integer function m1(a1,a2)
+ integer, optional, intent(in) :: a1, a2
+ m1 = max(1, 2, a1, a2)
+ end function m1
+
+ integer function m2(a1,a2)
+ integer, optional, intent(in) :: a1, a2
+ m2 = max(1, a1, 2, a2)
+ end function m2
+end
diff --git a/gcc/testsuite/gfortran.dg/namelist_14.f90 b/gcc/testsuite/gfortran.dg/namelist_14.f90
index e95495aaf2c..729f1b2d5c4 100644
--- a/gcc/testsuite/gfortran.dg/namelist_14.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_14.f90
@@ -6,6 +6,7 @@
module global
type :: mt
+ sequence
integer :: ii(4)
end type mt
end module global
diff --git a/gcc/testsuite/gfortran.dg/nan_1.f90 b/gcc/testsuite/gfortran.dg/nan_1.f90
index 59d4531de7f..0c9eb0435cf 100644
--- a/gcc/testsuite/gfortran.dg/nan_1.f90
+++ b/gcc/testsuite/gfortran.dg/nan_1.f90
@@ -2,6 +2,7 @@
! as arguments
!
! { dg-do run }
+! { dg-options "-pedantic-errors -mieee" { target sh*-*-* } }
!
module aux2
interface isnan
diff --git a/gcc/testsuite/gfortran.dg/negative_unit.f b/gcc/testsuite/gfortran.dg/negative_unit.f
index fd0100a14de..4f942e27e98 100644
--- a/gcc/testsuite/gfortran.dg/negative_unit.f
+++ b/gcc/testsuite/gfortran.dg/negative_unit.f
@@ -2,6 +2,8 @@
!
! PR libfortran/20660 and other bugs (not filed in bugzilla) relating
! to negative units
+! PR 33055 Runtime error in INQUIRE unit existance with -fdefault-integer-8
+! Test case update by Jerry DeLisle <jvdelisle@gcc.gnu.org>
!
! Bugs submitted by Walt Brainerd
integer i
@@ -16,6 +18,7 @@
open (unit=-11, file="xxx", iostat=i)
if (i <= 0) call abort
+ i = 0
inquire (unit=-42, exist=l)
if (l) call abort
diff --git a/gcc/testsuite/gfortran.dg/openmp_stack.f90 b/gcc/testsuite/gfortran.dg/openmp_stack.f90
new file mode 100644
index 00000000000..97dd9156cf2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/openmp_stack.f90
@@ -0,0 +1,22 @@
+! { dg-do run}
+! { dg-options "-fopenmp" }
+program openmp_stack
+ implicit none
+ integer id
+ integer ilocs(2)
+ integer omp_get_thread_num, foo
+ call omp_set_num_threads (2)
+!$omp parallel private (id)
+ id = omp_get_thread_num() + 1
+ ilocs(id) = foo()
+!$omp end parallel
+ ! Check that the two threads are not sharing a location for
+ ! the array x in foo()
+ if (ilocs(1) .eq. ilocs(2)) call abort
+end program openmp_stack
+
+integer function foo ()
+ implicit none
+ real x(100,100)
+ foo = loc(x)
+end function foo
diff --git a/gcc/testsuite/gfortran.dg/pointer_assign_4.f90 b/gcc/testsuite/gfortran.dg/pointer_assign_4.f90
new file mode 100644
index 00000000000..faf7c776c59
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pointer_assign_4.f90
@@ -0,0 +1,66 @@
+! { dg-do run }
+!
+! Verify that the bounds are correctly set when assigning pointers.
+!
+! PR fortran/33139
+!
+program prog
+ implicit none
+ real, target :: a(-10:10)
+ real, pointer :: p(:),p2(:)
+ integer :: i
+ do i = -10, 10
+ a(i) = real(i)
+ end do
+ p => a
+ p2 => p
+ if((lbound(p, dim=1) /= -10) .or. (ubound(p, dim=1) /= 10)) &
+ call abort()
+ if((lbound(p2,dim=1) /= -10) .or. (ubound(p2,dim=1) /= 10)) &
+ call abort()
+ do i = -10, 10
+ if(p(i) /= real(i)) call abort()
+ if(p2(i) /= real(i)) call abort()
+ end do
+ p => a(:)
+ p2 => p
+ if((lbound(p, dim=1) /= 1) .or. (ubound(p, dim=1) /= 21)) &
+ call abort()
+ if((lbound(p2,dim=1) /= 1) .or. (ubound(p2,dim=1) /= 21)) &
+ call abort()
+ p2 => p(:)
+ if((lbound(p2,dim=1) /= 1) .or. (ubound(p2,dim=1) /= 21)) &
+ call abort()
+ call multdim()
+contains
+ subroutine multdim()
+ real, target, allocatable :: b(:,:,:)
+ real, pointer :: ptr(:,:,:)
+ integer :: i, j, k
+ allocate(b(-5:5,10:20,0:3))
+ do i = 0, 3
+ do j = 10, 20
+ do k = -5, 5
+ b(k,j,i) = real(i+10*j+100*k)
+ end do
+ end do
+ end do
+ ptr => b
+ if((lbound(ptr,dim=1) /= -5) .or. (ubound(ptr,dim=1) /= 5) .or. &
+ (lbound(ptr,dim=2) /= 10) .or. (ubound(ptr,dim=2) /= 20) .or. &
+ (lbound(ptr,dim=3) /= 0) .or. (ubound(ptr,dim=3) /= 3)) &
+ call abort()
+ do i = 0, 3
+ do j = 10, 20
+ do k = -5, 5
+ if(ptr(k,j,i) /= real(i+10*j+100*k)) call abort()
+ end do
+ end do
+ end do
+ ptr => b(:,:,:)
+ if((lbound(ptr,dim=1) /= 1) .or. (ubound(ptr,dim=1) /= 11) .or. &
+ (lbound(ptr,dim=2) /= 1) .or. (ubound(ptr,dim=2) /= 11) .or. &
+ (lbound(ptr,dim=3) /= 1) .or. (ubound(ptr,dim=3) /= 4)) &
+ call abort()
+ end subroutine multdim
+end program prog
diff --git a/gcc/testsuite/gfortran.dg/recursive_stack.f90 b/gcc/testsuite/gfortran.dg/recursive_stack.f90
new file mode 100644
index 00000000000..7dbe9fcd740
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/recursive_stack.f90
@@ -0,0 +1,21 @@
+! { dg-do run}
+! { dg-options "-frecursive" }
+program recursive_stack
+ call foo (.true.)
+end program recursive_stack
+
+subroutine foo (recurse)
+ logical recurse
+ integer iarray(100,100)
+ if (recurse) then
+ iarray(49,49) = 17
+ call bar
+ if (iarray(49,49) .ne. 17) call abort
+ else
+ iarray(49,49) = 21
+ end if
+end subroutine foo
+
+subroutine bar
+ call foo (.false.)
+end subroutine bar
diff --git a/gcc/testsuite/gfortran.dg/shape_2.f90 b/gcc/testsuite/gfortran.dg/shape_2.f90
index a4bde98ba5f..057cb4c8558 100644
--- a/gcc/testsuite/gfortran.dg/shape_2.f90
+++ b/gcc/testsuite/gfortran.dg/shape_2.f90
@@ -22,9 +22,9 @@ contains
if (ubound (b (20:30:3, 40), 1) .ne. 4) call abort
ptr => b
- if (lbound (ptr, 1) .ne. 1) call abort
- if (ubound (ptr, 1) .ne. 40) call abort
- if (lbound (ptr, 2) .ne. 1) call abort
- if (ubound (ptr, 2) .ne. 80) call abort
+ if (lbound (ptr, 1) .ne. 11) call abort
+ if (ubound (ptr, 1) .ne. 50) call abort
+ if (lbound (ptr, 2) .ne. -8) call abort
+ if (ubound (ptr, 2) .ne. 71) call abort
end subroutine test
end program main
diff --git a/gcc/testsuite/gfortran.dg/use_10.f90 b/gcc/testsuite/gfortran.dg/use_10.f90
new file mode 100644
index 00000000000..e52fcff7e59
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/use_10.f90
@@ -0,0 +1,29 @@
+! { dg-do run }
+module a
+ implicit none
+interface operator(.op.)
+ module procedure sub
+end interface
+interface operator(.ops.)
+ module procedure sub2
+end interface
+
+contains
+ function sub(i)
+ integer :: sub
+ integer,intent(in) :: i
+ sub = -i
+ end function sub
+ function sub2(i)
+ integer :: sub2
+ integer,intent(in) :: i
+ sub2 = i
+ end function sub2
+end module a
+
+program test
+use a, only: operator(.op.), operator(.op.), &
+operator(.my.)=>operator(.op.),operator(.ops.)=>operator(.op.)
+implicit none
+if (.my.2 /= -2 .or. .op.3 /= -3 .or. .ops.7 /= -7) call abort()
+end
diff --git a/gcc/testsuite/gfortran.dg/used_types_18.f90 b/gcc/testsuite/gfortran.dg/used_types_18.f90
new file mode 100644
index 00000000000..e3dca1f735d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/used_types_18.f90
@@ -0,0 +1,12 @@
+! { dg do-compile }
+! { dg-options "-std=f2003" }
+!
+! Fortran 2003 allowes TYPE without components
+! The error message for -std=f95 is tested in
+! gfortran.dg/access_spec_2.f90
+!
+! PR fortran/33188
+!
+type t
+end type
+end
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/getarg_1.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/getarg_1.f90
index 2d566862d2d..7189991f7eb 100644
--- a/gcc/testsuite/gfortran.fortran-torture/execute/getarg_1.f90
+++ b/gcc/testsuite/gfortran.fortran-torture/execute/getarg_1.f90
@@ -1,12 +1,18 @@
! Check that getarg does somethig sensible.
program getarg_1
- CHARACTER*10 ARGS
+ CHARACTER*10 ARGS, ARGS2
INTEGER*4 I
+ INTEGER*2 I2
I = 0
CALL GETARG(I,ARGS)
! This should return the invoking command. The actual value depends
! on the OS, but a blank string is wrong no matter what.
! ??? What about deep embedded systems?
+
+ I2 = 0
+ CALL GETARG(I2,ARGS2)
+ if (args2.ne.args) call abort
+
if (args.eq.'') call abort
I = 1
CALL GETARG(I,ARGS)
diff --git a/gcc/testsuite/gnat.dg/prefix2.adb b/gcc/testsuite/gnat.dg/prefix2.adb
new file mode 100644
index 00000000000..562bdf495d0
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/prefix2.adb
@@ -0,0 +1,31 @@
+-- { dg-do compile }
+
+ package body prefix2 is
+ procedure Positionne (Objet : in out Instance; X, Y : Coordonnee) is
+ begin
+ Objet.X := X;
+ Objet.Y := Y;
+ end Positionne;
+ function RetourneX (Objet : in Instance) return Coordonnee is
+ begin
+ return Objet.X;
+ end RetourneX;
+ function RetourneY (Objet : in Instance) return Coordonnee is
+ begin
+ return Objet.Y;
+ end RetourneY;
+ procedure Affiche (Objet : in Class; EstVisible : Boolean) is
+ begin
+ if EstVisible then
+ Objet.Allume;
+ else
+ Objet.Eteins;
+ end if;
+ end Affiche;
+ procedure Deplace (Objet : in out Class; DX, DY : Coordonnee) is
+ begin
+ Objet.Affiche (False); -- erreur
+ Objet.Positionne (Objet.X + DX, Objet.Y + DY);
+ Objet.Affiche (True); -- erreur
+ end Deplace;
+ end prefix2;
diff --git a/gcc/testsuite/gnat.dg/prefix2.ads b/gcc/testsuite/gnat.dg/prefix2.ads
new file mode 100644
index 00000000000..5e7b2b27b6b
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/prefix2.ads
@@ -0,0 +1,17 @@
+
+ package prefix2 is
+ type Coordonnee is range -100 .. 100;
+ type Instance is abstract tagged private;
+ subtype Class is Instance'Class;
+ procedure Positionne (Objet : in out Instance; X, Y : Coordonnee);
+ function RetourneX (Objet : in Instance) return Coordonnee;
+ function RetourneY (Objet : in Instance) return Coordonnee;
+ procedure Allume (Objet : in Instance) is abstract;
+ procedure Eteins (Objet : in Instance) is abstract;
+ procedure Affiche (Objet : in Class; EstVisible : Boolean);
+ procedure Deplace (Objet : in out Class; DX, DY : Coordonnee);
+ private
+ type Instance is abstract tagged record
+ X, Y : Coordonnee := 0;
+ end record;
+ end;
diff --git a/gcc/testsuite/gnat.dg/remote_type.adb b/gcc/testsuite/gnat.dg/remote_type.adb
new file mode 100644
index 00000000000..788f795889f
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/remote_type.adb
@@ -0,0 +1,26 @@
+-- { dg-do compile }
+-- { dg-options "-gnatws" }
+
+package body remote_type is
+ procedure Append
+ (Container : in out List;
+ New_Item : in Element_Type)
+ is
+ begin
+ null;
+ end Append;
+ procedure Read
+ (S : access Root_Stream_Type'Class;
+ L : out List)
+ is
+ begin
+ null;
+ end Read;
+ procedure Write
+ (S : access Root_Stream_Type'Class;
+ L : in List)
+ is
+ begin
+ null;
+ end Write;
+end remote_type;
diff --git a/gcc/testsuite/gnat.dg/remote_type.ads b/gcc/testsuite/gnat.dg/remote_type.ads
new file mode 100644
index 00000000000..79c27106b78
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/remote_type.ads
@@ -0,0 +1,24 @@
+with Ada.Streams;
+generic
+ type Element_Type is private;
+package remote_type is
+ pragma Remote_Types;
+ type List is private;
+ procedure Append
+ (Container : in out List;
+ New_Item : in Element_Type);
+private
+ use Ada.Streams;
+ type List_Record is record
+ A : Boolean;
+ end record;
+ type List is access List_Record;
+ procedure Read
+ (S : access Root_Stream_Type'Class;
+ L : out List);
+ for List'Read use Read;
+ procedure Write
+ (S : access Root_Stream_Type'Class;
+ L : in List);
+ for List'Write use Write;
+end remote_type;
diff --git a/gcc/testsuite/gnat.dg/requeue1.adb b/gcc/testsuite/gnat.dg/requeue1.adb
new file mode 100644
index 00000000000..f7902966b56
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/requeue1.adb
@@ -0,0 +1,51 @@
+-- { dg-do run }
+
+with Ada.Text_Io; use Ada.Text_Io;
+
+procedure requeue1 is
+
+ protected P is
+ entry Requeue_Without_Abort;
+ entry Queue_Without;
+ procedure Open;
+ private
+ Opened: Boolean := False;
+ end P;
+
+ protected body P is
+ entry Requeue_Without_Abort when True is
+ begin
+ -- BUG: after this requeue no time out of the call should be possible
+ requeue Queue_Without;
+ end Requeue_Without_Abort;
+
+ entry Queue_Without when Opened is
+ begin
+ Opened := False;
+ end Queue_Without;
+
+ procedure Open is
+ begin
+ Opened := True;
+ end Open;
+ end P;
+
+ -- Test of timed entry call to an entry with requeue without abort
+ task T_Without;
+ task body T_Without is
+ begin
+ select
+ P.Requeue_Without_Abort;
+ or
+ delay 1.0;
+ Put_Line("failed");
+ end select;
+
+ exception
+ when others => Put_Line ("failed");
+ end T_Without;
+
+begin
+ delay 3.0;
+ P.Open;
+end;
diff --git a/gcc/testsuite/gnat.dg/specs/ai_116.ads b/gcc/testsuite/gnat.dg/specs/ai_116.ads
new file mode 100644
index 00000000000..88d7e987688
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/ai_116.ads
@@ -0,0 +1,23 @@
+-- { dg-do compile }
+
+with Ada.Finalization; use Ada;
+package ai_116 is
+ pragma Preelaborate;
+ type Buffer_Type is limited interface;
+
+ type Handle is new Finalization.Limited_Controlled and Buffer_Type with
+ private;
+ pragma Preelaborable_Initialization(Handle);
+
+ type Ptr is access all String;
+ Null_Handle : constant Handle;
+
+private
+ type Handle is new Finalization.Limited_Controlled and Buffer_Type with
+ record
+ Data : Ptr := null;
+ end record;
+
+ Null_Handle : constant Handle :=
+ (Finalization.Limited_Controlled with Data => null);
+end ai_116;
diff --git a/gcc/testsuite/gnat.dg/specs/private_with.ads b/gcc/testsuite/gnat.dg/specs/private_with.ads
new file mode 100644
index 00000000000..f339e5a43b3
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/private_with.ads
@@ -0,0 +1,16 @@
+-- { dg-do compile }
+
+private with Ada.Containers.Ordered_Maps;
+with Ada.Containers.Ordered_Sets;
+with Ada.Unchecked_Deallocation;
+package private_with is
+
+ type String_Access is access String;
+
+ package Index_Sets is new Ada.Containers.Ordered_Sets
+ (Element_Type => Positive);
+
+ procedure Free is new Ada.Unchecked_Deallocation
+ (Object => String,
+ Name => String_Access);
+end;
diff --git a/gcc/testsuite/gnat.dg/specs/with_containers.ads b/gcc/testsuite/gnat.dg/specs/with_containers.ads
new file mode 100644
index 00000000000..f2329cf88ec
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/with_containers.ads
@@ -0,0 +1,27 @@
+-- { dg-do compile }
+
+pragma Warnings (Off);
+with Ada.Containers.Doubly_Linked_Lists;
+with Ada.Containers.Hashed_Maps;
+with Ada.Containers.Hashed_Sets;
+with Ada.Containers.Indefinite_Doubly_Linked_Lists;
+with Ada.Containers.Indefinite_Hashed_Maps;
+with Ada.Containers.Indefinite_Hashed_Sets;
+with Ada.Containers.Indefinite_Ordered_Maps;
+with Ada.Containers.Indefinite_Ordered_Multisets;
+with Ada.Containers.Indefinite_Ordered_Sets;
+with Ada.Containers.Indefinite_Vectors;
+with Ada.Containers.Ordered_Maps;
+with Ada.Containers.Ordered_Multisets;
+with Ada.Containers.Ordered_Sets;
+with Ada.Containers.Prime_Numbers;
+with Ada.Containers.Red_Black_Trees.Generic_Keys;
+with Ada.Containers.Red_Black_Trees.Generic_Operations;
+with Ada.Containers.Red_Black_Trees.Generic_Set_Operations;
+with Ada.Containers.Red_Black_Trees;
+with Ada.Containers.Restricted_Doubly_Linked_Lists;
+with Ada.Containers.Vectors;
+
+package With_Containers is
+ pragma Remote_Types;
+end With_Containers;
diff --git a/gcc/testsuite/gnat.dg/test_prefix1.adb b/gcc/testsuite/gnat.dg/test_prefix1.adb
index 1dd6ab7f52d..8ed1ed5e5eb 100644
--- a/gcc/testsuite/gnat.dg/test_prefix1.adb
+++ b/gcc/testsuite/gnat.dg/test_prefix1.adb
@@ -1,4 +1,4 @@
--- {dg-do run }
+-- { dg-do run }
with prefix1; use prefix1;
procedure test_prefix1 is
diff --git a/gcc/testsuite/gnat.dg/test_table1.adb b/gcc/testsuite/gnat.dg/test_table1.adb
new file mode 100644
index 00000000000..64155bfd81a
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/test_table1.adb
@@ -0,0 +1,40 @@
+-- { dg-do run }
+
+with GNAT.Table;
+with Ada.Text_IO; use Ada.Text_IO;
+
+procedure test_table1 is
+ type Rec is record
+ A, B, C, D, E : Integer := 0;
+ F, G, H, I, J : Integer := 1;
+ K, L, M, N, O : Integer := 2;
+ end record;
+
+ R : Rec;
+
+ package Tab is new GNAT.Table (Rec, Positive, 1, 4, 30);
+
+ Last : Natural;
+
+begin
+ R.O := 3;
+
+ Tab.Append (R);
+
+ for J in 1 .. 1_000_000 loop
+ Last := Tab.Last;
+ begin
+ Tab.Append (Tab.Table (Last));
+ exception
+ when others =>
+ Put_Line ("exception raise for J =" & J'Img);
+ raise;
+ end;
+
+ if Tab.Table (Tab.Last) /= R then
+ Put_Line ("Last is not what is expected");
+ Put_Line (J'Img);
+ return;
+ end if;
+ end loop;
+end;
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 60017aa94e4..a40a99bb0c6 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -352,6 +352,12 @@ proc remove-build-file { pat } {
}
}
+# Remove runtime-generated profile file for the current test.
+proc cleanup-profile-file { } {
+ remove-build-file "mon.out"
+ remove-build-file "gmon.out"
+}
+
# Remove compiler-generated coverage files for the current test.
proc cleanup-coverage-files { } {
# This assumes that we are two frames down from dg-test or some other proc
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index c48138daa5d..fdf25444f9d 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -368,6 +368,7 @@ proc check_profiling_available { test_what } {
|| [istarget strongarm*-*-elf]
|| [istarget xscale*-*-elf]
|| [istarget cris-*-*]
+ || [istarget fido-*-elf]
|| [istarget h8300-*-*]
|| [istarget m32c-*-elf]
|| [istarget m68k-*-elf]
diff --git a/gcc/toplev.c b/gcc/toplev.c
index c138c178d51..fe7918fd736 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1685,6 +1685,31 @@ target_supports_section_anchors_p (void)
return true;
}
+/* Default the align_* variables to 1 if they're still unset, and
+ set up the align_*_log variables. */
+static void
+init_alignments (void)
+{
+ if (align_loops <= 0)
+ align_loops = 1;
+ if (align_loops_max_skip > align_loops)
+ align_loops_max_skip = align_loops - 1;
+ align_loops_log = floor_log2 (align_loops * 2 - 1);
+ if (align_jumps <= 0)
+ align_jumps = 1;
+ if (align_jumps_max_skip > align_jumps)
+ align_jumps_max_skip = align_jumps - 1;
+ align_jumps_log = floor_log2 (align_jumps * 2 - 1);
+ if (align_labels <= 0)
+ align_labels = 1;
+ align_labels_log = floor_log2 (align_labels * 2 - 1);
+ if (align_labels_max_skip > align_labels)
+ align_labels_max_skip = align_labels - 1;
+ if (align_functions <= 0)
+ align_functions = 1;
+ align_functions_log = floor_log2 (align_functions * 2 - 1);
+}
+
/* Process the options that have been parsed. */
static void
process_options (void)
@@ -1730,23 +1755,6 @@ process_options (void)
else
aux_base_name = "gccaux";
- /* Set up the align_*_log variables, defaulting them to 1 if they
- were still unset. */
- if (align_loops <= 0) align_loops = 1;
- if (align_loops_max_skip > align_loops || !align_loops)
- align_loops_max_skip = align_loops - 1;
- align_loops_log = floor_log2 (align_loops * 2 - 1);
- if (align_jumps <= 0) align_jumps = 1;
- if (align_jumps_max_skip > align_jumps || !align_jumps)
- align_jumps_max_skip = align_jumps - 1;
- align_jumps_log = floor_log2 (align_jumps * 2 - 1);
- if (align_labels <= 0) align_labels = 1;
- align_labels_log = floor_log2 (align_labels * 2 - 1);
- if (align_labels_max_skip > align_labels || !align_labels)
- align_labels_max_skip = align_labels - 1;
- if (align_functions <= 0) align_functions = 1;
- align_functions_log = floor_log2 (align_functions * 2 - 1);
-
/* Unrolling all loops implies that standard loop unrolling must also
be done. */
if (flag_unroll_all_loops)
@@ -1998,7 +2006,50 @@ process_options (void)
}
}
-/* Initialize the compiler back end. */
+/* This function can be called multiple times to reinitialize the compiler
+ back end when register classes or instruction sets have changed,
+ before each function. */
+static void
+backend_init_target (void)
+{
+ /* Initialize alignment variables. */
+ init_alignments ();
+
+ /* This reinitializes hard_frame_pointer, and calls init_reg_modes_target()
+ to initialize reg_raw_mode[]. */
+ init_emit_regs ();
+
+ /* This invokes target hooks to set fixed_reg[] etc, which is
+ mode-dependent. */
+ init_regs ();
+
+ /* This depends on stack_pointer_rtx. */
+ init_fake_stack_mems ();
+
+ /* Sets static_base_value[HARD_FRAME_POINTER_REGNUM], which is
+ mode-dependent. */
+ init_alias_target ();
+
+ /* Depends on HARD_FRAME_POINTER_REGNUM. */
+ init_reload ();
+
+ /* The following initialization functions need to generate rtl, so
+ provide a dummy function context for them. */
+ init_dummy_function_start ();
+
+ /* rtx_cost is mode-dependent, so cached values need to be recomputed
+ on a mode change. */
+ init_expmed ();
+
+ /* We may need to recompute regno_save_code[] and regno_restore_code[]
+ after a mode change as well. */
+ if (flag_caller_saves)
+ init_caller_save ();
+ expand_dummy_function_end ();
+}
+
+/* Initialize the compiler back end. This function is called only once,
+ when starting the compiler. */
static void
backend_init (void)
{
@@ -2011,19 +2062,34 @@ backend_init (void)
|| flag_test_coverage);
init_rtlanal ();
- init_regs ();
- init_fake_stack_mems ();
- init_alias_once ();
init_inline_once ();
- init_reload ();
init_varasm_once ();
+ /* Initialize the target-specific back end pieces. */
+ backend_init_target ();
+}
+
+/* Initialize things that are both lang-dependent and target-dependent.
+ This function can be called more than once if target parameters change. */
+static void
+lang_dependent_init_target (void)
+{
+ /* This creates various _DECL nodes, so needs to be called after the
+ front end is initialized. It also depends on the HAVE_xxx macros
+ generated from the target machine description. */
+ init_optabs ();
+
/* The following initialization functions need to generate rtl, so
provide a dummy function context for them. */
init_dummy_function_start ();
- init_expmed ();
- if (flag_caller_saves)
- init_caller_save ();
+
+ /* Do the target-specific parts of expr initialization. */
+ init_expr_target ();
+
+ /* Although the actions of init_set_costs are language-independent,
+ it uses optabs, so we cannot call it from backend_init. */
+ init_set_costs ();
+
expand_dummy_function_end ();
}
@@ -2048,21 +2114,12 @@ lang_dependent_init (const char *name)
init_asm_output (name);
- /* These create various _DECL nodes, so need to be called after the
+ /* This creates various _DECL nodes, so needs to be called after the
front end is initialized. */
init_eh ();
- init_optabs ();
-
- /* The following initialization functions need to generate rtl, so
- provide a dummy function context for them. */
- init_dummy_function_start ();
- init_expr_once ();
-
- /* Although the actions of init_set_costs are language-independent,
- it uses optabs, so we cannot call it from backend_init. */
- init_set_costs ();
- expand_dummy_function_end ();
+ /* Do the target-specific parts of the initialization. */
+ lang_dependent_init_target ();
/* If dbx symbol table desired, initialize writing it and output the
predefined types. */
@@ -2082,6 +2139,19 @@ lang_dependent_init (const char *name)
return 1;
}
+
+/* Reinitialize everything when target parameters, such as register usage,
+ have changed. */
+void
+target_reinit (void)
+{
+ /* Reinitialise RTL backend. */
+ backend_init_target ();
+
+ /* Reinitialize lang-dependent parts. */
+ lang_dependent_init_target ();
+}
+
void
dump_memory_report (bool final)
{
diff --git a/gcc/toplev.h b/gcc/toplev.h
index 906fd3de832..2397dee6dbf 100644
--- a/gcc/toplev.h
+++ b/gcc/toplev.h
@@ -101,6 +101,8 @@ extern void write_global_declarations (void);
extern void dump_memory_report (bool);
+extern void target_reinit (void);
+
/* A unique local time stamp, might be zero if none is available. */
extern unsigned local_tick;
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index e9be4d40440..8e889fa0ecd 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -104,7 +104,7 @@ static inline void change_bb_for_stmt (tree t, basic_block bb);
/* Flowgraph optimization and cleanup. */
static void tree_merge_blocks (basic_block, basic_block);
-static bool tree_can_merge_blocks_p (basic_block, basic_block);
+static bool tree_can_merge_blocks_p (const_basic_block, const_basic_block);
static void remove_bb (basic_block);
static edge find_taken_edge_computed_goto (basic_block, tree);
static edge find_taken_edge_cond_expr (basic_block, tree);
@@ -1135,10 +1135,10 @@ group_case_labels (void)
/* Checks whether we can merge block B into block A. */
static bool
-tree_can_merge_blocks_p (basic_block a, basic_block b)
+tree_can_merge_blocks_p (const_basic_block a, const_basic_block b)
{
- tree stmt;
- block_stmt_iterator bsi;
+ const_tree stmt;
+ const_block_stmt_iterator bsi;
tree phi;
if (!single_succ_p (a))
@@ -1158,7 +1158,7 @@ tree_can_merge_blocks_p (basic_block a, basic_block b)
/* If A ends by a statement causing exceptions or something similar, we
cannot merge the blocks. */
- stmt = last_stmt (a);
+ stmt = const_last_stmt (a);
if (stmt && stmt_ends_bb_p (stmt))
return false;
@@ -1184,9 +1184,9 @@ tree_can_merge_blocks_p (basic_block a, basic_block b)
}
/* Do not remove user labels. */
- for (bsi = bsi_start (b); !bsi_end_p (bsi); bsi_next (&bsi))
+ for (bsi = cbsi_start (b); !cbsi_end_p (bsi); cbsi_next (&bsi))
{
- stmt = bsi_stmt (bsi);
+ stmt = cbsi_stmt (bsi);
if (TREE_CODE (stmt) != LABEL_EXPR)
break;
if (!DECL_ARTIFICIAL (LABEL_EXPR_LABEL (stmt)))
@@ -2451,12 +2451,12 @@ is_ctrl_stmt (const_tree t)
(e.g., a call to a non-returning function). */
bool
-is_ctrl_altering_stmt (tree t)
+is_ctrl_altering_stmt (const_tree t)
{
- tree call;
+ const_tree call;
gcc_assert (t);
- call = get_call_expr_in (t);
+ call = const_get_call_expr_in (t);
if (call)
{
/* A non-pure/const CALL_EXPR alters flow control if the current
@@ -2558,7 +2558,7 @@ stmt_starts_bb_p (const_tree t, const_tree prev_t)
/* Return true if T should end a basic block. */
bool
-stmt_ends_bb_p (tree t)
+stmt_ends_bb_p (const_tree t)
{
return is_ctrl_stmt (t) || is_ctrl_altering_stmt (t);
}
@@ -4860,7 +4860,7 @@ tree_redirect_edge_and_branch (edge e, basic_block dest)
it to the destination of the other edge from E->src. */
static bool
-tree_can_remove_branch_p (edge e)
+tree_can_remove_branch_p (const_edge e)
{
if (e->flags & EDGE_ABNORMAL)
return false;
@@ -4956,7 +4956,7 @@ tree_move_block_after (basic_block bb, basic_block after)
/* Return true if basic_block can be duplicated. */
static bool
-tree_can_duplicate_bb_p (basic_block bb ATTRIBUTE_UNUSED)
+tree_can_duplicate_bb_p (const_basic_block bb ATTRIBUTE_UNUSED)
{
return true;
}
@@ -5917,10 +5917,10 @@ debug_loop_ir (void)
otherwise. */
static bool
-tree_block_ends_with_call_p (basic_block bb)
+tree_block_ends_with_call_p (const_basic_block bb)
{
- block_stmt_iterator bsi = bsi_last (bb);
- return get_call_expr_in (bsi_stmt (bsi)) != NULL;
+ const_block_stmt_iterator bsi = cbsi_last (bb);
+ return const_get_call_expr_in (cbsi_stmt (bsi)) != NULL;
}
@@ -5928,9 +5928,9 @@ tree_block_ends_with_call_p (basic_block bb)
otherwise. */
static bool
-tree_block_ends_with_condjump_p (basic_block bb)
+tree_block_ends_with_condjump_p (const_basic_block bb)
{
- tree stmt = last_stmt (bb);
+ const_tree stmt = const_last_stmt (bb);
return (stmt && TREE_CODE (stmt) == COND_EXPR);
}
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 48a50ddfb10..6ad2e96bea5 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -1229,6 +1229,9 @@ initialize_data_dependence_relation (struct data_reference *a,
DDR_B (res) = b;
DDR_LOOP_NEST (res) = NULL;
DDR_REVERSED_P (res) = false;
+ DDR_SUBSCRIPTS (res) = NULL;
+ DDR_DIR_VECTS (res) = NULL;
+ DDR_DIST_VECTS (res) = NULL;
if (a == NULL || b == NULL)
{
@@ -1268,8 +1271,6 @@ initialize_data_dependence_relation (struct data_reference *a,
DDR_SUBSCRIPTS (res) = VEC_alloc (subscript_p, heap, DR_NUM_DIMENSIONS (a));
DDR_LOOP_NEST (res) = loop_nest;
DDR_INNER_LOOP (res) = 0;
- DDR_DIR_VECTS (res) = NULL;
- DDR_DIST_VECTS (res) = NULL;
for (i = 0; i < DR_NUM_DIMENSIONS (a); i++)
{
@@ -1333,6 +1334,7 @@ finalize_ddr_dependent (struct data_dependence_relation *ddr,
DDR_ARE_DEPENDENT (ddr) = chrec;
free_subscripts (DDR_SUBSCRIPTS (ddr));
+ DDR_SUBSCRIPTS (ddr) = NULL;
}
/* The dependence relation DDR cannot be represented by a distance
@@ -2961,7 +2963,7 @@ build_classic_dist_vector (struct data_dependence_relation *ddr,
lambda_vector dist_v;
if (DDR_ARE_DEPENDENT (ddr) != NULL_TREE)
- return true;
+ return false;
if (same_access_functions (ddr))
{
@@ -3013,11 +3015,13 @@ build_classic_dist_vector (struct data_dependence_relation *ddr,
if (!lambda_vector_lexico_pos (dist_v, DDR_NB_LOOPS (ddr)))
{
lambda_vector save_v = lambda_vector_new (DDR_NB_LOOPS (ddr));
- subscript_dependence_tester_1 (ddr, DDR_B (ddr), DDR_A (ddr),
- loop_nest);
+ if (!subscript_dependence_tester_1 (ddr, DDR_B (ddr), DDR_A (ddr),
+ loop_nest))
+ return false;
compute_subscript_distance (ddr);
- build_classic_dist_vector_1 (ddr, DDR_B (ddr), DDR_A (ddr),
- save_v, &init_b, &index_carry);
+ if (!build_classic_dist_vector_1 (ddr, DDR_B (ddr), DDR_A (ddr),
+ save_v, &init_b, &index_carry))
+ return false;
save_dist_v (ddr, save_v);
DDR_REVERSED_P (ddr) = true;
@@ -3047,21 +3051,26 @@ build_classic_dist_vector (struct data_dependence_relation *ddr,
{
lambda_vector save_v = lambda_vector_new (DDR_NB_LOOPS (ddr));
lambda_vector_copy (dist_v, save_v, DDR_NB_LOOPS (ddr));
- save_dist_v (ddr, save_v);
if (DDR_NB_LOOPS (ddr) > 1)
{
lambda_vector opposite_v = lambda_vector_new (DDR_NB_LOOPS (ddr));
- subscript_dependence_tester_1 (ddr, DDR_B (ddr), DDR_A (ddr),
- loop_nest);
+ if (!subscript_dependence_tester_1 (ddr, DDR_B (ddr),
+ DDR_A (ddr), loop_nest))
+ return false;
compute_subscript_distance (ddr);
- build_classic_dist_vector_1 (ddr, DDR_B (ddr), DDR_A (ddr),
- opposite_v, &init_b, &index_carry);
+ if (!build_classic_dist_vector_1 (ddr, DDR_B (ddr), DDR_A (ddr),
+ opposite_v, &init_b,
+ &index_carry))
+ return false;
+ save_dist_v (ddr, save_v);
add_outer_distances (ddr, dist_v, index_carry);
add_outer_distances (ddr, opposite_v, index_carry);
}
+ else
+ save_dist_v (ddr, save_v);
}
}
else
@@ -4288,8 +4297,12 @@ free_dependence_relation (struct data_dependence_relation *ddr)
if (ddr == NULL)
return;
- if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE && DDR_SUBSCRIPTS (ddr))
+ if (DDR_SUBSCRIPTS (ddr))
free_subscripts (DDR_SUBSCRIPTS (ddr));
+ if (DDR_DIST_VECTS (ddr))
+ VEC_free (lambda_vector, heap, DDR_DIST_VECTS (ddr));
+ if (DDR_DIR_VECTS (ddr))
+ VEC_free (lambda_vector, heap, DDR_DIR_VECTS (ddr));
free (ddr);
}
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 7832b688e0a..e6b593e7214 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -325,7 +325,7 @@ dump_variable (FILE *file, tree var)
ann = var_ann (var);
- fprintf (file, ", UID %u", (unsigned) DECL_UID (var));
+ fprintf (file, ", UID D.%u", (unsigned) DECL_UID (var));
fprintf (file, ", ");
print_generic_expr (file, TREE_TYPE (var), dump_flags);
diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c
index f370bcd738e..6821e363bb3 100644
--- a/gcc/tree-dump.c
+++ b/gcc/tree-dump.c
@@ -34,7 +34,7 @@ along with GCC; see the file COPYING3. If not see
#include "real.h"
#include "fixed-value.h"
-static unsigned int queue (dump_info_p, tree, int);
+static unsigned int queue (dump_info_p, const_tree, int);
static void dump_index (dump_info_p, unsigned int);
static void dequeue_and_dump (dump_info_p);
static void dump_new_line (dump_info_p);
@@ -45,7 +45,7 @@ static int dump_enable_all (int, int);
assigned to T. */
static unsigned int
-queue (dump_info_p di, tree t, int flags)
+queue (dump_info_p di, const_tree t, int flags)
{
dump_queue_p dq;
dump_node_info_p dni;
@@ -94,7 +94,7 @@ dump_index (dump_info_p di, unsigned int index)
index of T is printed. */
void
-queue_and_dump_index (dump_info_p di, const char *field, tree t, int flags)
+queue_and_dump_index (dump_info_p di, const char *field, const_tree t, int flags)
{
unsigned int index;
splay_tree_node n;
@@ -122,7 +122,7 @@ queue_and_dump_index (dump_info_p di, const char *field, tree t, int flags)
/* Dump the type of T. */
void
-queue_and_dump_type (dump_info_p di, tree t)
+queue_and_dump_type (dump_info_p di, const_tree t)
{
queue_and_dump_index (di, "type", TREE_TYPE (t), DUMP_NONE);
}
@@ -735,7 +735,7 @@ dequeue_and_dump (dump_info_p di)
/* Return nonzero if FLAG has been specified for the dump, and NODE
is not the root node of the dump. */
-int dump_flag (dump_info_p di, int flag, tree node)
+int dump_flag (dump_info_p di, int flag, const_tree node)
{
return (di->flags & flag) && (node != di->node);
}
@@ -743,7 +743,7 @@ int dump_flag (dump_info_p di, int flag, tree node)
/* Dump T, and all its children, on STREAM. */
void
-dump_node (tree t, int flags, FILE *stream)
+dump_node (const_tree t, int flags, FILE *stream)
{
struct dump_info di;
dump_queue_p dq;
diff --git a/gcc/tree-dump.h b/gcc/tree-dump.h
index 311f3e1dfad..30efb10d413 100644
--- a/gcc/tree-dump.h
+++ b/gcc/tree-dump.h
@@ -58,7 +58,7 @@ struct dump_info
/* The stream on which to dump the information. */
FILE *stream;
/* The original node. */
- tree node;
+ const_tree node;
/* User flags. */
int flags;
/* The next unused node index. */
@@ -85,13 +85,13 @@ extern void dump_pointer (dump_info_p, const char *, void *);
extern void dump_int (dump_info_p, const char *, int);
extern void dump_string (dump_info_p, const char *);
extern void dump_string_field (dump_info_p, const char *, const char *);
-extern void dump_stmt (dump_info_p, tree);
-extern void queue_and_dump_index (dump_info_p, const char *, tree, int);
-extern void queue_and_dump_type (dump_info_p, tree);
+extern void dump_stmt (dump_info_p, const_tree);
+extern void queue_and_dump_index (dump_info_p, const char *, const_tree, int);
+extern void queue_and_dump_type (dump_info_p, const_tree);
extern void dump_function (enum tree_dump_index, tree);
extern void dump_function_to_file (tree, FILE *, int);
extern void debug_function (tree, int);
-extern int dump_flag (dump_info_p, int, tree);
+extern int dump_flag (dump_info_p, int, const_tree);
extern unsigned int dump_register (const char *, const char *, const char *,
int, int);
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 89f863fb85f..8b195d7ad5c 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -148,14 +148,16 @@ remove_stmt_from_eh_region (tree t)
}
int
-lookup_stmt_eh_region_fn (struct function *ifun, tree t)
+lookup_stmt_eh_region_fn (struct function *ifun, const_tree t)
{
struct throw_stmt_node *p, n;
if (!get_eh_throw_stmt_table (ifun))
return -2;
- n.stmt = t;
+ /* The CONST_CAST is okay because we don't modify n.stmt throughout
+ its scope, or the scope of p. */
+ n.stmt = (tree) CONST_CAST (t);
p = (struct throw_stmt_node *) htab_find (get_eh_throw_stmt_table (ifun),
&n);
@@ -163,7 +165,7 @@ lookup_stmt_eh_region_fn (struct function *ifun, tree t)
}
int
-lookup_stmt_eh_region (tree t)
+lookup_stmt_eh_region (const_tree t)
{
/* We can get called from initialized data when -fnon-call-exceptions
is on; prevent crash. */
@@ -2032,7 +2034,7 @@ tree_could_throw_p (tree t)
}
bool
-tree_can_throw_internal (tree stmt)
+tree_can_throw_internal (const_tree stmt)
{
int region_nr;
bool is_resx = false;
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h
index 992aad016b3..a5441fefacf 100644
--- a/gcc/tree-flow-inline.h
+++ b/gcc/tree-flow-inline.h
@@ -611,7 +611,7 @@ addresses_taken (tree stmt)
/* Return the PHI nodes for basic block BB, or NULL if there are no
PHI nodes. */
static inline tree
-phi_nodes (basic_block bb)
+phi_nodes (const_basic_block bb)
{
gcc_assert (!(bb->flags & BB_RTL));
if (!bb->il.tree)
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index 339baeba349..044a520b710 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -545,7 +545,7 @@ struct edge_prediction GTY((chain_next ("%h.ep_next")))
};
/* Accessors for basic block annotations. */
-static inline tree phi_nodes (basic_block);
+static inline tree phi_nodes (const_basic_block);
static inline void set_phi_nodes (basic_block, tree);
/*---------------------------------------------------------------------------
@@ -721,9 +721,9 @@ extern void free_omp_regions (void);
#define PENDING_STMT(e) ((e)->insns.t)
extern void delete_tree_cfg_annotations (void);
-extern bool stmt_ends_bb_p (tree);
+extern bool stmt_ends_bb_p (const_tree);
extern bool is_ctrl_stmt (const_tree);
-extern bool is_ctrl_altering_stmt (tree);
+extern bool is_ctrl_altering_stmt (const_tree);
extern bool computed_goto_p (const_tree);
extern bool simple_goto_p (const_tree);
extern bool tree_can_make_abnormal_goto (const_tree);
@@ -961,7 +961,7 @@ struct tree_niter_desc
/* In tree-vectorizer.c */
unsigned vectorize_loops (void);
-extern bool vect_can_force_dr_alignment_p (tree, unsigned int);
+extern bool vect_can_force_dr_alignment_p (const_tree, unsigned int);
extern tree get_vectype_for_scalar_type (tree);
/* In tree-ssa-phiopt.c */
@@ -1073,9 +1073,9 @@ static inline bool unmodifiable_var_p (const_tree);
extern void make_eh_edges (tree);
extern bool tree_could_trap_p (tree);
extern bool tree_could_throw_p (tree);
-extern bool tree_can_throw_internal (tree);
+extern bool tree_can_throw_internal (const_tree);
extern bool tree_can_throw_external (tree);
-extern int lookup_stmt_eh_region (tree);
+extern int lookup_stmt_eh_region (const_tree);
extern void add_stmt_to_eh_region (tree, int);
extern bool remove_stmt_from_eh_region (tree);
extern bool maybe_clean_or_replace_eh_stmt (tree, tree);
diff --git a/gcc/tree-gimple.c b/gcc/tree-gimple.c
index 8e976e201fe..42a29adf961 100644
--- a/gcc/tree-gimple.c
+++ b/gcc/tree-gimple.c
@@ -436,18 +436,28 @@ is_gimple_call_addr (tree t)
/* If T makes a function call, return the corresponding CALL_EXPR operand.
Otherwise, return NULL_TREE. */
+#define GET_CALL_EXPR_IN_BODY do { \
+ /* FIXME tuples: delete the assertion below when conversion complete. */ \
+ gcc_assert (TREE_CODE (t) != MODIFY_EXPR); \
+ if (TREE_CODE (t) == GIMPLE_MODIFY_STMT) \
+ t = GIMPLE_STMT_OPERAND (t, 1); \
+ if (TREE_CODE (t) == WITH_SIZE_EXPR) \
+ t = TREE_OPERAND (t, 0); \
+ if (TREE_CODE (t) == CALL_EXPR) \
+ return t; \
+ return NULL_TREE; \
+} while (0)
+
tree
get_call_expr_in (tree t)
{
- /* FIXME tuples: delete the assertion below when conversion complete. */
- gcc_assert (TREE_CODE (t) != MODIFY_EXPR);
- if (TREE_CODE (t) == GIMPLE_MODIFY_STMT)
- t = GIMPLE_STMT_OPERAND (t, 1);
- if (TREE_CODE (t) == WITH_SIZE_EXPR)
- t = TREE_OPERAND (t, 0);
- if (TREE_CODE (t) == CALL_EXPR)
- return t;
- return NULL_TREE;
+ GET_CALL_EXPR_IN_BODY;
+}
+
+const_tree
+const_get_call_expr_in (const_tree t)
+{
+ GET_CALL_EXPR_IN_BODY;
}
/* Given a memory reference expression T, return its base address.
diff --git a/gcc/tree-gimple.h b/gcc/tree-gimple.h
index 09182d725cf..3a121c07916 100644
--- a/gcc/tree-gimple.h
+++ b/gcc/tree-gimple.h
@@ -90,6 +90,7 @@ extern bool is_gimple_non_addressable (tree t);
extern bool is_gimple_call_addr (tree);
/* If T makes a function call, returns the CALL_EXPR operand. */
extern tree get_call_expr_in (tree t);
+extern const_tree const_get_call_expr_in (const_tree t);
extern void recalculate_side_effects (tree);
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index a24f70d0562..b2b959097cd 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -51,6 +51,8 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-prop.h"
#include "value-prof.h"
#include "tree-pass.h"
+#include "target.h"
+#include "integrate.h"
/* I'm not real happy about this, but we need to handle gimple and
non-gimple trees. */
@@ -1848,18 +1850,44 @@ static bool
inlinable_function_p (tree fn)
{
bool inlinable = true;
+ bool do_warning;
+ tree always_inline;
/* If we've already decided this function shouldn't be inlined,
there's no need to check again. */
if (DECL_UNINLINABLE (fn))
return false;
- /* See if there is any language-specific reason it cannot be
- inlined. (It is important that this hook be called early because
- in C++ it may result in template instantiation.)
- If the function is not inlinable for language-specific reasons,
- it is left up to the langhook to explain why. */
- inlinable = !lang_hooks.tree_inlining.cannot_inline_tree_fn (&fn);
+ /* We only warn for functions declared `inline' by the user. */
+ do_warning = (warn_inline
+ && DECL_INLINE (fn)
+ && DECL_DECLARED_INLINE_P (fn)
+ && !DECL_IN_SYSTEM_HEADER (fn));
+
+ always_inline = lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn));
+
+ if (flag_really_no_inline
+ && always_inline == NULL)
+ {
+ if (do_warning)
+ warning (OPT_Winline, "function %q+F can never be inlined because it "
+ "is suppressed using -fno-inline", fn);
+ inlinable = false;
+ }
+
+ /* Don't auto-inline anything that might not be bound within
+ this unit of translation. */
+ else if (!DECL_DECLARED_INLINE_P (fn)
+ && DECL_REPLACEABLE_P (fn))
+ inlinable = false;
+
+ else if (!function_attribute_inlinable_p (fn))
+ {
+ if (do_warning)
+ warning (OPT_Winline, "function %q+F can never be inlined because it "
+ "uses attributes conflicting with inlining", fn);
+ inlinable = false;
+ }
/* If we don't have the function body available, we can't inline it.
However, this should not be recorded since we also get here for
@@ -1893,14 +1921,8 @@ inlinable_function_p (tree fn)
about functions that would for example call alloca. But since
this a property of the function, just one warning is enough.
As a bonus we can now give more details about the reason why a
- function is not inlinable.
- We only warn for functions declared `inline' by the user. */
- bool do_warning = (warn_inline
- && DECL_INLINE (fn)
- && DECL_DECLARED_INLINE_P (fn)
- && !DECL_IN_SYSTEM_HEADER (fn));
-
- if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)))
+ function is not inlinable. */
+ if (always_inline)
sorry (inline_forbidden_reason, fn);
else if (do_warning)
warning (OPT_Winline, inline_forbidden_reason, fn);
@@ -1914,20 +1936,6 @@ inlinable_function_p (tree fn)
return inlinable;
}
-/* Return true if we shall disregard inlining limits for the function
- FN during inlining. */
-
-bool
-disregard_inline_limits_p (tree fn)
-{
- /* GNU extern inline functions are supposed to be cheap. */
- if (DECL_DECLARED_INLINE_P (fn)
- && DECL_EXTERNAL (fn))
- return true;
-
- return lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)) != NULL_TREE;
-}
-
/* Estimate the cost of a memory move. Use machine dependent
word size and take possible memcpy call into account. */
diff --git a/gcc/tree-inline.h b/gcc/tree-inline.h
index 05d921a2b6f..200a9a68fc3 100644
--- a/gcc/tree-inline.h
+++ b/gcc/tree-inline.h
@@ -130,7 +130,6 @@ extern void insert_decl_map (copy_body_data *, tree, tree);
unsigned int optimize_inline_calls (tree);
bool tree_inlinable_function_p (tree);
-bool disregard_inline_limits_p (tree);
tree copy_tree_r (tree *, int *, void *);
void clone_body (tree, tree, void *);
void save_body (tree, tree *, tree *);
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index 5a20772339e..fc6f1359c4d 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -78,7 +78,7 @@ extern int dump_enabled_p (enum tree_dump_index);
extern int dump_initialized_p (enum tree_dump_index);
extern FILE *dump_begin (enum tree_dump_index, int *);
extern void dump_end (enum tree_dump_index, FILE *);
-extern void dump_node (tree, int, FILE *);
+extern void dump_node (const_tree, int, FILE *);
extern int dump_switch_p (const char *);
extern const char *dump_flag_name (enum tree_dump_index);
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index 540e611d67c..738fb0938c2 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -863,7 +863,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
pp_printf (buffer, "<L" HOST_WIDE_INT_PRINT_DEC ">",
LABEL_DECL_UID (node));
else
- pp_printf (buffer, "<D%u>", DECL_UID (node));
+ pp_printf (buffer, "<D.%u>", DECL_UID (node));
break;
case TYPE_DECL:
@@ -1081,6 +1081,13 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
if (TREE_CODE (node) == GIMPLE_MODIFY_STMT
&& MOVE_NONTEMPORAL (node))
pp_string (buffer, "{nt}");
+ if (TREE_CODE (node) == GIMPLE_MODIFY_STMT)
+ {
+ stmt_ann_t ann;
+ if ((ann = stmt_ann (node))
+ && ann->has_volatile_ops)
+ pp_string (buffer, "{v}");
+ }
pp_space (buffer);
dump_generic_node (buffer, GENERIC_TREE_OPERAND (node, 1), spc, flags,
false);
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 103a0231fb3..2dc23513af9 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -3967,7 +3967,7 @@ find_used_portions (tree *tp, int *walk_subtrees, void *lhs_p)
for (i = 0; i < nargs; i++)
{
tree *arg = &CALL_EXPR_ARG (*tp, i);
- if (TREE_CODE (*arg) != ADDR_EXPR)
+ if (TREE_CODE (*arg) == ADDR_EXPR)
find_used_portions (arg, walk_subtrees, NULL);
}
*walk_subtrees = 0;
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index e6dfcd83e88..e0829f59917 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -2060,7 +2060,12 @@ fold_stmt_r (tree *expr_p, int *walk_subtrees, void *data)
(TREE_OPERAND (expr, 0),
integer_zero_node,
TREE_TYPE (TREE_TYPE (expr)))))
- t = build_fold_addr_expr_with_type (t, TREE_TYPE (expr));
+ {
+ tree ptr_type = build_pointer_type (TREE_TYPE (t));
+ if (!useless_type_conversion_p (TREE_TYPE (expr), ptr_type))
+ return NULL_TREE;
+ t = build_fold_addr_expr_with_type (t, ptr_type);
+ }
break;
/* ??? Could handle more ARRAY_REFs here, as a variant of INDIRECT_REF.
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index 6d1834ec5e4..40e7051c265 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -2969,8 +2969,7 @@ scev_probably_wraps_p (tree base, tree step,
2032, 2040, 0, 8, ..., but the code is still legal. */
if (chrec_contains_undetermined (base)
- || chrec_contains_undetermined (step)
- || TREE_CODE (step) != INTEGER_CST)
+ || chrec_contains_undetermined (step))
return true;
if (integer_zerop (step))
@@ -2981,6 +2980,11 @@ scev_probably_wraps_p (tree base, tree step,
if (use_overflow_semantics && nowrap_type_p (type))
return false;
+ /* To be able to use estimates on number of iterations of the loop,
+ we must have an upper bound on the absolute value of the step. */
+ if (TREE_CODE (step) != INTEGER_CST)
+ return true;
+
/* Don't issue signed overflow warnings. */
fold_defer_overflow_warnings ();
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index bfbf20ed860..33c44ee0d1b 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -111,7 +111,7 @@ along with GCC; see the file COPYING3. If not see
Fourth, we eliminate fully redundant expressions.
This is a simple statement walk that replaces redundant
- calculations with the now available values. */
+ calculations with the now available values. */
/* Representations of value numbers:
@@ -189,7 +189,7 @@ DEF_VEC_P (vuse_vec);
DEF_VEC_ALLOC_P (vuse_vec, heap);
static VEC(vuse_vec, heap) *expression_vuses;
-
+
/* Mapping from expression to id number we can use in bitmap sets. */
static VEC(tree, heap) *expressions;
@@ -545,7 +545,7 @@ phi_trans_add (tree e, tree v, basic_block pred, VEC (tree, gc) *vuses)
static inline bool
constant_expr_p (tree v)
{
- return TREE_CODE (v) != VALUE_HANDLE &&
+ return TREE_CODE (v) != VALUE_HANDLE &&
(TREE_CODE (v) == FIELD_DECL || is_gimple_min_invariant (v));
}
@@ -965,7 +965,7 @@ find_leader_in_sets (tree expr, bitmap_set_t set1, bitmap_set_t set2)
the phis in PRED. SEEN is a bitmap saying which expression we have
translated since we started translation of the toplevel expression.
Return NULL if we can't find a leader for each part of the
- translated expression. */
+ translated expression. */
static tree
phi_translate_1 (tree expr, bitmap_set_t set1, bitmap_set_t set2,
@@ -1323,13 +1323,13 @@ phi_translate_1 (tree expr, bitmap_set_t set1, bitmap_set_t set2,
{
tree val;
tree def = PHI_ARG_DEF (phi, e->dest_idx);
-
+
if (is_gimple_min_invariant (def))
return def;
-
+
if (is_undefined_value (def))
return NULL;
-
+
val = get_value_handle (def);
gcc_assert (val);
return def;
@@ -1343,9 +1343,9 @@ phi_translate_1 (tree expr, bitmap_set_t set1, bitmap_set_t set2,
}
/* Translate EXPR using phis in PHIBLOCK, so that it has the values of
- the phis in PRED.
+ the phis in PRED.
Return NULL if we can't find a leader for each part of the
- translated expression. */
+ translated expression. */
static tree
phi_translate (tree expr, bitmap_set_t set1, bitmap_set_t set2,
@@ -2063,7 +2063,7 @@ can_value_number_call (tree stmt)
}
/* Return true if OP is an exception handler related operation, such as
- FILTER_EXPRor EXC_PTR_EXPR. */
+ FILTER_EXPR or EXC_PTR_EXPR. */
static bool
is_exception_related (tree op)
@@ -2077,7 +2077,7 @@ is_exception_related (tree op)
static bool
can_value_number_operation (tree op)
{
- return (UNARY_CLASS_P (op)
+ return (UNARY_CLASS_P (op)
&& !is_exception_related (TREE_OPERAND (op, 0)))
|| BINARY_CLASS_P (op)
|| COMPARISON_CLASS_P (op)
@@ -2523,7 +2523,7 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum,
NECESSARY (temp) = 0;
VN_INFO_GET (PHI_RESULT (temp))->valnum = PHI_RESULT (temp);
-
+
VEC_safe_push (tree, heap, inserted_exprs, temp);
FOR_EACH_EDGE (pred, ei, block->preds)
add_phi_arg (temp, avail[pred->src->index], pred);
@@ -2892,7 +2892,7 @@ is_undefined_value (tree expr)
}
/* Add OP to EXP_GEN (block), and possibly to the maximal set if it is
- not defined by a phi node.
+ not defined by a phi node.
PHI nodes can't go in the maximal sets because they are not in
TMP_GEN, so it is possible to get into non-monotonic situations
during ANTIC calculation, because it will *add* bits. */
@@ -2956,7 +2956,7 @@ find_existing_value_expr (tree t, VEC (tree, gc) *vuses)
vh = vn_lookup_with_vuses (t, vuses);
else
vh = vn_lookup (t);
-
+
if (!vh)
return NULL;
exprset = VALUE_HANDLE_EXPR_SET (vh);
@@ -3036,7 +3036,7 @@ create_value_expr_from (tree expr, basic_block block, VEC (tree, gc) *vuses)
}
if (TREE_CODE (op) != TREE_LIST)
add_to_exp_gen (block, op);
-
+
if (TREE_CODE (val) == VALUE_HANDLE)
TREE_TYPE (val) = TREE_TYPE (TREE_OPERAND (vexpr, i));
@@ -3247,7 +3247,7 @@ get_sccvn_value (tree name)
if (!valvh && !is_invariant)
{
tree defstmt = SSA_NAME_DEF_STMT (val);
-
+
gcc_assert (VN_INFO (val)->valnum == val);
/* PHI nodes can't have vuses and attempts to iterate over
their VUSE operands will crash. */
@@ -3261,7 +3261,7 @@ get_sccvn_value (tree name)
}
valvh = vn_lookup_or_add_with_stmt (val, defstmt);
}
-
+
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "SCCVN says ");
@@ -3275,7 +3275,7 @@ get_sccvn_value (tree name)
fprintf (dump_file, ")\n");
}
else
- print_generic_stmt (dump_file, val, 0);
+ print_generic_stmt (dump_file, val, 0);
}
if (valvh)
return valvh;
@@ -3320,13 +3320,13 @@ make_values_for_stmt (tree stmt, basic_block block)
tree valvh = NULL_TREE;
tree lhsval;
VEC (tree, gc) *vuses = NULL;
-
+
valvh = get_sccvn_value (lhs);
if (valvh)
{
vn_add (lhs, valvh);
- bitmap_value_insert_into_set (AVAIL_OUT (block), lhs);
+ bitmap_value_insert_into_set (AVAIL_OUT (block), lhs);
/* Shortcut for FRE. We have no need to create value expressions,
just want to know what values are available where. */
if (in_fre)
@@ -3343,7 +3343,7 @@ make_values_for_stmt (tree stmt, basic_block block)
bitmap_value_insert_into_set (AVAIL_OUT (block), lhs);
return true;
}
-
+
lhsval = valvh ? valvh : get_value_handle (lhs);
vuses = copy_vuses_from_stmt (stmt);
STRIP_USELESS_TYPE_CONVERSION (rhs);
@@ -3370,10 +3370,10 @@ make_values_for_stmt (tree stmt, basic_block block)
tree val = vn_lookup_or_add_with_vuses (newt, vuses);
vn_add (lhs, val);
}
-
+
add_to_exp_gen (block, newt);
- }
-
+ }
+
bitmap_insert_into_set (TMP_GEN (block), lhs);
bitmap_value_insert_into_set (AVAIL_OUT (block), lhs);
return true;
@@ -3385,7 +3385,7 @@ make_values_for_stmt (tree stmt, basic_block block)
|| TREE_INVARIANT (rhs)
|| DECL_P (rhs))
{
-
+
if (lhsval)
{
set_expression_vuses (rhs, vuses);
@@ -3460,7 +3460,7 @@ compute_avail (void)
tree def = gimple_default_def (cfun, param);
vn_lookup_or_add (def);
- if (!in_fre)
+ if (!in_fre)
{
bitmap_insert_into_set (TMP_GEN (ENTRY_BLOCK_PTR), def);
bitmap_value_insert_into_set (maximal_set, def);
@@ -3621,7 +3621,7 @@ eliminate (void)
sprime = bitmap_find_leader (AVAIL_OUT (b),
get_value_handle (lhs));
-
+
if (sprime
&& sprime != lhs
&& (TREE_CODE (*rhs_p) != SSA_NAME
@@ -3793,7 +3793,7 @@ static void
init_pre (bool do_fre)
{
basic_block bb;
-
+
next_expression_id = 0;
expressions = NULL;
expression_vuses = NULL;
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 1c42da071cf..17eec742138 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -751,6 +751,7 @@ set_rhs (tree *stmt_p, tree expr)
SSA_NAME_DEF_STMT (var) = *stmt_p;
}
}
+ stmt->base.ann = NULL;
break;
}
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 5e6a86a4b6c..855f42af995 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -90,7 +90,7 @@ along with GCC; see the file COPYING3. If not see
In order to value number memory, we assign value numbers to vuses.
This enables us to note that, for example, stores to the same
address of the same value from the same starting memory states are
- equivalent.
+ equivalent.
TODO:
1. We can iterate only the changing portions of the SCC's, but
@@ -264,7 +264,7 @@ VN_INFO_SET (tree name, vn_ssa_aux_t value)
}
/* Get the value numbering info for a given SSA name, creating it if
- it does not exist. */
+ it does not exist. */
vn_ssa_aux_t
VN_INFO_GET (tree name)
@@ -367,7 +367,7 @@ vn_reference_eq (const void *p1, const void *p2)
if (VEC_index (tree, vr2->vuses, i) != v)
return false;
}
-
+
for (i = 0; VEC_iterate (vn_reference_op_s, vr1->operands, i, vro); i++)
{
if (!vn_reference_op_eq (VEC_index (vn_reference_op_s, vr2->operands, i),
@@ -554,7 +554,7 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
break;
default:
gcc_unreachable ();
-
+
}
VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
@@ -1078,7 +1078,7 @@ visit_copy (tree lhs, tree rhs)
/* Follow chains of copies to their destination. */
while (SSA_VAL (rhs) != rhs && TREE_CODE (SSA_VAL (rhs)) == SSA_NAME)
rhs = SSA_VAL (rhs);
-
+
/* The copy may have a more interesting constant filled expression
(we don't, since we know our RHS is just an SSA name). */
VN_INFO (lhs)->has_constants = VN_INFO (rhs)->has_constants;
@@ -1302,10 +1302,10 @@ visit_phi (tree phi)
VN_INFO (PHI_RESULT (phi))->has_constants = false;
VN_INFO (PHI_RESULT (phi))->expr = sameval;
}
-
+
if (TREE_CODE (sameval) == SSA_NAME)
return visit_copy (PHI_RESULT (phi), sameval);
-
+
return set_ssa_val_to (PHI_RESULT (phi), sameval);
}
@@ -1601,7 +1601,7 @@ visit_use (tree use)
have been value numbering optimistically, and
iterating. They may become non-constant in this case,
even if they were optimistically constant. */
-
+
VN_INFO (lhs)->has_constants = false;
VN_INFO (lhs)->expr = lhs;
}
@@ -1730,7 +1730,7 @@ process_scc (VEC (tree, heap) *scc)
if (VEC_length (tree, scc) == 1)
{
tree use = VEC_index (tree, scc, 0);
- if (!VN_INFO (use)->use_processed)
+ if (!VN_INFO (use)->use_processed)
visit_use (use);
}
else
@@ -1988,7 +1988,7 @@ free_scc_vn (void)
SSA_NAME_VALUE (name) = NULL;
}
}
-
+
VEC_free (vn_ssa_aux_t, heap, vn_ssa_aux_table);
VEC_free (tree, heap, sccstack);
free_vn_table (valid_info);
diff --git a/gcc/tree-ssa-sccvn.h b/gcc/tree-ssa-sccvn.h
index 780ebfd8095..6d8f258ddd3 100644
--- a/gcc/tree-ssa-sccvn.h
+++ b/gcc/tree-ssa-sccvn.h
@@ -59,6 +59,6 @@ tree vn_reference_lookup (tree, VEC (tree, gc) *);
void vn_reference_insert (tree, tree, VEC (tree, gc) *);
VEC (tree, gc) *shared_vuses_from_stmt (tree);
VEC (tree, gc) *copy_vuses_from_stmt (tree);
-
+
#endif /* TREE_SSA_SCCVN_H */
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index d894351a539..a379e7e2a8d 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -1647,6 +1647,7 @@ typedef struct equiv_class_label
bitmap labels;
hashval_t hashcode;
} *equiv_class_label_t;
+typedef const struct equiv_class_label *const_equiv_class_label_t;
/* A hashtable for mapping a bitmap of labels->pointer equivalence
classes. */
@@ -1661,7 +1662,7 @@ static htab_t location_equiv_class_table;
static hashval_t
equiv_class_label_hash (const void *p)
{
- const equiv_class_label_t ecl = (equiv_class_label_t) p;
+ const_equiv_class_label_t const ecl = (const_equiv_class_label_t) p;
return ecl->hashcode;
}
@@ -1670,8 +1671,8 @@ equiv_class_label_hash (const void *p)
static int
equiv_class_label_eq (const void *p1, const void *p2)
{
- const equiv_class_label_t eql1 = (equiv_class_label_t) p1;
- const equiv_class_label_t eql2 = (equiv_class_label_t) p2;
+ const_equiv_class_label_t const eql1 = (const_equiv_class_label_t) p1;
+ const_equiv_class_label_t const eql2 = (const_equiv_class_label_t) p2;
return bitmap_equal_p (eql1->labels, eql2->labels);
}
@@ -3654,6 +3655,27 @@ handle_rhs_call (tree rhs)
}
}
+/* For non-IPA mode, generate constraints necessary for a call
+ that returns a pointer and assigns it to LHS. This simply makes
+ the LHS point to anything. */
+
+static void
+handle_lhs_call (tree lhs)
+{
+ VEC(ce_s, heap) *lhsc = NULL;
+ struct constraint_expr rhsc;
+ unsigned int j;
+ struct constraint_expr *lhsp;
+
+ rhsc.var = anything_id;
+ rhsc.offset = 0;
+ rhsc.type = ADDRESSOF;
+ get_constraint_for (lhs, &lhsc);
+ for (j = 0; VEC_iterate (ce_s, lhsc, j, lhsp); j++)
+ process_constraint_1 (new_constraint (*lhsp, rhsc), true);
+ VEC_free (ce_s, heap, lhsc);
+}
+
/* Walk statement T setting up aliasing constraints according to the
references found in T. This function is the main part of the
constraint builder. AI points to auxiliary alias information used
@@ -3725,7 +3747,11 @@ find_func_aliases (tree origt)
if (!in_ipa_mode)
{
if (TREE_CODE (t) == GIMPLE_MODIFY_STMT)
- handle_rhs_call (GIMPLE_STMT_OPERAND (t, 1));
+ {
+ handle_rhs_call (GIMPLE_STMT_OPERAND (t, 1));
+ if (POINTER_TYPE_P (TREE_TYPE (GIMPLE_STMT_OPERAND (t, 1))))
+ handle_lhs_call (GIMPLE_STMT_OPERAND (t, 0));
+ }
else
handle_rhs_call (t);
}
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index e0885497e11..633e446fe1a 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -885,32 +885,10 @@ delete_tree_ssa (void)
cfun->gimple_df = NULL;
}
+/* Helper function for useless_type_conversion_p. */
-/* Return true if the conversion from INNER_TYPE to OUTER_TYPE is a
- useless type conversion, otherwise return false.
-
- This function implicitly defines the middle-end type system. With
- the notion of 'a < b' meaning that useless_type_conversion_p (a, b)
- holds and 'a > b' meaning that useless_type_conversion_p (b, a) holds,
- the following invariants shall be fulfilled:
-
- 1) useless_type_conversion_p is transitive.
- If a < b and b < c then a < c.
-
- 2) useless_type_conversion_p is not symmetric.
- From a < b does not follow a > b.
-
- 3) Types define the available set of operations applicable to values.
- A type conversion is useless if the operations for the target type
- is a subset of the operations for the source type. For example
- casts to void* are useless, casts from void* are not (void* can't
- be dereferenced or offsetted, but copied, hence its set of operations
- is a strict subset of that of all other data pointer types). Casts
- to const T* are useless (can't be written to), casts from const T*
- to T* are not. */
-
-bool
-useless_type_conversion_p (tree outer_type, tree inner_type)
+static bool
+useless_type_conversion_p_1 (tree outer_type, tree inner_type)
{
/* Qualifiers on value types do not matter. */
inner_type = TYPE_MAIN_VARIANT (inner_type);
@@ -964,11 +942,6 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
else if (POINTER_TYPE_P (inner_type)
&& POINTER_TYPE_P (outer_type))
{
- /* If the outer type is (void *), then the conversion is not
- necessary. */
- if (TREE_CODE (TREE_TYPE (outer_type)) == VOID_TYPE)
- return true;
-
/* Don't lose casts between pointers to volatile and non-volatile
qualified types. Doing so would result in changing the semantics
of later accesses. */
@@ -1002,22 +975,22 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
to types are effectively the same. We can strip qualifiers
on pointed-to types for further comparison, which is done in
the callee. */
- return useless_type_conversion_p (TREE_TYPE (outer_type),
- TREE_TYPE (inner_type));
+ return useless_type_conversion_p_1 (TREE_TYPE (outer_type),
+ TREE_TYPE (inner_type));
}
/* Recurse for complex types. */
else if (TREE_CODE (inner_type) == COMPLEX_TYPE
&& TREE_CODE (outer_type) == COMPLEX_TYPE)
- return useless_type_conversion_p (TREE_TYPE (outer_type),
- TREE_TYPE (inner_type));
+ return useless_type_conversion_p_1 (TREE_TYPE (outer_type),
+ TREE_TYPE (inner_type));
/* Recurse for vector types with the same number of subparts. */
else if (TREE_CODE (inner_type) == VECTOR_TYPE
&& TREE_CODE (outer_type) == VECTOR_TYPE
&& TYPE_PRECISION (inner_type) == TYPE_PRECISION (outer_type))
- return useless_type_conversion_p (TREE_TYPE (outer_type),
- TREE_TYPE (inner_type));
+ return useless_type_conversion_p_1 (TREE_TYPE (outer_type),
+ TREE_TYPE (inner_type));
/* For aggregates we may need to fall back to structural equality
checks. */
@@ -1037,6 +1010,43 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
return false;
}
+/* Return true if the conversion from INNER_TYPE to OUTER_TYPE is a
+ useless type conversion, otherwise return false.
+
+ This function implicitly defines the middle-end type system. With
+ the notion of 'a < b' meaning that useless_type_conversion_p (a, b)
+ holds and 'a > b' meaning that useless_type_conversion_p (b, a) holds,
+ the following invariants shall be fulfilled:
+
+ 1) useless_type_conversion_p is transitive.
+ If a < b and b < c then a < c.
+
+ 2) useless_type_conversion_p is not symmetric.
+ From a < b does not follow a > b.
+
+ 3) Types define the available set of operations applicable to values.
+ A type conversion is useless if the operations for the target type
+ is a subset of the operations for the source type. For example
+ casts to void* are useless, casts from void* are not (void* can't
+ be dereferenced or offsetted, but copied, hence its set of operations
+ is a strict subset of that of all other data pointer types). Casts
+ to const T* are useless (can't be written to), casts from const T*
+ to T* are not. */
+
+bool
+useless_type_conversion_p (tree outer_type, tree inner_type)
+{
+ /* If the outer type is (void *), then the conversion is not
+ necessary. We have to make sure to not apply this while
+ recursing though. */
+ if (POINTER_TYPE_P (inner_type)
+ && POINTER_TYPE_P (outer_type)
+ && TREE_CODE (TREE_TYPE (outer_type)) == VOID_TYPE)
+ return true;
+
+ return useless_type_conversion_p_1 (outer_type, inner_type);
+}
+
/* Return true if a conversion from either type of TYPE1 and TYPE2
to the other is not required. Otherwise return false. */
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 372334dddd9..2c525eaaa71 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -1378,7 +1378,7 @@ new_stmt_vec_info (tree stmt, loop_vec_info loop_vinfo)
static bool
bb_in_loop_p (const_basic_block bb, const void *data)
{
- struct loop *loop = (struct loop *)data;
+ const struct loop *const loop = (const struct loop *)data;
if (flow_bb_inside_loop_p (loop, bb))
return true;
return false;
@@ -1583,7 +1583,7 @@ destroy_loop_vec_info (loop_vec_info loop_vinfo, bool clean_stmts)
on ALIGNMENT bit boundary. */
bool
-vect_can_force_dr_alignment_p (tree decl, unsigned int alignment)
+vect_can_force_dr_alignment_p (const_tree decl, unsigned int alignment)
{
if (TREE_CODE (decl) != VAR_DECL)
return false;
@@ -2061,7 +2061,7 @@ supportable_widening_operation (enum tree_code code, tree stmt, tree vectype,
bool
supportable_narrowing_operation (enum tree_code code,
- tree stmt, tree vectype,
+ const_tree stmt, const_tree vectype,
enum tree_code *code1)
{
enum machine_mode vec_mode;
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index ad7ccea4b23..1dd472c3e2d 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -506,14 +506,14 @@ extern bool vect_is_simple_use (tree, loop_vec_info, tree *, tree *,
enum vect_def_type *);
extern bool vect_is_simple_iv_evolution (unsigned, tree, tree *, tree *);
extern tree vect_is_simple_reduction (loop_vec_info, tree);
-extern bool vect_can_force_dr_alignment_p (tree, unsigned int);
+extern bool vect_can_force_dr_alignment_p (const_tree, unsigned int);
extern enum dr_alignment_support vect_supportable_dr_alignment
(struct data_reference *);
extern bool reduction_code_for_scalar_code (enum tree_code, enum tree_code *);
extern bool supportable_widening_operation (enum tree_code, tree, tree,
tree *, tree *, enum tree_code *, enum tree_code *);
-extern bool supportable_narrowing_operation (enum tree_code, tree, tree,
- enum tree_code *);
+extern bool supportable_narrowing_operation (enum tree_code, const_tree,
+ const_tree, enum tree_code *);
/* Creation and deletion of loop and stmt info structs. */
extern loop_vec_info new_loop_vec_info (struct loop *loop);
diff --git a/gcc/tree-vn.c b/gcc/tree-vn.c
index 1cbb55d723b..a23d7beb467 100644
--- a/gcc/tree-vn.c
+++ b/gcc/tree-vn.c
@@ -59,7 +59,7 @@ bool
expressions_equal_p (tree e1, tree e2)
{
tree te1, te2;
-
+
if (e1 == e2)
return true;
@@ -82,7 +82,7 @@ expressions_equal_p (tree e1, tree e2)
return true;
}
- else if (TREE_CODE (e1) == TREE_CODE (e2)
+ else if (TREE_CODE (e1) == TREE_CODE (e2)
&& (te1 == te2
|| types_compatible_p (te1, te2))
&& operand_equal_p (e1, e2, OEP_PURE_SAME))
@@ -92,7 +92,7 @@ expressions_equal_p (tree e1, tree e2)
}
/* Set the value handle for expression E to value V. */
-
+
void
set_value_handle (tree e, tree v)
{
@@ -132,12 +132,12 @@ print_creation_to_file (tree v, tree expr, VEC (tree, gc) *vuses)
print_generic_expr (dump_file, v, dump_flags);
fprintf (dump_file, " for ");
print_generic_expr (dump_file, expr, dump_flags);
-
+
if (vuses && VEC_length (tree, vuses) != 0)
{
size_t i;
tree vuse;
-
+
fprintf (dump_file, " vuses: (");
for (i = 0; VEC_iterate (tree, vuses, i, vuse); i++)
{
@@ -146,7 +146,7 @@ print_creation_to_file (tree v, tree expr, VEC (tree, gc) *vuses)
fprintf (dump_file, ",");
}
fprintf (dump_file, ")");
- }
+ }
fprintf (dump_file, "\n");
}
@@ -154,7 +154,7 @@ print_creation_to_file (tree v, tree expr, VEC (tree, gc) *vuses)
/* Sort the VUSE array so that we can do equality comparisons
quicker on two vuse vecs. */
-void
+void
sort_vuses (VEC (tree,gc) *vuses)
{
if (VEC_length (tree, vuses) > 1)
@@ -167,7 +167,7 @@ sort_vuses (VEC (tree,gc) *vuses)
/* Sort the VUSE array so that we can do equality comparisons
quicker on two vuse vecs. */
-void
+void
sort_vuses_heap (VEC (tree,heap) *vuses)
{
if (VEC_length (tree, vuses) > 1)
@@ -279,7 +279,7 @@ vn_lookup (tree expr)
if (TREE_CODE (expr) == CALL_EXPR || DECL_P (expr))
return vn_reference_lookup (expr, NULL);
else if (TREE_CODE (expr) == SSA_NAME)
- return SSA_NAME_VALUE (expr);
+ return SSA_NAME_VALUE (expr);
else if (TREE_CODE (expr) == ADDR_EXPR)
return vn_unary_op_lookup (expr);
/* FALLTHROUGH */
@@ -291,7 +291,7 @@ vn_lookup (tree expr)
/* Search in the value numbering tables for an existing instance of
expression EXPR, and return its value, or NULL if none has been set. STMT
- represents the stmt associated with EXPR. It is used when computing the
+ represents the stmt associated with EXPR. It is used when computing the
hash value for EXPR for reference operations. */
tree
@@ -328,9 +328,9 @@ static tree
create_value_handle_for_expr (tree expr, VEC(tree, gc) *vuses)
{
tree v;
-
+
v = make_value_handle (TREE_TYPE (expr));
-
+
if (dump_file && (dump_flags & TDF_DETAILS))
print_creation_to_file (v, expr, vuses);
return v;
@@ -343,7 +343,7 @@ tree
vn_lookup_or_add (tree expr)
{
tree v = vn_lookup (expr);
-
+
if (v == NULL_TREE)
{
v = create_value_handle_for_expr (expr, NULL);
@@ -387,10 +387,10 @@ tree
vn_lookup_or_add_with_vuses (tree expr, VEC (tree, gc) *vuses)
{
tree v;
-
+
if (!vuses || VEC_length (tree, vuses) == 0)
return vn_lookup_or_add (expr);
-
+
v = vn_lookup_with_vuses (expr, vuses);
if (v == NULL_TREE)
{
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 40d2264dfdd..dfb28203948 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -107,7 +107,7 @@ static int *vr_phi_edge_counts;
TYPE_{MIN,MAX}_VALUE. */
static inline bool
-needs_overflow_infinity (tree type)
+needs_overflow_infinity (const_tree type)
{
return INTEGRAL_TYPE_P (type) && !TYPE_OVERFLOW_WRAPS (type);
}
@@ -119,7 +119,7 @@ needs_overflow_infinity (tree type)
VARYING. */
static inline bool
-supports_overflow_infinity (tree type)
+supports_overflow_infinity (const_tree type)
{
#ifdef ENABLE_CHECKING
gcc_assert (needs_overflow_infinity (type));
@@ -169,7 +169,7 @@ positive_overflow_infinity (tree type)
/* Return whether VAL is a negative overflow infinity. */
static inline bool
-is_negative_overflow_infinity (tree val)
+is_negative_overflow_infinity (const_tree val)
{
return (needs_overflow_infinity (TREE_TYPE (val))
&& CONSTANT_CLASS_P (val)
@@ -180,7 +180,7 @@ is_negative_overflow_infinity (tree val)
/* Return whether VAL is a positive overflow infinity. */
static inline bool
-is_positive_overflow_infinity (tree val)
+is_positive_overflow_infinity (const_tree val)
{
return (needs_overflow_infinity (TREE_TYPE (val))
&& CONSTANT_CLASS_P (val)
@@ -191,7 +191,7 @@ is_positive_overflow_infinity (tree val)
/* Return whether VAL is a positive or negative overflow infinity. */
static inline bool
-is_overflow_infinity (tree val)
+is_overflow_infinity (const_tree val)
{
return (needs_overflow_infinity (TREE_TYPE (val))
&& CONSTANT_CLASS_P (val)
@@ -229,7 +229,7 @@ avoid_overflow_infinity (tree val)
to the integer constant with the same value in the type. */
static inline bool
-vrp_val_is_max (tree val)
+vrp_val_is_max (const_tree val)
{
tree type_max = TYPE_MAX_VALUE (TREE_TYPE (val));
@@ -242,7 +242,7 @@ vrp_val_is_max (tree val)
will be true for a negative overflow infinity. */
static inline bool
-vrp_val_is_min (tree val)
+vrp_val_is_min (const_tree val)
{
tree type_min = TYPE_MIN_VALUE (TREE_TYPE (val));
@@ -256,7 +256,7 @@ vrp_val_is_min (tree val)
current function signature. */
static bool
-nonnull_arg_p (tree arg)
+nonnull_arg_p (const_tree arg)
{
tree t, attrs, fntype;
unsigned HOST_WIDE_INT arg_num;
@@ -462,7 +462,7 @@ set_value_range_to_undefined (value_range_t *vr)
return NULL. Otherwise create an empty range if none existed for VAR. */
static value_range_t *
-get_value_range (tree var)
+get_value_range (const_tree var)
{
value_range_t *vr;
tree sym;
@@ -504,7 +504,7 @@ get_value_range (tree var)
/* Return true, if VAL1 and VAL2 are equal values for VRP purposes. */
static inline bool
-vrp_operand_equal_p (tree val1, tree val2)
+vrp_operand_equal_p (const_tree val1, const_tree val2)
{
if (val1 == val2)
return true;
@@ -536,7 +536,7 @@ vrp_bitmap_equal_p (const_bitmap b1, const_bitmap b2)
is the range object associated with another SSA name. */
static inline bool
-update_value_range (tree var, value_range_t *new_vr)
+update_value_range (const_tree var, value_range_t *new_vr)
{
value_range_t *old_vr;
bool is_new;
@@ -562,7 +562,7 @@ update_value_range (tree var, value_range_t *new_vr)
point where equivalence processing can be turned on/off. */
static void
-add_equivalence (bitmap *equiv, tree var)
+add_equivalence (bitmap *equiv, const_tree var)
{
unsigned ver = SSA_NAME_VERSION (var);
value_range_t *vr = vr_value[ver];
@@ -1044,7 +1044,7 @@ range_includes_zero_p (value_range_t *vr)
false otherwise or if no value range information is available. */
bool
-ssa_name_nonnegative_p (tree t)
+ssa_name_nonnegative_p (const_tree t)
{
value_range_t *vr = get_value_range (t);
@@ -1066,7 +1066,7 @@ ssa_name_nonnegative_p (tree t)
false otherwise or if no value range information is available. */
bool
-ssa_name_nonzero_p (tree t)
+ssa_name_nonzero_p (const_tree t)
{
value_range_t *vr = get_value_range (t);
@@ -3252,7 +3252,7 @@ build_assert_expr_for (tree cond, tree v)
point values. */
static inline bool
-fp_predicate (tree expr)
+fp_predicate (const_tree expr)
{
return (COMPARISON_CLASS_P (expr)
&& FLOAT_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 0))));
diff --git a/gcc/tree.c b/gcc/tree.c
index 95aa1b9e040..fc5c8246ccc 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -3678,12 +3678,6 @@ build_type_attribute_qual_variant (tree ttype, tree attribute, int quals)
TYPE_REFERENCE_TO (ntype) = 0;
TYPE_ATTRIBUTES (ntype) = attribute;
- if (TYPE_STRUCTURAL_EQUALITY_P (ttype))
- SET_TYPE_STRUCTURAL_EQUALITY (ntype);
- else
- TYPE_CANONICAL (ntype)
- = build_qualified_type (TYPE_CANONICAL (ttype), quals);
-
/* Create a new main variant of TYPE. */
TYPE_MAIN_VARIANT (ntype) = ntype;
TYPE_NEXT_VARIANT (ntype) = 0;
@@ -3726,8 +3720,12 @@ build_type_attribute_qual_variant (tree ttype, tree attribute, int quals)
/* If the target-dependent attributes make NTYPE different from
its canonical type, we will need to use structural equality
checks for this qualified type. */
- if (!targetm.comp_type_attributes (ntype, ttype))
+ ttype = build_qualified_type (ttype, TYPE_UNQUALIFIED);
+ if (TYPE_STRUCTURAL_EQUALITY_P (ttype)
+ || !targetm.comp_type_attributes (ntype, ttype))
SET_TYPE_STRUCTURAL_EQUALITY (ntype);
+ else
+ TYPE_CANONICAL (ntype) = TYPE_CANONICAL (ttype);
ttype = build_qualified_type (ntype, quals);
}
@@ -3811,20 +3809,28 @@ is_attribute_p (const char *attr, const_tree ident)
returns the first occurrence; the TREE_CHAIN of the return value should
be passed back in if further occurrences are wanted. */
+#define LOOKUP_ATTRIBUTE_BODY(TYPE) do { \
+ TYPE l; \
+ size_t attr_len = strlen (attr_name); \
+ for (l = list; l; l = TREE_CHAIN (l)) \
+ { \
+ gcc_assert (TREE_CODE (TREE_PURPOSE (l)) == IDENTIFIER_NODE); \
+ if (is_attribute_with_length_p (attr_name, attr_len, TREE_PURPOSE (l))) \
+ return l; \
+ } \
+ return NULL_TREE; \
+} while (0)
+
tree
lookup_attribute (const char *attr_name, tree list)
{
- tree l;
- size_t attr_len = strlen (attr_name);
-
- for (l = list; l; l = TREE_CHAIN (l))
- {
- gcc_assert (TREE_CODE (TREE_PURPOSE (l)) == IDENTIFIER_NODE);
- if (is_attribute_with_length_p (attr_name, attr_len, TREE_PURPOSE (l)))
- return l;
- }
+ LOOKUP_ATTRIBUTE_BODY(tree);
+}
- return NULL_TREE;
+const_tree
+const_lookup_attribute (const char *attr_name, const_tree list)
+{
+ LOOKUP_ATTRIBUTE_BODY(const_tree);
}
/* Remove any instances of attribute ATTR_NAME in LIST and return the
@@ -4757,7 +4763,7 @@ attribute_hash_list (const_tree list, hashval_t hashcode)
equivalent to l1. */
int
-attribute_list_equal (tree l1, tree l2)
+attribute_list_equal (const_tree l1, const_tree l2)
{
return attribute_list_contained (l1, l2)
&& attribute_list_contained (l2, l1);
@@ -4772,9 +4778,9 @@ attribute_list_equal (tree l1, tree l2)
correctly. */
int
-attribute_list_contained (tree l1, tree l2)
+attribute_list_contained (const_tree l1, const_tree l2)
{
- tree t1, t2;
+ const_tree t1, t2;
/* First check the obvious, maybe the lists are identical. */
if (l1 == l2)
@@ -4793,11 +4799,11 @@ attribute_list_contained (tree l1, tree l2)
for (; t2 != 0; t2 = TREE_CHAIN (t2))
{
- tree attr;
- for (attr = lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (t2)), l1);
+ const_tree attr;
+ for (attr = const_lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (t2)), l1);
attr != NULL_TREE;
- attr = lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
- TREE_CHAIN (attr)))
+ attr = const_lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
+ TREE_CHAIN (attr)))
{
if (TREE_VALUE (t2) != NULL
&& TREE_CODE (TREE_VALUE (t2)) == TREE_LIST
@@ -6359,7 +6365,7 @@ get_type_static_bounds (const_tree type, mpz_t min, mpz_t max)
variable defined in function FN. */
bool
-auto_var_in_fn_p (tree var, tree fn)
+auto_var_in_fn_p (const_tree var, const_tree fn)
{
return (DECL_P (var) && DECL_CONTEXT (var) == fn
&& (((TREE_CODE (var) == VAR_DECL || TREE_CODE (var) == PARM_DECL)
@@ -7973,7 +7979,7 @@ range_in_array_bounds_p (tree ref)
location. */
bool
-needs_to_live_in_memory (tree t)
+needs_to_live_in_memory (const_tree t)
{
if (TREE_CODE (t) == SSA_NAME)
t = SSA_NAME_VAR (t);
@@ -8642,10 +8648,10 @@ walk_tree_without_duplicates_1 (tree *tp, walk_tree_fn func, void *data,
empty statements. */
bool
-empty_body_p (tree stmt)
+empty_body_p (const_tree stmt)
{
- tree_stmt_iterator i;
- tree body;
+ const_tree_stmt_iterator i;
+ const_tree body;
if (IS_EMPTY_STMT (stmt))
return true;
@@ -8656,8 +8662,8 @@ empty_body_p (tree stmt)
else
return false;
- for (i = tsi_start (body); !tsi_end_p (i); tsi_next (&i))
- if (!empty_body_p (tsi_stmt (i)))
+ for (i = ctsi_start (body); !ctsi_end_p (i); ctsi_next (&i))
+ if (!empty_body_p (ctsi_stmt (i)))
return false;
return true;
diff --git a/gcc/tree.h b/gcc/tree.h
index 18cef504e72..4985fa903d6 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -2311,7 +2311,7 @@ struct tree_type GTY(())
tree reference_to;
union tree_type_symtab {
int GTY ((tag ("0"))) address;
- char * GTY ((tag ("1"))) pointer;
+ const char * GTY ((tag ("1"))) pointer;
struct die_struct * GTY ((tag ("2"))) die;
} GTY ((desc ("debug_hooks == &sdb_debug_hooks ? 1 : debug_hooks == &dwarf2_debug_hooks ? 2 : 0"),
descbits ("2"))) symtab;
@@ -3273,6 +3273,13 @@ struct tree_decl_non_common GTY(())
#define DECL_DECLARED_INLINE_P(NODE) \
(FUNCTION_DECL_CHECK (NODE)->function_decl.declared_inline_flag)
+/* Nonzero in a FUNCTION_DECL that should be always inlined by the inliner
+ disregarding size and cost heuristics. This is equivalent to using
+ the always_inline attribute without the required diagnostics if the
+ function cannot be inlined. */
+#define DECL_DISREGARD_INLINE_LIMITS(NODE) \
+ (FUNCTION_DECL_CHECK (NODE)->function_decl.disregard_inline_limits)
+
/* For FUNCTION_DECL, this holds a pointer to a structure ("struct function")
that describes the status of this function. */
#define DECL_STRUCT_FUNCTION(NODE) (FUNCTION_DECL_CHECK (NODE)->function_decl.f)
@@ -3299,27 +3306,33 @@ struct tree_function_decl GTY(())
{
struct tree_decl_non_common common;
+ struct function *f;
+
/* In a FUNCTION_DECL for which DECL_BUILT_IN holds, this is
- DECL_FUNCTION_CODE. Otherwise unused. */
- enum built_in_function function_code;
+ DECL_FUNCTION_CODE. Otherwise unused.
+ ??? The bitfield needs to be able to hold all target function
+ codes as well. */
+ ENUM_BITFIELD(built_in_function) function_code : 11;
+ ENUM_BITFIELD(built_in_class) built_in_class : 2;
unsigned static_ctor_flag : 1;
unsigned static_dtor_flag : 1;
unsigned uninlinable : 1;
+
unsigned possibly_inlined : 1;
unsigned novops_flag : 1;
unsigned returns_twice_flag : 1;
unsigned malloc_flag : 1;
unsigned pure_flag : 1;
-
unsigned declared_inline_flag : 1;
unsigned regdecl_flag : 1;
unsigned inline_flag : 1;
+
unsigned no_instrument_function_entry_exit : 1;
unsigned no_limit_stack : 1;
- ENUM_BITFIELD(built_in_class) built_in_class : 2;
+ unsigned disregard_inline_limits : 1;
- struct function *f;
+ /* 5 bits left */
};
/* For a TYPE_DECL, holds the "original" type. (TREE_TYPE has the copy.) */
@@ -3998,8 +4011,8 @@ extern bool range_in_array_bounds_p (tree);
extern tree value_member (tree, tree);
extern tree purpose_member (const_tree, tree);
-extern int attribute_list_equal (tree, tree);
-extern int attribute_list_contained (tree, tree);
+extern int attribute_list_equal (const_tree, const_tree);
+extern int attribute_list_contained (const_tree, const_tree);
extern int tree_int_cst_equal (const_tree, const_tree);
extern int tree_int_cst_lt (const_tree, const_tree);
extern int tree_int_cst_compare (const_tree, const_tree);
@@ -4143,6 +4156,7 @@ extern int is_attribute_p (const char *, const_tree);
of the attribute or NULL_TREE if not found. */
extern tree lookup_attribute (const char *, tree);
+extern const_tree const_lookup_attribute (const char *, const_tree);
/* Remove any instances of attribute ATTR_NAME in LIST and return the
modified list. */
@@ -4606,11 +4620,11 @@ extern bool commutative_tree_code (enum tree_code);
extern tree upper_bound_in_type (tree, tree);
extern tree lower_bound_in_type (tree, tree);
extern int operand_equal_for_phi_arg_p (const_tree, const_tree);
-extern bool empty_body_p (tree);
+extern bool empty_body_p (const_tree);
extern tree call_expr_arg (tree, int);
extern tree *call_expr_argp (tree, int);
extern tree call_expr_arglist (tree);
-extern bool auto_var_in_fn_p (tree, tree);
+extern bool auto_var_in_fn_p (const_tree, const_tree);
/* In stmt.c */
@@ -4803,7 +4817,7 @@ extern void expand_function_start (tree);
extern void stack_protect_prologue (void);
extern void stack_protect_epilogue (void);
extern void recompute_tree_invariant_for_addr_expr (tree);
-extern bool needs_to_live_in_memory (tree);
+extern bool needs_to_live_in_memory (const_tree);
extern tree reconstruct_complex_type (tree, tree);
extern int real_onep (const_tree);
@@ -4858,7 +4872,7 @@ extern void free_temp_slots (void);
extern void pop_temp_slots (void);
extern void push_temp_slots (void);
extern void preserve_temp_slots (rtx);
-extern int aggregate_value_p (tree, tree);
+extern int aggregate_value_p (const_tree, const_tree);
extern void push_function_context (void);
extern void pop_function_context (void);
extern void push_function_context_to (tree);
@@ -4921,8 +4935,8 @@ extern int call_expr_flags (const_tree);
extern int setjmp_call_p (const_tree);
extern bool alloca_call_p (const_tree);
-extern bool must_pass_in_stack_var_size (enum machine_mode, tree);
-extern bool must_pass_in_stack_var_size_or_pad (enum machine_mode, tree);
+extern bool must_pass_in_stack_var_size (enum machine_mode, const_tree);
+extern bool must_pass_in_stack_var_size_or_pad (enum machine_mode, const_tree);
/* In attribs.c. */
@@ -5142,8 +5156,8 @@ extern tree tree_mem_ref_addr (tree, tree);
extern void copy_mem_ref_info (tree, tree);
/* In tree-vrp.c */
-extern bool ssa_name_nonzero_p (tree);
-extern bool ssa_name_nonnegative_p (tree);
+extern bool ssa_name_nonzero_p (const_tree);
+extern bool ssa_name_nonnegative_p (const_tree);
/* In tree-object-size.c. */
extern void init_object_sizes (void);
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index 937688fad4a..124a3c866b1 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -1392,13 +1392,13 @@ tree_stringops_transform (block_stmt_iterator *bsi)
case BUILT_IN_MEMSET:
if (!can_store_by_pieces (val, builtin_memset_read_str,
CALL_EXPR_ARG (call, 1),
- dest_align))
+ dest_align, true))
return false;
break;
case BUILT_IN_BZERO:
if (!can_store_by_pieces (val, builtin_memset_read_str,
integer_zero_node,
- dest_align))
+ dest_align, true))
return false;
break;
default:
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 2ec4f2b876a..29e6649db0a 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -1056,7 +1056,7 @@ decode_reg_name (const char *asmspec)
/* Return true if DECL's initializer is suitable for a BSS section. */
static bool
-bss_initializer_p (tree decl)
+bss_initializer_p (const_tree decl)
{
return (DECL_INITIAL (decl) == NULL
|| DECL_INITIAL (decl) == error_mark_node
@@ -2570,11 +2570,17 @@ assemble_integer (rtx x, unsigned int size, unsigned int align, int force)
enum machine_mode omode, imode;
unsigned int subalign;
unsigned int subsize, i;
+ unsigned char mclass;
subsize = size > UNITS_PER_WORD? UNITS_PER_WORD : 1;
subalign = MIN (align, subsize * BITS_PER_UNIT);
- omode = mode_for_size (subsize * BITS_PER_UNIT, MODE_INT, 0);
- imode = mode_for_size (size * BITS_PER_UNIT, MODE_INT, 0);
+ if (GET_CODE (x) == CONST_FIXED)
+ mclass = GET_MODE_CLASS (GET_MODE (x));
+ else
+ mclass = MODE_INT;
+
+ omode = mode_for_size (subsize * BITS_PER_UNIT, mclass, 0);
+ imode = mode_for_size (size * BITS_PER_UNIT, mclass, 0);
for (i = 0; i < size; i += subsize)
{
@@ -2686,6 +2692,7 @@ decode_addr_const (tree exp, struct addr_const *value)
break;
case REAL_CST:
+ case FIXED_CST:
case STRING_CST:
case COMPLEX_CST:
case CONSTRUCTOR:
@@ -2757,6 +2764,9 @@ const_hash_1 (const tree exp)
case REAL_CST:
return real_hash (TREE_REAL_CST_PTR (exp));
+ case FIXED_CST:
+ return fixed_hash (TREE_FIXED_CST_PTR (exp));
+
case STRING_CST:
p = TREE_STRING_POINTER (exp);
len = TREE_STRING_LENGTH (exp);
@@ -2875,6 +2885,13 @@ compare_constant (const tree t1, const tree t2)
return REAL_VALUES_IDENTICAL (TREE_REAL_CST (t1), TREE_REAL_CST (t2));
+ case FIXED_CST:
+ /* Fixed constants are the same only if the same width of type. */
+ if (TYPE_PRECISION (TREE_TYPE (t1)) != TYPE_PRECISION (TREE_TYPE (t2)))
+ return 0;
+
+ return FIXED_VALUES_IDENTICAL (TREE_FIXED_CST (t1), TREE_FIXED_CST (t2));
+
case STRING_CST:
if (TYPE_MODE (TREE_TYPE (t1)) != TYPE_MODE (TREE_TYPE (t2)))
return 0;
@@ -3001,6 +3018,7 @@ copy_constant (tree exp)
case INTEGER_CST:
case REAL_CST:
+ case FIXED_CST:
case STRING_CST:
return copy_node (exp);
@@ -3395,6 +3413,10 @@ const_rtx_hash_1 (rtx *xp, void *data)
h ^= real_hash (CONST_DOUBLE_REAL_VALUE (x));
break;
+ case CONST_FIXED:
+ h ^= fixed_hash (CONST_FIXED_VALUE (x));
+ break;
+
case CONST_VECTOR:
{
int i;
@@ -3636,11 +3658,19 @@ output_constant_pool_2 (enum machine_mode mode, rtx x, unsigned int align)
case MODE_INT:
case MODE_PARTIAL_INT:
+ case MODE_FRACT:
+ case MODE_UFRACT:
+ case MODE_ACCUM:
+ case MODE_UACCUM:
assemble_integer (x, GET_MODE_SIZE (mode), align, 1);
break;
case MODE_VECTOR_FLOAT:
case MODE_VECTOR_INT:
+ case MODE_VECTOR_FRACT:
+ case MODE_VECTOR_UFRACT:
+ case MODE_VECTOR_ACCUM:
+ case MODE_VECTOR_UACCUM:
{
int i, units;
enum machine_mode submode = GET_MODE_INNER (mode);
@@ -4058,6 +4088,7 @@ initializer_constant_valid_p (tree value, tree endtype)
case INTEGER_CST:
case VECTOR_CST:
case REAL_CST:
+ case FIXED_CST:
case STRING_CST:
case COMPLEX_CST:
return null_pointer_node;
@@ -4381,10 +4412,11 @@ output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align)
case POINTER_TYPE:
case REFERENCE_TYPE:
case OFFSET_TYPE:
+ case FIXED_POINT_TYPE:
if (! assemble_integer (expand_expr (exp, NULL_RTX, VOIDmode,
EXPAND_INITIALIZER),
MIN (size, thissize), align, 0))
- error ("initializer for integer value is too complicated");
+ error ("initializer for integer/fixed-point value is too complicated");
break;
case REAL_TYPE:
@@ -5512,7 +5544,7 @@ init_varasm_once (void)
}
enum tls_model
-decl_default_tls_model (tree decl)
+decl_default_tls_model (const_tree decl)
{
enum tls_model kind;
bool is_local;
@@ -5752,7 +5784,7 @@ default_select_section (tree decl, int reloc,
}
enum section_category
-categorize_decl_for_section (tree decl, int reloc)
+categorize_decl_for_section (const_tree decl, int reloc)
{
enum section_category ret;
@@ -5834,7 +5866,7 @@ categorize_decl_for_section (tree decl, int reloc)
}
bool
-decl_readonly_section (tree decl, int reloc)
+decl_readonly_section (const_tree decl, int reloc)
{
switch (categorize_decl_for_section (decl, reloc))
{
@@ -6122,7 +6154,7 @@ default_asm_output_anchor (rtx symbol)
/* The default implementation of TARGET_USE_ANCHORS_FOR_SYMBOL_P. */
bool
-default_use_anchors_for_symbol_p (rtx symbol)
+default_use_anchors_for_symbol_p (const_rtx symbol)
{
section *sect;
tree decl;
@@ -6161,13 +6193,13 @@ default_use_anchors_for_symbol_p (rtx symbol)
wrt cross-module name binding. */
bool
-default_binds_local_p (tree exp)
+default_binds_local_p (const_tree exp)
{
return default_binds_local_p_1 (exp, flag_shlib);
}
bool
-default_binds_local_p_1 (tree exp, int shlib)
+default_binds_local_p_1 (const_tree exp, int shlib)
{
bool local_p;
diff --git a/gcc/varpool.c b/gcc/varpool.c
index 9be16417de4..719f212cbf5 100644
--- a/gcc/varpool.c
+++ b/gcc/varpool.c
@@ -57,8 +57,9 @@ struct varpool_node *varpool_nodes;
The queue is maintained via mark_needed_node, linked via node->next_needed
pointer.
- LAST_NNEDED_NODE points to the end of queue, so it can be maintained in forward
- order. QTY is needed to make it friendly to PCH.
+ LAST_NEEDED_NODE points to the end of queue, so it can be
+ maintained in forward order. QTY is needed to make it friendly to
+ PCH.
During unit-at-a-time compilation we construct the queue of needed variables
twice: first time it is during cgraph construction, second time it is at the
diff --git a/gcc/vmsdbgout.c b/gcc/vmsdbgout.c
index e865eb14297..27197c17f7e 100644
--- a/gcc/vmsdbgout.c
+++ b/gcc/vmsdbgout.c
@@ -149,13 +149,13 @@ static char *full_name (const char *);
static unsigned int lookup_filename (const char *);
static void addr_const_to_string (char *, rtx);
static int write_debug_header (DST_HEADER *, const char *, int);
-static int write_debug_addr (char *, const char *, int);
+static int write_debug_addr (const char *, const char *, int);
static int write_debug_data1 (unsigned int, const char *, int);
static int write_debug_data2 (unsigned int, const char *, int);
static int write_debug_data4 (unsigned long, const char *, int);
static int write_debug_data8 (unsigned long long, const char *, int);
-static int write_debug_delta4 (char *, char *, const char *, int);
-static int write_debug_string (char *, const char *, int);
+static int write_debug_delta4 (const char *, const char *, const char *, int);
+static int write_debug_string (const char *, const char *, int);
static int write_modbeg (int);
static int write_modend (int);
static int write_rtnbeg (int, int);
@@ -172,7 +172,7 @@ static void vmsdbgout_start_source_file (unsigned int, const char *);
static void vmsdbgout_end_source_file (unsigned int);
static void vmsdbgout_begin_block (unsigned int, unsigned int);
static void vmsdbgout_end_block (unsigned int, unsigned int);
-static bool vmsdbgout_ignore_block (tree);
+static bool vmsdbgout_ignore_block (const_tree);
static void vmsdbgout_source_line (unsigned int, const char *);
static void vmsdbgout_begin_prologue (unsigned int, const char *);
static void vmsdbgout_end_prologue (unsigned int, const char *);
@@ -381,7 +381,7 @@ static char text_end_label[MAX_ARTIFICIAL_LABEL_BYTES];
do \
{ \
register int slen = strlen(P); \
- register char *p = (P); \
+ register const char *p = (P); \
register int i; \
fprintf (FILE, "\t.ascii \""); \
for (i = 0; i < slen; i++) \
@@ -579,7 +579,7 @@ write_debug_header (DST_HEADER *header, const char *comment, int dosizeonly)
nonzero. */
static int
-write_debug_addr (char *symbol, const char *comment, int dosizeonly)
+write_debug_addr (const char *symbol, const char *comment, int dosizeonly)
{
if (!dosizeonly)
{
@@ -668,8 +668,8 @@ write_debug_data8 (unsigned long long data8, const char *comment,
DOSIZEONLY is nonzero. */
static int
-write_debug_delta4 (char *label1, char *label2, const char *comment,
- int dosizeonly)
+write_debug_delta4 (const char *label1, const char *label2,
+ const char *comment, int dosizeonly)
{
if (!dosizeonly)
{
@@ -687,7 +687,7 @@ write_debug_delta4 (char *label1, char *label2, const char *comment,
nonzero. */
static int
-write_debug_string (char *string, const char *comment, int dosizeonly)
+write_debug_string (const char *string, const char *comment, int dosizeonly)
{
if (!dosizeonly)
{
@@ -788,7 +788,7 @@ write_modend (int dosizeonly)
static int
write_rtnbeg (int rtnnum, int dosizeonly)
{
- char *rtnname;
+ const char *rtnname;
int rtnnamelen;
char *rtnentryname;
int totsize = 0;
@@ -797,7 +797,7 @@ write_rtnbeg (int rtnnum, int dosizeonly)
DST_PROLOG prolog;
vms_func_ref fde = &func_table[rtnnum];
- rtnname = (char *)fde->vms_func_name;
+ rtnname = fde->vms_func_name;
rtnnamelen = strlen (rtnname);
rtnentryname = concat (rtnname, "..en", NULL);
@@ -825,7 +825,7 @@ write_rtnbeg (int rtnnum, int dosizeonly)
dosizeonly);
totsize += write_debug_data1 (strlen (go), "length of main_name",
dosizeonly);
- totsize += write_debug_string ((char *) go, "main name", dosizeonly);
+ totsize += write_debug_string (go, "main name", dosizeonly);
}
/* The header length never includes the length byte. */
@@ -1363,7 +1363,7 @@ vmsdbgout_end_block (register unsigned line, register unsigned blocknum)
/* Not implemented in VMS Debug. */
static bool
-vmsdbgout_ignore_block (tree block)
+vmsdbgout_ignore_block (const_tree block)
{
bool retval = 0;
@@ -1441,7 +1441,7 @@ lookup_filename (const char *file_name)
static unsigned int last_file_lookup_index = 0;
register char *fn;
register unsigned i;
- char *fnam;
+ const char *fnam;
long long cdt;
long ebk;
short ffb;
@@ -1480,7 +1480,7 @@ lookup_filename (const char *file_name)
ebk = 0;
ffb = 0;
rfo = 0;
- fnam = (char *) "";
+ fnam = "";
flen = 0;
}
diff --git a/gcc/xcoffout.c b/gcc/xcoffout.c
index d1dc5a3a4db..fb99903b76d 100644
--- a/gcc/xcoffout.c
+++ b/gcc/xcoffout.c
@@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. If not see
#include "output.h"
#include "ggc.h"
#include "target.h"
+#include "debug.h"
#ifdef XCOFF_DEBUGGING_INFO
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 7e8dfd5a642..c24f47e1eff 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,14 @@
+2007-08-30 Chao-ying Fu <fu@mips.com>
+
+ * expr.c (interpret_float_suffix): Support hr, r, lr, llr, uhr, ur,
+ ulr, ullr, hk, k, lk, llk, uhk, uk, ulk, ullk.
+ (cpp_classify_number): Support decimal fixed-point constants without
+ exponents.
+ Warn about fixed-point constants when -pedantic.
+ * include/cpplib.h (CPP_N_SMALL, CPP_N_MEDIUM, CPP_N_LARGE): Change
+ comments to support fixed-point values.
+ (CPP_N_FRACT, CPP_N_ACCUM): Define.
+
2007-08-18 Tom Tromey <tromey@redhat.com>
PR preprocessor/32974:
diff --git a/libcpp/expr.c b/libcpp/expr.c
index f20d50c3fdd..9df75332c05 100644
--- a/libcpp/expr.c
+++ b/libcpp/expr.c
@@ -83,12 +83,18 @@ static unsigned int
interpret_float_suffix (const uchar *s, size_t len)
{
size_t f, l, w, q, i, d;
+ size_t r, k, u, h;
f = l = w = q = i = d = 0;
+ r = k = u = h = 0;
while (len--)
switch (s[len])
{
+ case 'r': case 'R': r++; break;
+ case 'k': case 'K': k++; break;
+ case 'u': case 'U': u++; break;
+ case 'h': case 'H': h++; break;
case 'f': case 'F':
if (d > 0)
return 0;
@@ -98,6 +104,9 @@ interpret_float_suffix (const uchar *s, size_t len)
if (d > 0)
return 0;
l++;
+ /* If there are two Ls, they must be adjacent and the same case. */
+ if (l == 2 && s[len] != s[len + 1])
+ return 0;
break;
case 'w': case 'W':
if (d > 0)
@@ -116,7 +125,34 @@ interpret_float_suffix (const uchar *s, size_t len)
return 0;
}
- if (f + l + w + q > 1 || i > 1)
+ if (r + k > 1 || h > 1 || l > 2 || u > 1)
+ return 0;
+
+ if (r == 1)
+ {
+ if (f || i || d || w || q)
+ return 0;
+
+ return (CPP_N_FRACT
+ | (u ? CPP_N_UNSIGNED : 0)
+ | (h ? CPP_N_SMALL :
+ l == 2 ? CPP_N_LARGE :
+ l == 1 ? CPP_N_MEDIUM : 0));
+ }
+
+ if (k == 1)
+ {
+ if (f || i || d || w || q)
+ return 0;
+
+ return (CPP_N_ACCUM
+ | (u ? CPP_N_UNSIGNED : 0)
+ | (h ? CPP_N_SMALL :
+ l == 2 ? CPP_N_LARGE :
+ l == 1 ? CPP_N_MEDIUM : 0));
+ }
+
+ if (f + l + w + q > 1 || i > 1 || h + u > 0)
return 0;
/* Allow dd, df, dl suffixes for decimal float constants. */
@@ -238,6 +274,26 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token)
}
}
+ /* The suffix may be for decimal fixed-point constants without exponent. */
+ if (radix != 16 && float_flag == NOT_FLOAT)
+ {
+ result = interpret_float_suffix (str, limit - str);
+ if ((result & CPP_N_FRACT) || (result & CPP_N_ACCUM))
+ {
+ result |= CPP_N_FLOATING;
+ /* We need to restore the radix to 10, if the radix is 8. */
+ if (radix == 8)
+ radix = 10;
+
+ if (CPP_PEDANTIC (pfile))
+ cpp_error (pfile, CPP_DL_PEDWARN,
+ "fixed-point constants are a GCC extension");
+ goto syntax_ok;
+ }
+ else
+ result = 0;
+ }
+
if (float_flag != NOT_FLOAT && radix == 8)
radix = 10;
@@ -304,6 +360,10 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token)
return CPP_N_INVALID;
}
+ if ((result & (CPP_N_FRACT | CPP_N_ACCUM)) && CPP_PEDANTIC (pfile))
+ cpp_error (pfile, CPP_DL_PEDWARN,
+ "fixed-point constants are a GCC extension");
+
if ((result & CPP_N_DFLOAT) && CPP_PEDANTIC (pfile))
cpp_error (pfile, CPP_DL_PEDWARN,
"decimal float constants are a GCC extension");
@@ -343,6 +403,7 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token)
result |= CPP_N_INTEGER;
}
+ syntax_ok:
if ((result & CPP_N_IMAGINARY) && CPP_PEDANTIC (pfile))
cpp_error (pfile, CPP_DL_PEDWARN,
"imaginary constants are a GCC extension");
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index 2dac4c2d988..039dfbbf193 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -747,9 +747,10 @@ struct cpp_num
#define CPP_N_FLOATING 0x0002
#define CPP_N_WIDTH 0x00F0
-#define CPP_N_SMALL 0x0010 /* int, float. */
-#define CPP_N_MEDIUM 0x0020 /* long, double. */
-#define CPP_N_LARGE 0x0040 /* long long, long double. */
+#define CPP_N_SMALL 0x0010 /* int, float, shrot _Fract/Accum */
+#define CPP_N_MEDIUM 0x0020 /* long, double, long _Fract/_Accum. */
+#define CPP_N_LARGE 0x0040 /* long long, long double,
+ long long _Fract/Accum. */
#define CPP_N_WIDTH_MD 0xF0000 /* machine defined. */
#define CPP_N_MD_W 0x10000
@@ -765,6 +766,9 @@ struct cpp_num
#define CPP_N_IMAGINARY 0x2000
#define CPP_N_DFLOAT 0x4000
+#define CPP_N_FRACT 0x100000 /* Fract types. */
+#define CPP_N_ACCUM 0x200000 /* Accum types. */
+
/* Classify a CPP_NUMBER token. The return value is a combination of
the flags from the above sets. */
extern unsigned cpp_classify_number (cpp_reader *, const cpp_token *);
diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index 671100b4188..00e17a91e0a 100644
--- a/libffi/ChangeLog
+++ b/libffi/ChangeLog
@@ -1,3 +1,7 @@
+2007-08-24 David Daney <ddaney@avtrex.com>
+
+ * testsuite/libffi.call/return_sl.c: New test.
+
2007-08-10 David Daney <ddaney@avtrex.com>
* testsuite/libffi.call/cls_multi_ushort.c,
diff --git a/libffi/testsuite/libffi.call/return_sl.c b/libffi/testsuite/libffi.call/return_sl.c
new file mode 100644
index 00000000000..f0fd345f7a8
--- /dev/null
+++ b/libffi/testsuite/libffi.call/return_sl.c
@@ -0,0 +1,38 @@
+/* Area: ffi_call
+ Purpose: Check if long as return type is handled correctly.
+ Limitations: none.
+ PR: none.
+ */
+
+/* { dg-do run } */
+#include "ffitest.h"
+static long return_sl(long l1, long l2)
+{
+ return l1 - l2;
+}
+
+int main (void)
+{
+ ffi_cif cif;
+ ffi_type *args[MAX_ARGS];
+ void *values[MAX_ARGS];
+ ffi_arg res;
+ unsigned long l1, l2;
+
+ args[0] = &ffi_type_slong;
+ args[1] = &ffi_type_slong;
+ values[0] = &l1;
+ values[1] = &l2;
+
+ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2,
+ &ffi_type_slong, args) == FFI_OK);
+
+ l1 = 1073741823L;
+ l2 = 1073741824L;
+
+ ffi_call(&cif, FFI_FN(return_sl), &res, values);
+ printf("res: %ld, %ld\n", (long)res, l1 - l2);
+ /* { dg-output "res: -1, -1" } */
+
+ exit(0);
+}
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index d8cc555519a..84bb87644e1 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,7 @@
+2007-08-27 Hans Kester <hans.kester@ellips.nl>
+
+ * config.host : Add x86_64-elf target.
+
2007-07-06 H.J. Lu <hongjiu.lu@intel.com>
* configure.ac (set_have_cc_tls): Add a missing =.
diff --git a/libgcc/config.host b/libgcc/config.host
index 642f45fdbdd..e76dff5707a 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -310,6 +310,8 @@ x86_64-*-darwin*)
;;
i[34567]86-*-elf*)
;;
+x86_64-*-elf*)
+ ;;
i[34567]86-sequent-ptx4* | i[34567]86-sequent-sysv4*)
;;
i[34567]86-*-aout*)
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index de3d574fea4..aa1df6aa7a6 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,225 @@
+2007-08-29 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ * runtime/memory.c (internal_realloc, allocate, allocate_array,
+ deallocate): Remove functions.
+ * gfortran.map (_gfortran_allocate, _gfortran_allocate_array,
+ _gfortran_deallocate, _gfortran_internal_realloc): Remove symbols.
+ * libgfortran.h (error_codes): Add comment.
+
+2007-08-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/33055
+ Revert previous patch.
+
+2007-08-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ * io/write.c (stdbool.h): Add include. (sign_t): Move typedef to
+ new file write_float.def. Include write_float.def.
+ (extract_real): Delete. (calculate_sign): Delete.
+ (calculate_exp): Delete. (calculate_G_format): Delete.
+ (output_float): Delete. (write_float): Delete.
+ * io/write_float.def (calculate_sign): Added.
+ (output_float): Refactored to be independent of kind and added to this
+ file for inclusion. (write_infnan): New function to write "Infinite" or
+ "NaN" depending on flags passed, independent of kind.
+ (CALCULATE_EXP): New macro to build kind specific functions. Use it.
+ (OUTPUT_FLOAT_FMT_G): New macro, likewise. Use it.
+ (DTOA, DTOAL): Macros to implement "decimal to ascii".
+ (WRITE_FLOAT): New macro for kind specific write_float functions.
+ (write_float): Revised function to determine kind and use WRITE_FLOAT
+ to implement kind specific output.
+
+2007-08-26 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/33055
+ * io/inquire.c (inquire_via_unit): If inquiring by unit, check for
+ an error condition from the IOSTAT variable and set EXIST to false if
+ there was a bad unit number.
+
+2007-08-24 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/32972
+ * libgfortran.h: Remove GFOR_POINTER_L8_TO_L4 macro.
+ Add GFOR_POINTER_TO_L1 macro.
+ * m4/iforeach.m4(`m'name`'rtype_qual`_'atype_code):
+ Change argument 'mask' to gfc_array_l1. Adjust prototype.
+ Change mask pointer to GFC_LOGICAL_1. Multiply strides
+ by kind of mask
+ * m4/ifunction.m4: Likewise.
+ * intrinsics/pack_generic.c(pack_internal): Likewise.
+ * intrinsics/unpack_generic.c(unpack_internal): Likewise.
+ * m4/matmull.m4: Switch to GFC_LOGICAL_1. Multiply strides by
+ kind of logical arguments a and b.
+ * generated/matmul_l16.c: Regenerated.
+ * generated/matmul_l4.c: Regenerated.
+ * generated/matmul_l8.c: Regenerated.
+ * generated/maxloc0_16_i1.c: Regenerated.
+ * generated/maxloc0_16_i16.c: Regenerated.
+ * generated/maxloc0_16_i2.c: Regenerated.
+ * generated/maxloc0_16_i4.c: Regenerated.
+ * generated/maxloc0_16_i8.c: Regenerated.
+ * generated/maxloc0_16_r10.c: Regenerated.
+ * generated/maxloc0_16_r16.c: Regenerated.
+ * generated/maxloc0_16_r4.c: Regenerated.
+ * generated/maxloc0_16_r8.c: Regenerated.
+ * generated/maxloc0_4_i1.c: Regenerated.
+ * generated/maxloc0_4_i16.c: Regenerated.
+ * generated/maxloc0_4_i2.c: Regenerated.
+ * generated/maxloc0_4_i4.c: Regenerated.
+ * generated/maxloc0_4_i8.c: Regenerated.
+ * generated/maxloc0_4_r10.c: Regenerated.
+ * generated/maxloc0_4_r16.c: Regenerated.
+ * generated/maxloc0_4_r4.c: Regenerated.
+ * generated/maxloc0_4_r8.c: Regenerated.
+ * generated/maxloc0_8_i1.c: Regenerated.
+ * generated/maxloc0_8_i16.c: Regenerated.
+ * generated/maxloc0_8_i2.c: Regenerated.
+ * generated/maxloc0_8_i4.c: Regenerated.
+ * generated/maxloc0_8_i8.c: Regenerated.
+ * generated/maxloc0_8_r10.c: Regenerated.
+ * generated/maxloc0_8_r16.c: Regenerated.
+ * generated/maxloc0_8_r4.c: Regenerated.
+ * generated/maxloc0_8_r8.c: Regenerated.
+ * generated/maxloc1_16_i1.c: Regenerated.
+ * generated/maxloc1_16_i16.c: Regenerated.
+ * generated/maxloc1_16_i2.c: Regenerated.
+ * generated/maxloc1_16_i4.c: Regenerated.
+ * generated/maxloc1_16_i8.c: Regenerated.
+ * generated/maxloc1_16_r10.c: Regenerated.
+ * generated/maxloc1_16_r16.c: Regenerated.
+ * generated/maxloc1_16_r4.c: Regenerated.
+ * generated/maxloc1_16_r8.c: Regenerated.
+ * generated/maxloc1_4_i1.c: Regenerated.
+ * generated/maxloc1_4_i16.c: Regenerated.
+ * generated/maxloc1_4_i2.c: Regenerated.
+ * generated/maxloc1_4_i4.c: Regenerated.
+ * generated/maxloc1_4_i8.c: Regenerated.
+ * generated/maxloc1_4_r10.c: Regenerated.
+ * generated/maxloc1_4_r16.c: Regenerated.
+ * generated/maxloc1_4_r4.c: Regenerated.
+ * generated/maxloc1_4_r8.c: Regenerated.
+ * generated/maxloc1_8_i1.c: Regenerated.
+ * generated/maxloc1_8_i16.c: Regenerated.
+ * generated/maxloc1_8_i2.c: Regenerated.
+ * generated/maxloc1_8_i4.c: Regenerated.
+ * generated/maxloc1_8_i8.c: Regenerated.
+ * generated/maxloc1_8_r10.c: Regenerated.
+ * generated/maxloc1_8_r16.c: Regenerated.
+ * generated/maxloc1_8_r4.c: Regenerated.
+ * generated/maxloc1_8_r8.c: Regenerated.
+ * generated/maxval_i1.c: Regenerated.
+ * generated/maxval_i16.c: Regenerated.
+ * generated/maxval_i2.c: Regenerated.
+ * generated/maxval_i4.c: Regenerated.
+ * generated/maxval_i8.c: Regenerated.
+ * generated/maxval_r10.c: Regenerated.
+ * generated/maxval_r16.c: Regenerated.
+ * generated/maxval_r4.c: Regenerated.
+ * generated/maxval_r8.c: Regenerated.
+ * generated/minloc0_16_i1.c: Regenerated.
+ * generated/minloc0_16_i16.c: Regenerated.
+ * generated/minloc0_16_i2.c: Regenerated.
+ * generated/minloc0_16_i4.c: Regenerated.
+ * generated/minloc0_16_i8.c: Regenerated.
+ * generated/minloc0_16_r10.c: Regenerated.
+ * generated/minloc0_16_r16.c: Regenerated.
+ * generated/minloc0_16_r4.c: Regenerated.
+ * generated/minloc0_16_r8.c: Regenerated.
+ * generated/minloc0_4_i1.c: Regenerated.
+ * generated/minloc0_4_i16.c: Regenerated.
+ * generated/minloc0_4_i2.c: Regenerated.
+ * generated/minloc0_4_i4.c: Regenerated.
+ * generated/minloc0_4_i8.c: Regenerated.
+ * generated/minloc0_4_r10.c: Regenerated.
+ * generated/minloc0_4_r16.c: Regenerated.
+ * generated/minloc0_4_r4.c: Regenerated.
+ * generated/minloc0_4_r8.c: Regenerated.
+ * generated/minloc0_8_i1.c: Regenerated.
+ * generated/minloc0_8_i16.c: Regenerated.
+ * generated/minloc0_8_i2.c: Regenerated.
+ * generated/minloc0_8_i4.c: Regenerated.
+ * generated/minloc0_8_i8.c: Regenerated.
+ * generated/minloc0_8_r10.c: Regenerated.
+ * generated/minloc0_8_r16.c: Regenerated.
+ * generated/minloc0_8_r4.c: Regenerated.
+ * generated/minloc0_8_r8.c: Regenerated.
+ * generated/minloc1_16_i1.c: Regenerated.
+ * generated/minloc1_16_i16.c: Regenerated.
+ * generated/minloc1_16_i2.c: Regenerated.
+ * generated/minloc1_16_i4.c: Regenerated.
+ * generated/minloc1_16_i8.c: Regenerated.
+ * generated/minloc1_16_r10.c: Regenerated.
+ * generated/minloc1_16_r16.c: Regenerated.
+ * generated/minloc1_16_r4.c: Regenerated.
+ * generated/minloc1_16_r8.c: Regenerated.
+ * generated/minloc1_4_i1.c: Regenerated.
+ * generated/minloc1_4_i16.c: Regenerated.
+ * generated/minloc1_4_i2.c: Regenerated.
+ * generated/minloc1_4_i4.c: Regenerated.
+ * generated/minloc1_4_i8.c: Regenerated.
+ * generated/minloc1_4_r10.c: Regenerated.
+ * generated/minloc1_4_r16.c: Regenerated.
+ * generated/minloc1_4_r4.c: Regenerated.
+ * generated/minloc1_4_r8.c: Regenerated.
+ * generated/minloc1_8_i1.c: Regenerated.
+ * generated/minloc1_8_i16.c: Regenerated.
+ * generated/minloc1_8_i2.c: Regenerated.
+ * generated/minloc1_8_i4.c: Regenerated.
+ * generated/minloc1_8_i8.c: Regenerated.
+ * generated/minloc1_8_r10.c: Regenerated.
+ * generated/minloc1_8_r16.c: Regenerated.
+ * generated/minloc1_8_r4.c: Regenerated.
+ * generated/minloc1_8_r8.c: Regenerated.
+ * generated/minval_i1.c: Regenerated.
+ * generated/minval_i16.c: Regenerated.
+ * generated/minval_i2.c: Regenerated.
+ * generated/minval_i4.c: Regenerated.
+ * generated/minval_i8.c: Regenerated.
+ * generated/minval_r10.c: Regenerated.
+ * generated/minval_r16.c: Regenerated.
+ * generated/minval_r4.c: Regenerated.
+ * generated/minval_r8.c: Regenerated.
+ * generated/product_c10.c: Regenerated.
+ * generated/product_c16.c: Regenerated.
+ * generated/product_c4.c: Regenerated.
+ * generated/product_c8.c: Regenerated.
+ * generated/product_i1.c: Regenerated.
+ * generated/product_i16.c: Regenerated.
+ * generated/product_i2.c: Regenerated.
+ * generated/product_i4.c: Regenerated.
+ * generated/product_i8.c: Regenerated.
+ * generated/product_r10.c: Regenerated.
+ * generated/product_r16.c: Regenerated.
+ * generated/product_r4.c: Regenerated.
+ * generated/product_r8.c: Regenerated.
+ * generated/sum_c10.c: Regenerated.
+ * generated/sum_c16.c: Regenerated.
+ * generated/sum_c4.c: Regenerated.
+ * generated/sum_c8.c: Regenerated.
+ * generated/sum_i1.c: Regenerated.
+ * generated/sum_i16.c: Regenerated.
+ * generated/sum_i2.c: Regenerated.
+ * generated/sum_i4.c: Regenerated.
+ * generated/sum_i8.c: Regenerated.
+ * generated/sum_r10.c: Regenerated.
+ * generated/sum_r16.c: Regenerated.
+ * generated/sum_r4.c: Regenerated.
+ * generated/sum_r8.c: Regenerated.
+
+2007-08-23 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR libfortran/23138
+ * acinclude.m4 (LIBGFOR_CHECK_MINGW_SNPRINTF): New check.
+ * configure.ac: Use LIBGFOR_CHECK_MINGW_SNPRINTF.
+ * libgfortran.h: If HAVE_MINGW_SNPRINTF is true, use __mingw_snprintf
+ instead of snprintf.
+ * config.h.in: Regenerate.
+ * configure: Regenerate.
+
+2007-08-22 Bernhard Fischer <rep.dot.nop@gmail.com>
+
+ * libgfortran/Makefile.am (AM_CPPFLAGS): Commentary typo fix.
+
2007-08-17 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/33079
diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index ba81c75f238..aa2629e2d2d 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -22,7 +22,7 @@ myexeclibdir = $(libdir)/gcc/$(target_alias)/$(gcc_version)$(MULTISUBDIR)
libgfortranbegin_la_SOURCES = fmain.c
libgfortranbegin_la_LDFLAGS = -static
-## io.h conflicts with some a system header on some platforms, so
+## io.h conflicts with a system header on some platforms, so
## use -iquote
AM_CPPFLAGS = -iquote$(srcdir)/io -I$(srcdir)/$(MULTISRCTOP)../gcc \
-I$(srcdir)/$(MULTISRCTOP)../gcc/config \
diff --git a/libgfortran/acinclude.m4 b/libgfortran/acinclude.m4
index 1270a98c04e..40ce53560b3 100644
--- a/libgfortran/acinclude.m4
+++ b/libgfortran/acinclude.m4
@@ -386,3 +386,19 @@ AC_DEFUN([LIBGFOR_CHECK_FPSETMASK], [
AC_DEFINE(HAVE_FPSETMASK, 1, [Define if you have fpsetmask.])
fi
])
+
+dnl Check whether we have a mingw that provides a __mingw_snprintf function
+AC_DEFUN([LIBGFOR_CHECK_MINGW_SNPRINTF], [
+ AC_CACHE_CHECK([whether __mingw_snprintf is present], have_mingw_snprintf, [
+ AC_TRY_LINK([
+#include <stdio.h>
+extern int __mingw_snprintf (char *, size_t, const char *, ...);
+],[
+__mingw_snprintf (NULL, 0, "%d\n", 1);
+],
+ eval "have_mingw_snprintf=yes", eval "have_mingw_snprintf=no")
+ ])
+ if test x"$have_mingw_snprintf" = xyes; then
+ AC_DEFINE(HAVE_MINGW_SNPRINTF, 1, [Define if you have __mingw_snprintf.])
+ fi
+])
diff --git a/libgfortran/config.h.in b/libgfortran/config.h.in
index 4099c39894f..877fc5a6e01 100644
--- a/libgfortran/config.h.in
+++ b/libgfortran/config.h.in
@@ -522,6 +522,9 @@
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
+/* Define if you have __mingw_snprintf. */
+#undef HAVE_MINGW_SNPRINTF
+
/* Define to 1 if you have the `mkstemp' function. */
#undef HAVE_MKSTEMP
diff --git a/libgfortran/configure b/libgfortran/configure
index c68cb7436b7..f71c5900f2e 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -31797,6 +31797,83 @@ _ACEOF
fi
+# Check whether __mingw_snprintf() is present
+
+ echo "$as_me:$LINENO: checking whether __mingw_snprintf is present" >&5
+echo $ECHO_N "checking whether __mingw_snprintf is present... $ECHO_C" >&6
+if test "${have_mingw_snprintf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <stdio.h>
+extern int __mingw_snprintf (char *, size_t, const char *, ...);
+
+int
+main ()
+{
+
+__mingw_snprintf (NULL, 0, "%d\n", 1);
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "have_mingw_snprintf=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "have_mingw_snprintf=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+fi
+echo "$as_me:$LINENO: result: $have_mingw_snprintf" >&5
+echo "${ECHO_T}$have_mingw_snprintf" >&6
+ if test x"$have_mingw_snprintf" = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MINGW_SNPRINTF 1
+_ACEOF
+
+ fi
+
+
# Check for GNU libc feenableexcept
echo "$as_me:$LINENO: checking for feenableexcept in -lm" >&5
echo $ECHO_N "checking for feenableexcept in -lm... $ECHO_C" >&6
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 8709e16472b..8aa3b637785 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -383,6 +383,9 @@ LIBGFOR_CHECK_FOR_BROKEN_FPCLASSIFY
# Check whether the system has a working stat()
LIBGFOR_CHECK_WORKING_STAT
+# Check whether __mingw_snprintf() is present
+LIBGFOR_CHECK_MINGW_SNPRINTF
+
# Check for GNU libc feenableexcept
AC_CHECK_LIB([m],[feenableexcept],[have_feenableexcept=yes AC_DEFINE([HAVE_FEENABLEEXCEPT],[1],[libm includes feenableexcept])])
diff --git a/libgfortran/generated/matmul_l16.c b/libgfortran/generated/matmul_l16.c
index 7e7f2f9c658..f4fb0b3770e 100644
--- a/libgfortran/generated/matmul_l16.c
+++ b/libgfortran/generated/matmul_l16.c
@@ -39,15 +39,15 @@ Boston, MA 02110-1301, USA. */
Either a or b can be rank 1. In this case x or y is 1. */
extern void matmul_l16 (gfc_array_l16 * const restrict,
- gfc_array_l4 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict, gfc_array_l1 * const restrict);
export_proto(matmul_l16);
void
matmul_l16 (gfc_array_l16 * const restrict retarray,
- gfc_array_l4 * const restrict a, gfc_array_l4 * const restrict b)
+ gfc_array_l1 * const restrict a, gfc_array_l1 * const restrict b)
{
- const GFC_INTEGER_4 * restrict abase;
- const GFC_INTEGER_4 * restrict bbase;
+ const GFC_LOGICAL_1 * restrict abase;
+ const GFC_LOGICAL_1 * restrict bbase;
GFC_LOGICAL_16 * restrict dest;
index_type rxstride;
index_type rystride;
@@ -57,9 +57,11 @@ matmul_l16 (gfc_array_l16 * const restrict retarray,
index_type ystride;
index_type x;
index_type y;
+ int a_kind;
+ int b_kind;
- const GFC_INTEGER_4 * restrict pa;
- const GFC_INTEGER_4 * restrict pb;
+ const GFC_LOGICAL_1 * restrict pa;
+ const GFC_LOGICAL_1 * restrict pb;
index_type astride;
index_type bstride;
index_type count;
@@ -99,17 +101,29 @@ matmul_l16 (gfc_array_l16 * const restrict retarray,
}
abase = a->data;
- if (GFC_DESCRIPTOR_SIZE (a) != 4)
- {
- assert (GFC_DESCRIPTOR_SIZE (a) == 8);
- abase = GFOR_POINTER_L8_TO_L4 (abase);
- }
+ a_kind = GFC_DESCRIPTOR_SIZE (a);
+
+ if (a_kind == 1 || a_kind == 2 || a_kind == 4 || a_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || a_kind == 16
+#endif
+ )
+ abase = GFOR_POINTER_TO_L1 (abase, a_kind);
+ else
+ internal_error (NULL, "Funny sized logical array");
+
bbase = b->data;
- if (GFC_DESCRIPTOR_SIZE (b) != 4)
- {
- assert (GFC_DESCRIPTOR_SIZE (b) == 8);
- bbase = GFOR_POINTER_L8_TO_L4 (bbase);
- }
+ b_kind = GFC_DESCRIPTOR_SIZE (b);
+
+ if (b_kind == 1 || b_kind == 2 || b_kind == 4 || b_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || b_kind == 16
+#endif
+ )
+ bbase = GFOR_POINTER_TO_L1 (bbase, b_kind);
+ else
+ internal_error (NULL, "Funny sized logical array");
+
dest = retarray->data;
@@ -128,7 +142,7 @@ matmul_l16 (gfc_array_l16 * const restrict retarray,
one. */
if (GFC_DESCRIPTOR_RANK (a) == 1)
{
- astride = a->dim[0].stride;
+ astride = a->dim[0].stride * a_kind;
count = a->dim[0].ubound + 1 - a->dim[0].lbound;
xstride = 0;
rxstride = 0;
@@ -136,14 +150,14 @@ matmul_l16 (gfc_array_l16 * const restrict retarray,
}
else
{
- astride = a->dim[1].stride;
+ astride = a->dim[1].stride * a_kind;
count = a->dim[1].ubound + 1 - a->dim[1].lbound;
xstride = a->dim[0].stride;
xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
}
if (GFC_DESCRIPTOR_RANK (b) == 1)
{
- bstride = b->dim[0].stride;
+ bstride = b->dim[0].stride * b_kind;
assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
ystride = 0;
rystride = 0;
@@ -151,7 +165,7 @@ matmul_l16 (gfc_array_l16 * const restrict retarray,
}
else
{
- bstride = b->dim[0].stride;
+ bstride = b->dim[0].stride * b_kind;
assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
ystride = b->dim[1].stride;
ycount = b->dim[1].ubound + 1 - b->dim[1].lbound;
@@ -189,3 +203,4 @@ matmul_l16 (gfc_array_l16 * const restrict retarray,
}
#endif
+
diff --git a/libgfortran/generated/matmul_l4.c b/libgfortran/generated/matmul_l4.c
index 8428ff9dc0b..0b822f63e4d 100644
--- a/libgfortran/generated/matmul_l4.c
+++ b/libgfortran/generated/matmul_l4.c
@@ -39,15 +39,15 @@ Boston, MA 02110-1301, USA. */
Either a or b can be rank 1. In this case x or y is 1. */
extern void matmul_l4 (gfc_array_l4 * const restrict,
- gfc_array_l4 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict, gfc_array_l1 * const restrict);
export_proto(matmul_l4);
void
matmul_l4 (gfc_array_l4 * const restrict retarray,
- gfc_array_l4 * const restrict a, gfc_array_l4 * const restrict b)
+ gfc_array_l1 * const restrict a, gfc_array_l1 * const restrict b)
{
- const GFC_INTEGER_4 * restrict abase;
- const GFC_INTEGER_4 * restrict bbase;
+ const GFC_LOGICAL_1 * restrict abase;
+ const GFC_LOGICAL_1 * restrict bbase;
GFC_LOGICAL_4 * restrict dest;
index_type rxstride;
index_type rystride;
@@ -57,9 +57,11 @@ matmul_l4 (gfc_array_l4 * const restrict retarray,
index_type ystride;
index_type x;
index_type y;
+ int a_kind;
+ int b_kind;
- const GFC_INTEGER_4 * restrict pa;
- const GFC_INTEGER_4 * restrict pb;
+ const GFC_LOGICAL_1 * restrict pa;
+ const GFC_LOGICAL_1 * restrict pb;
index_type astride;
index_type bstride;
index_type count;
@@ -99,17 +101,29 @@ matmul_l4 (gfc_array_l4 * const restrict retarray,
}
abase = a->data;
- if (GFC_DESCRIPTOR_SIZE (a) != 4)
- {
- assert (GFC_DESCRIPTOR_SIZE (a) == 8);
- abase = GFOR_POINTER_L8_TO_L4 (abase);
- }
+ a_kind = GFC_DESCRIPTOR_SIZE (a);
+
+ if (a_kind == 1 || a_kind == 2 || a_kind == 4 || a_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || a_kind == 16
+#endif
+ )
+ abase = GFOR_POINTER_TO_L1 (abase, a_kind);
+ else
+ internal_error (NULL, "Funny sized logical array");
+
bbase = b->data;
- if (GFC_DESCRIPTOR_SIZE (b) != 4)
- {
- assert (GFC_DESCRIPTOR_SIZE (b) == 8);
- bbase = GFOR_POINTER_L8_TO_L4 (bbase);
- }
+ b_kind = GFC_DESCRIPTOR_SIZE (b);
+
+ if (b_kind == 1 || b_kind == 2 || b_kind == 4 || b_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || b_kind == 16
+#endif
+ )
+ bbase = GFOR_POINTER_TO_L1 (bbase, b_kind);
+ else
+ internal_error (NULL, "Funny sized logical array");
+
dest = retarray->data;
@@ -128,7 +142,7 @@ matmul_l4 (gfc_array_l4 * const restrict retarray,
one. */
if (GFC_DESCRIPTOR_RANK (a) == 1)
{
- astride = a->dim[0].stride;
+ astride = a->dim[0].stride * a_kind;
count = a->dim[0].ubound + 1 - a->dim[0].lbound;
xstride = 0;
rxstride = 0;
@@ -136,14 +150,14 @@ matmul_l4 (gfc_array_l4 * const restrict retarray,
}
else
{
- astride = a->dim[1].stride;
+ astride = a->dim[1].stride * a_kind;
count = a->dim[1].ubound + 1 - a->dim[1].lbound;
xstride = a->dim[0].stride;
xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
}
if (GFC_DESCRIPTOR_RANK (b) == 1)
{
- bstride = b->dim[0].stride;
+ bstride = b->dim[0].stride * b_kind;
assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
ystride = 0;
rystride = 0;
@@ -151,7 +165,7 @@ matmul_l4 (gfc_array_l4 * const restrict retarray,
}
else
{
- bstride = b->dim[0].stride;
+ bstride = b->dim[0].stride * b_kind;
assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
ystride = b->dim[1].stride;
ycount = b->dim[1].ubound + 1 - b->dim[1].lbound;
@@ -189,3 +203,4 @@ matmul_l4 (gfc_array_l4 * const restrict retarray,
}
#endif
+
diff --git a/libgfortran/generated/matmul_l8.c b/libgfortran/generated/matmul_l8.c
index 76dee0a48d7..2fe09830760 100644
--- a/libgfortran/generated/matmul_l8.c
+++ b/libgfortran/generated/matmul_l8.c
@@ -39,15 +39,15 @@ Boston, MA 02110-1301, USA. */
Either a or b can be rank 1. In this case x or y is 1. */
extern void matmul_l8 (gfc_array_l8 * const restrict,
- gfc_array_l4 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict, gfc_array_l1 * const restrict);
export_proto(matmul_l8);
void
matmul_l8 (gfc_array_l8 * const restrict retarray,
- gfc_array_l4 * const restrict a, gfc_array_l4 * const restrict b)
+ gfc_array_l1 * const restrict a, gfc_array_l1 * const restrict b)
{
- const GFC_INTEGER_4 * restrict abase;
- const GFC_INTEGER_4 * restrict bbase;
+ const GFC_LOGICAL_1 * restrict abase;
+ const GFC_LOGICAL_1 * restrict bbase;
GFC_LOGICAL_8 * restrict dest;
index_type rxstride;
index_type rystride;
@@ -57,9 +57,11 @@ matmul_l8 (gfc_array_l8 * const restrict retarray,
index_type ystride;
index_type x;
index_type y;
+ int a_kind;
+ int b_kind;
- const GFC_INTEGER_4 * restrict pa;
- const GFC_INTEGER_4 * restrict pb;
+ const GFC_LOGICAL_1 * restrict pa;
+ const GFC_LOGICAL_1 * restrict pb;
index_type astride;
index_type bstride;
index_type count;
@@ -99,17 +101,29 @@ matmul_l8 (gfc_array_l8 * const restrict retarray,
}
abase = a->data;
- if (GFC_DESCRIPTOR_SIZE (a) != 4)
- {
- assert (GFC_DESCRIPTOR_SIZE (a) == 8);
- abase = GFOR_POINTER_L8_TO_L4 (abase);
- }
+ a_kind = GFC_DESCRIPTOR_SIZE (a);
+
+ if (a_kind == 1 || a_kind == 2 || a_kind == 4 || a_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || a_kind == 16
+#endif
+ )
+ abase = GFOR_POINTER_TO_L1 (abase, a_kind);
+ else
+ internal_error (NULL, "Funny sized logical array");
+
bbase = b->data;
- if (GFC_DESCRIPTOR_SIZE (b) != 4)
- {
- assert (GFC_DESCRIPTOR_SIZE (b) == 8);
- bbase = GFOR_POINTER_L8_TO_L4 (bbase);
- }
+ b_kind = GFC_DESCRIPTOR_SIZE (b);
+
+ if (b_kind == 1 || b_kind == 2 || b_kind == 4 || b_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || b_kind == 16
+#endif
+ )
+ bbase = GFOR_POINTER_TO_L1 (bbase, b_kind);
+ else
+ internal_error (NULL, "Funny sized logical array");
+
dest = retarray->data;
@@ -128,7 +142,7 @@ matmul_l8 (gfc_array_l8 * const restrict retarray,
one. */
if (GFC_DESCRIPTOR_RANK (a) == 1)
{
- astride = a->dim[0].stride;
+ astride = a->dim[0].stride * a_kind;
count = a->dim[0].ubound + 1 - a->dim[0].lbound;
xstride = 0;
rxstride = 0;
@@ -136,14 +150,14 @@ matmul_l8 (gfc_array_l8 * const restrict retarray,
}
else
{
- astride = a->dim[1].stride;
+ astride = a->dim[1].stride * a_kind;
count = a->dim[1].ubound + 1 - a->dim[1].lbound;
xstride = a->dim[0].stride;
xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
}
if (GFC_DESCRIPTOR_RANK (b) == 1)
{
- bstride = b->dim[0].stride;
+ bstride = b->dim[0].stride * b_kind;
assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
ystride = 0;
rystride = 0;
@@ -151,7 +165,7 @@ matmul_l8 (gfc_array_l8 * const restrict retarray,
}
else
{
- bstride = b->dim[0].stride;
+ bstride = b->dim[0].stride * b_kind;
assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
ystride = b->dim[1].stride;
ycount = b->dim[1].ubound + 1 - b->dim[1].lbound;
@@ -189,3 +203,4 @@ matmul_l8 (gfc_array_l8 * const restrict retarray,
}
#endif
+
diff --git a/libgfortran/generated/maxloc0_16_i1.c b/libgfortran/generated/maxloc0_16_i1.c
index 37b0bb06614..aa52dece020 100644
--- a/libgfortran/generated/maxloc0_16_i1.c
+++ b/libgfortran/generated/maxloc0_16_i1.c
@@ -148,13 +148,13 @@ maxloc0_16_i1 (gfc_array_i16 * const restrict retarray,
extern void mmaxloc0_16_i1 (gfc_array_i16 * const restrict,
- gfc_array_i1 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i1 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_16_i1);
void
mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray,
gfc_array_i1 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray,
index_type dstride;
GFC_INTEGER_16 *dest;
const GFC_INTEGER_1 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_16_i16.c b/libgfortran/generated/maxloc0_16_i16.c
index efd421b053c..30c91f5736c 100644
--- a/libgfortran/generated/maxloc0_16_i16.c
+++ b/libgfortran/generated/maxloc0_16_i16.c
@@ -148,13 +148,13 @@ maxloc0_16_i16 (gfc_array_i16 * const restrict retarray,
extern void mmaxloc0_16_i16 (gfc_array_i16 * const restrict,
- gfc_array_i16 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i16 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_16_i16);
void
mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray,
gfc_array_i16 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray,
index_type dstride;
GFC_INTEGER_16 *dest;
const GFC_INTEGER_16 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_16_i2.c b/libgfortran/generated/maxloc0_16_i2.c
index df2466b7776..bf55fbd1d2d 100644
--- a/libgfortran/generated/maxloc0_16_i2.c
+++ b/libgfortran/generated/maxloc0_16_i2.c
@@ -148,13 +148,13 @@ maxloc0_16_i2 (gfc_array_i16 * const restrict retarray,
extern void mmaxloc0_16_i2 (gfc_array_i16 * const restrict,
- gfc_array_i2 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i2 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_16_i2);
void
mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray,
gfc_array_i2 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray,
index_type dstride;
GFC_INTEGER_16 *dest;
const GFC_INTEGER_2 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_16_i4.c b/libgfortran/generated/maxloc0_16_i4.c
index 0154bf37c33..ffe10a8e0cc 100644
--- a/libgfortran/generated/maxloc0_16_i4.c
+++ b/libgfortran/generated/maxloc0_16_i4.c
@@ -148,13 +148,13 @@ maxloc0_16_i4 (gfc_array_i16 * const restrict retarray,
extern void mmaxloc0_16_i4 (gfc_array_i16 * const restrict,
- gfc_array_i4 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i4 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_16_i4);
void
mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray,
gfc_array_i4 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray,
index_type dstride;
GFC_INTEGER_16 *dest;
const GFC_INTEGER_4 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_16_i8.c b/libgfortran/generated/maxloc0_16_i8.c
index 8f7804b201d..9f619178d4e 100644
--- a/libgfortran/generated/maxloc0_16_i8.c
+++ b/libgfortran/generated/maxloc0_16_i8.c
@@ -148,13 +148,13 @@ maxloc0_16_i8 (gfc_array_i16 * const restrict retarray,
extern void mmaxloc0_16_i8 (gfc_array_i16 * const restrict,
- gfc_array_i8 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i8 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_16_i8);
void
mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray,
gfc_array_i8 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray,
index_type dstride;
GFC_INTEGER_16 *dest;
const GFC_INTEGER_8 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_16_r10.c b/libgfortran/generated/maxloc0_16_r10.c
index 48910a9ce8d..4da00f2176a 100644
--- a/libgfortran/generated/maxloc0_16_r10.c
+++ b/libgfortran/generated/maxloc0_16_r10.c
@@ -148,13 +148,13 @@ maxloc0_16_r10 (gfc_array_i16 * const restrict retarray,
extern void mmaxloc0_16_r10 (gfc_array_i16 * const restrict,
- gfc_array_r10 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r10 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_16_r10);
void
mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray,
gfc_array_r10 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray,
index_type dstride;
GFC_INTEGER_16 *dest;
const GFC_REAL_10 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_16_r16.c b/libgfortran/generated/maxloc0_16_r16.c
index 8492293e9b3..3f33f63d679 100644
--- a/libgfortran/generated/maxloc0_16_r16.c
+++ b/libgfortran/generated/maxloc0_16_r16.c
@@ -148,13 +148,13 @@ maxloc0_16_r16 (gfc_array_i16 * const restrict retarray,
extern void mmaxloc0_16_r16 (gfc_array_i16 * const restrict,
- gfc_array_r16 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r16 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_16_r16);
void
mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray,
gfc_array_r16 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray,
index_type dstride;
GFC_INTEGER_16 *dest;
const GFC_REAL_16 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_16_r4.c b/libgfortran/generated/maxloc0_16_r4.c
index 602f334b381..0868d1fb41b 100644
--- a/libgfortran/generated/maxloc0_16_r4.c
+++ b/libgfortran/generated/maxloc0_16_r4.c
@@ -148,13 +148,13 @@ maxloc0_16_r4 (gfc_array_i16 * const restrict retarray,
extern void mmaxloc0_16_r4 (gfc_array_i16 * const restrict,
- gfc_array_r4 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r4 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_16_r4);
void
mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray,
gfc_array_r4 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray,
index_type dstride;
GFC_INTEGER_16 *dest;
const GFC_REAL_4 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_16_r8.c b/libgfortran/generated/maxloc0_16_r8.c
index 1dbdda034a9..5fe64123d91 100644
--- a/libgfortran/generated/maxloc0_16_r8.c
+++ b/libgfortran/generated/maxloc0_16_r8.c
@@ -148,13 +148,13 @@ maxloc0_16_r8 (gfc_array_i16 * const restrict retarray,
extern void mmaxloc0_16_r8 (gfc_array_i16 * const restrict,
- gfc_array_r8 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r8 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_16_r8);
void
mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray,
gfc_array_r8 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray,
index_type dstride;
GFC_INTEGER_16 *dest;
const GFC_REAL_8 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_4_i1.c b/libgfortran/generated/maxloc0_4_i1.c
index de62212f47b..10ed2d0a51c 100644
--- a/libgfortran/generated/maxloc0_4_i1.c
+++ b/libgfortran/generated/maxloc0_4_i1.c
@@ -148,13 +148,13 @@ maxloc0_4_i1 (gfc_array_i4 * const restrict retarray,
extern void mmaxloc0_4_i1 (gfc_array_i4 * const restrict,
- gfc_array_i1 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i1 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_4_i1);
void
mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray,
gfc_array_i1 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray,
index_type dstride;
GFC_INTEGER_4 *dest;
const GFC_INTEGER_1 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_4_i16.c b/libgfortran/generated/maxloc0_4_i16.c
index 98245df9814..4e80d675d7d 100644
--- a/libgfortran/generated/maxloc0_4_i16.c
+++ b/libgfortran/generated/maxloc0_4_i16.c
@@ -148,13 +148,13 @@ maxloc0_4_i16 (gfc_array_i4 * const restrict retarray,
extern void mmaxloc0_4_i16 (gfc_array_i4 * const restrict,
- gfc_array_i16 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i16 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_4_i16);
void
mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray,
gfc_array_i16 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray,
index_type dstride;
GFC_INTEGER_4 *dest;
const GFC_INTEGER_16 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_4_i2.c b/libgfortran/generated/maxloc0_4_i2.c
index 0a0a04e82dc..15d975c7d59 100644
--- a/libgfortran/generated/maxloc0_4_i2.c
+++ b/libgfortran/generated/maxloc0_4_i2.c
@@ -148,13 +148,13 @@ maxloc0_4_i2 (gfc_array_i4 * const restrict retarray,
extern void mmaxloc0_4_i2 (gfc_array_i4 * const restrict,
- gfc_array_i2 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i2 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_4_i2);
void
mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray,
gfc_array_i2 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray,
index_type dstride;
GFC_INTEGER_4 *dest;
const GFC_INTEGER_2 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_4_i4.c b/libgfortran/generated/maxloc0_4_i4.c
index e8fe5982483..813c8bd7acc 100644
--- a/libgfortran/generated/maxloc0_4_i4.c
+++ b/libgfortran/generated/maxloc0_4_i4.c
@@ -148,13 +148,13 @@ maxloc0_4_i4 (gfc_array_i4 * const restrict retarray,
extern void mmaxloc0_4_i4 (gfc_array_i4 * const restrict,
- gfc_array_i4 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i4 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_4_i4);
void
mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray,
gfc_array_i4 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray,
index_type dstride;
GFC_INTEGER_4 *dest;
const GFC_INTEGER_4 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_4_i8.c b/libgfortran/generated/maxloc0_4_i8.c
index 80ef84206d7..8c3fb9540a4 100644
--- a/libgfortran/generated/maxloc0_4_i8.c
+++ b/libgfortran/generated/maxloc0_4_i8.c
@@ -148,13 +148,13 @@ maxloc0_4_i8 (gfc_array_i4 * const restrict retarray,
extern void mmaxloc0_4_i8 (gfc_array_i4 * const restrict,
- gfc_array_i8 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i8 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_4_i8);
void
mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray,
gfc_array_i8 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray,
index_type dstride;
GFC_INTEGER_4 *dest;
const GFC_INTEGER_8 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_4_r10.c b/libgfortran/generated/maxloc0_4_r10.c
index 0059d3bad05..74be989cf4b 100644
--- a/libgfortran/generated/maxloc0_4_r10.c
+++ b/libgfortran/generated/maxloc0_4_r10.c
@@ -148,13 +148,13 @@ maxloc0_4_r10 (gfc_array_i4 * const restrict retarray,
extern void mmaxloc0_4_r10 (gfc_array_i4 * const restrict,
- gfc_array_r10 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r10 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_4_r10);
void
mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray,
gfc_array_r10 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray,
index_type dstride;
GFC_INTEGER_4 *dest;
const GFC_REAL_10 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_4_r16.c b/libgfortran/generated/maxloc0_4_r16.c
index 9cb04bf30ce..a6cf8bc011a 100644
--- a/libgfortran/generated/maxloc0_4_r16.c
+++ b/libgfortran/generated/maxloc0_4_r16.c
@@ -148,13 +148,13 @@ maxloc0_4_r16 (gfc_array_i4 * const restrict retarray,
extern void mmaxloc0_4_r16 (gfc_array_i4 * const restrict,
- gfc_array_r16 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r16 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_4_r16);
void
mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray,
gfc_array_r16 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray,
index_type dstride;
GFC_INTEGER_4 *dest;
const GFC_REAL_16 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_4_r4.c b/libgfortran/generated/maxloc0_4_r4.c
index e568a444b2a..50915d4f652 100644
--- a/libgfortran/generated/maxloc0_4_r4.c
+++ b/libgfortran/generated/maxloc0_4_r4.c
@@ -148,13 +148,13 @@ maxloc0_4_r4 (gfc_array_i4 * const restrict retarray,
extern void mmaxloc0_4_r4 (gfc_array_i4 * const restrict,
- gfc_array_r4 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r4 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_4_r4);
void
mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray,
gfc_array_r4 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray,
index_type dstride;
GFC_INTEGER_4 *dest;
const GFC_REAL_4 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_4_r8.c b/libgfortran/generated/maxloc0_4_r8.c
index e84235ea76f..ec613e77413 100644
--- a/libgfortran/generated/maxloc0_4_r8.c
+++ b/libgfortran/generated/maxloc0_4_r8.c
@@ -148,13 +148,13 @@ maxloc0_4_r8 (gfc_array_i4 * const restrict retarray,
extern void mmaxloc0_4_r8 (gfc_array_i4 * const restrict,
- gfc_array_r8 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r8 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_4_r8);
void
mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray,
gfc_array_r8 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray,
index_type dstride;
GFC_INTEGER_4 *dest;
const GFC_REAL_8 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_8_i1.c b/libgfortran/generated/maxloc0_8_i1.c
index da132d4b5f1..916e4dcb1a2 100644
--- a/libgfortran/generated/maxloc0_8_i1.c
+++ b/libgfortran/generated/maxloc0_8_i1.c
@@ -148,13 +148,13 @@ maxloc0_8_i1 (gfc_array_i8 * const restrict retarray,
extern void mmaxloc0_8_i1 (gfc_array_i8 * const restrict,
- gfc_array_i1 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i1 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_8_i1);
void
mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray,
gfc_array_i1 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray,
index_type dstride;
GFC_INTEGER_8 *dest;
const GFC_INTEGER_1 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_8_i16.c b/libgfortran/generated/maxloc0_8_i16.c
index 3b94adeffb3..e554f46e2a6 100644
--- a/libgfortran/generated/maxloc0_8_i16.c
+++ b/libgfortran/generated/maxloc0_8_i16.c
@@ -148,13 +148,13 @@ maxloc0_8_i16 (gfc_array_i8 * const restrict retarray,
extern void mmaxloc0_8_i16 (gfc_array_i8 * const restrict,
- gfc_array_i16 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i16 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_8_i16);
void
mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray,
gfc_array_i16 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray,
index_type dstride;
GFC_INTEGER_8 *dest;
const GFC_INTEGER_16 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_8_i2.c b/libgfortran/generated/maxloc0_8_i2.c
index 41f6457ab63..40ebe0f3628 100644
--- a/libgfortran/generated/maxloc0_8_i2.c
+++ b/libgfortran/generated/maxloc0_8_i2.c
@@ -148,13 +148,13 @@ maxloc0_8_i2 (gfc_array_i8 * const restrict retarray,
extern void mmaxloc0_8_i2 (gfc_array_i8 * const restrict,
- gfc_array_i2 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i2 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_8_i2);
void
mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray,
gfc_array_i2 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray,
index_type dstride;
GFC_INTEGER_8 *dest;
const GFC_INTEGER_2 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_8_i4.c b/libgfortran/generated/maxloc0_8_i4.c
index 93fa3581437..df9a43e67dd 100644
--- a/libgfortran/generated/maxloc0_8_i4.c
+++ b/libgfortran/generated/maxloc0_8_i4.c
@@ -148,13 +148,13 @@ maxloc0_8_i4 (gfc_array_i8 * const restrict retarray,
extern void mmaxloc0_8_i4 (gfc_array_i8 * const restrict,
- gfc_array_i4 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i4 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_8_i4);
void
mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray,
gfc_array_i4 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray,
index_type dstride;
GFC_INTEGER_8 *dest;
const GFC_INTEGER_4 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_8_i8.c b/libgfortran/generated/maxloc0_8_i8.c
index 49a8d5255a0..eedd6e69f11 100644
--- a/libgfortran/generated/maxloc0_8_i8.c
+++ b/libgfortran/generated/maxloc0_8_i8.c
@@ -148,13 +148,13 @@ maxloc0_8_i8 (gfc_array_i8 * const restrict retarray,
extern void mmaxloc0_8_i8 (gfc_array_i8 * const restrict,
- gfc_array_i8 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i8 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_8_i8);
void
mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray,
gfc_array_i8 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray,
index_type dstride;
GFC_INTEGER_8 *dest;
const GFC_INTEGER_8 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_8_r10.c b/libgfortran/generated/maxloc0_8_r10.c
index ebe3f04d195..215b5397606 100644
--- a/libgfortran/generated/maxloc0_8_r10.c
+++ b/libgfortran/generated/maxloc0_8_r10.c
@@ -148,13 +148,13 @@ maxloc0_8_r10 (gfc_array_i8 * const restrict retarray,
extern void mmaxloc0_8_r10 (gfc_array_i8 * const restrict,
- gfc_array_r10 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r10 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_8_r10);
void
mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray,
gfc_array_r10 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray,
index_type dstride;
GFC_INTEGER_8 *dest;
const GFC_REAL_10 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_8_r16.c b/libgfortran/generated/maxloc0_8_r16.c
index 800f5c6d7a0..32f4b859806 100644
--- a/libgfortran/generated/maxloc0_8_r16.c
+++ b/libgfortran/generated/maxloc0_8_r16.c
@@ -148,13 +148,13 @@ maxloc0_8_r16 (gfc_array_i8 * const restrict retarray,
extern void mmaxloc0_8_r16 (gfc_array_i8 * const restrict,
- gfc_array_r16 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r16 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_8_r16);
void
mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray,
gfc_array_r16 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray,
index_type dstride;
GFC_INTEGER_8 *dest;
const GFC_REAL_16 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_8_r4.c b/libgfortran/generated/maxloc0_8_r4.c
index f68a5ea4531..140f6cb8f74 100644
--- a/libgfortran/generated/maxloc0_8_r4.c
+++ b/libgfortran/generated/maxloc0_8_r4.c
@@ -148,13 +148,13 @@ maxloc0_8_r4 (gfc_array_i8 * const restrict retarray,
extern void mmaxloc0_8_r4 (gfc_array_i8 * const restrict,
- gfc_array_r4 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r4 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_8_r4);
void
mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray,
gfc_array_r4 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray,
index_type dstride;
GFC_INTEGER_8 *dest;
const GFC_REAL_4 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc0_8_r8.c b/libgfortran/generated/maxloc0_8_r8.c
index 5ec6afede23..907dbc7e03f 100644
--- a/libgfortran/generated/maxloc0_8_r8.c
+++ b/libgfortran/generated/maxloc0_8_r8.c
@@ -148,13 +148,13 @@ maxloc0_8_r8 (gfc_array_i8 * const restrict retarray,
extern void mmaxloc0_8_r8 (gfc_array_i8 * const restrict,
- gfc_array_r8 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r8 * const restrict, gfc_array_l1 * const restrict);
export_proto(mmaxloc0_8_r8);
void
mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray,
gfc_array_r8 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray,
index_type dstride;
GFC_INTEGER_8 *dest;
const GFC_REAL_8 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/maxloc1_16_i1.c b/libgfortran/generated/maxloc1_16_i1.c
index 009ea6de124..dc42f603df8 100644
--- a/libgfortran/generated/maxloc1_16_i1.c
+++ b/libgfortran/generated/maxloc1_16_i1.c
@@ -191,14 +191,14 @@ maxloc1_16_i1 (gfc_array_i16 * const restrict retarray,
extern void mmaxloc1_16_i1 (gfc_array_i16 * const restrict,
gfc_array_i1 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_16_i1);
void
mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray,
gfc_array_i1 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_INTEGER_1 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_1 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_16_i16.c b/libgfortran/generated/maxloc1_16_i16.c
index 94bab619f19..5b69dea88c9 100644
--- a/libgfortran/generated/maxloc1_16_i16.c
+++ b/libgfortran/generated/maxloc1_16_i16.c
@@ -191,14 +191,14 @@ maxloc1_16_i16 (gfc_array_i16 * const restrict retarray,
extern void mmaxloc1_16_i16 (gfc_array_i16 * const restrict,
gfc_array_i16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_16_i16);
void
mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray,
gfc_array_i16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_INTEGER_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_16_i2.c b/libgfortran/generated/maxloc1_16_i2.c
index 9cdd41814d3..25360bc7cca 100644
--- a/libgfortran/generated/maxloc1_16_i2.c
+++ b/libgfortran/generated/maxloc1_16_i2.c
@@ -191,14 +191,14 @@ maxloc1_16_i2 (gfc_array_i16 * const restrict retarray,
extern void mmaxloc1_16_i2 (gfc_array_i16 * const restrict,
gfc_array_i2 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_16_i2);
void
mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray,
gfc_array_i2 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_INTEGER_2 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_2 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_16_i4.c b/libgfortran/generated/maxloc1_16_i4.c
index 564b378c4ed..d089126c934 100644
--- a/libgfortran/generated/maxloc1_16_i4.c
+++ b/libgfortran/generated/maxloc1_16_i4.c
@@ -191,14 +191,14 @@ maxloc1_16_i4 (gfc_array_i16 * const restrict retarray,
extern void mmaxloc1_16_i4 (gfc_array_i16 * const restrict,
gfc_array_i4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_16_i4);
void
mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray,
gfc_array_i4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_INTEGER_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_16_i8.c b/libgfortran/generated/maxloc1_16_i8.c
index 91b68bf1b76..502c951e90e 100644
--- a/libgfortran/generated/maxloc1_16_i8.c
+++ b/libgfortran/generated/maxloc1_16_i8.c
@@ -191,14 +191,14 @@ maxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
extern void mmaxloc1_16_i8 (gfc_array_i16 * const restrict,
gfc_array_i8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_16_i8);
void
mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
gfc_array_i8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_INTEGER_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_16_r10.c b/libgfortran/generated/maxloc1_16_r10.c
index f60e044d6f9..721b3902251 100644
--- a/libgfortran/generated/maxloc1_16_r10.c
+++ b/libgfortran/generated/maxloc1_16_r10.c
@@ -191,14 +191,14 @@ maxloc1_16_r10 (gfc_array_i16 * const restrict retarray,
extern void mmaxloc1_16_r10 (gfc_array_i16 * const restrict,
gfc_array_r10 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_16_r10);
void
mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray,
gfc_array_r10 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_REAL_10 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_10 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_16_r16.c b/libgfortran/generated/maxloc1_16_r16.c
index 22bdb6d545f..1a8e113b393 100644
--- a/libgfortran/generated/maxloc1_16_r16.c
+++ b/libgfortran/generated/maxloc1_16_r16.c
@@ -191,14 +191,14 @@ maxloc1_16_r16 (gfc_array_i16 * const restrict retarray,
extern void mmaxloc1_16_r16 (gfc_array_i16 * const restrict,
gfc_array_r16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_16_r16);
void
mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray,
gfc_array_r16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_REAL_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_16_r4.c b/libgfortran/generated/maxloc1_16_r4.c
index 4af1841322b..fda1bfaf53d 100644
--- a/libgfortran/generated/maxloc1_16_r4.c
+++ b/libgfortran/generated/maxloc1_16_r4.c
@@ -191,14 +191,14 @@ maxloc1_16_r4 (gfc_array_i16 * const restrict retarray,
extern void mmaxloc1_16_r4 (gfc_array_i16 * const restrict,
gfc_array_r4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_16_r4);
void
mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray,
gfc_array_r4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_REAL_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_16_r8.c b/libgfortran/generated/maxloc1_16_r8.c
index 34d5ada7dc9..4d2208a12e0 100644
--- a/libgfortran/generated/maxloc1_16_r8.c
+++ b/libgfortran/generated/maxloc1_16_r8.c
@@ -191,14 +191,14 @@ maxloc1_16_r8 (gfc_array_i16 * const restrict retarray,
extern void mmaxloc1_16_r8 (gfc_array_i16 * const restrict,
gfc_array_r8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_16_r8);
void
mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray,
gfc_array_r8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_REAL_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_4_i1.c b/libgfortran/generated/maxloc1_4_i1.c
index e2f41411528..0ae1a5ba528 100644
--- a/libgfortran/generated/maxloc1_4_i1.c
+++ b/libgfortran/generated/maxloc1_4_i1.c
@@ -191,14 +191,14 @@ maxloc1_4_i1 (gfc_array_i4 * const restrict retarray,
extern void mmaxloc1_4_i1 (gfc_array_i4 * const restrict,
gfc_array_i1 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_4_i1);
void
mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray,
gfc_array_i1 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_INTEGER_1 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_1 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_4_i16.c b/libgfortran/generated/maxloc1_4_i16.c
index 30d782ca579..39a57c6f684 100644
--- a/libgfortran/generated/maxloc1_4_i16.c
+++ b/libgfortran/generated/maxloc1_4_i16.c
@@ -191,14 +191,14 @@ maxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
extern void mmaxloc1_4_i16 (gfc_array_i4 * const restrict,
gfc_array_i16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_4_i16);
void
mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
gfc_array_i16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_INTEGER_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_4_i2.c b/libgfortran/generated/maxloc1_4_i2.c
index 1e02f75b1c6..bbf43ec4969 100644
--- a/libgfortran/generated/maxloc1_4_i2.c
+++ b/libgfortran/generated/maxloc1_4_i2.c
@@ -191,14 +191,14 @@ maxloc1_4_i2 (gfc_array_i4 * const restrict retarray,
extern void mmaxloc1_4_i2 (gfc_array_i4 * const restrict,
gfc_array_i2 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_4_i2);
void
mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray,
gfc_array_i2 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_INTEGER_2 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_2 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_4_i4.c b/libgfortran/generated/maxloc1_4_i4.c
index 249efd76354..5b00fb1eda1 100644
--- a/libgfortran/generated/maxloc1_4_i4.c
+++ b/libgfortran/generated/maxloc1_4_i4.c
@@ -191,14 +191,14 @@ maxloc1_4_i4 (gfc_array_i4 * const restrict retarray,
extern void mmaxloc1_4_i4 (gfc_array_i4 * const restrict,
gfc_array_i4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_4_i4);
void
mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray,
gfc_array_i4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_INTEGER_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_4_i8.c b/libgfortran/generated/maxloc1_4_i8.c
index b12a40b9050..f5131140355 100644
--- a/libgfortran/generated/maxloc1_4_i8.c
+++ b/libgfortran/generated/maxloc1_4_i8.c
@@ -191,14 +191,14 @@ maxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
extern void mmaxloc1_4_i8 (gfc_array_i4 * const restrict,
gfc_array_i8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_4_i8);
void
mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
gfc_array_i8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_INTEGER_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_4_r10.c b/libgfortran/generated/maxloc1_4_r10.c
index c498bffd669..17e9cbba9a3 100644
--- a/libgfortran/generated/maxloc1_4_r10.c
+++ b/libgfortran/generated/maxloc1_4_r10.c
@@ -191,14 +191,14 @@ maxloc1_4_r10 (gfc_array_i4 * const restrict retarray,
extern void mmaxloc1_4_r10 (gfc_array_i4 * const restrict,
gfc_array_r10 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_4_r10);
void
mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray,
gfc_array_r10 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_REAL_10 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_10 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_4_r16.c b/libgfortran/generated/maxloc1_4_r16.c
index 71c9723c120..7b1c558e30f 100644
--- a/libgfortran/generated/maxloc1_4_r16.c
+++ b/libgfortran/generated/maxloc1_4_r16.c
@@ -191,14 +191,14 @@ maxloc1_4_r16 (gfc_array_i4 * const restrict retarray,
extern void mmaxloc1_4_r16 (gfc_array_i4 * const restrict,
gfc_array_r16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_4_r16);
void
mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray,
gfc_array_r16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_REAL_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_4_r4.c b/libgfortran/generated/maxloc1_4_r4.c
index 69f3ca9e268..4534e6f4739 100644
--- a/libgfortran/generated/maxloc1_4_r4.c
+++ b/libgfortran/generated/maxloc1_4_r4.c
@@ -191,14 +191,14 @@ maxloc1_4_r4 (gfc_array_i4 * const restrict retarray,
extern void mmaxloc1_4_r4 (gfc_array_i4 * const restrict,
gfc_array_r4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_4_r4);
void
mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray,
gfc_array_r4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_REAL_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_4_r8.c b/libgfortran/generated/maxloc1_4_r8.c
index cab8eebbfa2..7917aae76eb 100644
--- a/libgfortran/generated/maxloc1_4_r8.c
+++ b/libgfortran/generated/maxloc1_4_r8.c
@@ -191,14 +191,14 @@ maxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
extern void mmaxloc1_4_r8 (gfc_array_i4 * const restrict,
gfc_array_r8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_4_r8);
void
mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
gfc_array_r8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_REAL_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_8_i1.c b/libgfortran/generated/maxloc1_8_i1.c
index a6a796672e1..33966a235b6 100644
--- a/libgfortran/generated/maxloc1_8_i1.c
+++ b/libgfortran/generated/maxloc1_8_i1.c
@@ -191,14 +191,14 @@ maxloc1_8_i1 (gfc_array_i8 * const restrict retarray,
extern void mmaxloc1_8_i1 (gfc_array_i8 * const restrict,
gfc_array_i1 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_8_i1);
void
mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray,
gfc_array_i1 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_INTEGER_1 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_1 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_8_i16.c b/libgfortran/generated/maxloc1_8_i16.c
index b366e68cf71..612003ef74a 100644
--- a/libgfortran/generated/maxloc1_8_i16.c
+++ b/libgfortran/generated/maxloc1_8_i16.c
@@ -191,14 +191,14 @@ maxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
extern void mmaxloc1_8_i16 (gfc_array_i8 * const restrict,
gfc_array_i16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_8_i16);
void
mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
gfc_array_i16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_INTEGER_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_8_i2.c b/libgfortran/generated/maxloc1_8_i2.c
index 0cfe019ad4b..04018e37919 100644
--- a/libgfortran/generated/maxloc1_8_i2.c
+++ b/libgfortran/generated/maxloc1_8_i2.c
@@ -191,14 +191,14 @@ maxloc1_8_i2 (gfc_array_i8 * const restrict retarray,
extern void mmaxloc1_8_i2 (gfc_array_i8 * const restrict,
gfc_array_i2 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_8_i2);
void
mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray,
gfc_array_i2 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_INTEGER_2 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_2 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_8_i4.c b/libgfortran/generated/maxloc1_8_i4.c
index e43ba950ade..833e4bed806 100644
--- a/libgfortran/generated/maxloc1_8_i4.c
+++ b/libgfortran/generated/maxloc1_8_i4.c
@@ -191,14 +191,14 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
extern void mmaxloc1_8_i4 (gfc_array_i8 * const restrict,
gfc_array_i4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_8_i4);
void
mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
gfc_array_i4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_INTEGER_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_8_i8.c b/libgfortran/generated/maxloc1_8_i8.c
index 733462baffe..880ad7ca4ae 100644
--- a/libgfortran/generated/maxloc1_8_i8.c
+++ b/libgfortran/generated/maxloc1_8_i8.c
@@ -191,14 +191,14 @@ maxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
extern void mmaxloc1_8_i8 (gfc_array_i8 * const restrict,
gfc_array_i8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_8_i8);
void
mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
gfc_array_i8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_INTEGER_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_8_r10.c b/libgfortran/generated/maxloc1_8_r10.c
index deef31c91ec..6de90ead1de 100644
--- a/libgfortran/generated/maxloc1_8_r10.c
+++ b/libgfortran/generated/maxloc1_8_r10.c
@@ -191,14 +191,14 @@ maxloc1_8_r10 (gfc_array_i8 * const restrict retarray,
extern void mmaxloc1_8_r10 (gfc_array_i8 * const restrict,
gfc_array_r10 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_8_r10);
void
mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray,
gfc_array_r10 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_REAL_10 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_10 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_8_r16.c b/libgfortran/generated/maxloc1_8_r16.c
index 24d55c34bca..06e00dc0eb4 100644
--- a/libgfortran/generated/maxloc1_8_r16.c
+++ b/libgfortran/generated/maxloc1_8_r16.c
@@ -191,14 +191,14 @@ maxloc1_8_r16 (gfc_array_i8 * const restrict retarray,
extern void mmaxloc1_8_r16 (gfc_array_i8 * const restrict,
gfc_array_r16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_8_r16);
void
mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray,
gfc_array_r16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_REAL_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_8_r4.c b/libgfortran/generated/maxloc1_8_r4.c
index 3dd01b3bd6a..3d9d5c6df98 100644
--- a/libgfortran/generated/maxloc1_8_r4.c
+++ b/libgfortran/generated/maxloc1_8_r4.c
@@ -191,14 +191,14 @@ maxloc1_8_r4 (gfc_array_i8 * const restrict retarray,
extern void mmaxloc1_8_r4 (gfc_array_i8 * const restrict,
gfc_array_r4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_8_r4);
void
mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray,
gfc_array_r4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_REAL_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxloc1_8_r8.c b/libgfortran/generated/maxloc1_8_r8.c
index 1adc4c88838..ea2769ebc70 100644
--- a/libgfortran/generated/maxloc1_8_r8.c
+++ b/libgfortran/generated/maxloc1_8_r8.c
@@ -191,14 +191,14 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
extern void mmaxloc1_8_r8 (gfc_array_i8 * const restrict,
gfc_array_r8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxloc1_8_r8);
void
mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
gfc_array_r8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_REAL_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxval_i1.c b/libgfortran/generated/maxval_i1.c
index 3c63c225821..08334d5bf5e 100644
--- a/libgfortran/generated/maxval_i1.c
+++ b/libgfortran/generated/maxval_i1.c
@@ -185,14 +185,14 @@ maxval_i1 (gfc_array_i1 * const restrict retarray,
extern void mmaxval_i1 (gfc_array_i1 * const restrict,
gfc_array_i1 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxval_i1);
void
mmaxval_i1 (gfc_array_i1 * const restrict retarray,
gfc_array_i1 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_1 * restrict dest;
const GFC_INTEGER_1 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -231,7 +246,7 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -286,22 +301,11 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_1 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_1 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxval_i16.c b/libgfortran/generated/maxval_i16.c
index 9a217ac9dbd..56d7854021d 100644
--- a/libgfortran/generated/maxval_i16.c
+++ b/libgfortran/generated/maxval_i16.c
@@ -185,14 +185,14 @@ maxval_i16 (gfc_array_i16 * const restrict retarray,
extern void mmaxval_i16 (gfc_array_i16 * const restrict,
gfc_array_i16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxval_i16);
void
mmaxval_i16 (gfc_array_i16 * const restrict retarray,
gfc_array_i16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_INTEGER_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -231,7 +246,7 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -286,22 +301,11 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxval_i2.c b/libgfortran/generated/maxval_i2.c
index c8fd718f8dc..111f5b91083 100644
--- a/libgfortran/generated/maxval_i2.c
+++ b/libgfortran/generated/maxval_i2.c
@@ -185,14 +185,14 @@ maxval_i2 (gfc_array_i2 * const restrict retarray,
extern void mmaxval_i2 (gfc_array_i2 * const restrict,
gfc_array_i2 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxval_i2);
void
mmaxval_i2 (gfc_array_i2 * const restrict retarray,
gfc_array_i2 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_2 * restrict dest;
const GFC_INTEGER_2 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -231,7 +246,7 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -286,22 +301,11 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_2 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_2 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxval_i4.c b/libgfortran/generated/maxval_i4.c
index c800f1a733d..4413477f8b8 100644
--- a/libgfortran/generated/maxval_i4.c
+++ b/libgfortran/generated/maxval_i4.c
@@ -185,14 +185,14 @@ maxval_i4 (gfc_array_i4 * const restrict retarray,
extern void mmaxval_i4 (gfc_array_i4 * const restrict,
gfc_array_i4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxval_i4);
void
mmaxval_i4 (gfc_array_i4 * const restrict retarray,
gfc_array_i4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_INTEGER_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -231,7 +246,7 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -286,22 +301,11 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxval_i8.c b/libgfortran/generated/maxval_i8.c
index 898ef3c5956..7e3cb16dd69 100644
--- a/libgfortran/generated/maxval_i8.c
+++ b/libgfortran/generated/maxval_i8.c
@@ -185,14 +185,14 @@ maxval_i8 (gfc_array_i8 * const restrict retarray,
extern void mmaxval_i8 (gfc_array_i8 * const restrict,
gfc_array_i8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxval_i8);
void
mmaxval_i8 (gfc_array_i8 * const restrict retarray,
gfc_array_i8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_INTEGER_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -231,7 +246,7 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -286,22 +301,11 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxval_r10.c b/libgfortran/generated/maxval_r10.c
index 3123d06cf58..14338644b40 100644
--- a/libgfortran/generated/maxval_r10.c
+++ b/libgfortran/generated/maxval_r10.c
@@ -185,14 +185,14 @@ maxval_r10 (gfc_array_r10 * const restrict retarray,
extern void mmaxval_r10 (gfc_array_r10 * const restrict,
gfc_array_r10 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxval_r10);
void
mmaxval_r10 (gfc_array_r10 * const restrict retarray,
gfc_array_r10 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_REAL_10 * restrict dest;
const GFC_REAL_10 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -231,7 +246,7 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -286,22 +301,11 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_10 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_REAL_10 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxval_r16.c b/libgfortran/generated/maxval_r16.c
index bdef6167916..6b4c409452d 100644
--- a/libgfortran/generated/maxval_r16.c
+++ b/libgfortran/generated/maxval_r16.c
@@ -185,14 +185,14 @@ maxval_r16 (gfc_array_r16 * const restrict retarray,
extern void mmaxval_r16 (gfc_array_r16 * const restrict,
gfc_array_r16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxval_r16);
void
mmaxval_r16 (gfc_array_r16 * const restrict retarray,
gfc_array_r16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_REAL_16 * restrict dest;
const GFC_REAL_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -231,7 +246,7 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -286,22 +301,11 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_REAL_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxval_r4.c b/libgfortran/generated/maxval_r4.c
index ebdb9684fb6..9e797d3f077 100644
--- a/libgfortran/generated/maxval_r4.c
+++ b/libgfortran/generated/maxval_r4.c
@@ -185,14 +185,14 @@ maxval_r4 (gfc_array_r4 * const restrict retarray,
extern void mmaxval_r4 (gfc_array_r4 * const restrict,
gfc_array_r4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxval_r4);
void
mmaxval_r4 (gfc_array_r4 * const restrict retarray,
gfc_array_r4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_REAL_4 * restrict dest;
const GFC_REAL_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -231,7 +246,7 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -286,22 +301,11 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_REAL_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/maxval_r8.c b/libgfortran/generated/maxval_r8.c
index 6a05df76381..ff4ed07d5ea 100644
--- a/libgfortran/generated/maxval_r8.c
+++ b/libgfortran/generated/maxval_r8.c
@@ -185,14 +185,14 @@ maxval_r8 (gfc_array_r8 * const restrict retarray,
extern void mmaxval_r8 (gfc_array_r8 * const restrict,
gfc_array_r8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mmaxval_r8);
void
mmaxval_r8 (gfc_array_r8 * const restrict retarray,
gfc_array_r8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_REAL_8 * restrict dest;
const GFC_REAL_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -231,7 +246,7 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -286,22 +301,11 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_REAL_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc0_16_i1.c b/libgfortran/generated/minloc0_16_i1.c
index e8f985627d8..5afd38763d1 100644
--- a/libgfortran/generated/minloc0_16_i1.c
+++ b/libgfortran/generated/minloc0_16_i1.c
@@ -148,13 +148,13 @@ minloc0_16_i1 (gfc_array_i16 * const restrict retarray,
extern void mminloc0_16_i1 (gfc_array_i16 * const restrict,
- gfc_array_i1 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i1 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_16_i1);
void
mminloc0_16_i1 (gfc_array_i16 * const restrict retarray,
gfc_array_i1 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_16_i1 (gfc_array_i16 * const restrict retarray,
index_type dstride;
GFC_INTEGER_16 *dest;
const GFC_INTEGER_1 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_16_i1 (gfc_array_i16 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_16_i1 (gfc_array_i16 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_16_i16.c b/libgfortran/generated/minloc0_16_i16.c
index 31ade2421ea..5f49874324b 100644
--- a/libgfortran/generated/minloc0_16_i16.c
+++ b/libgfortran/generated/minloc0_16_i16.c
@@ -148,13 +148,13 @@ minloc0_16_i16 (gfc_array_i16 * const restrict retarray,
extern void mminloc0_16_i16 (gfc_array_i16 * const restrict,
- gfc_array_i16 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i16 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_16_i16);
void
mminloc0_16_i16 (gfc_array_i16 * const restrict retarray,
gfc_array_i16 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray,
index_type dstride;
GFC_INTEGER_16 *dest;
const GFC_INTEGER_16 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_16_i2.c b/libgfortran/generated/minloc0_16_i2.c
index 772519dbebd..fed80151594 100644
--- a/libgfortran/generated/minloc0_16_i2.c
+++ b/libgfortran/generated/minloc0_16_i2.c
@@ -148,13 +148,13 @@ minloc0_16_i2 (gfc_array_i16 * const restrict retarray,
extern void mminloc0_16_i2 (gfc_array_i16 * const restrict,
- gfc_array_i2 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i2 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_16_i2);
void
mminloc0_16_i2 (gfc_array_i16 * const restrict retarray,
gfc_array_i2 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_16_i2 (gfc_array_i16 * const restrict retarray,
index_type dstride;
GFC_INTEGER_16 *dest;
const GFC_INTEGER_2 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_16_i2 (gfc_array_i16 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_16_i2 (gfc_array_i16 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_16_i4.c b/libgfortran/generated/minloc0_16_i4.c
index 3096ec02049..bfb45413886 100644
--- a/libgfortran/generated/minloc0_16_i4.c
+++ b/libgfortran/generated/minloc0_16_i4.c
@@ -148,13 +148,13 @@ minloc0_16_i4 (gfc_array_i16 * const restrict retarray,
extern void mminloc0_16_i4 (gfc_array_i16 * const restrict,
- gfc_array_i4 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i4 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_16_i4);
void
mminloc0_16_i4 (gfc_array_i16 * const restrict retarray,
gfc_array_i4 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray,
index_type dstride;
GFC_INTEGER_16 *dest;
const GFC_INTEGER_4 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_16_i8.c b/libgfortran/generated/minloc0_16_i8.c
index 99b53bef5eb..d07297e90c3 100644
--- a/libgfortran/generated/minloc0_16_i8.c
+++ b/libgfortran/generated/minloc0_16_i8.c
@@ -148,13 +148,13 @@ minloc0_16_i8 (gfc_array_i16 * const restrict retarray,
extern void mminloc0_16_i8 (gfc_array_i16 * const restrict,
- gfc_array_i8 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i8 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_16_i8);
void
mminloc0_16_i8 (gfc_array_i16 * const restrict retarray,
gfc_array_i8 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray,
index_type dstride;
GFC_INTEGER_16 *dest;
const GFC_INTEGER_8 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_16_r10.c b/libgfortran/generated/minloc0_16_r10.c
index 5c043f899d9..34b1d56735a 100644
--- a/libgfortran/generated/minloc0_16_r10.c
+++ b/libgfortran/generated/minloc0_16_r10.c
@@ -148,13 +148,13 @@ minloc0_16_r10 (gfc_array_i16 * const restrict retarray,
extern void mminloc0_16_r10 (gfc_array_i16 * const restrict,
- gfc_array_r10 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r10 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_16_r10);
void
mminloc0_16_r10 (gfc_array_i16 * const restrict retarray,
gfc_array_r10 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray,
index_type dstride;
GFC_INTEGER_16 *dest;
const GFC_REAL_10 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_16_r16.c b/libgfortran/generated/minloc0_16_r16.c
index 9a87bb61ee7..6e60e19203f 100644
--- a/libgfortran/generated/minloc0_16_r16.c
+++ b/libgfortran/generated/minloc0_16_r16.c
@@ -148,13 +148,13 @@ minloc0_16_r16 (gfc_array_i16 * const restrict retarray,
extern void mminloc0_16_r16 (gfc_array_i16 * const restrict,
- gfc_array_r16 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r16 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_16_r16);
void
mminloc0_16_r16 (gfc_array_i16 * const restrict retarray,
gfc_array_r16 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray,
index_type dstride;
GFC_INTEGER_16 *dest;
const GFC_REAL_16 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_16_r4.c b/libgfortran/generated/minloc0_16_r4.c
index dbe167ecfea..7e98c18b81e 100644
--- a/libgfortran/generated/minloc0_16_r4.c
+++ b/libgfortran/generated/minloc0_16_r4.c
@@ -148,13 +148,13 @@ minloc0_16_r4 (gfc_array_i16 * const restrict retarray,
extern void mminloc0_16_r4 (gfc_array_i16 * const restrict,
- gfc_array_r4 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r4 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_16_r4);
void
mminloc0_16_r4 (gfc_array_i16 * const restrict retarray,
gfc_array_r4 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray,
index_type dstride;
GFC_INTEGER_16 *dest;
const GFC_REAL_4 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_16_r8.c b/libgfortran/generated/minloc0_16_r8.c
index 8c43bb5a7c4..4c2044b981e 100644
--- a/libgfortran/generated/minloc0_16_r8.c
+++ b/libgfortran/generated/minloc0_16_r8.c
@@ -148,13 +148,13 @@ minloc0_16_r8 (gfc_array_i16 * const restrict retarray,
extern void mminloc0_16_r8 (gfc_array_i16 * const restrict,
- gfc_array_r8 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r8 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_16_r8);
void
mminloc0_16_r8 (gfc_array_i16 * const restrict retarray,
gfc_array_r8 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray,
index_type dstride;
GFC_INTEGER_16 *dest;
const GFC_REAL_8 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_4_i1.c b/libgfortran/generated/minloc0_4_i1.c
index 42d64a8750d..645af760ba0 100644
--- a/libgfortran/generated/minloc0_4_i1.c
+++ b/libgfortran/generated/minloc0_4_i1.c
@@ -148,13 +148,13 @@ minloc0_4_i1 (gfc_array_i4 * const restrict retarray,
extern void mminloc0_4_i1 (gfc_array_i4 * const restrict,
- gfc_array_i1 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i1 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_4_i1);
void
mminloc0_4_i1 (gfc_array_i4 * const restrict retarray,
gfc_array_i1 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_4_i1 (gfc_array_i4 * const restrict retarray,
index_type dstride;
GFC_INTEGER_4 *dest;
const GFC_INTEGER_1 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_4_i1 (gfc_array_i4 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_4_i1 (gfc_array_i4 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_4_i16.c b/libgfortran/generated/minloc0_4_i16.c
index 19b960e912a..5160d2e90a5 100644
--- a/libgfortran/generated/minloc0_4_i16.c
+++ b/libgfortran/generated/minloc0_4_i16.c
@@ -148,13 +148,13 @@ minloc0_4_i16 (gfc_array_i4 * const restrict retarray,
extern void mminloc0_4_i16 (gfc_array_i4 * const restrict,
- gfc_array_i16 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i16 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_4_i16);
void
mminloc0_4_i16 (gfc_array_i4 * const restrict retarray,
gfc_array_i16 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray,
index_type dstride;
GFC_INTEGER_4 *dest;
const GFC_INTEGER_16 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_4_i2.c b/libgfortran/generated/minloc0_4_i2.c
index c57d5e72643..28d0a7f9d44 100644
--- a/libgfortran/generated/minloc0_4_i2.c
+++ b/libgfortran/generated/minloc0_4_i2.c
@@ -148,13 +148,13 @@ minloc0_4_i2 (gfc_array_i4 * const restrict retarray,
extern void mminloc0_4_i2 (gfc_array_i4 * const restrict,
- gfc_array_i2 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i2 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_4_i2);
void
mminloc0_4_i2 (gfc_array_i4 * const restrict retarray,
gfc_array_i2 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_4_i2 (gfc_array_i4 * const restrict retarray,
index_type dstride;
GFC_INTEGER_4 *dest;
const GFC_INTEGER_2 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_4_i2 (gfc_array_i4 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_4_i2 (gfc_array_i4 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_4_i4.c b/libgfortran/generated/minloc0_4_i4.c
index a8c5a5e8ff2..a820231df49 100644
--- a/libgfortran/generated/minloc0_4_i4.c
+++ b/libgfortran/generated/minloc0_4_i4.c
@@ -148,13 +148,13 @@ minloc0_4_i4 (gfc_array_i4 * const restrict retarray,
extern void mminloc0_4_i4 (gfc_array_i4 * const restrict,
- gfc_array_i4 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i4 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_4_i4);
void
mminloc0_4_i4 (gfc_array_i4 * const restrict retarray,
gfc_array_i4 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray,
index_type dstride;
GFC_INTEGER_4 *dest;
const GFC_INTEGER_4 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_4_i8.c b/libgfortran/generated/minloc0_4_i8.c
index 61eab8cdd0c..4d63109f8b9 100644
--- a/libgfortran/generated/minloc0_4_i8.c
+++ b/libgfortran/generated/minloc0_4_i8.c
@@ -148,13 +148,13 @@ minloc0_4_i8 (gfc_array_i4 * const restrict retarray,
extern void mminloc0_4_i8 (gfc_array_i4 * const restrict,
- gfc_array_i8 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i8 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_4_i8);
void
mminloc0_4_i8 (gfc_array_i4 * const restrict retarray,
gfc_array_i8 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray,
index_type dstride;
GFC_INTEGER_4 *dest;
const GFC_INTEGER_8 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_4_r10.c b/libgfortran/generated/minloc0_4_r10.c
index 20a22520f3f..c2d8d82eba4 100644
--- a/libgfortran/generated/minloc0_4_r10.c
+++ b/libgfortran/generated/minloc0_4_r10.c
@@ -148,13 +148,13 @@ minloc0_4_r10 (gfc_array_i4 * const restrict retarray,
extern void mminloc0_4_r10 (gfc_array_i4 * const restrict,
- gfc_array_r10 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r10 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_4_r10);
void
mminloc0_4_r10 (gfc_array_i4 * const restrict retarray,
gfc_array_r10 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray,
index_type dstride;
GFC_INTEGER_4 *dest;
const GFC_REAL_10 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_4_r16.c b/libgfortran/generated/minloc0_4_r16.c
index 83f293c203f..9a42aab2938 100644
--- a/libgfortran/generated/minloc0_4_r16.c
+++ b/libgfortran/generated/minloc0_4_r16.c
@@ -148,13 +148,13 @@ minloc0_4_r16 (gfc_array_i4 * const restrict retarray,
extern void mminloc0_4_r16 (gfc_array_i4 * const restrict,
- gfc_array_r16 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r16 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_4_r16);
void
mminloc0_4_r16 (gfc_array_i4 * const restrict retarray,
gfc_array_r16 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray,
index_type dstride;
GFC_INTEGER_4 *dest;
const GFC_REAL_16 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_4_r4.c b/libgfortran/generated/minloc0_4_r4.c
index 669a8c1c325..a2c67257476 100644
--- a/libgfortran/generated/minloc0_4_r4.c
+++ b/libgfortran/generated/minloc0_4_r4.c
@@ -148,13 +148,13 @@ minloc0_4_r4 (gfc_array_i4 * const restrict retarray,
extern void mminloc0_4_r4 (gfc_array_i4 * const restrict,
- gfc_array_r4 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r4 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_4_r4);
void
mminloc0_4_r4 (gfc_array_i4 * const restrict retarray,
gfc_array_r4 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray,
index_type dstride;
GFC_INTEGER_4 *dest;
const GFC_REAL_4 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_4_r8.c b/libgfortran/generated/minloc0_4_r8.c
index fbe9abd83bb..ceefacf6cf1 100644
--- a/libgfortran/generated/minloc0_4_r8.c
+++ b/libgfortran/generated/minloc0_4_r8.c
@@ -148,13 +148,13 @@ minloc0_4_r8 (gfc_array_i4 * const restrict retarray,
extern void mminloc0_4_r8 (gfc_array_i4 * const restrict,
- gfc_array_r8 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r8 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_4_r8);
void
mminloc0_4_r8 (gfc_array_i4 * const restrict retarray,
gfc_array_r8 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray,
index_type dstride;
GFC_INTEGER_4 *dest;
const GFC_REAL_8 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_8_i1.c b/libgfortran/generated/minloc0_8_i1.c
index e1b95ced532..2629591cb7d 100644
--- a/libgfortran/generated/minloc0_8_i1.c
+++ b/libgfortran/generated/minloc0_8_i1.c
@@ -148,13 +148,13 @@ minloc0_8_i1 (gfc_array_i8 * const restrict retarray,
extern void mminloc0_8_i1 (gfc_array_i8 * const restrict,
- gfc_array_i1 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i1 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_8_i1);
void
mminloc0_8_i1 (gfc_array_i8 * const restrict retarray,
gfc_array_i1 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_8_i1 (gfc_array_i8 * const restrict retarray,
index_type dstride;
GFC_INTEGER_8 *dest;
const GFC_INTEGER_1 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_8_i1 (gfc_array_i8 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_8_i1 (gfc_array_i8 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_8_i16.c b/libgfortran/generated/minloc0_8_i16.c
index 390b74a7f75..30d8551cd8a 100644
--- a/libgfortran/generated/minloc0_8_i16.c
+++ b/libgfortran/generated/minloc0_8_i16.c
@@ -148,13 +148,13 @@ minloc0_8_i16 (gfc_array_i8 * const restrict retarray,
extern void mminloc0_8_i16 (gfc_array_i8 * const restrict,
- gfc_array_i16 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i16 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_8_i16);
void
mminloc0_8_i16 (gfc_array_i8 * const restrict retarray,
gfc_array_i16 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray,
index_type dstride;
GFC_INTEGER_8 *dest;
const GFC_INTEGER_16 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_8_i2.c b/libgfortran/generated/minloc0_8_i2.c
index c07042989e9..34c23637642 100644
--- a/libgfortran/generated/minloc0_8_i2.c
+++ b/libgfortran/generated/minloc0_8_i2.c
@@ -148,13 +148,13 @@ minloc0_8_i2 (gfc_array_i8 * const restrict retarray,
extern void mminloc0_8_i2 (gfc_array_i8 * const restrict,
- gfc_array_i2 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i2 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_8_i2);
void
mminloc0_8_i2 (gfc_array_i8 * const restrict retarray,
gfc_array_i2 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_8_i2 (gfc_array_i8 * const restrict retarray,
index_type dstride;
GFC_INTEGER_8 *dest;
const GFC_INTEGER_2 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_8_i2 (gfc_array_i8 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_8_i2 (gfc_array_i8 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_8_i4.c b/libgfortran/generated/minloc0_8_i4.c
index 524af749728..e1053e0b3f5 100644
--- a/libgfortran/generated/minloc0_8_i4.c
+++ b/libgfortran/generated/minloc0_8_i4.c
@@ -148,13 +148,13 @@ minloc0_8_i4 (gfc_array_i8 * const restrict retarray,
extern void mminloc0_8_i4 (gfc_array_i8 * const restrict,
- gfc_array_i4 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i4 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_8_i4);
void
mminloc0_8_i4 (gfc_array_i8 * const restrict retarray,
gfc_array_i4 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray,
index_type dstride;
GFC_INTEGER_8 *dest;
const GFC_INTEGER_4 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_8_i8.c b/libgfortran/generated/minloc0_8_i8.c
index 510973cb35f..851645e1389 100644
--- a/libgfortran/generated/minloc0_8_i8.c
+++ b/libgfortran/generated/minloc0_8_i8.c
@@ -148,13 +148,13 @@ minloc0_8_i8 (gfc_array_i8 * const restrict retarray,
extern void mminloc0_8_i8 (gfc_array_i8 * const restrict,
- gfc_array_i8 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_i8 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_8_i8);
void
mminloc0_8_i8 (gfc_array_i8 * const restrict retarray,
gfc_array_i8 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray,
index_type dstride;
GFC_INTEGER_8 *dest;
const GFC_INTEGER_8 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_8_r10.c b/libgfortran/generated/minloc0_8_r10.c
index 7e4dcb017e7..569efa08b79 100644
--- a/libgfortran/generated/minloc0_8_r10.c
+++ b/libgfortran/generated/minloc0_8_r10.c
@@ -148,13 +148,13 @@ minloc0_8_r10 (gfc_array_i8 * const restrict retarray,
extern void mminloc0_8_r10 (gfc_array_i8 * const restrict,
- gfc_array_r10 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r10 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_8_r10);
void
mminloc0_8_r10 (gfc_array_i8 * const restrict retarray,
gfc_array_r10 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray,
index_type dstride;
GFC_INTEGER_8 *dest;
const GFC_REAL_10 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_8_r16.c b/libgfortran/generated/minloc0_8_r16.c
index dfb6bd67ead..4e19efab4f2 100644
--- a/libgfortran/generated/minloc0_8_r16.c
+++ b/libgfortran/generated/minloc0_8_r16.c
@@ -148,13 +148,13 @@ minloc0_8_r16 (gfc_array_i8 * const restrict retarray,
extern void mminloc0_8_r16 (gfc_array_i8 * const restrict,
- gfc_array_r16 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r16 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_8_r16);
void
mminloc0_8_r16 (gfc_array_i8 * const restrict retarray,
gfc_array_r16 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray,
index_type dstride;
GFC_INTEGER_8 *dest;
const GFC_REAL_16 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_8_r4.c b/libgfortran/generated/minloc0_8_r4.c
index d10f942e2ab..0bcf5c63447 100644
--- a/libgfortran/generated/minloc0_8_r4.c
+++ b/libgfortran/generated/minloc0_8_r4.c
@@ -148,13 +148,13 @@ minloc0_8_r4 (gfc_array_i8 * const restrict retarray,
extern void mminloc0_8_r4 (gfc_array_i8 * const restrict,
- gfc_array_r4 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r4 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_8_r4);
void
mminloc0_8_r4 (gfc_array_i8 * const restrict retarray,
gfc_array_r4 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray,
index_type dstride;
GFC_INTEGER_8 *dest;
const GFC_REAL_4 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc0_8_r8.c b/libgfortran/generated/minloc0_8_r8.c
index 781f0caaef4..778963376d3 100644
--- a/libgfortran/generated/minloc0_8_r8.c
+++ b/libgfortran/generated/minloc0_8_r8.c
@@ -148,13 +148,13 @@ minloc0_8_r8 (gfc_array_i8 * const restrict retarray,
extern void mminloc0_8_r8 (gfc_array_i8 * const restrict,
- gfc_array_r8 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_r8 * const restrict, gfc_array_l1 * const restrict);
export_proto(mminloc0_8_r8);
void
mminloc0_8_r8 (gfc_array_i8 * const restrict retarray,
gfc_array_r8 * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray,
index_type dstride;
GFC_INTEGER_8 *dest;
const GFC_REAL_8 *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray,
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray,
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/generated/minloc1_16_i1.c b/libgfortran/generated/minloc1_16_i1.c
index fa25b3d82d6..1e7b09bd131 100644
--- a/libgfortran/generated/minloc1_16_i1.c
+++ b/libgfortran/generated/minloc1_16_i1.c
@@ -191,14 +191,14 @@ minloc1_16_i1 (gfc_array_i16 * const restrict retarray,
extern void mminloc1_16_i1 (gfc_array_i16 * const restrict,
gfc_array_i1 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_16_i1);
void
mminloc1_16_i1 (gfc_array_i16 * const restrict retarray,
gfc_array_i1 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_INTEGER_1 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_1 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_16_i16.c b/libgfortran/generated/minloc1_16_i16.c
index 4ea816f6539..0570e1686ad 100644
--- a/libgfortran/generated/minloc1_16_i16.c
+++ b/libgfortran/generated/minloc1_16_i16.c
@@ -191,14 +191,14 @@ minloc1_16_i16 (gfc_array_i16 * const restrict retarray,
extern void mminloc1_16_i16 (gfc_array_i16 * const restrict,
gfc_array_i16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_16_i16);
void
mminloc1_16_i16 (gfc_array_i16 * const restrict retarray,
gfc_array_i16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_INTEGER_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_16_i2.c b/libgfortran/generated/minloc1_16_i2.c
index 6251f19d2eb..3ec829ee7c0 100644
--- a/libgfortran/generated/minloc1_16_i2.c
+++ b/libgfortran/generated/minloc1_16_i2.c
@@ -191,14 +191,14 @@ minloc1_16_i2 (gfc_array_i16 * const restrict retarray,
extern void mminloc1_16_i2 (gfc_array_i16 * const restrict,
gfc_array_i2 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_16_i2);
void
mminloc1_16_i2 (gfc_array_i16 * const restrict retarray,
gfc_array_i2 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_INTEGER_2 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_2 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_16_i4.c b/libgfortran/generated/minloc1_16_i4.c
index c70b028122f..1d2a22982c7 100644
--- a/libgfortran/generated/minloc1_16_i4.c
+++ b/libgfortran/generated/minloc1_16_i4.c
@@ -191,14 +191,14 @@ minloc1_16_i4 (gfc_array_i16 * const restrict retarray,
extern void mminloc1_16_i4 (gfc_array_i16 * const restrict,
gfc_array_i4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_16_i4);
void
mminloc1_16_i4 (gfc_array_i16 * const restrict retarray,
gfc_array_i4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_INTEGER_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_16_i8.c b/libgfortran/generated/minloc1_16_i8.c
index 913532711c4..009bfc84b1a 100644
--- a/libgfortran/generated/minloc1_16_i8.c
+++ b/libgfortran/generated/minloc1_16_i8.c
@@ -191,14 +191,14 @@ minloc1_16_i8 (gfc_array_i16 * const restrict retarray,
extern void mminloc1_16_i8 (gfc_array_i16 * const restrict,
gfc_array_i8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_16_i8);
void
mminloc1_16_i8 (gfc_array_i16 * const restrict retarray,
gfc_array_i8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_INTEGER_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_16_r10.c b/libgfortran/generated/minloc1_16_r10.c
index 77cc6442b99..18e7d9038ba 100644
--- a/libgfortran/generated/minloc1_16_r10.c
+++ b/libgfortran/generated/minloc1_16_r10.c
@@ -191,14 +191,14 @@ minloc1_16_r10 (gfc_array_i16 * const restrict retarray,
extern void mminloc1_16_r10 (gfc_array_i16 * const restrict,
gfc_array_r10 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_16_r10);
void
mminloc1_16_r10 (gfc_array_i16 * const restrict retarray,
gfc_array_r10 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_REAL_10 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_10 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_16_r16.c b/libgfortran/generated/minloc1_16_r16.c
index 146a66f29a7..11d66700d04 100644
--- a/libgfortran/generated/minloc1_16_r16.c
+++ b/libgfortran/generated/minloc1_16_r16.c
@@ -191,14 +191,14 @@ minloc1_16_r16 (gfc_array_i16 * const restrict retarray,
extern void mminloc1_16_r16 (gfc_array_i16 * const restrict,
gfc_array_r16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_16_r16);
void
mminloc1_16_r16 (gfc_array_i16 * const restrict retarray,
gfc_array_r16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_REAL_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_16_r4.c b/libgfortran/generated/minloc1_16_r4.c
index 93bf9e99b4e..36ab93342a1 100644
--- a/libgfortran/generated/minloc1_16_r4.c
+++ b/libgfortran/generated/minloc1_16_r4.c
@@ -191,14 +191,14 @@ minloc1_16_r4 (gfc_array_i16 * const restrict retarray,
extern void mminloc1_16_r4 (gfc_array_i16 * const restrict,
gfc_array_r4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_16_r4);
void
mminloc1_16_r4 (gfc_array_i16 * const restrict retarray,
gfc_array_r4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_REAL_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_16_r8.c b/libgfortran/generated/minloc1_16_r8.c
index 8313589bd7b..4bc2f7e9468 100644
--- a/libgfortran/generated/minloc1_16_r8.c
+++ b/libgfortran/generated/minloc1_16_r8.c
@@ -191,14 +191,14 @@ minloc1_16_r8 (gfc_array_i16 * const restrict retarray,
extern void mminloc1_16_r8 (gfc_array_i16 * const restrict,
gfc_array_r8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_16_r8);
void
mminloc1_16_r8 (gfc_array_i16 * const restrict retarray,
gfc_array_r8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_REAL_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_4_i1.c b/libgfortran/generated/minloc1_4_i1.c
index 637a7ec2be6..b94775d748d 100644
--- a/libgfortran/generated/minloc1_4_i1.c
+++ b/libgfortran/generated/minloc1_4_i1.c
@@ -191,14 +191,14 @@ minloc1_4_i1 (gfc_array_i4 * const restrict retarray,
extern void mminloc1_4_i1 (gfc_array_i4 * const restrict,
gfc_array_i1 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_4_i1);
void
mminloc1_4_i1 (gfc_array_i4 * const restrict retarray,
gfc_array_i1 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_INTEGER_1 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_1 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_4_i16.c b/libgfortran/generated/minloc1_4_i16.c
index abc9d792c90..720d35c0066 100644
--- a/libgfortran/generated/minloc1_4_i16.c
+++ b/libgfortran/generated/minloc1_4_i16.c
@@ -191,14 +191,14 @@ minloc1_4_i16 (gfc_array_i4 * const restrict retarray,
extern void mminloc1_4_i16 (gfc_array_i4 * const restrict,
gfc_array_i16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_4_i16);
void
mminloc1_4_i16 (gfc_array_i4 * const restrict retarray,
gfc_array_i16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_INTEGER_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_4_i2.c b/libgfortran/generated/minloc1_4_i2.c
index 0183035d462..10a3537f8cf 100644
--- a/libgfortran/generated/minloc1_4_i2.c
+++ b/libgfortran/generated/minloc1_4_i2.c
@@ -191,14 +191,14 @@ minloc1_4_i2 (gfc_array_i4 * const restrict retarray,
extern void mminloc1_4_i2 (gfc_array_i4 * const restrict,
gfc_array_i2 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_4_i2);
void
mminloc1_4_i2 (gfc_array_i4 * const restrict retarray,
gfc_array_i2 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_INTEGER_2 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_2 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_4_i4.c b/libgfortran/generated/minloc1_4_i4.c
index 8e746c8bc40..941ac82ae01 100644
--- a/libgfortran/generated/minloc1_4_i4.c
+++ b/libgfortran/generated/minloc1_4_i4.c
@@ -191,14 +191,14 @@ minloc1_4_i4 (gfc_array_i4 * const restrict retarray,
extern void mminloc1_4_i4 (gfc_array_i4 * const restrict,
gfc_array_i4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_4_i4);
void
mminloc1_4_i4 (gfc_array_i4 * const restrict retarray,
gfc_array_i4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_INTEGER_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_4_i8.c b/libgfortran/generated/minloc1_4_i8.c
index a05e972817b..36768068183 100644
--- a/libgfortran/generated/minloc1_4_i8.c
+++ b/libgfortran/generated/minloc1_4_i8.c
@@ -191,14 +191,14 @@ minloc1_4_i8 (gfc_array_i4 * const restrict retarray,
extern void mminloc1_4_i8 (gfc_array_i4 * const restrict,
gfc_array_i8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_4_i8);
void
mminloc1_4_i8 (gfc_array_i4 * const restrict retarray,
gfc_array_i8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_INTEGER_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_4_r10.c b/libgfortran/generated/minloc1_4_r10.c
index 2c36814d3fe..84631c091e5 100644
--- a/libgfortran/generated/minloc1_4_r10.c
+++ b/libgfortran/generated/minloc1_4_r10.c
@@ -191,14 +191,14 @@ minloc1_4_r10 (gfc_array_i4 * const restrict retarray,
extern void mminloc1_4_r10 (gfc_array_i4 * const restrict,
gfc_array_r10 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_4_r10);
void
mminloc1_4_r10 (gfc_array_i4 * const restrict retarray,
gfc_array_r10 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_REAL_10 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_10 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_4_r16.c b/libgfortran/generated/minloc1_4_r16.c
index 7258ddaed42..d3e9b5fef8c 100644
--- a/libgfortran/generated/minloc1_4_r16.c
+++ b/libgfortran/generated/minloc1_4_r16.c
@@ -191,14 +191,14 @@ minloc1_4_r16 (gfc_array_i4 * const restrict retarray,
extern void mminloc1_4_r16 (gfc_array_i4 * const restrict,
gfc_array_r16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_4_r16);
void
mminloc1_4_r16 (gfc_array_i4 * const restrict retarray,
gfc_array_r16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_REAL_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_4_r4.c b/libgfortran/generated/minloc1_4_r4.c
index b36cee2d1fa..e2ccd58572e 100644
--- a/libgfortran/generated/minloc1_4_r4.c
+++ b/libgfortran/generated/minloc1_4_r4.c
@@ -191,14 +191,14 @@ minloc1_4_r4 (gfc_array_i4 * const restrict retarray,
extern void mminloc1_4_r4 (gfc_array_i4 * const restrict,
gfc_array_r4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_4_r4);
void
mminloc1_4_r4 (gfc_array_i4 * const restrict retarray,
gfc_array_r4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_REAL_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_4_r8.c b/libgfortran/generated/minloc1_4_r8.c
index a4ad1382b57..6e96a65cdeb 100644
--- a/libgfortran/generated/minloc1_4_r8.c
+++ b/libgfortran/generated/minloc1_4_r8.c
@@ -191,14 +191,14 @@ minloc1_4_r8 (gfc_array_i4 * const restrict retarray,
extern void mminloc1_4_r8 (gfc_array_i4 * const restrict,
gfc_array_r8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_4_r8);
void
mminloc1_4_r8 (gfc_array_i4 * const restrict retarray,
gfc_array_r8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_REAL_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_8_i1.c b/libgfortran/generated/minloc1_8_i1.c
index 36f49828bae..caa48af2a2e 100644
--- a/libgfortran/generated/minloc1_8_i1.c
+++ b/libgfortran/generated/minloc1_8_i1.c
@@ -191,14 +191,14 @@ minloc1_8_i1 (gfc_array_i8 * const restrict retarray,
extern void mminloc1_8_i1 (gfc_array_i8 * const restrict,
gfc_array_i1 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_8_i1);
void
mminloc1_8_i1 (gfc_array_i8 * const restrict retarray,
gfc_array_i1 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_INTEGER_1 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_1 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_8_i16.c b/libgfortran/generated/minloc1_8_i16.c
index 907454dc50a..1928c401004 100644
--- a/libgfortran/generated/minloc1_8_i16.c
+++ b/libgfortran/generated/minloc1_8_i16.c
@@ -191,14 +191,14 @@ minloc1_8_i16 (gfc_array_i8 * const restrict retarray,
extern void mminloc1_8_i16 (gfc_array_i8 * const restrict,
gfc_array_i16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_8_i16);
void
mminloc1_8_i16 (gfc_array_i8 * const restrict retarray,
gfc_array_i16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_INTEGER_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_8_i2.c b/libgfortran/generated/minloc1_8_i2.c
index 1d6526ec6b6..6c40de8040f 100644
--- a/libgfortran/generated/minloc1_8_i2.c
+++ b/libgfortran/generated/minloc1_8_i2.c
@@ -191,14 +191,14 @@ minloc1_8_i2 (gfc_array_i8 * const restrict retarray,
extern void mminloc1_8_i2 (gfc_array_i8 * const restrict,
gfc_array_i2 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_8_i2);
void
mminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
gfc_array_i2 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_INTEGER_2 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_2 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_8_i4.c b/libgfortran/generated/minloc1_8_i4.c
index cebf4527e13..9f563d5cdce 100644
--- a/libgfortran/generated/minloc1_8_i4.c
+++ b/libgfortran/generated/minloc1_8_i4.c
@@ -191,14 +191,14 @@ minloc1_8_i4 (gfc_array_i8 * const restrict retarray,
extern void mminloc1_8_i4 (gfc_array_i8 * const restrict,
gfc_array_i4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_8_i4);
void
mminloc1_8_i4 (gfc_array_i8 * const restrict retarray,
gfc_array_i4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_INTEGER_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_8_i8.c b/libgfortran/generated/minloc1_8_i8.c
index 1b822e2c6a5..6cdeec75db1 100644
--- a/libgfortran/generated/minloc1_8_i8.c
+++ b/libgfortran/generated/minloc1_8_i8.c
@@ -191,14 +191,14 @@ minloc1_8_i8 (gfc_array_i8 * const restrict retarray,
extern void mminloc1_8_i8 (gfc_array_i8 * const restrict,
gfc_array_i8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_8_i8);
void
mminloc1_8_i8 (gfc_array_i8 * const restrict retarray,
gfc_array_i8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_INTEGER_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_8_r10.c b/libgfortran/generated/minloc1_8_r10.c
index f7fb3bf3c13..1dc5be69197 100644
--- a/libgfortran/generated/minloc1_8_r10.c
+++ b/libgfortran/generated/minloc1_8_r10.c
@@ -191,14 +191,14 @@ minloc1_8_r10 (gfc_array_i8 * const restrict retarray,
extern void mminloc1_8_r10 (gfc_array_i8 * const restrict,
gfc_array_r10 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_8_r10);
void
mminloc1_8_r10 (gfc_array_i8 * const restrict retarray,
gfc_array_r10 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_REAL_10 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_10 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_8_r16.c b/libgfortran/generated/minloc1_8_r16.c
index cbba161c84c..5bec2992ff6 100644
--- a/libgfortran/generated/minloc1_8_r16.c
+++ b/libgfortran/generated/minloc1_8_r16.c
@@ -191,14 +191,14 @@ minloc1_8_r16 (gfc_array_i8 * const restrict retarray,
extern void mminloc1_8_r16 (gfc_array_i8 * const restrict,
gfc_array_r16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_8_r16);
void
mminloc1_8_r16 (gfc_array_i8 * const restrict retarray,
gfc_array_r16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_REAL_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_8_r4.c b/libgfortran/generated/minloc1_8_r4.c
index 75081789788..99521480937 100644
--- a/libgfortran/generated/minloc1_8_r4.c
+++ b/libgfortran/generated/minloc1_8_r4.c
@@ -191,14 +191,14 @@ minloc1_8_r4 (gfc_array_i8 * const restrict retarray,
extern void mminloc1_8_r4 (gfc_array_i8 * const restrict,
gfc_array_r4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_8_r4);
void
mminloc1_8_r4 (gfc_array_i8 * const restrict retarray,
gfc_array_r4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_REAL_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minloc1_8_r8.c b/libgfortran/generated/minloc1_8_r8.c
index 372ff2135fa..44e3eecb7cf 100644
--- a/libgfortran/generated/minloc1_8_r8.c
+++ b/libgfortran/generated/minloc1_8_r8.c
@@ -191,14 +191,14 @@ minloc1_8_r8 (gfc_array_i8 * const restrict retarray,
extern void mminloc1_8_r8 (gfc_array_i8 * const restrict,
gfc_array_r8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminloc1_8_r8);
void
mminloc1_8_r8 (gfc_array_i8 * const restrict retarray,
gfc_array_r8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_REAL_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -292,22 +307,11 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minval_i1.c b/libgfortran/generated/minval_i1.c
index 6ac105b2cd9..5c72eb93062 100644
--- a/libgfortran/generated/minval_i1.c
+++ b/libgfortran/generated/minval_i1.c
@@ -185,14 +185,14 @@ minval_i1 (gfc_array_i1 * const restrict retarray,
extern void mminval_i1 (gfc_array_i1 * const restrict,
gfc_array_i1 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminval_i1);
void
mminval_i1 (gfc_array_i1 * const restrict retarray,
gfc_array_i1 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mminval_i1 (gfc_array_i1 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_1 * restrict dest;
const GFC_INTEGER_1 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mminval_i1 (gfc_array_i1 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -231,7 +246,7 @@ mminval_i1 (gfc_array_i1 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -286,22 +301,11 @@ mminval_i1 (gfc_array_i1 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_1 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_1 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minval_i16.c b/libgfortran/generated/minval_i16.c
index 3dd1678b617..eedadadc058 100644
--- a/libgfortran/generated/minval_i16.c
+++ b/libgfortran/generated/minval_i16.c
@@ -185,14 +185,14 @@ minval_i16 (gfc_array_i16 * const restrict retarray,
extern void mminval_i16 (gfc_array_i16 * const restrict,
gfc_array_i16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminval_i16);
void
mminval_i16 (gfc_array_i16 * const restrict retarray,
gfc_array_i16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mminval_i16 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_INTEGER_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mminval_i16 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -231,7 +246,7 @@ mminval_i16 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -286,22 +301,11 @@ mminval_i16 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minval_i2.c b/libgfortran/generated/minval_i2.c
index 6d0d3eb8668..2ca35064421 100644
--- a/libgfortran/generated/minval_i2.c
+++ b/libgfortran/generated/minval_i2.c
@@ -185,14 +185,14 @@ minval_i2 (gfc_array_i2 * const restrict retarray,
extern void mminval_i2 (gfc_array_i2 * const restrict,
gfc_array_i2 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminval_i2);
void
mminval_i2 (gfc_array_i2 * const restrict retarray,
gfc_array_i2 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mminval_i2 (gfc_array_i2 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_2 * restrict dest;
const GFC_INTEGER_2 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mminval_i2 (gfc_array_i2 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -231,7 +246,7 @@ mminval_i2 (gfc_array_i2 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -286,22 +301,11 @@ mminval_i2 (gfc_array_i2 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_2 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_2 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minval_i4.c b/libgfortran/generated/minval_i4.c
index 2d6c1dee749..2f5796efbe2 100644
--- a/libgfortran/generated/minval_i4.c
+++ b/libgfortran/generated/minval_i4.c
@@ -185,14 +185,14 @@ minval_i4 (gfc_array_i4 * const restrict retarray,
extern void mminval_i4 (gfc_array_i4 * const restrict,
gfc_array_i4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminval_i4);
void
mminval_i4 (gfc_array_i4 * const restrict retarray,
gfc_array_i4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mminval_i4 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_INTEGER_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mminval_i4 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -231,7 +246,7 @@ mminval_i4 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -286,22 +301,11 @@ mminval_i4 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minval_i8.c b/libgfortran/generated/minval_i8.c
index 78158ca98b3..0bdbb81b230 100644
--- a/libgfortran/generated/minval_i8.c
+++ b/libgfortran/generated/minval_i8.c
@@ -185,14 +185,14 @@ minval_i8 (gfc_array_i8 * const restrict retarray,
extern void mminval_i8 (gfc_array_i8 * const restrict,
gfc_array_i8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminval_i8);
void
mminval_i8 (gfc_array_i8 * const restrict retarray,
gfc_array_i8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mminval_i8 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_INTEGER_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mminval_i8 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -231,7 +246,7 @@ mminval_i8 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -286,22 +301,11 @@ mminval_i8 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minval_r10.c b/libgfortran/generated/minval_r10.c
index fe87af41ac1..aa5c576d2eb 100644
--- a/libgfortran/generated/minval_r10.c
+++ b/libgfortran/generated/minval_r10.c
@@ -185,14 +185,14 @@ minval_r10 (gfc_array_r10 * const restrict retarray,
extern void mminval_r10 (gfc_array_r10 * const restrict,
gfc_array_r10 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminval_r10);
void
mminval_r10 (gfc_array_r10 * const restrict retarray,
gfc_array_r10 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mminval_r10 (gfc_array_r10 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_REAL_10 * restrict dest;
const GFC_REAL_10 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mminval_r10 (gfc_array_r10 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -231,7 +246,7 @@ mminval_r10 (gfc_array_r10 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -286,22 +301,11 @@ mminval_r10 (gfc_array_r10 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_10 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_REAL_10 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minval_r16.c b/libgfortran/generated/minval_r16.c
index 58596b5eea6..ada6f8c6227 100644
--- a/libgfortran/generated/minval_r16.c
+++ b/libgfortran/generated/minval_r16.c
@@ -185,14 +185,14 @@ minval_r16 (gfc_array_r16 * const restrict retarray,
extern void mminval_r16 (gfc_array_r16 * const restrict,
gfc_array_r16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminval_r16);
void
mminval_r16 (gfc_array_r16 * const restrict retarray,
gfc_array_r16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mminval_r16 (gfc_array_r16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_REAL_16 * restrict dest;
const GFC_REAL_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mminval_r16 (gfc_array_r16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -231,7 +246,7 @@ mminval_r16 (gfc_array_r16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -286,22 +301,11 @@ mminval_r16 (gfc_array_r16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_REAL_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minval_r4.c b/libgfortran/generated/minval_r4.c
index a11549ee974..7143b2b604a 100644
--- a/libgfortran/generated/minval_r4.c
+++ b/libgfortran/generated/minval_r4.c
@@ -185,14 +185,14 @@ minval_r4 (gfc_array_r4 * const restrict retarray,
extern void mminval_r4 (gfc_array_r4 * const restrict,
gfc_array_r4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminval_r4);
void
mminval_r4 (gfc_array_r4 * const restrict retarray,
gfc_array_r4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mminval_r4 (gfc_array_r4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_REAL_4 * restrict dest;
const GFC_REAL_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mminval_r4 (gfc_array_r4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -231,7 +246,7 @@ mminval_r4 (gfc_array_r4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -286,22 +301,11 @@ mminval_r4 (gfc_array_r4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_REAL_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/minval_r8.c b/libgfortran/generated/minval_r8.c
index 14ca0552bda..c21dc2350a9 100644
--- a/libgfortran/generated/minval_r8.c
+++ b/libgfortran/generated/minval_r8.c
@@ -185,14 +185,14 @@ minval_r8 (gfc_array_r8 * const restrict retarray,
extern void mminval_r8 (gfc_array_r8 * const restrict,
gfc_array_r8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mminval_r8);
void
mminval_r8 (gfc_array_r8 * const restrict retarray,
gfc_array_r8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mminval_r8 (gfc_array_r8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_REAL_8 * restrict dest;
const GFC_REAL_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mminval_r8 (gfc_array_r8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -231,7 +246,7 @@ mminval_r8 (gfc_array_r8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -286,22 +301,11 @@ mminval_r8 (gfc_array_r8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_REAL_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/product_c10.c b/libgfortran/generated/product_c10.c
index 0d73a9b799c..b63cb6afabd 100644
--- a/libgfortran/generated/product_c10.c
+++ b/libgfortran/generated/product_c10.c
@@ -184,14 +184,14 @@ product_c10 (gfc_array_c10 * const restrict retarray,
extern void mproduct_c10 (gfc_array_c10 * const restrict,
gfc_array_c10 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mproduct_c10);
void
mproduct_c10 (gfc_array_c10 * const restrict retarray,
gfc_array_c10 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_COMPLEX_10 * restrict dest;
const GFC_COMPLEX_10 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_COMPLEX_10 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_COMPLEX_10 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/product_c16.c b/libgfortran/generated/product_c16.c
index a5c8bd07e74..3b6265a2720 100644
--- a/libgfortran/generated/product_c16.c
+++ b/libgfortran/generated/product_c16.c
@@ -184,14 +184,14 @@ product_c16 (gfc_array_c16 * const restrict retarray,
extern void mproduct_c16 (gfc_array_c16 * const restrict,
gfc_array_c16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mproduct_c16);
void
mproduct_c16 (gfc_array_c16 * const restrict retarray,
gfc_array_c16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_COMPLEX_16 * restrict dest;
const GFC_COMPLEX_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_COMPLEX_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_COMPLEX_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/product_c4.c b/libgfortran/generated/product_c4.c
index 45a62c9cfb9..07e0df0b85e 100644
--- a/libgfortran/generated/product_c4.c
+++ b/libgfortran/generated/product_c4.c
@@ -184,14 +184,14 @@ product_c4 (gfc_array_c4 * const restrict retarray,
extern void mproduct_c4 (gfc_array_c4 * const restrict,
gfc_array_c4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mproduct_c4);
void
mproduct_c4 (gfc_array_c4 * const restrict retarray,
gfc_array_c4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_COMPLEX_4 * restrict dest;
const GFC_COMPLEX_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_COMPLEX_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_COMPLEX_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/product_c8.c b/libgfortran/generated/product_c8.c
index 69bcb87c399..a81241eca2c 100644
--- a/libgfortran/generated/product_c8.c
+++ b/libgfortran/generated/product_c8.c
@@ -184,14 +184,14 @@ product_c8 (gfc_array_c8 * const restrict retarray,
extern void mproduct_c8 (gfc_array_c8 * const restrict,
gfc_array_c8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mproduct_c8);
void
mproduct_c8 (gfc_array_c8 * const restrict retarray,
gfc_array_c8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_COMPLEX_8 * restrict dest;
const GFC_COMPLEX_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_COMPLEX_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_COMPLEX_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/product_i1.c b/libgfortran/generated/product_i1.c
index 76427e4cbb7..4c68414247c 100644
--- a/libgfortran/generated/product_i1.c
+++ b/libgfortran/generated/product_i1.c
@@ -184,14 +184,14 @@ product_i1 (gfc_array_i1 * const restrict retarray,
extern void mproduct_i1 (gfc_array_i1 * const restrict,
gfc_array_i1 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mproduct_i1);
void
mproduct_i1 (gfc_array_i1 * const restrict retarray,
gfc_array_i1 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_1 * restrict dest;
const GFC_INTEGER_1 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_1 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_1 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/product_i16.c b/libgfortran/generated/product_i16.c
index 7b735783094..9e81e595931 100644
--- a/libgfortran/generated/product_i16.c
+++ b/libgfortran/generated/product_i16.c
@@ -184,14 +184,14 @@ product_i16 (gfc_array_i16 * const restrict retarray,
extern void mproduct_i16 (gfc_array_i16 * const restrict,
gfc_array_i16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mproduct_i16);
void
mproduct_i16 (gfc_array_i16 * const restrict retarray,
gfc_array_i16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_INTEGER_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/product_i2.c b/libgfortran/generated/product_i2.c
index bdb51a65c52..dde442a7433 100644
--- a/libgfortran/generated/product_i2.c
+++ b/libgfortran/generated/product_i2.c
@@ -184,14 +184,14 @@ product_i2 (gfc_array_i2 * const restrict retarray,
extern void mproduct_i2 (gfc_array_i2 * const restrict,
gfc_array_i2 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mproduct_i2);
void
mproduct_i2 (gfc_array_i2 * const restrict retarray,
gfc_array_i2 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_2 * restrict dest;
const GFC_INTEGER_2 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_2 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_2 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/product_i4.c b/libgfortran/generated/product_i4.c
index 72d0e1afbad..50875daafd3 100644
--- a/libgfortran/generated/product_i4.c
+++ b/libgfortran/generated/product_i4.c
@@ -184,14 +184,14 @@ product_i4 (gfc_array_i4 * const restrict retarray,
extern void mproduct_i4 (gfc_array_i4 * const restrict,
gfc_array_i4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mproduct_i4);
void
mproduct_i4 (gfc_array_i4 * const restrict retarray,
gfc_array_i4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_INTEGER_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/product_i8.c b/libgfortran/generated/product_i8.c
index d1ae82e4303..0b9d268a6c7 100644
--- a/libgfortran/generated/product_i8.c
+++ b/libgfortran/generated/product_i8.c
@@ -184,14 +184,14 @@ product_i8 (gfc_array_i8 * const restrict retarray,
extern void mproduct_i8 (gfc_array_i8 * const restrict,
gfc_array_i8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mproduct_i8);
void
mproduct_i8 (gfc_array_i8 * const restrict retarray,
gfc_array_i8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_INTEGER_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/product_r10.c b/libgfortran/generated/product_r10.c
index f19b67ba949..28732503501 100644
--- a/libgfortran/generated/product_r10.c
+++ b/libgfortran/generated/product_r10.c
@@ -184,14 +184,14 @@ product_r10 (gfc_array_r10 * const restrict retarray,
extern void mproduct_r10 (gfc_array_r10 * const restrict,
gfc_array_r10 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mproduct_r10);
void
mproduct_r10 (gfc_array_r10 * const restrict retarray,
gfc_array_r10 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_REAL_10 * restrict dest;
const GFC_REAL_10 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_10 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_REAL_10 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/product_r16.c b/libgfortran/generated/product_r16.c
index 3d0a76a4ade..61149515b7f 100644
--- a/libgfortran/generated/product_r16.c
+++ b/libgfortran/generated/product_r16.c
@@ -184,14 +184,14 @@ product_r16 (gfc_array_r16 * const restrict retarray,
extern void mproduct_r16 (gfc_array_r16 * const restrict,
gfc_array_r16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mproduct_r16);
void
mproduct_r16 (gfc_array_r16 * const restrict retarray,
gfc_array_r16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_REAL_16 * restrict dest;
const GFC_REAL_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_REAL_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/product_r4.c b/libgfortran/generated/product_r4.c
index 069b0d0c0e7..b3c9a0b25ca 100644
--- a/libgfortran/generated/product_r4.c
+++ b/libgfortran/generated/product_r4.c
@@ -184,14 +184,14 @@ product_r4 (gfc_array_r4 * const restrict retarray,
extern void mproduct_r4 (gfc_array_r4 * const restrict,
gfc_array_r4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mproduct_r4);
void
mproduct_r4 (gfc_array_r4 * const restrict retarray,
gfc_array_r4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_REAL_4 * restrict dest;
const GFC_REAL_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_REAL_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/product_r8.c b/libgfortran/generated/product_r8.c
index e9cfae39782..8d49b279894 100644
--- a/libgfortran/generated/product_r8.c
+++ b/libgfortran/generated/product_r8.c
@@ -184,14 +184,14 @@ product_r8 (gfc_array_r8 * const restrict retarray,
extern void mproduct_r8 (gfc_array_r8 * const restrict,
gfc_array_r8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(mproduct_r8);
void
mproduct_r8 (gfc_array_r8 * const restrict retarray,
gfc_array_r8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_REAL_8 * restrict dest;
const GFC_REAL_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_REAL_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/sum_c10.c b/libgfortran/generated/sum_c10.c
index 96b878b7fcd..2fa759450aa 100644
--- a/libgfortran/generated/sum_c10.c
+++ b/libgfortran/generated/sum_c10.c
@@ -184,14 +184,14 @@ sum_c10 (gfc_array_c10 * const restrict retarray,
extern void msum_c10 (gfc_array_c10 * const restrict,
gfc_array_c10 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(msum_c10);
void
msum_c10 (gfc_array_c10 * const restrict retarray,
gfc_array_c10 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_c10 (gfc_array_c10 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_COMPLEX_10 * restrict dest;
const GFC_COMPLEX_10 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_c10 (gfc_array_c10 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_c10 (gfc_array_c10 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ msum_c10 (gfc_array_c10 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_COMPLEX_10 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_COMPLEX_10 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/sum_c16.c b/libgfortran/generated/sum_c16.c
index a99d4f65b62..b74aa43b250 100644
--- a/libgfortran/generated/sum_c16.c
+++ b/libgfortran/generated/sum_c16.c
@@ -184,14 +184,14 @@ sum_c16 (gfc_array_c16 * const restrict retarray,
extern void msum_c16 (gfc_array_c16 * const restrict,
gfc_array_c16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(msum_c16);
void
msum_c16 (gfc_array_c16 * const restrict retarray,
gfc_array_c16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_c16 (gfc_array_c16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_COMPLEX_16 * restrict dest;
const GFC_COMPLEX_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_c16 (gfc_array_c16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_c16 (gfc_array_c16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ msum_c16 (gfc_array_c16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_COMPLEX_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_COMPLEX_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/sum_c4.c b/libgfortran/generated/sum_c4.c
index 83979fbdf21..bf41330a2f5 100644
--- a/libgfortran/generated/sum_c4.c
+++ b/libgfortran/generated/sum_c4.c
@@ -184,14 +184,14 @@ sum_c4 (gfc_array_c4 * const restrict retarray,
extern void msum_c4 (gfc_array_c4 * const restrict,
gfc_array_c4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(msum_c4);
void
msum_c4 (gfc_array_c4 * const restrict retarray,
gfc_array_c4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_c4 (gfc_array_c4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_COMPLEX_4 * restrict dest;
const GFC_COMPLEX_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_c4 (gfc_array_c4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_c4 (gfc_array_c4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ msum_c4 (gfc_array_c4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_COMPLEX_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_COMPLEX_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/sum_c8.c b/libgfortran/generated/sum_c8.c
index d82092a1b6b..d7c3c9dadc2 100644
--- a/libgfortran/generated/sum_c8.c
+++ b/libgfortran/generated/sum_c8.c
@@ -184,14 +184,14 @@ sum_c8 (gfc_array_c8 * const restrict retarray,
extern void msum_c8 (gfc_array_c8 * const restrict,
gfc_array_c8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(msum_c8);
void
msum_c8 (gfc_array_c8 * const restrict retarray,
gfc_array_c8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_c8 (gfc_array_c8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_COMPLEX_8 * restrict dest;
const GFC_COMPLEX_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_c8 (gfc_array_c8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_c8 (gfc_array_c8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ msum_c8 (gfc_array_c8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_COMPLEX_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_COMPLEX_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/sum_i1.c b/libgfortran/generated/sum_i1.c
index 87205b8f716..0b0d3c8135d 100644
--- a/libgfortran/generated/sum_i1.c
+++ b/libgfortran/generated/sum_i1.c
@@ -184,14 +184,14 @@ sum_i1 (gfc_array_i1 * const restrict retarray,
extern void msum_i1 (gfc_array_i1 * const restrict,
gfc_array_i1 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(msum_i1);
void
msum_i1 (gfc_array_i1 * const restrict retarray,
gfc_array_i1 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_i1 (gfc_array_i1 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_1 * restrict dest;
const GFC_INTEGER_1 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_i1 (gfc_array_i1 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_i1 (gfc_array_i1 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ msum_i1 (gfc_array_i1 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_1 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_1 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/sum_i16.c b/libgfortran/generated/sum_i16.c
index 83857734a00..0f0bc55e373 100644
--- a/libgfortran/generated/sum_i16.c
+++ b/libgfortran/generated/sum_i16.c
@@ -184,14 +184,14 @@ sum_i16 (gfc_array_i16 * const restrict retarray,
extern void msum_i16 (gfc_array_i16 * const restrict,
gfc_array_i16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(msum_i16);
void
msum_i16 (gfc_array_i16 * const restrict retarray,
gfc_array_i16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_i16 (gfc_array_i16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_16 * restrict dest;
const GFC_INTEGER_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_i16 (gfc_array_i16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_i16 (gfc_array_i16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ msum_i16 (gfc_array_i16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/sum_i2.c b/libgfortran/generated/sum_i2.c
index c4452c3ce9d..c951d670177 100644
--- a/libgfortran/generated/sum_i2.c
+++ b/libgfortran/generated/sum_i2.c
@@ -184,14 +184,14 @@ sum_i2 (gfc_array_i2 * const restrict retarray,
extern void msum_i2 (gfc_array_i2 * const restrict,
gfc_array_i2 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(msum_i2);
void
msum_i2 (gfc_array_i2 * const restrict retarray,
gfc_array_i2 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_i2 (gfc_array_i2 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_2 * restrict dest;
const GFC_INTEGER_2 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_i2 (gfc_array_i2 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_i2 (gfc_array_i2 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ msum_i2 (gfc_array_i2 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_2 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_2 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/sum_i4.c b/libgfortran/generated/sum_i4.c
index e97d15c62ba..973b8f10297 100644
--- a/libgfortran/generated/sum_i4.c
+++ b/libgfortran/generated/sum_i4.c
@@ -184,14 +184,14 @@ sum_i4 (gfc_array_i4 * const restrict retarray,
extern void msum_i4 (gfc_array_i4 * const restrict,
gfc_array_i4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(msum_i4);
void
msum_i4 (gfc_array_i4 * const restrict retarray,
gfc_array_i4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_i4 (gfc_array_i4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_4 * restrict dest;
const GFC_INTEGER_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_i4 (gfc_array_i4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_i4 (gfc_array_i4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ msum_i4 (gfc_array_i4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/sum_i8.c b/libgfortran/generated/sum_i8.c
index da913442b4f..87e7ec650f0 100644
--- a/libgfortran/generated/sum_i8.c
+++ b/libgfortran/generated/sum_i8.c
@@ -184,14 +184,14 @@ sum_i8 (gfc_array_i8 * const restrict retarray,
extern void msum_i8 (gfc_array_i8 * const restrict,
gfc_array_i8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(msum_i8);
void
msum_i8 (gfc_array_i8 * const restrict retarray,
gfc_array_i8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_i8 (gfc_array_i8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_INTEGER_8 * restrict dest;
const GFC_INTEGER_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_i8 (gfc_array_i8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_i8 (gfc_array_i8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ msum_i8 (gfc_array_i8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_INTEGER_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_INTEGER_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/sum_r10.c b/libgfortran/generated/sum_r10.c
index 0433c90f90b..f552026e446 100644
--- a/libgfortran/generated/sum_r10.c
+++ b/libgfortran/generated/sum_r10.c
@@ -184,14 +184,14 @@ sum_r10 (gfc_array_r10 * const restrict retarray,
extern void msum_r10 (gfc_array_r10 * const restrict,
gfc_array_r10 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(msum_r10);
void
msum_r10 (gfc_array_r10 * const restrict retarray,
gfc_array_r10 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_r10 (gfc_array_r10 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_REAL_10 * restrict dest;
const GFC_REAL_10 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_r10 (gfc_array_r10 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_r10 (gfc_array_r10 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ msum_r10 (gfc_array_r10 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_10 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_REAL_10 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/sum_r16.c b/libgfortran/generated/sum_r16.c
index 2c9fdf5b221..58610542011 100644
--- a/libgfortran/generated/sum_r16.c
+++ b/libgfortran/generated/sum_r16.c
@@ -184,14 +184,14 @@ sum_r16 (gfc_array_r16 * const restrict retarray,
extern void msum_r16 (gfc_array_r16 * const restrict,
gfc_array_r16 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(msum_r16);
void
msum_r16 (gfc_array_r16 * const restrict retarray,
gfc_array_r16 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_r16 (gfc_array_r16 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_REAL_16 * restrict dest;
const GFC_REAL_16 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_r16 (gfc_array_r16 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_r16 (gfc_array_r16 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ msum_r16 (gfc_array_r16 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_16 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_REAL_16 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/sum_r4.c b/libgfortran/generated/sum_r4.c
index e3c33fbf1d4..4b07477d56e 100644
--- a/libgfortran/generated/sum_r4.c
+++ b/libgfortran/generated/sum_r4.c
@@ -184,14 +184,14 @@ sum_r4 (gfc_array_r4 * const restrict retarray,
extern void msum_r4 (gfc_array_r4 * const restrict,
gfc_array_r4 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(msum_r4);
void
msum_r4 (gfc_array_r4 * const restrict retarray,
gfc_array_r4 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_r4 (gfc_array_r4 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_REAL_4 * restrict dest;
const GFC_REAL_4 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_r4 (gfc_array_r4 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_r4 (gfc_array_r4 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ msum_r4 (gfc_array_r4 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_4 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_REAL_4 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/generated/sum_r8.c b/libgfortran/generated/sum_r8.c
index 4d331e277a7..43df4a6f23b 100644
--- a/libgfortran/generated/sum_r8.c
+++ b/libgfortran/generated/sum_r8.c
@@ -184,14 +184,14 @@ sum_r8 (gfc_array_r8 * const restrict retarray,
extern void msum_r8 (gfc_array_r8 * const restrict,
gfc_array_r8 * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(msum_r8);
void
msum_r8 (gfc_array_r8 * const restrict retarray,
gfc_array_r8 * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_r8 (gfc_array_r8 * const restrict retarray,
index_type mstride[GFC_MAX_DIMENSIONS];
GFC_REAL_8 * restrict dest;
const GFC_REAL_8 * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_r8 (gfc_array_r8 * const restrict retarray,
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_r8 (gfc_array_r8 * const restrict retarray,
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -285,22 +300,11 @@ msum_r8 (gfc_array_r8 * const restrict retarray,
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const GFC_REAL_8 * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
GFC_REAL_8 result;
src = base;
msrc = mbase;
diff --git a/libgfortran/gfortran.map b/libgfortran/gfortran.map
index 31ca41e9f88..429c84c8c4a 100644
--- a/libgfortran/gfortran.map
+++ b/libgfortran/gfortran.map
@@ -11,8 +11,6 @@ GFORTRAN_1.0 {
_gfortran_all_l16;
_gfortran_all_l4;
_gfortran_all_l8;
- _gfortran_allocate;
- _gfortran_allocate_array;
_gfortran_any_l16;
_gfortran_any_l4;
_gfortran_any_l8;
@@ -60,7 +58,6 @@ GFORTRAN_1.0 {
_gfortran_ctime;
_gfortran_ctime_sub;
_gfortran_date_and_time;
- _gfortran_deallocate;
_gfortran_eoshift0_1;
_gfortran_eoshift0_1_char;
_gfortran_eoshift0_2;
@@ -167,7 +164,6 @@ GFORTRAN_1.0 {
_gfortran_ierrno_i4;
_gfortran_ierrno_i8;
_gfortran_internal_pack;
- _gfortran_internal_realloc;
_gfortran_internal_unpack;
_gfortran_irand;
_gfortran_isatty_l4;
diff --git a/libgfortran/intrinsics/pack_generic.c b/libgfortran/intrinsics/pack_generic.c
index a1998ad580b..30255f04686 100644
--- a/libgfortran/intrinsics/pack_generic.c
+++ b/libgfortran/intrinsics/pack_generic.c
@@ -76,7 +76,7 @@ array valued, and the other one where MASK is scalar. */
static void
pack_internal (gfc_array_char *ret, const gfc_array_char *array,
- const gfc_array_l4 *mask, const gfc_array_char *vector,
+ const gfc_array_l1 *mask, const gfc_array_char *vector,
index_type size)
{
/* r.* indicates the return array. */
@@ -89,7 +89,7 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array,
/* m.* indicates the mask array. */
index_type mstride[GFC_MAX_DIMENSIONS];
index_type mstride0;
- const GFC_LOGICAL_4 *mptr;
+ const GFC_LOGICAL_1 *mptr;
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -98,8 +98,31 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array,
index_type dim;
index_type nelem;
index_type total;
+ int mask_kind;
dim = GFC_DESCRIPTOR_RANK (array);
+
+ sptr = array->data;
+ mptr = mask->data;
+
+ /* Use the same loop for all logical types, by using GFC_LOGICAL_1
+ and using shifting to address size and endian issues. */
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ {
+ /* Don't convert a NULL pointer as we use test for NULL below. */
+ if (mptr)
+ mptr = GFOR_POINTER_TO_L1 (mptr, mask_kind);
+ }
+ else
+ runtime_error ("Funny sized logical array");
+
zero_sized = 0;
for (n = 0; n < dim; n++)
{
@@ -108,25 +131,12 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array,
if (extent[n] <= 0)
zero_sized = 1;
sstride[n] = array->dim[n].stride * size;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
}
if (sstride[0] == 0)
sstride[0] = size;
if (mstride[0] == 0)
- mstride[0] = 1;
-
- sptr = array->data;
- mptr = mask->data;
-
- /* Use the same loop for both logical types. */
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- if (GFC_DESCRIPTOR_SIZE (mask) != 8)
- runtime_error ("Funny sized logical array");
- for (n = 0; n < dim; n++)
- mstride[n] <<= 1;
- mptr = GFOR_POINTER_L8_TO_L4 (mptr);
- }
+ mstride[0] = mask_kind;
if (ret->data == NULL || compile_options.bounds_check)
{
@@ -156,7 +166,7 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array,
cache behavior in the case where our cache is not big
enough to hold all elements that have to be copied. */
- const GFC_LOGICAL_4 *m = mptr;
+ const GFC_LOGICAL_1 *m = mptr;
total = 0;
if (zero_sized)
diff --git a/libgfortran/intrinsics/unpack_generic.c b/libgfortran/intrinsics/unpack_generic.c
index b349f0d60fd..86c70fb7e45 100644
--- a/libgfortran/intrinsics/unpack_generic.c
+++ b/libgfortran/intrinsics/unpack_generic.c
@@ -36,7 +36,7 @@ Boston, MA 02110-1301, USA. */
static void
unpack_internal (gfc_array_char *ret, const gfc_array_char *vector,
- const gfc_array_l4 *mask, const gfc_array_char *field,
+ const gfc_array_l1 *mask, const gfc_array_char *field,
index_type size, index_type fsize)
{
/* r.* indicates the return array. */
@@ -54,7 +54,7 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector,
/* m.* indicates the mask array. */
index_type mstride[GFC_MAX_DIMENSIONS];
index_type mstride0;
- const GFC_LOGICAL_4 *mptr;
+ const GFC_LOGICAL_1 *mptr;
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -62,8 +62,30 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector,
index_type dim;
int empty;
+ int mask_kind;
empty = 0;
+
+ mptr = mask->data;
+
+ /* Use the same loop for all logical types, by using GFC_LOGICAL_1
+ and using shifting to address size and endian issues. */
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ {
+ /* Don't convert a NULL pointer as we use test for NULL below. */
+ if (mptr)
+ mptr = GFOR_POINTER_TO_L1 (mptr, mask_kind);
+ }
+ else
+ runtime_error ("Funny sized logical array");
+
if (ret->data == NULL)
{
/* The front end has signalled that we need to populate the
@@ -80,7 +102,7 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector,
empty = empty || extent[n] <= 0;
rstride[n] = ret->dim[n].stride * size;
fstride[n] = field->dim[n].stride * fsize;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
rs *= extent[n];
}
ret->offset = 0;
@@ -96,7 +118,7 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector,
empty = empty || extent[n] <= 0;
rstride[n] = ret->dim[n].stride * size;
fstride[n] = field->dim[n].stride * fsize;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
}
if (rstride[0] == 0)
rstride[0] = size;
@@ -118,20 +140,8 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector,
mstride0 = mstride[0];
rptr = ret->data;
fptr = field->data;
- mptr = mask->data;
vptr = vector->data;
- /* Use the same loop for both logical types. */
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- if (GFC_DESCRIPTOR_SIZE (mask) != 8)
- runtime_error ("Funny sized logical array");
- for (n = 0; n < dim; n++)
- mstride[n] <<= 1;
- mstride0 <<= 1;
- mptr = GFOR_POINTER_L8_TO_L4 (mptr);
- }
-
while (rptr)
{
if (*mptr)
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c
index 9509711694a..229250886b3 100644
--- a/libgfortran/io/write.c
+++ b/libgfortran/io/write.c
@@ -34,16 +34,13 @@ Boston, MA 02110-1301, USA. */
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
+#include <stdbool.h>
#include "libgfortran.h"
#include "io.h"
#define star_fill(p, n) memset(p, '*', n)
-
-typedef enum
-{ SIGN_NONE, SIGN_MINUS, SIGN_PLUS }
-sign_t;
-
+#include "write_float.def"
void
write_a (st_parameter_dt *dtp, const fnode *f, const char *source, int len)
@@ -235,653 +232,6 @@ extract_uint (const void *p, int len)
return i;
}
-static GFC_REAL_LARGEST
-extract_real (const void *p, int len)
-{
- GFC_REAL_LARGEST i = 0;
- switch (len)
- {
- case 4:
- {
- GFC_REAL_4 tmp;
- memcpy ((void *) &tmp, p, len);
- i = tmp;
- }
- break;
- case 8:
- {
- GFC_REAL_8 tmp;
- memcpy ((void *) &tmp, p, len);
- i = tmp;
- }
- break;
-#ifdef HAVE_GFC_REAL_10
- case 10:
- {
- GFC_REAL_10 tmp;
- memcpy ((void *) &tmp, p, len);
- i = tmp;
- }
- break;
-#endif
-#ifdef HAVE_GFC_REAL_16
- case 16:
- {
- GFC_REAL_16 tmp;
- memcpy ((void *) &tmp, p, len);
- i = tmp;
- }
- break;
-#endif
- default:
- internal_error (NULL, "bad real kind");
- }
- return i;
-}
-
-
-/* Given a flag that indicate if a value is negative or not, return a
- sign_t that gives the sign that we need to produce. */
-
-static sign_t
-calculate_sign (st_parameter_dt *dtp, int negative_flag)
-{
- sign_t s = SIGN_NONE;
-
- if (negative_flag)
- s = SIGN_MINUS;
- else
- switch (dtp->u.p.sign_status)
- {
- case SIGN_SP:
- s = SIGN_PLUS;
- break;
- case SIGN_SS:
- s = SIGN_NONE;
- break;
- case SIGN_S:
- s = options.optional_plus ? SIGN_PLUS : SIGN_NONE;
- break;
- }
-
- return s;
-}
-
-
-/* Returns the value of 10**d. */
-
-static GFC_REAL_LARGEST
-calculate_exp (int d)
-{
- int i;
- GFC_REAL_LARGEST r = 1.0;
-
- for (i = 0; i< (d >= 0 ? d : -d); i++)
- r *= 10;
-
- r = (d >= 0) ? r : 1.0 / r;
-
- return r;
-}
-
-
-/* Generate corresponding I/O format for FMT_G output.
- The rules to translate FMT_G to FMT_E or FMT_F from DEC fortran
- LRM (table 11-2, Chapter 11, "I/O Formatting", P11-25) is:
-
- Data Magnitude Equivalent Conversion
- 0< m < 0.1-0.5*10**(-d-1) Ew.d[Ee]
- m = 0 F(w-n).(d-1), n' '
- 0.1-0.5*10**(-d-1)<= m < 1-0.5*10**(-d) F(w-n).d, n' '
- 1-0.5*10**(-d)<= m < 10-0.5*10**(-d+1) F(w-n).(d-1), n' '
- 10-0.5*10**(-d+1)<= m < 100-0.5*10**(-d+2) F(w-n).(d-2), n' '
- ................ ..........
- 10**(d-1)-0.5*10**(-1)<= m <10**d-0.5 F(w-n).0,n(' ')
- m >= 10**d-0.5 Ew.d[Ee]
-
- notes: for Gw.d , n' ' means 4 blanks
- for Gw.dEe, n' ' means e+2 blanks */
-
-static fnode *
-calculate_G_format (st_parameter_dt *dtp, const fnode *f,
- GFC_REAL_LARGEST value, int *num_blank)
-{
- int e = f->u.real.e;
- int d = f->u.real.d;
- int w = f->u.real.w;
- fnode *newf;
- GFC_REAL_LARGEST m, exp_d;
- int low, high, mid;
- int ubound, lbound;
-
- newf = get_mem (sizeof (fnode));
-
- /* Absolute value. */
- m = (value > 0.0) ? value : -value;
-
- /* In case of the two data magnitude ranges,
- generate E editing, Ew.d[Ee]. */
- exp_d = calculate_exp (d);
- if ((m > 0.0 && m < 0.1 - 0.05 / exp_d) || (m >= exp_d - 0.5 ) ||
- ((m == 0.0) && !(compile_options.allow_std & GFC_STD_F2003)))
- {
- newf->format = FMT_E;
- newf->u.real.w = w;
- newf->u.real.d = d;
- newf->u.real.e = e;
- *num_blank = 0;
- return newf;
- }
-
- /* Use binary search to find the data magnitude range. */
- mid = 0;
- low = 0;
- high = d + 1;
- lbound = 0;
- ubound = d + 1;
-
- while (low <= high)
- {
- GFC_REAL_LARGEST temp;
- mid = (low + high) / 2;
-
- /* 0.1 * 10**mid - 0.5 * 10**(mid-d-1) */
- temp = 0.1 * calculate_exp (mid) - 0.5 * calculate_exp (mid - d - 1);
-
- if (m < temp)
- {
- ubound = mid;
- if (ubound == lbound + 1)
- break;
- high = mid - 1;
- }
- else if (m > temp)
- {
- lbound = mid;
- if (ubound == lbound + 1)
- {
- mid ++;
- break;
- }
- low = mid + 1;
- }
- else
- break;
- }
-
- /* Pad with blanks where the exponent would be. */
- if (e < 0)
- *num_blank = 4;
- else
- *num_blank = e + 2;
-
- /* Generate the F editing. F(w-n).(-(mid-d-1)), n' '. */
- newf->format = FMT_F;
- newf->u.real.w = f->u.real.w - *num_blank;
-
- /* Special case. */
- if (m == 0.0)
- newf->u.real.d = d - 1;
- else
- newf->u.real.d = - (mid - d - 1);
-
- /* For F editing, the scale factor is ignored. */
- dtp->u.p.scale_factor = 0;
- return newf;
-}
-
-
-/* Output a real number according to its format which is FMT_G free. */
-
-static void
-output_float (st_parameter_dt *dtp, const fnode *f, GFC_REAL_LARGEST value)
-{
-#if defined(HAVE_GFC_REAL_16) && __LDBL_DIG__ > 18
-# define MIN_FIELD_WIDTH 46
-#else
-# define MIN_FIELD_WIDTH 31
-#endif
-#define STR(x) STR1(x)
-#define STR1(x) #x
- /* This must be large enough to accurately hold any value. */
- char buffer[MIN_FIELD_WIDTH+1];
- char *out;
- char *digits;
- int e;
- char expchar;
- format_token ft;
- int w;
- int d;
- int edigits;
- int ndigits;
- /* Number of digits before the decimal point. */
- int nbefore;
- /* Number of zeros after the decimal point. */
- int nzero;
- /* Number of digits after the decimal point. */
- int nafter;
- /* Number of zeros after the decimal point, whatever the precision. */
- int nzero_real;
- int leadzero;
- int nblanks;
- int i;
- int sign_bit;
- sign_t sign;
-
- ft = f->format;
- w = f->u.real.w;
- d = f->u.real.d;
-
- nzero_real = -1;
-
-
- /* We should always know the field width and precision. */
- if (d < 0)
- internal_error (&dtp->common, "Unspecified precision");
-
- /* Use sprintf to print the number in the format +D.DDDDe+ddd
- For an N digit exponent, this gives us (MIN_FIELD_WIDTH-5)-N digits
- after the decimal point, plus another one before the decimal point. */
- sign = calculate_sign (dtp, value < 0.0);
- sign_bit = signbit (value);
- if (value < 0)
- value = -value;
-
- /* Special case when format specifies no digits after the decimal point. */
- if (d == 0 && ft == FMT_F)
- {
- if (value < 0.5)
- value = 0.0;
- else if (value < 1.0)
- value = value + 0.5;
- }
-
- /* printf pads blanks for us on the exponent so we just need it big enough
- to handle the largest number of exponent digits expected. */
- edigits=4;
-
- if (ft == FMT_F || ft == FMT_EN
- || ((ft == FMT_D || ft == FMT_E) && dtp->u.p.scale_factor != 0))
- {
- /* Always convert at full precision to avoid double rounding. */
- ndigits = MIN_FIELD_WIDTH - 4 - edigits;
- }
- else
- {
- /* We know the number of digits, so can let printf do the rounding
- for us. */
- if (ft == FMT_ES)
- ndigits = d + 1;
- else
- ndigits = d;
- if (ndigits > MIN_FIELD_WIDTH - 4 - edigits)
- ndigits = MIN_FIELD_WIDTH - 4 - edigits;
- }
-
- /* # The result will always contain a decimal point, even if no
- * digits follow it
- *
- * - The converted value is to be left adjusted on the field boundary
- *
- * + A sign (+ or -) always be placed before a number
- *
- * MIN_FIELD_WIDTH minimum field width
- *
- * * (ndigits-1) is used as the precision
- *
- * e format: [-]d.ddde±dd where there is one digit before the
- * decimal-point character and the number of digits after it is
- * equal to the precision. The exponent always contains at least two
- * digits; if the value is zero, the exponent is 00.
- */
-#ifdef HAVE_SNPRINTF
- snprintf (buffer, sizeof (buffer), "%+-#" STR(MIN_FIELD_WIDTH) ".*"
- GFC_REAL_LARGEST_FORMAT "e", ndigits - 1, value);
-#else
- sprintf (buffer, "%+-#" STR(MIN_FIELD_WIDTH) ".*"
- GFC_REAL_LARGEST_FORMAT "e", ndigits - 1, value);
-#endif
-
- /* Check the resulting string has punctuation in the correct places. */
- if (d != 0 && (buffer[2] != '.' || buffer[ndigits + 2] != 'e'))
- internal_error (&dtp->common, "printf is broken");
-
- /* Read the exponent back in. */
- e = atoi (&buffer[ndigits + 3]) + 1;
-
- /* Make sure zero comes out as 0.0e0. */
- if (value == 0.0)
- {
- e = 0;
- if (compile_options.sign_zero == 1)
- sign = calculate_sign (dtp, sign_bit);
- else
- sign = calculate_sign (dtp, 0);
- }
-
- /* Normalize the fractional component. */
- buffer[2] = buffer[1];
- digits = &buffer[2];
-
- /* Figure out where to place the decimal point. */
- switch (ft)
- {
- case FMT_F:
- nbefore = e + dtp->u.p.scale_factor;
- if (nbefore < 0)
- {
- nzero = -nbefore;
- nzero_real = nzero;
- if (nzero > d)
- nzero = d;
- nafter = d - nzero;
- nbefore = 0;
- }
- else
- {
- nzero = 0;
- nafter = d;
- }
- expchar = 0;
- break;
-
- case FMT_E:
- case FMT_D:
- i = dtp->u.p.scale_factor;
- if (value != 0.0)
- e -= i;
- if (i < 0)
- {
- nbefore = 0;
- nzero = -i;
- nafter = d + i;
- }
- else if (i > 0)
- {
- nbefore = i;
- nzero = 0;
- nafter = (d - i) + 1;
- }
- else /* i == 0 */
- {
- nbefore = 0;
- nzero = 0;
- nafter = d;
- }
-
- if (ft == FMT_E)
- expchar = 'E';
- else
- expchar = 'D';
- break;
-
- case FMT_EN:
- /* The exponent must be a multiple of three, with 1-3 digits before
- the decimal point. */
- if (value != 0.0)
- e--;
- if (e >= 0)
- nbefore = e % 3;
- else
- {
- nbefore = (-e) % 3;
- if (nbefore != 0)
- nbefore = 3 - nbefore;
- }
- e -= nbefore;
- nbefore++;
- nzero = 0;
- nafter = d;
- expchar = 'E';
- break;
-
- case FMT_ES:
- if (value != 0.0)
- e--;
- nbefore = 1;
- nzero = 0;
- nafter = d;
- expchar = 'E';
- break;
-
- default:
- /* Should never happen. */
- internal_error (&dtp->common, "Unexpected format token");
- }
-
- /* Round the value. */
- if (nbefore + nafter == 0)
- {
- ndigits = 0;
- if (nzero_real == d && digits[0] >= '5')
- {
- /* We rounded to zero but shouldn't have */
- nzero--;
- nafter = 1;
- digits[0] = '1';
- ndigits = 1;
- }
- }
- else if (nbefore + nafter < ndigits)
- {
- ndigits = nbefore + nafter;
- i = ndigits;
- if (digits[i] >= '5')
- {
- /* Propagate the carry. */
- for (i--; i >= 0; i--)
- {
- if (digits[i] != '9')
- {
- digits[i]++;
- break;
- }
- digits[i] = '0';
- }
-
- if (i < 0)
- {
- /* The carry overflowed. Fortunately we have some spare space
- at the start of the buffer. We may discard some digits, but
- this is ok because we already know they are zero. */
- digits--;
- digits[0] = '1';
- if (ft == FMT_F)
- {
- if (nzero > 0)
- {
- nzero--;
- nafter++;
- }
- else
- nbefore++;
- }
- else if (ft == FMT_EN)
- {
- nbefore++;
- if (nbefore == 4)
- {
- nbefore = 1;
- e += 3;
- }
- }
- else
- e++;
- }
- }
- }
-
- /* Calculate the format of the exponent field. */
- if (expchar)
- {
- edigits = 1;
- for (i = abs (e); i >= 10; i /= 10)
- edigits++;
-
- if (f->u.real.e < 0)
- {
- /* Width not specified. Must be no more than 3 digits. */
- if (e > 999 || e < -999)
- edigits = -1;
- else
- {
- edigits = 4;
- if (e > 99 || e < -99)
- expchar = ' ';
- }
- }
- else
- {
- /* Exponent width specified, check it is wide enough. */
- if (edigits > f->u.real.e)
- edigits = -1;
- else
- edigits = f->u.real.e + 2;
- }
- }
- else
- edigits = 0;
-
- /* Pick a field size if none was specified. */
- if (w <= 0)
- w = nbefore + nzero + nafter + (sign != SIGN_NONE ? 2 : 1);
-
- /* Create the ouput buffer. */
- out = write_block (dtp, w);
- if (out == NULL)
- return;
-
- /* Zero values always output as positive, even if the value was negative
- before rounding. */
- for (i = 0; i < ndigits; i++)
- {
- if (digits[i] != '0')
- break;
- }
- if (i == ndigits)
- {
- /* The output is zero, so set the sign according to the sign bit unless
- -fno-sign-zero was specified. */
- if (compile_options.sign_zero == 1)
- sign = calculate_sign (dtp, sign_bit);
- else
- sign = calculate_sign (dtp, 0);
- }
-
- /* Work out how much padding is needed. */
- nblanks = w - (nbefore + nzero + nafter + edigits + 1);
- if (sign != SIGN_NONE)
- nblanks--;
-
- /* Check the value fits in the specified field width. */
- if (nblanks < 0 || edigits == -1)
- {
- star_fill (out, w);
- return;
- }
-
- /* See if we have space for a zero before the decimal point. */
- if (nbefore == 0 && nblanks > 0)
- {
- leadzero = 1;
- nblanks--;
- }
- else
- leadzero = 0;
-
- /* Pad to full field width. */
-
- if ( ( nblanks > 0 ) && !dtp->u.p.no_leading_blank)
- {
- memset (out, ' ', nblanks);
- out += nblanks;
- }
-
- /* Output the initial sign (if any). */
- if (sign == SIGN_PLUS)
- *(out++) = '+';
- else if (sign == SIGN_MINUS)
- *(out++) = '-';
-
- /* Output an optional leading zero. */
- if (leadzero)
- *(out++) = '0';
-
- /* Output the part before the decimal point, padding with zeros. */
- if (nbefore > 0)
- {
- if (nbefore > ndigits)
- {
- i = ndigits;
- memcpy (out, digits, i);
- ndigits = 0;
- while (i < nbefore)
- out[i++] = '0';
- }
- else
- {
- i = nbefore;
- memcpy (out, digits, i);
- ndigits -= i;
- }
-
- digits += i;
- out += nbefore;
- }
- /* Output the decimal point. */
- *(out++) = '.';
-
- /* Output leading zeros after the decimal point. */
- if (nzero > 0)
- {
- for (i = 0; i < nzero; i++)
- *(out++) = '0';
- }
-
- /* Output digits after the decimal point, padding with zeros. */
- if (nafter > 0)
- {
- if (nafter > ndigits)
- i = ndigits;
- else
- i = nafter;
-
- memcpy (out, digits, i);
- while (i < nafter)
- out[i++] = '0';
-
- digits += i;
- ndigits -= i;
- out += nafter;
- }
-
- /* Output the exponent. */
- if (expchar)
- {
- if (expchar != ' ')
- {
- *(out++) = expchar;
- edigits--;
- }
-#if HAVE_SNPRINTF
- snprintf (buffer, sizeof (buffer), "%+0*d", edigits, e);
-#else
- sprintf (buffer, "%+0*d", edigits, e);
-#endif
- memcpy (out, buffer, edigits);
- }
-
- if (dtp->u.p.no_leading_blank)
- {
- out += edigits;
- memset( out , ' ' , nblanks );
- dtp->u.p.no_leading_blank = 0;
- }
-#undef STR
-#undef STR1
-#undef MIN_FIELD_WIDTH
-}
-
void
write_l (st_parameter_dt *dtp, const fnode *f, char *source, int len)
@@ -898,108 +248,6 @@ write_l (st_parameter_dt *dtp, const fnode *f, char *source, int len)
p[f->u.w - 1] = (n) ? 'T' : 'F';
}
-/* Output a real number according to its format. */
-
-static void
-write_float (st_parameter_dt *dtp, const fnode *f, const char *source, int len)
-{
- GFC_REAL_LARGEST n;
- int nb =0, res, save_scale_factor;
- char * p, fin;
- fnode *f2 = NULL;
-
- n = extract_real (source, len);
-
- if (f->format != FMT_B && f->format != FMT_O && f->format != FMT_Z)
- {
- res = isfinite (n);
- if (res == 0)
- {
- nb = f->u.real.w;
-
- /* If the field width is zero, the processor must select a width
- not zero. 4 is chosen to allow output of '-Inf' or '+Inf' */
-
- if (nb == 0) nb = 4;
- p = write_block (dtp, nb);
- if (p == NULL)
- return;
- if (nb < 3)
- {
- memset (p, '*',nb);
- return;
- }
-
- memset(p, ' ', nb);
- res = !isnan (n);
- if (res != 0)
- {
- if (signbit(n))
- {
-
- /* If the sign is negative and the width is 3, there is
- insufficient room to output '-Inf', so output asterisks */
-
- if (nb == 3)
- {
- memset (p, '*',nb);
- return;
- }
-
- /* The negative sign is mandatory */
-
- fin = '-';
- }
- else
-
- /* The positive sign is optional, but we output it for
- consistency */
-
- fin = '+';
-
- if (nb > 8)
-
- /* We have room, so output 'Infinity' */
-
- memcpy(p + nb - 8, "Infinity", 8);
- else
-
- /* For the case of width equals 8, there is not enough room
- for the sign and 'Infinity' so we go with 'Inf' */
-
- memcpy(p + nb - 3, "Inf", 3);
- if (nb < 9 && nb > 3)
- p[nb - 4] = fin; /* Put the sign in front of Inf */
- else if (nb > 8)
- p[nb - 9] = fin; /* Put the sign in front of Infinity */
- }
- else
- memcpy(p + nb - 3, "NaN", 3);
- return;
- }
- }
-
- if (f->format != FMT_G)
- output_float (dtp, f, n);
- else
- {
- save_scale_factor = dtp->u.p.scale_factor;
- f2 = calculate_G_format (dtp, f, n, &nb);
- output_float (dtp, f2, n);
- dtp->u.p.scale_factor = save_scale_factor;
- if (f2 != NULL)
- free_mem(f2);
-
- if (nb > 0)
- {
- p = write_block (dtp, nb);
- if (p == NULL)
- return;
- memset (p, ' ', nb);
- }
- }
-}
-
static void
write_int (st_parameter_dt *dtp, const fnode *f, const char *source, int len,
diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def
new file mode 100644
index 00000000000..ff8be1903af
--- /dev/null
+++ b/libgfortran/io/write_float.def
@@ -0,0 +1,808 @@
+/* Copyright (C) 2007 Free Software Foundation, Inc.
+ Contributed by Andy Vaught
+ Write float code factoring to this file by Jerry DeLisle
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file. (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Libgfortran; see the file COPYING. If not, write to
+the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+#include "config.h"
+
+typedef enum
+{ SIGN_NONE, SIGN_MINUS, SIGN_PLUS }
+sign_t;
+
+/* Given a flag that indicates if a value is negative or not, return a
+ sign_t that gives the sign that we need to produce. */
+
+static sign_t
+calculate_sign (st_parameter_dt *dtp, int negative_flag)
+{
+ sign_t s = SIGN_NONE;
+
+ if (negative_flag)
+ s = SIGN_MINUS;
+ else
+ switch (dtp->u.p.sign_status)
+ {
+ case SIGN_SP:
+ s = SIGN_PLUS;
+ break;
+ case SIGN_SS:
+ s = SIGN_NONE;
+ break;
+ case SIGN_S:
+ s = options.optional_plus ? SIGN_PLUS : SIGN_NONE;
+ break;
+ }
+
+ return s;
+}
+
+
+/* Output a real number according to its format which is FMT_G free. */
+
+static void
+output_float (st_parameter_dt *dtp, const fnode *f, char *buffer,
+ int sign_bit, bool zero_flag, int ndigits, int edigits)
+{
+ char *out;
+ char *digits;
+ int e;
+ char expchar;
+ format_token ft;
+ int w;
+ int d;
+ /* Number of digits before the decimal point. */
+ int nbefore;
+ /* Number of zeros after the decimal point. */
+ int nzero;
+ /* Number of digits after the decimal point. */
+ int nafter;
+ /* Number of zeros after the decimal point, whatever the precision. */
+ int nzero_real;
+ int leadzero;
+ int nblanks;
+ int i;
+ sign_t sign;
+
+ ft = f->format;
+ w = f->u.real.w;
+ d = f->u.real.d;
+
+ nzero_real = -1;
+
+ /* We should always know the field width and precision. */
+ if (d < 0)
+ internal_error (&dtp->common, "Unspecified precision");
+
+ /* Use sprintf to print the number in the format +D.DDDDe+ddd
+ For an N digit exponent, this gives us (MIN_FIELD_WIDTH-5)-N digits
+ after the decimal point, plus another one before the decimal point. */
+
+ sign = calculate_sign (dtp, sign_bit);
+
+ /* # The result will always contain a decimal point, even if no
+ * digits follow it
+ *
+ * - The converted value is to be left adjusted on the field boundary
+ *
+ * + A sign (+ or -) always be placed before a number
+ *
+ * MIN_FIELD_WIDTH minimum field width
+ *
+ * * (ndigits-1) is used as the precision
+ *
+ * e format: [-]d.ddde±dd where there is one digit before the
+ * decimal-point character and the number of digits after it is
+ * equal to the precision. The exponent always contains at least two
+ * digits; if the value is zero, the exponent is 00.
+ */
+
+ /* Check the given string has punctuation in the correct places. */
+ if (d != 0 && (buffer[2] != '.' || buffer[ndigits + 2] != 'e'))
+ internal_error (&dtp->common, "printf is broken");
+
+ /* Read the exponent back in. */
+ e = atoi (&buffer[ndigits + 3]) + 1;
+
+ /* Make sure zero comes out as 0.0e0. */
+ if (zero_flag)
+ {
+ e = 0;
+ if (compile_options.sign_zero == 1)
+ sign = calculate_sign (dtp, sign_bit);
+ else
+ sign = calculate_sign (dtp, 0);
+ }
+
+ /* Normalize the fractional component. */
+ buffer[2] = buffer[1];
+ digits = &buffer[2];
+
+ /* Figure out where to place the decimal point. */
+ switch (ft)
+ {
+ case FMT_F:
+ nbefore = e + dtp->u.p.scale_factor;
+ if (nbefore <= 0)
+ {
+ nzero = -nbefore;
+ nzero_real = nzero;
+ if (nzero > d)
+ nzero = d;
+ nafter = d - nzero;
+ nbefore = 0;
+ }
+ else
+ {
+ nzero = 0;
+ nafter = d;
+ }
+ expchar = 0;
+ break;
+
+ case FMT_E:
+ case FMT_D:
+ i = dtp->u.p.scale_factor;
+ if (!zero_flag)
+ e -= i;
+ if (i < 0)
+ {
+ nbefore = 0;
+ nzero = -i;
+ nafter = d + i;
+ }
+ else if (i > 0)
+ {
+ nbefore = i;
+ nzero = 0;
+ nafter = (d - i) + 1;
+ }
+ else /* i == 0 */
+ {
+ nbefore = 0;
+ nzero = 0;
+ nafter = d;
+ }
+
+ if (ft == FMT_E)
+ expchar = 'E';
+ else
+ expchar = 'D';
+ break;
+
+ case FMT_EN:
+ /* The exponent must be a multiple of three, with 1-3 digits before
+ the decimal point. */
+ if (!zero_flag)
+ e--;
+ if (e >= 0)
+ nbefore = e % 3;
+ else
+ {
+ nbefore = (-e) % 3;
+ if (nbefore != 0)
+ nbefore = 3 - nbefore;
+ }
+ e -= nbefore;
+ nbefore++;
+ nzero = 0;
+ nafter = d;
+ expchar = 'E';
+ break;
+
+ case FMT_ES:
+ if (!zero_flag)
+ e--;
+ nbefore = 1;
+ nzero = 0;
+ nafter = d;
+ expchar = 'E';
+ break;
+
+ default:
+ /* Should never happen. */
+ internal_error (&dtp->common, "Unexpected format token");
+ }
+
+ /* Round the value. */
+ if (nbefore + nafter == 0)
+ {
+ ndigits = 0;
+ if (nzero_real == d && digits[0] >= '5')
+ {
+ /* We rounded to zero but shouldn't have */
+ nzero--;
+ nafter = 1;
+ digits[0] = '1';
+ ndigits = 1;
+ }
+ }
+ else if (nbefore + nafter < ndigits)
+ {
+ ndigits = nbefore + nafter;
+ i = ndigits;
+ if (digits[i] >= '5')
+ {
+ /* Propagate the carry. */
+ for (i--; i >= 0; i--)
+ {
+ if (digits[i] != '9')
+ {
+ digits[i]++;
+ break;
+ }
+ digits[i] = '0';
+ }
+
+ if (i < 0)
+ {
+ /* The carry overflowed. Fortunately we have some spare space
+ at the start of the buffer. We may discard some digits, but
+ this is ok because we already know they are zero. */
+ digits--;
+ digits[0] = '1';
+ if (ft == FMT_F)
+ {
+ if (nzero > 0)
+ {
+ nzero--;
+ nafter++;
+ }
+ else
+ nbefore++;
+ }
+ else if (ft == FMT_EN)
+ {
+ nbefore++;
+ if (nbefore == 4)
+ {
+ nbefore = 1;
+ e += 3;
+ }
+ }
+ else
+ e++;
+ }
+ }
+ }
+
+ /* Calculate the format of the exponent field. */
+ if (expchar)
+ {
+ edigits = 1;
+ for (i = abs (e); i >= 10; i /= 10)
+ edigits++;
+
+ if (f->u.real.e < 0)
+ {
+ /* Width not specified. Must be no more than 3 digits. */
+ if (e > 999 || e < -999)
+ edigits = -1;
+ else
+ {
+ edigits = 4;
+ if (e > 99 || e < -99)
+ expchar = ' ';
+ }
+ }
+ else
+ {
+ /* Exponent width specified, check it is wide enough. */
+ if (edigits > f->u.real.e)
+ edigits = -1;
+ else
+ edigits = f->u.real.e + 2;
+ }
+ }
+ else
+ edigits = 0;
+
+ /* Pick a field size if none was specified. */
+ if (w <= 0)
+ w = nbefore + nzero + nafter + (sign != SIGN_NONE ? 2 : 1);
+
+ /* Create the ouput buffer. */
+ out = write_block (dtp, w);
+ if (out == NULL)
+ return;
+
+ /* Zero values always output as positive, even if the value was negative
+ before rounding. */
+ for (i = 0; i < ndigits; i++)
+ {
+ if (digits[i] != '0')
+ break;
+ }
+ if (i == ndigits)
+ {
+ /* The output is zero, so set the sign according to the sign bit unless
+ -fno-sign-zero was specified. */
+ if (compile_options.sign_zero == 1)
+ sign = calculate_sign (dtp, sign_bit);
+ else
+ sign = calculate_sign (dtp, 0);
+ }
+
+ /* Work out how much padding is needed. */
+ nblanks = w - (nbefore + nzero + nafter + edigits + 1);
+ if (sign != SIGN_NONE)
+ nblanks--;
+
+ /* Check the value fits in the specified field width. */
+ if (nblanks < 0 || edigits == -1)
+ {
+ star_fill (out, w);
+ return;
+ }
+
+ /* See if we have space for a zero before the decimal point. */
+ if (nbefore == 0 && nblanks > 0)
+ {
+ leadzero = 1;
+ nblanks--;
+ }
+ else
+ leadzero = 0;
+
+ /* Pad to full field width. */
+
+ if ( ( nblanks > 0 ) && !dtp->u.p.no_leading_blank)
+ {
+ memset (out, ' ', nblanks);
+ out += nblanks;
+ }
+
+ /* Output the initial sign (if any). */
+ if (sign == SIGN_PLUS)
+ *(out++) = '+';
+ else if (sign == SIGN_MINUS)
+ *(out++) = '-';
+
+ /* Output an optional leading zero. */
+ if (leadzero)
+ *(out++) = '0';
+
+ /* Output the part before the decimal point, padding with zeros. */
+ if (nbefore > 0)
+ {
+ if (nbefore > ndigits)
+ {
+ i = ndigits;
+ memcpy (out, digits, i);
+ ndigits = 0;
+ while (i < nbefore)
+ out[i++] = '0';
+ }
+ else
+ {
+ i = nbefore;
+ memcpy (out, digits, i);
+ ndigits -= i;
+ }
+
+ digits += i;
+ out += nbefore;
+ }
+ /* Output the decimal point. */
+ *(out++) = '.';
+
+ /* Output leading zeros after the decimal point. */
+ if (nzero > 0)
+ {
+ for (i = 0; i < nzero; i++)
+ *(out++) = '0';
+ }
+
+ /* Output digits after the decimal point, padding with zeros. */
+ if (nafter > 0)
+ {
+ if (nafter > ndigits)
+ i = ndigits;
+ else
+ i = nafter;
+
+ memcpy (out, digits, i);
+ while (i < nafter)
+ out[i++] = '0';
+
+ digits += i;
+ ndigits -= i;
+ out += nafter;
+ }
+
+ /* Output the exponent. */
+ if (expchar)
+ {
+ if (expchar != ' ')
+ {
+ *(out++) = expchar;
+ edigits--;
+ }
+#if HAVE_SNPRINTF
+ snprintf (buffer, sizeof (buffer), "%+0*d", edigits, e);
+#else
+ sprintf (buffer, "%+0*d", edigits, e);
+#endif
+ memcpy (out, buffer, edigits);
+ }
+
+ if (dtp->u.p.no_leading_blank)
+ {
+ out += edigits;
+ memset( out , ' ' , nblanks );
+ dtp->u.p.no_leading_blank = 0;
+ }
+#undef STR
+#undef STR1
+#undef MIN_FIELD_WIDTH
+}
+
+
+/* Write "Infinite" or "Nan" as appropriate for the given format. */
+
+static void
+write_infnan (st_parameter_dt *dtp, const fnode *f, int isnan_flag, int sign_bit)
+{
+ char * p, fin;
+ int nb = 0;
+
+ if (f->format != FMT_B && f->format != FMT_O && f->format != FMT_Z)
+ {
+ nb = f->u.real.w;
+
+ /* If the field width is zero, the processor must select a width
+ not zero. 4 is chosen to allow output of '-Inf' or '+Inf' */
+
+ if (nb == 0) nb = 4;
+ p = write_block (dtp, nb);
+ if (p == NULL)
+ return;
+ if (nb < 3)
+ {
+ memset (p, '*',nb);
+ return;
+ }
+
+ memset(p, ' ', nb);
+ if (!isnan_flag)
+ {
+ if (sign_bit)
+ {
+
+ /* If the sign is negative and the width is 3, there is
+ insufficient room to output '-Inf', so output asterisks */
+
+ if (nb == 3)
+ {
+ memset (p, '*',nb);
+ return;
+ }
+
+ /* The negative sign is mandatory */
+
+ fin = '-';
+ }
+ else
+
+ /* The positive sign is optional, but we output it for
+ consistency */
+ fin = '+';
+
+ if (nb > 8)
+
+ /* We have room, so output 'Infinity' */
+ memcpy(p + nb - 8, "Infinity", 8);
+ else
+
+ /* For the case of width equals 8, there is not enough room
+ for the sign and 'Infinity' so we go with 'Inf' */
+ memcpy(p + nb - 3, "Inf", 3);
+
+ if (nb < 9 && nb > 3)
+ p[nb - 4] = fin; /* Put the sign in front of Inf */
+ else if (nb > 8)
+ p[nb - 9] = fin; /* Put the sign in front of Infinity */
+ }
+ else
+ memcpy(p + nb - 3, "NaN", 3);
+ return;
+ }
+ }
+
+
+/* Returns the value of 10**d. */
+
+#define CALCULATE_EXP(x) \
+inline static GFC_REAL_ ## x \
+calculate_exp_ ## x (int d)\
+{\
+ int i;\
+ GFC_REAL_ ## x r = 1.0;\
+ for (i = 0; i< (d >= 0 ? d : -d); i++)\
+ r *= 10;\
+ r = (d >= 0) ? r : 1.0 / r;\
+ return r;\
+}
+
+CALCULATE_EXP(4)
+
+CALCULATE_EXP(8)
+
+#ifdef HAVE_GFC_REAL_10
+CALCULATE_EXP(10)
+#endif
+
+#ifdef HAVE_GFC_REAL_16
+CALCULATE_EXP(16)
+#endif
+#undef CALCULATE_EXP
+
+/* Generate corresponding I/O format for FMT_G and output.
+ The rules to translate FMT_G to FMT_E or FMT_F from DEC fortran
+ LRM (table 11-2, Chapter 11, "I/O Formatting", P11-25) is:
+
+ Data Magnitude Equivalent Conversion
+ 0< m < 0.1-0.5*10**(-d-1) Ew.d[Ee]
+ m = 0 F(w-n).(d-1), n' '
+ 0.1-0.5*10**(-d-1)<= m < 1-0.5*10**(-d) F(w-n).d, n' '
+ 1-0.5*10**(-d)<= m < 10-0.5*10**(-d+1) F(w-n).(d-1), n' '
+ 10-0.5*10**(-d+1)<= m < 100-0.5*10**(-d+2) F(w-n).(d-2), n' '
+ ................ ..........
+ 10**(d-1)-0.5*10**(-1)<= m <10**d-0.5 F(w-n).0,n(' ')
+ m >= 10**d-0.5 Ew.d[Ee]
+
+ notes: for Gw.d , n' ' means 4 blanks
+ for Gw.dEe, n' ' means e+2 blanks */
+
+#define OUTPUT_FLOAT_FMT_G(x) \
+static void \
+output_float_FMT_G_ ## x (st_parameter_dt *dtp, const fnode *f, \
+ GFC_REAL_ ## x m, char *buffer, int sign_bit, \
+ bool zero_flag, int ndigits, int edigits) \
+{ \
+ int e = f->u.real.e;\
+ int d = f->u.real.d;\
+ int w = f->u.real.w;\
+ fnode *newf;\
+ GFC_REAL_ ## x exp_d;\
+ int low, high, mid;\
+ int ubound, lbound;\
+ char *p;\
+ int save_scale_factor, nb = 0;\
+\
+ save_scale_factor = dtp->u.p.scale_factor;\
+ newf = get_mem (sizeof (fnode));\
+\
+ exp_d = calculate_exp_ ## x (d);\
+ if ((m > 0.0 && m < 0.1 - 0.05 / exp_d) || (m >= exp_d - 0.5 ) ||\
+ ((m == 0.0) && !(compile_options.allow_std & GFC_STD_F2003)))\
+ { \
+ newf->format = FMT_E;\
+ newf->u.real.w = w;\
+ newf->u.real.d = d;\
+ newf->u.real.e = e;\
+ nb = 0;\
+ goto finish;\
+ }\
+\
+ mid = 0;\
+ low = 0;\
+ high = d + 1;\
+ lbound = 0;\
+ ubound = d + 1;\
+\
+ while (low <= high)\
+ { \
+ GFC_REAL_ ## x temp;\
+ mid = (low + high) / 2;\
+\
+ temp = 0.1 * calculate_exp_ ## x (mid) - 0.5\
+ * calculate_exp_ ## x (mid - d - 1);\
+\
+ if (m < temp)\
+ { \
+ ubound = mid;\
+ if (ubound == lbound + 1)\
+ break;\
+ high = mid - 1;\
+ }\
+ else if (m > temp)\
+ { \
+ lbound = mid;\
+ if (ubound == lbound + 1)\
+ { \
+ mid ++;\
+ break;\
+ }\
+ low = mid + 1;\
+ }\
+ else\
+ break;\
+ }\
+\
+ if (e < 0)\
+ nb = 4;\
+ else\
+ nb = e + 2;\
+\
+ newf->format = FMT_F;\
+ newf->u.real.w = f->u.real.w - nb;\
+\
+ if (m == 0.0)\
+ newf->u.real.d = d - 1;\
+ else\
+ newf->u.real.d = - (mid - d - 1);\
+\
+ dtp->u.p.scale_factor = 0;\
+\
+ finish:\
+ output_float (dtp, newf, buffer, sign_bit, zero_flag, ndigits, edigits);\
+ dtp->u.p.scale_factor = save_scale_factor;\
+\
+ free_mem(newf);\
+\
+ if (nb > 0)\
+ { \
+ p = write_block (dtp, nb);\
+ if (p == NULL)\
+ return;\
+ memset (p, ' ', nb);\
+ }\
+}\
+
+OUTPUT_FLOAT_FMT_G(4)
+
+OUTPUT_FLOAT_FMT_G(8)
+
+#ifdef HAVE_GFC_REAL_10
+OUTPUT_FLOAT_FMT_G(10)
+#endif
+
+#ifdef HAVE_GFC_REAL_16
+OUTPUT_FLOAT_FMT_G(16)
+#endif
+
+#undef OUTPUT_FLOAT_FMT_G
+
+/* Define a macro to build code for write_float. */
+
+#ifdef HAVE_SNPRINTF
+
+#define DTOA \
+snprintf (buffer, sizeof (buffer), "%+-#" STR(MIN_FIELD_WIDTH) ".*" \
+ "e", ndigits - 1, tmp);
+
+#define DTOAL \
+snprintf (buffer, sizeof (buffer), "%+-#" STR(MIN_FIELD_WIDTH) ".*" \
+ "Le", ndigits - 1, tmp);
+
+#else
+
+#define DTOA \
+sprintf (buffer, "%+-#" STR(MIN_FIELD_WIDTH) ".*" \
+ "e", ndigits - 1, tmp);
+
+#define DTOAL \
+sprintf (buffer, "%+-#" STR(MIN_FIELD_WIDTH) ".*" \
+ "Le", ndigits - 1, tmp);
+
+#endif
+
+#define WRITE_FLOAT(x,y)\
+{\
+ GFC_REAL_ ## x tmp;\
+ tmp = * (GFC_REAL_ ## x *)source;\
+ sign_bit = signbit (tmp);\
+ if (!isfinite (tmp))\
+ { \
+ write_infnan (dtp, f, isnan (tmp), sign_bit);\
+ return;\
+ }\
+ tmp = sign_bit ? -tmp : tmp;\
+ if (f->u.real.d == 0 && f->format == FMT_F)\
+ {\
+ if (tmp < 0.5)\
+ tmp = 0.0;\
+ else if (tmp < 1.0)\
+ tmp = tmp + 0.5;\
+ }\
+ zero_flag = (tmp == 0.0);\
+\
+ DTOA ## y\
+\
+ if (f->format != FMT_G)\
+ output_float (dtp, f, buffer, sign_bit, zero_flag, ndigits, edigits);\
+ else \
+ output_float_FMT_G_ ## x (dtp, f, tmp, buffer, sign_bit, zero_flag, \
+ ndigits, edigits);\
+}\
+
+/* Output a real number according to its format. */
+
+static void
+write_float (st_parameter_dt *dtp, const fnode *f, const char *source, int len)
+{
+
+#if defined(HAVE_GFC_REAL_16) && __LDBL_DIG__ > 18
+# define MIN_FIELD_WIDTH 46
+#else
+# define MIN_FIELD_WIDTH 31
+#endif
+#define STR(x) STR1(x)
+#define STR1(x) #x
+
+ /* This must be large enough to accurately hold any value. */
+ char buffer[MIN_FIELD_WIDTH+1];
+ int sign_bit, ndigits, edigits;
+ bool zero_flag;
+
+ /* printf pads blanks for us on the exponent so we just need it big enough
+ to handle the largest number of exponent digits expected. */
+ edigits=4;
+
+ if (f->format == FMT_F || f->format == FMT_EN || f->format == FMT_G
+ || ((f->format == FMT_D || f->format == FMT_E)
+ && dtp->u.p.scale_factor != 0))
+ {
+ /* Always convert at full precision to avoid double rounding. */
+ ndigits = MIN_FIELD_WIDTH - 4 - edigits;
+ }
+ else
+ {
+ /* The number of digits is known, so let printf do the rounding. */
+ if (f->format == FMT_ES)
+ ndigits = f->u.real.d + 1;
+ else
+ ndigits = f->u.real.d;
+ if (ndigits > MIN_FIELD_WIDTH - 4 - edigits)
+ ndigits = MIN_FIELD_WIDTH - 4 - edigits;
+ }
+
+ switch (len)
+ {
+ case 4:
+ WRITE_FLOAT(4,)
+ break;
+
+ case 8:
+ WRITE_FLOAT(8,)
+ break;
+
+#ifdef HAVE_GFC_REAL_10
+ case 10:
+ WRITE_FLOAT(10,L)
+ break;
+#endif
+#ifdef HAVE_GFC_REAL_16
+ case 16:
+ WRITE_FLOAT(16,L)
+ break;
+#endif
+ default:
+ internal_error (NULL, "bad real kind");
+ }
+}
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index ce6d28e9f95..d068a753fa4 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -70,6 +70,16 @@ typedef off_t gfc_offset;
#endif
+/* On mingw, work around the buggy Windows snprintf() by using the one
+ mingw provides, __mingw_snprintf(). We also provide a prototype for
+ __mingw_snprintf(), because the mingw headers currently don't have one. */
+#if HAVE_MINGW_SNPRINTF
+extern int __mingw_snprintf (char *, size_t, const char *, ...);
+#undef snprintf
+#define snprintf __mingw_snprintf
+#endif
+
+
/* For a library, a standard prefix is a requirement in order to partition
the namespace. IPREFIX is for symbols intended to be internal to the
library. */
@@ -223,8 +233,8 @@ typedef GFC_INTEGER_4 gfc_charlen_type;
extern int l8_to_l4_offset;
internal_proto(l8_to_l4_offset);
-#define GFOR_POINTER_L8_TO_L4(p8) \
- (l8_to_l4_offset + (GFC_LOGICAL_4 *)(p8))
+#define GFOR_POINTER_TO_L1(p, kind) \
+ (l8_to_l4_offset * (kind - 1) + (GFC_LOGICAL_1 *)(p))
#define GFC_INTEGER_1_HUGE \
(GFC_INTEGER_1)((((GFC_UINTEGER_1)1) << 7) - 1)
@@ -312,6 +322,8 @@ typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_10) gfc_array_c10;
#ifdef HAVE_GFC_COMPLEX_16
typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_16) gfc_array_c16;
#endif
+typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_1) gfc_array_l1;
+typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_2) gfc_array_l2;
typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_4) gfc_array_l4;
typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_8) gfc_array_l8;
#ifdef HAVE_GFC_LOGICAL_16
@@ -435,7 +447,9 @@ typedef enum
ERROR_READ_OVERFLOW,
ERROR_INTERNAL,
ERROR_INTERNAL_UNIT,
- ERROR_ALLOCATION,
+ ERROR_ALLOCATION, /* Keep in sync with value used in
+ gcc/fortran/trans.c
+ (gfc_allocate_array_with_status). */
ERROR_DIRECT_EOR,
ERROR_SHORT_RECORD,
ERROR_CORRUPT_FILE,
diff --git a/libgfortran/m4/iforeach.m4 b/libgfortran/m4/iforeach.m4
index af53cef7ecc..720a4c05851 100644
--- a/libgfortran/m4/iforeach.m4
+++ b/libgfortran/m4/iforeach.m4
@@ -106,13 +106,13 @@ define(FINISH_FOREACH_FUNCTION,
define(START_MASKED_FOREACH_FUNCTION,
`
extern void `m'name`'rtype_qual`_'atype_code (rtype * const restrict,
- atype * const restrict, gfc_array_l4 * const restrict);
+ atype * const restrict, gfc_array_l1 * const restrict);
export_proto(`m'name`'rtype_qual`_'atype_code);
void
`m'name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
atype * const restrict array,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -121,9 +121,10 @@ void
index_type dstride;
rtype_name *dest;
const atype_name *base;
- GFC_LOGICAL_4 *mbase;
+ GFC_LOGICAL_1 *mbase;
int rank;
index_type n;
+ int mask_kind;
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
@@ -147,12 +148,25 @@ void
runtime_error ("dimension of return array incorrect");
}
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ mbase = mask->data;
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
@@ -165,17 +179,6 @@ void
}
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
-
/* Initialize the return value. */
for (n = 0; n < rank; n++)
diff --git a/libgfortran/m4/ifunction.m4 b/libgfortran/m4/ifunction.m4
index 225b89a7562..d8a661c2a89 100644
--- a/libgfortran/m4/ifunction.m4
+++ b/libgfortran/m4/ifunction.m4
@@ -166,14 +166,14 @@ define(START_MASKED_ARRAY_FUNCTION,
`
extern void `m'name`'rtype_qual`_'atype_code (rtype * const restrict,
atype * const restrict, const index_type * const restrict,
- gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict);
export_proto(`m'name`'rtype_qual`_'atype_code);
void
`m'name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
atype * const restrict array,
const index_type * const restrict pdim,
- gfc_array_l4 * const restrict mask)
+ gfc_array_l1 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
@@ -182,13 +182,14 @@ void
index_type mstride[GFC_MAX_DIMENSIONS];
rtype_name * restrict dest;
const atype_name * restrict base;
- const GFC_LOGICAL_4 * restrict mbase;
+ const GFC_LOGICAL_1 * restrict mbase;
int rank;
int dim;
index_type n;
index_type len;
index_type delta;
index_type mdelta;
+ int mask_kind;
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -196,13 +197,27 @@ void
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
return;
+
+ mbase = mask->data;
+
+ mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+ if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || mask_kind == 16
+#endif
+ )
+ mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+ else
+ runtime_error ("Funny sized logical array");
+
delta = array->dim[dim].stride;
- mdelta = mask->dim[dim].stride;
+ mdelta = mask->dim[dim].stride * mask_kind;
for (n = 0; n < dim; n++)
{
sstride[n] = array->dim[n].stride;
- mstride[n] = mask->dim[n].stride;
+ mstride[n] = mask->dim[n].stride * mask_kind;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
if (extent[n] < 0)
@@ -212,7 +227,7 @@ void
for (n = dim; n < rank; n++)
{
sstride[n] = array->dim[n + 1].stride;
- mstride[n] = mask->dim[n + 1].stride;
+ mstride[n] = mask->dim[n + 1].stride * mask_kind;
extent[n] =
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
@@ -267,22 +282,11 @@ void
dest = retarray->data;
base = array->data;
- mbase = mask->data;
-
- if (GFC_DESCRIPTOR_SIZE (mask) != 4)
- {
- /* This allows the same loop to be used for all logical types. */
- assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
- for (n = 0; n < rank; n++)
- mstride[n] <<= 1;
- mdelta <<= 1;
- mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
- }
while (base)
{
const atype_name * restrict src;
- const GFC_LOGICAL_4 * restrict msrc;
+ const GFC_LOGICAL_1 * restrict msrc;
rtype_name result;
src = base;
msrc = mbase;
diff --git a/libgfortran/m4/matmull.m4 b/libgfortran/m4/matmull.m4
index d4b0008e951..4e999fc34da 100644
--- a/libgfortran/m4/matmull.m4
+++ b/libgfortran/m4/matmull.m4
@@ -40,15 +40,15 @@ include(iparm.m4)dnl
Either a or b can be rank 1. In this case x or y is 1. */
extern void matmul_'rtype_code` ('rtype` * const restrict,
- gfc_array_l4 * const restrict, gfc_array_l4 * const restrict);
+ gfc_array_l1 * const restrict, gfc_array_l1 * const restrict);
export_proto(matmul_'rtype_code`);
void
matmul_'rtype_code` ('rtype` * const restrict retarray,
- gfc_array_l4 * const restrict a, gfc_array_l4 * const restrict b)
+ gfc_array_l1 * const restrict a, gfc_array_l1 * const restrict b)
{
- const GFC_INTEGER_4 * restrict abase;
- const GFC_INTEGER_4 * restrict bbase;
+ const GFC_LOGICAL_1 * restrict abase;
+ const GFC_LOGICAL_1 * restrict bbase;
'rtype_name` * restrict dest;
index_type rxstride;
index_type rystride;
@@ -58,9 +58,11 @@ matmul_'rtype_code` ('rtype` * const restrict retarray,
index_type ystride;
index_type x;
index_type y;
+ int a_kind;
+ int b_kind;
- const GFC_INTEGER_4 * restrict pa;
- const GFC_INTEGER_4 * restrict pb;
+ const GFC_LOGICAL_1 * restrict pa;
+ const GFC_LOGICAL_1 * restrict pb;
index_type astride;
index_type bstride;
index_type count;
@@ -100,17 +102,29 @@ matmul_'rtype_code` ('rtype` * const restrict retarray,
}
abase = a->data;
- if (GFC_DESCRIPTOR_SIZE (a) != 4)
- {
- assert (GFC_DESCRIPTOR_SIZE (a) == 8);
- abase = GFOR_POINTER_L8_TO_L4 (abase);
- }
+ a_kind = GFC_DESCRIPTOR_SIZE (a);
+
+ if (a_kind == 1 || a_kind == 2 || a_kind == 4 || a_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || a_kind == 16
+#endif
+ )
+ abase = GFOR_POINTER_TO_L1 (abase, a_kind);
+ else
+ internal_error (NULL, "Funny sized logical array");
+
bbase = b->data;
- if (GFC_DESCRIPTOR_SIZE (b) != 4)
- {
- assert (GFC_DESCRIPTOR_SIZE (b) == 8);
- bbase = GFOR_POINTER_L8_TO_L4 (bbase);
- }
+ b_kind = GFC_DESCRIPTOR_SIZE (b);
+
+ if (b_kind == 1 || b_kind == 2 || b_kind == 4 || b_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+ || b_kind == 16
+#endif
+ )
+ bbase = GFOR_POINTER_TO_L1 (bbase, b_kind);
+ else
+ internal_error (NULL, "Funny sized logical array");
+
dest = retarray->data;
'
sinclude(`matmul_asm_'rtype_code`.m4')dnl
@@ -130,7 +144,7 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
one. */
if (GFC_DESCRIPTOR_RANK (a) == 1)
{
- astride = a->dim[0].stride;
+ astride = a->dim[0].stride * a_kind;
count = a->dim[0].ubound + 1 - a->dim[0].lbound;
xstride = 0;
rxstride = 0;
@@ -138,14 +152,14 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
}
else
{
- astride = a->dim[1].stride;
+ astride = a->dim[1].stride * a_kind;
count = a->dim[1].ubound + 1 - a->dim[1].lbound;
xstride = a->dim[0].stride;
xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
}
if (GFC_DESCRIPTOR_RANK (b) == 1)
{
- bstride = b->dim[0].stride;
+ bstride = b->dim[0].stride * b_kind;
assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
ystride = 0;
rystride = 0;
@@ -153,7 +167,7 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
}
else
{
- bstride = b->dim[0].stride;
+ bstride = b->dim[0].stride * b_kind;
assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
ystride = b->dim[1].stride;
ycount = b->dim[1].ubound + 1 - b->dim[1].lbound;
@@ -191,4 +205,4 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
}
#endif
-' \ No newline at end of file
+'
diff --git a/libgfortran/runtime/memory.c b/libgfortran/runtime/memory.c
index f1991cda324..7407486b696 100644
--- a/libgfortran/runtime/memory.c
+++ b/libgfortran/runtime/memory.c
@@ -38,10 +38,6 @@ Boston, MA 02110-1301, USA. */
performance is desired, but it can help when you're debugging code. */
/* #define GFC_CLEAR_MEMORY */
-/* If GFC_CHECK_MEMORY is defined, we do some sanity checks at runtime.
- This causes small overhead, but again, it also helps debugging. */
-#define GFC_CHECK_MEMORY
-
void *
get_mem (size_t n)
{
@@ -76,123 +72,3 @@ internal_malloc_size (size_t size)
return get_mem (size);
}
-
-
-/* Reallocate internal memory MEM so it has SIZE bytes of data.
- Allocate a new block if MEM is zero, and free the block if
- SIZE is 0. */
-
-extern void *internal_realloc (void *, index_type);
-export_proto(internal_realloc);
-
-void *
-internal_realloc (void *mem, index_type size)
-{
-#ifdef GFC_CHECK_MEMORY
- /* Under normal circumstances, this is _never_ going to happen! */
- if (size < 0)
- runtime_error ("Attempt to allocate a negative amount of memory.");
-#endif
- mem = realloc (mem, size);
- if (!mem && size != 0)
- os_error ("Out of memory.");
-
- if (size == 0)
- return NULL;
-
- return mem;
-}
-
-
-/* User-allocate, one call for each member of the alloc-list of an
- ALLOCATE statement. */
-
-extern void *allocate (index_type, GFC_INTEGER_4 *) __attribute__ ((malloc));
-export_proto(allocate);
-
-void *
-allocate (index_type size, GFC_INTEGER_4 * stat)
-{
- void *newmem;
-
-#ifdef GFC_CHECK_MEMORY
- /* The only time this can happen is the size computed by the
- frontend wraps around. */
- if (size < 0)
- {
- if (stat)
- {
- *stat = ERROR_ALLOCATION;
- return NULL;
- }
- else
- runtime_error ("Attempt to allocate negative amount of memory. "
- "Possible integer overflow");
- }
-#endif
- newmem = malloc (size ? size : 1);
- if (!newmem)
- {
- if (stat)
- {
- *stat = ERROR_ALLOCATION;
- return newmem;
- }
- else
- runtime_error ("ALLOCATE: Out of memory.");
- }
-
- if (stat)
- *stat = 0;
-
- return newmem;
-}
-
-/* Function to call in an ALLOCATE statement when the argument is an
- allocatable array. If the array is currently allocated, it is
- an error to allocate it again. */
-
-extern void *allocate_array (void *, index_type, GFC_INTEGER_4 *);
-export_proto(allocate_array);
-
-void *
-allocate_array (void *mem, index_type size, GFC_INTEGER_4 * stat)
-{
- if (mem == NULL)
- return allocate (size, stat);
- if (stat)
- {
- free (mem);
- mem = allocate (size, stat);
- *stat = ERROR_ALLOCATION;
- return mem;
- }
-
- runtime_error ("Attempting to allocate already allocated array.");
-}
-
-
-/* User-deallocate; pointer is then NULLified by the front-end. */
-
-extern void deallocate (void *, GFC_INTEGER_4 *);
-export_proto(deallocate);
-
-void
-deallocate (void *mem, GFC_INTEGER_4 * stat)
-{
- if (!mem)
- {
- if (stat)
- {
- *stat = 1;
- return;
- }
- else
- runtime_error ("Internal: Attempt to DEALLOCATE unallocated memory.");
- }
-
- free (mem);
-
- if (stat)
- *stat = 0;
-}
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 11e908207b4..8e3444820c1 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,11 @@
+2007-08-24 Kai Tietz <kai.tietz@onevision.com>
+
+ * pex-common.h: (pex_funcs): Retyped wait and exec_child to pid_t.
+ * pex-djgpp.c: Likewise.
+ * pex-msdos.c: Likewise.
+ * pex-unix.c: Likewise.
+ * pex-win32.c: Likewise.
+
2007-08-17 Michael Snyder <msnyder@access-company.com>
* make-relative-prefix.c (make_relative_prefix_1): Resource leaks.
diff --git a/libiberty/pex-common.h b/libiberty/pex-common.h
index 8edc13b7650..5b7bfcc03ee 100644
--- a/libiberty/pex-common.h
+++ b/libiberty/pex-common.h
@@ -26,6 +26,12 @@ Boston, MA 02110-1301, USA. */
#include "libiberty.h"
#include <stdio.h>
+/* pid_t is may defined by config.h or sys/types.h needs to be
+ included. */
+#if !defined(pid_t) && defined(HAVE_SYS_TYPES_H)
+#include <sys/types.h>
+#endif
+
#define install_error_msg "installation problem, cannot exec `%s'"
/* stdin file number. */
@@ -108,7 +114,7 @@ struct pex_funcs
closed in the child process. The function should handle the
PEX_STDERR_TO_STDOUT flag. Return >= 0 on success, or -1 on
error and set *ERRMSG and *ERR. */
- long (*exec_child) (struct pex_obj *, int /* flags */,
+ pid_t (*exec_child) (struct pex_obj *, int /* flags */,
const char */* executable */, char * const * /* argv */,
char * const * /* env */,
int /* in */, int /* out */, int /* errdes */,
@@ -120,7 +126,7 @@ struct pex_funcs
and time in *TIME (if it is not null). CHILD is from fork. DONE
is 1 if this is called via pex_free. ERRMSG and ERR are as in
fork. Return 0 on success, -1 on error. */
- int (*wait) (struct pex_obj *, long /* child */, int * /* status */,
+ int (*wait) (struct pex_obj *, pid_t /* child */, int * /* status */,
struct pex_time * /* time */, int /* done */,
const char ** /* errmsg */, int * /* err */);
/* Create a pipe (only called if PEX_USE_PIPES is set) storing two
diff --git a/libiberty/pex-djgpp.c b/libiberty/pex-djgpp.c
index ac5a4f97ba7..bd279380dae 100644
--- a/libiberty/pex-djgpp.c
+++ b/libiberty/pex-djgpp.c
@@ -44,12 +44,12 @@ extern int errno;
static int pex_djgpp_open_read (struct pex_obj *, const char *, int);
static int pex_djgpp_open_write (struct pex_obj *, const char *, int);
-static long pex_djgpp_exec_child (struct pex_obj *, int, const char *,
+static pid_t pex_djgpp_exec_child (struct pex_obj *, int, const char *,
char * const *, char * const *,
int, int, int, int,
const char **, int *);
static int pex_djgpp_close (struct pex_obj *, int);
-static int pex_djgpp_wait (struct pex_obj *, long, int *, struct pex_time *,
+static int pex_djgpp_wait (struct pex_obj *, pid_t, int *, struct pex_time *,
int, const char **, int *);
/* The list of functions we pass to the common routines. */
@@ -110,7 +110,7 @@ pex_djgpp_close (struct pex_obj *obj ATTRIBUTE_UNUSED, int fd)
/* Execute a child. */
-static long
+static pid_t
pex_djgpp_exec_child (struct pex_obj *obj, int flags, const char *executable,
char * const * argv, char * const * env,
int in, int out, int errdes,
@@ -132,19 +132,19 @@ pex_djgpp_exec_child (struct pex_obj *obj, int flags, const char *executable,
{
*err = errno;
*errmsg = "dup";
- return -1;
+ return (pid_t) -1;
}
if (dup2 (in, STDIN_FILE_NO) < 0)
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ return (pid_t) -1;
}
if (close (in) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
@@ -155,19 +155,19 @@ pex_djgpp_exec_child (struct pex_obj *obj, int flags, const char *executable,
{
*err = errno;
*errmsg = "dup";
- return -1;
+ return (pid_t) -1;
}
if (dup2 (out, STDOUT_FILE_NO) < 0)
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ return (pid_t) -1;
}
if (close (out) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
@@ -179,14 +179,14 @@ pex_djgpp_exec_child (struct pex_obj *obj, int flags, const char *executable,
{
*err = errno;
*errmsg = "dup";
- return -1;
+ return (pid_t) -1;
}
if (dup2 ((flags & PEX_STDERR_TO_STDOUT) != 0 ? STDOUT_FILE_NO : errdes,
STDERR_FILE_NO) < 0)
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ return (pid_t) -1;
}
if (errdes != STDERR_FILE_NO)
{
@@ -194,7 +194,7 @@ pex_djgpp_exec_child (struct pex_obj *obj, int flags, const char *executable,
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
}
@@ -218,13 +218,13 @@ pex_djgpp_exec_child (struct pex_obj *obj, int flags, const char *executable,
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ return (pid_t) -1;
}
if (close (org_in) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
@@ -234,13 +234,13 @@ pex_djgpp_exec_child (struct pex_obj *obj, int flags, const char *executable,
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ return (pid_t) -1;
}
if (close (org_out) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
@@ -251,13 +251,13 @@ pex_djgpp_exec_child (struct pex_obj *obj, int flags, const char *executable,
{
*err = errno;
*errmsg = "dup2";
- return -1;
+ return (pid_t) -1;
}
if (close (org_errdes) < 0)
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
@@ -269,7 +269,7 @@ pex_djgpp_exec_child (struct pex_obj *obj, int flags, const char *executable,
statuses[obj->count] = status;
obj->sysdep = (void *) statuses;
- return obj->count;
+ return (pid_t) obj->count;
}
/* Wait for a child process to complete. Actually the child process
@@ -277,7 +277,7 @@ pex_djgpp_exec_child (struct pex_obj *obj, int flags, const char *executable,
status. */
static int
-pex_djgpp_wait (struct pex_obj *obj, long pid, int *status,
+pex_djgpp_wait (struct pex_obj *obj, pid_t pid, int *status,
struct pex_time *time, int done ATTRIBUTE_UNUSED,
const char **errmsg ATTRIBUTE_UNUSED,
int *err ATTRIBUTE_UNUSED)
diff --git a/libiberty/pex-msdos.c b/libiberty/pex-msdos.c
index b5acd86b0f5..ab4d736429e 100644
--- a/libiberty/pex-msdos.c
+++ b/libiberty/pex-msdos.c
@@ -54,12 +54,12 @@ struct pex_msdos
static int pex_msdos_open (struct pex_obj *, const char *, int);
static int pex_msdos_open (struct pex_obj *, const char *, int);
static int pex_msdos_fdindex (struct pex_msdos *, int);
-static long pex_msdos_exec_child (struct pex_obj *, int, const char *,
+static pid_t pex_msdos_exec_child (struct pex_obj *, int, const char *,
char * const *, char * const *,
int, int, int, int,
int, const char **, int *);
static int pex_msdos_close (struct pex_obj *, int);
-static int pex_msdos_wait (struct pex_obj *, long, int *, struct pex_time *,
+static int pex_msdos_wait (struct pex_obj *, pid_t, int *, struct pex_time *,
int, const char **, int *);
static void pex_msdos_cleanup (struct pex_obj *);
@@ -152,7 +152,7 @@ pex_msdos_close (struct pex_obj *obj, int fd)
/* Execute a child. */
-static long
+static pid_t
pex_msdos_exec_child (struct pex_obj *obj, int flags, const char *executable,
char * const * argv, char * const * env, int in, int out,
int toclose ATTRIBUTE_UNUSED,
@@ -235,7 +235,7 @@ pex_msdos_exec_child (struct pex_obj *obj, int flags, const char *executable,
free (scmd);
free (rf);
*errmsg = "cannot open temporary command file";
- return -1;
+ return (pid_t) -1;
}
for (i = 1; argv[i] != NULL; ++i)
@@ -262,7 +262,7 @@ pex_msdos_exec_child (struct pex_obj *obj, int flags, const char *executable,
free (scmd);
free (rf);
*errmsg = "system";
- return -1;
+ return (pid_t) -1;
}
remove (rf);
@@ -275,7 +275,7 @@ pex_msdos_exec_child (struct pex_obj *obj, int flags, const char *executable,
ms->statuses = XRESIZEVEC(int, ms->statuses, obj->count + 1);
ms->statuses[obj->count] = status;
- return obj->count;
+ return (pid_t) obj->count;
}
/* Wait for a child process to complete. Actually the child process
@@ -283,7 +283,7 @@ pex_msdos_exec_child (struct pex_obj *obj, int flags, const char *executable,
status. */
static int
-pex_msdos_wait (struct pex_obj *obj, long pid, int *status,
+pex_msdos_wait (struct pex_obj *obj, pid_t pid, int *status,
struct pex_time *time, int done ATTRIBUTE_UNUSED,
const char **errmsg ATTRIBUTE_UNUSED,
int *err ATTRIBUTE_UNUSED)
diff --git a/libiberty/pex-unix.c b/libiberty/pex-unix.c
index a7760415e01..366e96ef8d2 100644
--- a/libiberty/pex-unix.c
+++ b/libiberty/pex-unix.c
@@ -269,12 +269,12 @@ static void pex_child_error (struct pex_obj *, const char *, const char *, int)
ATTRIBUTE_NORETURN;
static int pex_unix_open_read (struct pex_obj *, const char *, int);
static int pex_unix_open_write (struct pex_obj *, const char *, int);
-static long pex_unix_exec_child (struct pex_obj *, int, const char *,
+static pid_t pex_unix_exec_child (struct pex_obj *, int, const char *,
char * const *, char * const *,
int, int, int, int,
const char **, int *);
static int pex_unix_close (struct pex_obj *, int);
-static int pex_unix_wait (struct pex_obj *, long, int *, struct pex_time *,
+static int pex_unix_wait (struct pex_obj *, pid_t, int *, struct pex_time *,
int, const char **, int *);
static int pex_unix_pipe (struct pex_obj *, int *, int);
static FILE *pex_unix_fdopenr (struct pex_obj *, int, int);
@@ -355,7 +355,7 @@ pex_child_error (struct pex_obj *obj, const char *executable,
extern char **environ;
-static long
+static pid_t
pex_unix_exec_child (struct pex_obj *obj, int flags, const char *executable,
char * const * argv, char * const * env,
int in, int out, int errdes,
@@ -384,7 +384,7 @@ pex_unix_exec_child (struct pex_obj *obj, int flags, const char *executable,
case -1:
*err = errno;
*errmsg = VFORK_STRING;
- return -1;
+ return (pid_t) -1;
case 0:
/* Child process. */
@@ -435,7 +435,7 @@ pex_unix_exec_child (struct pex_obj *obj, int flags, const char *executable,
}
/* NOTREACHED */
- return -1;
+ return (pid_t) -1;
default:
/* Parent process. */
@@ -445,7 +445,7 @@ pex_unix_exec_child (struct pex_obj *obj, int flags, const char *executable,
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
if (out != STDOUT_FILE_NO)
@@ -454,7 +454,7 @@ pex_unix_exec_child (struct pex_obj *obj, int flags, const char *executable,
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
if (errdes != STDERR_FILE_NO)
@@ -463,18 +463,18 @@ pex_unix_exec_child (struct pex_obj *obj, int flags, const char *executable,
{
*err = errno;
*errmsg = "close";
- return -1;
+ return (pid_t) -1;
}
}
- return (long) pid;
+ return pid;
}
}
/* Wait for a child process to complete. */
static int
-pex_unix_wait (struct pex_obj *obj, long pid, int *status,
+pex_unix_wait (struct pex_obj *obj, pid_t pid, int *status,
struct pex_time *time, int done, const char **errmsg,
int *err)
{
diff --git a/libiberty/pex-win32.c b/libiberty/pex-win32.c
index ef9eb025caf..05d44e9d183 100644
--- a/libiberty/pex-win32.c
+++ b/libiberty/pex-win32.c
@@ -79,12 +79,12 @@ backslashify (char *s)
static int pex_win32_open_read (struct pex_obj *, const char *, int);
static int pex_win32_open_write (struct pex_obj *, const char *, int);
-static long pex_win32_exec_child (struct pex_obj *, int, const char *,
+static pid_t pex_win32_exec_child (struct pex_obj *, int, const char *,
char * const *, char * const *,
int, int, int, int,
const char **, int *);
static int pex_win32_close (struct pex_obj *, int);
-static int pex_win32_wait (struct pex_obj *, long, int *,
+static int pex_win32_wait (struct pex_obj *, pid_t, int *,
struct pex_time *, int, const char **, int *);
static int pex_win32_pipe (struct pex_obj *, int *, int);
static FILE *pex_win32_fdopenr (struct pex_obj *, int, int);
@@ -522,7 +522,7 @@ env_compare (const void *a_ptr, const void *b_ptr)
return c1 - c2;
}
-static long
+static pid_t
win32_spawn (const char *executable,
BOOL search,
char *const *argv,
@@ -597,7 +597,7 @@ win32_spawn (const char *executable,
free (full_executable);
- return -1;
+ return (pid_t) -1;
}
/* Clean up. */
@@ -606,7 +606,7 @@ win32_spawn (const char *executable,
if (env_block)
free (env_block);
- return (long) pi->hProcess;
+ return (pid_t) pi->hProcess;
error:
if (env_block)
@@ -616,17 +616,17 @@ win32_spawn (const char *executable,
if (full_executable)
free (full_executable);
- return -1;
+ return (pid_t) -1;
}
-static long
+static pid_t
spawn_script (const char *executable, char *const *argv,
char* const *env,
DWORD dwCreationFlags,
LPSTARTUPINFO si,
LPPROCESS_INFORMATION pi)
{
- int pid = -1;
+ pid_t pid = (pid_t) -1;
int save_errno = errno;
int fd = _open (executable, _O_RDONLY);
@@ -673,7 +673,7 @@ spawn_script (const char *executable, char *const *argv,
dwCreationFlags, si, pi);
if (executable1 != newex)
free ((char *) newex);
- if (pid < 0)
+ if ((long) pid < 0)
{
newex = msys_rootify (executable1);
if (newex != executable1)
@@ -689,14 +689,14 @@ spawn_script (const char *executable, char *const *argv,
}
}
}
- if (pid < 0)
+ if ((long) pid < 0)
errno = save_errno;
return pid;
}
/* Execute a child. */
-static long
+static pid_t
pex_win32_exec_child (struct pex_obj *obj ATTRIBUTE_UNUSED, int flags,
const char *executable, char * const * argv,
char* const* env,
@@ -705,7 +705,7 @@ pex_win32_exec_child (struct pex_obj *obj ATTRIBUTE_UNUSED, int flags,
const char **errmsg,
int *err)
{
- long pid;
+ pid_t pid;
HANDLE stdin_handle;
HANDLE stdout_handle;
HANDLE stderr_handle;
@@ -780,10 +780,10 @@ pex_win32_exec_child (struct pex_obj *obj ATTRIBUTE_UNUSED, int flags,
/* Create the child process. */
pid = win32_spawn (executable, (flags & PEX_SEARCH) != 0,
argv, env, dwCreationFlags, &si, &pi);
- if (pid == -1)
+ if (pid == (pid_t) -1)
pid = spawn_script (executable, argv, env, dwCreationFlags,
&si, &pi);
- if (pid == -1)
+ if (pid == (pid_t) -1)
{
*err = ENOENT;
*errmsg = "CreateProcess";
@@ -808,7 +808,7 @@ pex_win32_exec_child (struct pex_obj *obj ATTRIBUTE_UNUSED, int flags,
macros. Note that WIFSIGNALED will never be true under CRTDLL. */
static int
-pex_win32_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, long pid,
+pex_win32_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, pid_t pid,
int *status, struct pex_time *time, int done ATTRIBUTE_UNUSED,
const char **errmsg, int *err)
{
@@ -883,7 +883,7 @@ main (int argc ATTRIBUTE_UNUSED, char **argv)
char const *errmsg;
int err;
argv++;
- printf ("%ld\n", pex_win32_exec_child (NULL, PEX_SEARCH, argv[0], argv, NULL, 0, 0, 1, 2, &errmsg, &err));
+ printf ("%ld\n", (long) pex_win32_exec_child (NULL, PEX_SEARCH, argv[0], argv, NULL, 0, 0, 1, 2, &errmsg, &err));
exit (0);
}
#endif
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 07b0d14c416..d68d4d6b16b 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,7 @@
+2007-08-30 Andreas Tobler <a.tobler@schweiz.org>
+
+ * gij.cc (version): Update Copyright year.
+
2007-08-16 Samuel Thibault <samuel.thibault@ens-lyon.org>
* configure.host (gnu*): Set use_libgcj_bc to yes.
diff --git a/libjava/classpath/ChangeLog b/libjava/classpath/ChangeLog
index cb34d1daaa1..15342acd2b8 100644
--- a/libjava/classpath/ChangeLog
+++ b/libjava/classpath/ChangeLog
@@ -1,3 +1,10 @@
+2007-08-22 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/util/EnumSet.java:
+ Documented.
+ (complementOf(EnumSet)): Fixed to flip only
+ the bits used by the enumset.
+
2007-07-31 Dalibor Topic <robilad@kaffe.org>
PR 32844
diff --git a/libjava/classpath/java/util/EnumSet.java b/libjava/classpath/java/util/EnumSet.java
index 543df0c0279..31b03684ab6 100644
--- a/libjava/classpath/java/util/EnumSet.java
+++ b/libjava/classpath/java/util/EnumSet.java
@@ -41,6 +41,38 @@ package java.util;
import java.io.Serializable;
/**
+ * <p>
+ * Provides an efficient mechanism for recording a set of enumeration
+ * constants. As enumerations have a known set of possible values, certain
+ * assumptions can be made when creating a set of constants. The maximum
+ * size of the set will always be equal to the number of constants, and each
+ * value will always be one of these constants. As a result, the set only needs
+ * to store whether a particular constant is present or not rather than the
+ * values themselves. Each constant can thus be represented by a single bit.
+ * </p>
+ * <p>
+ * This class is designed to provide an alternative to using integer bit flags
+ * by providing a typesafe {@link Collection} interface with an underlying
+ * implementation that utilises the assumptions above to give an equivalent level
+ * of efficiency. The values in a {@link EnumSet} must all be from the same
+ * {@link Enum} type, which allows the contents to be packed into a bit vector.
+ * A containment test is then simply a matter of inspecting the appropriate bit, while
+ * addition involves setting the same. Such basic operations take place in constant
+ * time.
+ * </p>
+ * <p>
+ * The {@link Iterator} implementation traverses the values in the natural order
+ * of the enumeration provided by each constant's {@link Enum#ordinal()}. It is
+ * <emph>weakly consistent</emph> and will not throw a {@link ConcurrentModificationException}.
+ * This means that concurrent changes to the set may or may not be noticeable during
+ * traversal.
+ * </p>
+ * <p>
+ * As is usual with most collections, the set is not synchronized by default. This
+ * can be remedied by using the {@link Collections#synchronizedSet(Set)} method. Null
+ * elements are not supported and attempts to add one will throw a {@link NullPointerException}.
+ * </p>
+ *
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @author Dalibor Topic (robilad@kaffe.org)
@@ -57,14 +89,35 @@ public abstract class EnumSet<T extends Enum<T>>
// These fields could go into the anonymous inner class in of(E),
// complementOf would need to be refactored then, though.
+ /**
+ * The store which maintains the bits used to represent
+ * the enumeration constants.
+ */
BitSet store;
+
+ /**
+ * The cardinality of the set (the current number
+ * of bits set).
+ */
int cardinality;
+
+ /**
+ * The enumeration used by this set.
+ */
Class<T> enumClass;
+ /**
+ * Empty package-private constructor
+ */
EnumSet()
{
}
+ /**
+ * Returns a clone of the set.
+ *
+ * @return a clone of the set.
+ */
public EnumSet<T> clone()
{
EnumSet<T> r;
@@ -82,22 +135,56 @@ public abstract class EnumSet<T extends Enum<T>>
return r;
}
+ /**
+ * Returns a set for the given enumeration type where
+ * all the constants are present.
+ *
+ * @param eltType the type of enumeration to use for the set.
+ * @return an {@link EnumSet} with all the bits set.
+ * @throws NullPointerException if the element type is <code>null</code>.
+ */
public static <T extends Enum<T>> EnumSet<T> allOf(Class<T> eltType)
{
// create an EnumSet from the list of values of the type
return copyOf(Arrays.asList(eltType.getEnumConstants()));
}
+ /**
+ * Returns a set for the given enumeration type where
+ * none of the constants are present.
+ *
+ * @param eltType the type of enumeration to use for the set.
+ * @return an {@link EnumSet} with none of the bits set.
+ * @throws NullPointerException if the element type is <code>null</code>.
+ */
public static <T extends Enum<T>> EnumSet<T> noneOf(Class<T> eltType)
{
return complementOf(allOf(eltType));
}
+ /**
+ * Returns a clone of the given set.
+ *
+ * @param other the set to clone.
+ * @return an {@link EnumSet} that is a clone of the given set.
+ * @throws NullPointerException if <code>other</code> is <code>null</code>.
+ */
public static <T extends Enum<T>> EnumSet<T> copyOf(EnumSet<T> other)
{
return other.clone();
}
+ /**
+ * Creates an {@link EnumSet} using the contents of the given collection.
+ * If the collection is also an {@link EnumSet}, this method works the
+ * same as {@link #copyOf(EnumSet)}. Otherwise, the elements of the collection
+ * are inspected and used to populate the new set.
+ *
+ * @param other the collection to use to populate the new set.
+ * @return an {@link EnumSet} containing elements from the given collection.
+ * @throws NullPointerException if <code>other</code> is <code>null</code>.
+ * @throws IllegalArgumentException if the collection is empty.
+ */
public static <T extends Enum<T>> EnumSet<T> copyOf(Collection<T> other)
{
if (other instanceof EnumSet)
@@ -118,14 +205,31 @@ public abstract class EnumSet<T extends Enum<T>>
return r;
}
+ /**
+ * Returns a set which is the inverse of the supplied set.
+ * If a constant is present in the current set, it will not be
+ * present in the new set and vice versa.
+ *
+ * @param other the set to provide the complement of.
+ * @return an {@link EnumSet} which is the inverse of the current one.
+ * @throws NullPointerException if <code>other</code> is <code>null</code>.
+ */
public static <T extends Enum<T>> EnumSet<T> complementOf(EnumSet<T> other)
{
EnumSet<T> r = other.clone();
- r.store.flip(0, r.store.size());
- r.cardinality = r.store.size() - other.cardinality;
+ int numConstants = r.enumClass.getEnumConstants().length;
+ r.store.flip(0, numConstants);
+ r.cardinality = numConstants - other.cardinality;
return r;
}
+ /**
+ * Creates a new {@link EnumSet} populated with the given element.
+ *
+ * @param first the element to use to populate the new set.
+ * @return an {@link EnumSet} containing the element.
+ * @throws NullPointerException if <code>first</code> is <code>null</code>.
+ */
public static <T extends Enum<T>> EnumSet<T> of(T first)
{
EnumSet<T> r = new EnumSet<T>()
@@ -286,6 +390,14 @@ public abstract class EnumSet<T extends Enum<T>>
return r;
}
+ /**
+ * Creates a new {@link EnumSet} populated with the given two elements.
+ *
+ * @param first the first element to use to populate the new set.
+ * @param second the second element to use.
+ * @return an {@link EnumSet} containing the elements.
+ * @throws NullPointerException if any of the parameters are <code>null</code>.
+ */
public static <T extends Enum<T>> EnumSet<T> of(T first, T second)
{
EnumSet<T> r = of(first);
@@ -293,6 +405,15 @@ public abstract class EnumSet<T extends Enum<T>>
return r;
}
+ /**
+ * Creates a new {@link EnumSet} populated with the given three elements.
+ *
+ * @param first the first element to use to populate the new set.
+ * @param second the second element to use.
+ * @param third the third element to use.
+ * @return an {@link EnumSet} containing the elements.
+ * @throws NullPointerException if any of the parameters are <code>null</code>.
+ */
public static <T extends Enum<T>> EnumSet<T> of(T first, T second, T third)
{
EnumSet<T> r = of(first, second);
@@ -300,6 +421,16 @@ public abstract class EnumSet<T extends Enum<T>>
return r;
}
+ /**
+ * Creates a new {@link EnumSet} populated with the given four elements.
+ *
+ * @param first the first element to use to populate the new set.
+ * @param second the second element to use.
+ * @param third the third element to use.
+ * @param fourth the fourth element to use.
+ * @return an {@link EnumSet} containing the elements.
+ * @throws NullPointerException if any of the parameters are <code>null</code>.
+ */
public static <T extends Enum<T>> EnumSet<T> of(T first, T second, T third,
T fourth)
{
@@ -308,6 +439,17 @@ public abstract class EnumSet<T extends Enum<T>>
return r;
}
+ /**
+ * Creates a new {@link EnumSet} populated with the given five elements.
+ *
+ * @param first the first element to use to populate the new set.
+ * @param second the second element to use.
+ * @param third the third element to use.
+ * @param fourth the fourth element to use.
+ * @param fifth the fifth element to use.
+ * @return an {@link EnumSet} containing the elements.
+ * @throws NullPointerException if any of the parameters are <code>null</code>.
+ */
public static <T extends Enum<T>> EnumSet<T> of(T first, T second, T third,
T fourth, T fifth)
{
@@ -316,6 +458,14 @@ public abstract class EnumSet<T extends Enum<T>>
return r;
}
+ /**
+ * Creates a new {@link EnumSet} populated with the given elements.
+ *
+ * @param first the first element to use to populate the new set.
+ * @param rest the other elements to use.
+ * @return an {@link EnumSet} containing the elements.
+ * @throws NullPointerException if any of the parameters are <code>null</code>.
+ */
public static <T extends Enum<T>> EnumSet<T> of(T first, T... rest)
{
EnumSet<T> r = noneOf(first.getDeclaringClass());
@@ -325,6 +475,22 @@ public abstract class EnumSet<T extends Enum<T>>
return r;
}
+ /**
+ * Creates a new {@link EnumSet} using the enumeration constants
+ * starting from {@code from} and ending at {@code to} inclusive.
+ * The two may be the same, but they must be in the correct order.
+ * So giving the first constant twice would give a set with just that
+ * constant set, while supplying the first and second constant will give
+ * a set with those two elements. However, specifying the second as
+ * the {@code from} element followed by an earlier element as the
+ * {@code to} element will result in an error.
+ *
+ * @param from the element to start from.
+ * @param to the element to end at (may be the same as {@code from}.
+ * @return an {@link EnumSet} containing the specified range of elements.
+ * @throws NullPointerException if any of the parameters are <code>null</code>.
+ * @throws IllegalArgumentException if {@code first.compareTo(last) > 0}.
+ */
public static <T extends Enum<T>> EnumSet<T> range(T from, T to)
{
if (from.compareTo(to) > 0)
diff --git a/libjava/gij.cc b/libjava/gij.cc
index a3b8529c4c9..c04b1d889a8 100644
--- a/libjava/gij.cc
+++ b/libjava/gij.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2006 Free Software Foundation
+/* Copyright (C) 1999-2007 Free Software Foundation
This file is part of libgcj.
@@ -42,7 +42,7 @@ version ()
{
printf ("java version \"" JV_VERSION "\"\n");
printf ("gij (GNU libgcj) version %s\n\n", __VERSION__);
- printf ("Copyright (C) 2006 Free Software Foundation, Inc.\n");
+ printf ("Copyright (C) 2007 Free Software Foundation, Inc.\n");
printf ("This is free software; see the source for copying conditions. There is NO\n");
printf ("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
}
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 144ac4792ad..99048bb4584 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,99 @@
+2007-08-29 Benjamin Kosnik <bkoz@redhat.com>
+
+ * acinclude.m4 (GLIBCXX_CHECK_SYSTEM_ERROR): Add ENODATA, ENOSR,
+ ENOSTR, ETIME for freebsd.
+ * configure: Regenerate.
+ * include/std/system_error: Guard.
+ * testsuite/19_diagnostics/headers/system_error/
+ types_std_c++0x.cc: Same.
+ * testsuite/19_diagnostics/error_category/cons/copy_neg.cc: Adjust
+ line numbers.
+
+2007-08-28 Paolo Carlini <pcarlini@suse.de>
+
+ PR libstdc++/33128
+ * include/tr1_impl/random (uniform_int<>::_M_call): Deal with
+ __urng() returning negative values.
+ * testsuite/tr1/5_numerical_facilities/random/uniform_int/33128.cc:
+ New.
+
+2007-08-24 Benjamin Kosnik <bkoz@redhat.com>
+
+ * acinclude.m4: Fix duplicate variable names.
+ * configure: Regenerate.
+
+2007-08-24 Benjamin Kosnik <bkoz@redhat.com>
+
+ * acinclude.m4 (GLIBCXX_CHECK_SYSTEM_ERROR): Add ENOLINK, EPROTO
+ for netbsd.
+ * configure: Regenerate.
+ * include/std/system_error: Guard.
+ * testsuite/19_diagnostics/headers/system_error/
+ types_std_c++0x.cc: Same.
+ * testsuite/19_diagnostics/error_category/cons/copy_neg.cc: Adjust
+ line numbers.
+
+2007-08-23 Benjamin Kosnik <bkoz@redhat.com>
+
+ * include/std/system_error: New file.
+ * src/system_error.cc: New file.
+ * src/Makefile.am (sources): Add.
+ * src/Makefile.in: Regenerate.
+ * include/Makefile.am (std_headers): Add system_error.
+ * include/Makefile.in: Regenerate.
+ * acinclude.m4 (GLIBCXX_CHECK_SYSTEM_ERROR): New.
+ * configure.ac: Call it.
+ * config.h.in: Regenerate.
+ * include/bits/functional_hash.h: Add hash<error_code>.
+ * include/std/ostream: Add inserters for error_code.
+
+ * docs/doxygen/user.cfg.in: Add system_error.
+
+ * config/abi/pre/gnu.ver(GLIBCXX_3.4.10): Add new symbols.
+
+ * testsuite/19_diagnostics/error_code: New.
+ * testsuite/19_diagnostics/error_code/cons: Same.
+ * testsuite/19_diagnostics/error_code/cons/1.cc: Same.
+ * testsuite/19_diagnostics/error_code/operators: Same.
+ * testsuite/19_diagnostics/error_code/operators/bool.cc: Same.
+ * testsuite/19_diagnostics/error_code/operators/bool_neg.cc: Same.
+ * testsuite/19_diagnostics/error_code/operators/equal.cc: Same.
+ * testsuite/19_diagnostics/error_code/operators/not_equal.cc: Same.
+ * testsuite/19_diagnostics/error_category: Same.
+ * testsuite/19_diagnostics/error_category/cons: Same.
+ * testsuite/19_diagnostics/error_category/cons/copy_neg.cc: Same.
+ * testsuite/19_diagnostics/error_category/cons/default.cc: Same.
+ * testsuite/19_diagnostics/error_category/operators: Same.
+ * testsuite/19_diagnostics/error_category/operators/equal.cc: Same.
+ * testsuite/19_diagnostics/error_category/operators/not_equal.cc: Same.
+ * testsuite/19_diagnostics/headers/system_error: Same.
+ * testsuite/19_diagnostics/headers/system_error/
+ types_std_c++0x.cc: Same.
+ * testsuite/19_diagnostics/headers/system_error/std_c++0x_neg.cc: Same.
+ * testsuite/19_diagnostics/system_error: Same.
+ * testsuite/19_diagnostics/system_error/
+ cons_virtual_derivation.cc: Same.
+ * testsuite/19_diagnostics/system_error/cons-1.cc: Same.
+ * testsuite/19_diagnostics/system_error/what-1.cc: Same.
+ * testsuite/19_diagnostics/system_error/what-2.cc: Same.
+ * testsuite/19_diagnostics/system_error/what-big.cc: Same.
+ * testsuite/19_diagnostics/system_error/what-3.cc: Same.
+ * testsuite/19_diagnostics/system_error/what-4.cc: Same.
+ * testsuite/27_io/basic_ostream/inserters_other/wchar_t/
+ error_code.cc: Same.
+ * testsuite/27_io/basic_ostream/inserters_other/char/
+ error_code.cc: Same.
+ * testsuite/tr1/6_containers/hash/operators: New.
+ * testsuite/tr1/6_containers/hash/operators/size_t.cc: Same.
+
+ * testsuite/23_containers/hash: Move...
+ * testsuite/20_util/hash: ... here.
+ * testsuite/20_util/hash/operators: New.
+ * testsuite/20_util/hash/operators/size_t.cc: New.
+
+ * testsuite/20_util/function_objects/bad_function_call: Move...
+ * testsuite/20_util/bad_function_call: ...here.
+
2007-08-21 Benjamin Kosnik <bkoz@montsouris.artheist.org>
* include/Makefile.am (install-data-local): Remove pch-install rules.
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 4b3aaa5b58d..5fa76eda147 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -1258,6 +1258,102 @@ AC_DEFUN([GLIBCXX_CHECK_RANDOM_TR1], [
])
dnl
+dnl Check whether macros, etc are present for <system_error>
+dnl
+AC_DEFUN([GLIBCXX_CHECK_SYSTEM_ERROR], [
+
+ AC_MSG_CHECKING([for EOWNERDEAD])
+ AC_CACHE_VAL(ac_system_error1, [
+ AC_TRY_COMPILE([#include <errno.h>], [ int i = EOWNERDEAD; ],
+ [ac_system_error1=yes], [ac_system_error1=no])
+ ])
+ AC_MSG_RESULT($ac_system_error1)
+ if test x"$ac_system_error1" = x"yes"; then
+ AC_DEFINE(HAVE_EOWNERDEAD, 1, [Define if EOWNERDEAD exists.])
+ fi
+
+ AC_MSG_CHECKING([for ENOTRECOVERABLE])
+ AC_CACHE_VAL(ac_system_error2, [
+ AC_TRY_COMPILE([#include <errno.h>], [ int i = ENOTRECOVERABLE; ],
+ [ac_system_error2=yes], [ac_system_error2=no])
+ ])
+ AC_MSG_RESULT($ac_system_error2)
+ if test x"$ac_system_error2" = x"yes"; then
+ AC_DEFINE(HAVE_ENOTRECOVERABLE, 1, [Define if ENOTRECOVERABLE exists.])
+ fi
+
+ AC_MSG_CHECKING([for ENOLINK])
+ AC_CACHE_VAL(ac_system_error3, [
+ AC_TRY_COMPILE([#include <errno.h>], [ int i = ENOLINK; ],
+ [ac_system_error3=yes], [ac_system_error3=no])
+ ])
+ AC_MSG_RESULT($ac_system_error3)
+ if test x"$ac_system_error3" = x"yes"; then
+ AC_DEFINE(HAVE_ENOLINK, 1, [Define if ENOLINK exists.])
+ fi
+
+ AC_MSG_CHECKING([for EPROTO])
+ AC_CACHE_VAL(ac_system_error_4, [
+ AC_TRY_COMPILE([#include <errno.h>], [ int i = EPROTO; ],
+ [ac_system_error_4=yes], [ac_system_error_4=no])
+ ])
+ AC_MSG_RESULT($ac_system_error_4)
+ if test x"$ac_system_error_4" = x"yes"; then
+ AC_DEFINE(HAVE_EPROTO, 1, [Define if EPROTO exists.])
+ fi
+
+ AC_MSG_CHECKING([for ENODATA])
+ AC_CACHE_VAL(ac_system_error_5, [
+ AC_TRY_COMPILE([#include <errno.h>], [ int i = ENODATA; ],
+ [ac_system_error_5=yes], [ac_system_error_5=no])
+ ])
+ AC_MSG_RESULT($ac_system_error_5)
+ if test x"$ac_system_error_5" = x"yes"; then
+ AC_DEFINE(HAVE_ENODATA, 1, [Define if ENODATA exists.])
+ fi
+
+ AC_MSG_CHECKING([for ENOSR])
+ AC_CACHE_VAL(ac_system_error_6, [
+ AC_TRY_COMPILE([#include <errno.h>], [ int i = ENOSR; ],
+ [ac_system_error_6=yes], [ac_system_error_6=no])
+ ])
+ AC_MSG_RESULT($ac_system_error_6)
+ if test x"$ac_system_error_6" = x"yes"; then
+ AC_DEFINE(HAVE_ENOSR, 1, [Define if ENOSR exists.])
+ fi
+
+ AC_MSG_CHECKING([for ENOSTR])
+ AC_CACHE_VAL(ac_system_error_7, [
+ AC_TRY_COMPILE([#include <errno.h>], [ int i = ENOSTR; ],
+ [ac_system_error_7=yes], [ac_system_error_7=no])
+ ])
+ AC_MSG_RESULT($ac_system_error_7)
+ if test x"$ac_system_error_7" = x"yes"; then
+ AC_DEFINE(HAVE_ENOSTR, 1, [Define if ENOSTR exists.])
+ fi
+
+ AC_MSG_CHECKING([for ETIME])
+ AC_CACHE_VAL(ac_system_error_8, [
+ AC_TRY_COMPILE([#include <errno.h>], [ int i = ETIME; ],
+ [ac_system_error_8=yes], [ac_system_error_8=no])
+ ])
+ AC_MSG_RESULT($ac_system_error_8)
+ if test x"$ac_system_error_8" = x"yes"; then
+ AC_DEFINE(HAVE_ETIME, 1, [Define if ETIME exists.])
+ fi
+
+ AC_MSG_CHECKING([for sys_nerr])
+ AC_CACHE_VAL(ac_system_error9, [
+ AC_TRY_COMPILE([#include <errno.h> ], [ int i = sys_nerr; ],
+ [ac_system_error9=yes], [ac_system_error9=no])
+ ])
+ AC_MSG_RESULT($ac_system_error9)
+ if test x"$ac_system_error9" = x"yes"; then
+ AC_DEFINE(HAVE_SYS_NERR, 1, [Define if sys_nerr exists.])
+ fi
+])
+
+dnl
dnl Check for what type of C headers to use.
dnl
dnl --enable-cheaders= [does stuff].
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
index 30a03cc24d3..be830a0c1ce 100644
--- a/libstdc++-v3/config.h.in
+++ b/libstdc++-v3/config.h.in
@@ -63,6 +63,30 @@
/* Define to 1 if you have the <endian.h> header file. */
#undef HAVE_ENDIAN_H
+/* Define if ENODATA exists. */
+#undef HAVE_ENODATA
+
+/* Define if ENOLINK exists. */
+#undef HAVE_ENOLINK
+
+/* Define if ENOSR exists. */
+#undef HAVE_ENOSR
+
+/* Define if ENOSTR exists. */
+#undef HAVE_ENOSTR
+
+/* Define if ENOTRECOVERABLE exists. */
+#undef HAVE_ENOTRECOVERABLE
+
+/* Define if EOWNERDEAD exists. */
+#undef HAVE_EOWNERDEAD
+
+/* Define if EPROTO exists. */
+#undef HAVE_EPROTO
+
+/* Define if ETIME exists. */
+#undef HAVE_ETIME
+
/* Define to 1 if you have the `expf' function. */
#undef HAVE_EXPF
@@ -331,6 +355,9 @@
/* Define to 1 if you have the <sys/machine.h> header file. */
#undef HAVE_SYS_MACHINE_H
+/* Define if sys_nerr exists. */
+#undef HAVE_SYS_NERR
+
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index a7f378dd236..059d20a19e9 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -447,7 +447,14 @@ GLIBCXX_3.4 {
_ZTVNSt6locale5facetE;
_ZTVS[a-z];
_ZTVSt[0-9][A-Za-z]*;
- _ZTVSt[0-9][0-9][A-Za-z]*;
+# _ZTVSt[0-9][0-9][A-Za-z]*;
+ _ZTVSt[0-9][0-9][A-Z]*;
+ _ZTVSt[0-9][0-9][a-d]*;
+ _ZTVSt[0-9][0-9][f-r]*;
+ _ZTVSt[0-9][0-9][t-z]*;
+ _ZTVSt[0-9][0-9]e[^r]*;
+ _ZTVSt[0-9][0-9]s[^y]*;
+
_ZTVSt11__timepunctI[cw]E;
_ZTVSt23__codecvt_abstract_baseI[cw]c11__mbstate_tE;
_ZTVSt21__ctype_abstract_baseI[cw]E;
@@ -459,14 +466,23 @@ GLIBCXX_3.4 {
# typeinfo structure
_ZTIS[a-z];
- _ZTINSt8ios_base7failureE;
- _ZTINSt6locale5facetE;
_ZTISt[0-9][A-Za-z]*;
- _ZTISt[0-9][0-9][A-Za-z]*;
+# _ZTISt[0-9][0-9][A-Za-z]*;
+ _ZTISt[0-9][0-9][A-Z]*;
+ _ZTISt[0-9][0-9][a-d]*;
+ _ZTISt[0-9][0-9][f-r]*;
+ _ZTISt[0-9][0-9][t-z]*;
+ _ZTISt[0-9][0-9]e[^r]*;
+ _ZTISt[0-9][0-9]s[^y]*;
_ZTISt11__timepunctI[cw]E;
_ZTISt10__num_base;
_ZTISt21__ctype_abstract_baseI[cw]E;
_ZTISt23__codecvt_abstract_baseI[cw]c11__mbstate_tE;
+# _ZTISt16__numpunct_cacheI[cw]E;
+# _ZTISt17__timepunct_cacheI[cw]E;
+# _ZTISt18__moneypunct_cacheI[cw]Lb?EE;
+ _ZTINSt8ios_base7failureE;
+ _ZTINSt6locale5facetE;
_ZTIN9__gnu_cxx18stdio_sync_filebufI[cw]St11char_traitsI[cw]EEE;
_ZTIN9__gnu_cxx13stdio_filebufI[cw]St11char_traitsI[cw]EEE;
@@ -475,7 +491,14 @@ GLIBCXX_3.4 {
_ZTSNSt6locale5facetE;
_ZTSS[a-z];
_ZTSSt[0-9][A-Za-z]*;
- _ZTSSt[0-9][0-9][A-Za-z]*;
+# _ZTSSt[0-9][0-9][A-Za-z]*;
+ _ZTSSt[0-9][0-9][A-Z]*;
+ _ZTSSt[0-9][0-9][a-d]*;
+ _ZTSSt[0-9][0-9][f-r]*;
+ _ZTSSt[0-9][0-9][t-z]*;
+ _ZTSSt[0-9][0-9]e[^r]*;
+ _ZTSSt[0-9][0-9]s[^y]*;
+
_ZTSSt11__timepunctI[cw]E;
_ZTSSt10__num_base;
_ZTSSt21__ctype_abstract_baseI[cw]E;
@@ -719,6 +742,18 @@ GLIBCXX_3.4.10 {
_ZNK11__gnu_debug16_Error_formatter17_M_get_max_lengthEv;
+ # system_error
+ _ZSt15system_category;
+
+ _ZTISt14error_category;
+ _ZTSSt14error_category;
+ _ZTVSt14error_category;
+
+ _ZTSSt12system_error;
+ _ZTISt12system_error;
+ _ZTVSt12system_error;
+ _ZNSt12system_errorD*Ev;
+
} GLIBCXX_3.4.9;
# Symbols in the support library (libsupc++) have their own tag.
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 8e78be89292..4df7e23acf4 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -13792,7 +13792,7 @@ _ACEOF
-# Check for compiler support that doesn't require linking.
+# Enable compiler support that doesn't require linking.
echo "$as_me:$LINENO: checking for exception model to use" >&5
echo $ECHO_N "checking for exception model to use... $ECHO_C" >&6
@@ -13956,7 +13956,7 @@ echo "${ECHO_T}$enable_libstdcxx_pch" >&6
-# Enable all the variable C++ runtime options.
+# Enable all the variable C++ runtime options that doesn't require linking.
echo "$as_me:$LINENO: checking for underlying I/O to use" >&5
echo $ECHO_N "checking for underlying I/O to use... $ECHO_C" >&6
@@ -16530,6 +16530,586 @@ _ACEOF
fi
+# Checks for operating systems support that don't require linking.
+
+
+ echo "$as_me:$LINENO: checking for EOWNERDEAD" >&5
+echo $ECHO_N "checking for EOWNERDEAD... $ECHO_C" >&6
+ if test "${ac_system_error1+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <errno.h>
+int
+main ()
+{
+ int i = EOWNERDEAD;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_system_error1=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_system_error1=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+ echo "$as_me:$LINENO: result: $ac_system_error1" >&5
+echo "${ECHO_T}$ac_system_error1" >&6
+ if test x"$ac_system_error1" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_EOWNERDEAD 1
+_ACEOF
+
+ fi
+
+ echo "$as_me:$LINENO: checking for ENOTRECOVERABLE" >&5
+echo $ECHO_N "checking for ENOTRECOVERABLE... $ECHO_C" >&6
+ if test "${ac_system_error2+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <errno.h>
+int
+main ()
+{
+ int i = ENOTRECOVERABLE;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_system_error2=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_system_error2=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+ echo "$as_me:$LINENO: result: $ac_system_error2" >&5
+echo "${ECHO_T}$ac_system_error2" >&6
+ if test x"$ac_system_error2" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ENOTRECOVERABLE 1
+_ACEOF
+
+ fi
+
+ echo "$as_me:$LINENO: checking for ENOLINK" >&5
+echo $ECHO_N "checking for ENOLINK... $ECHO_C" >&6
+ if test "${ac_system_error3+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <errno.h>
+int
+main ()
+{
+ int i = ENOLINK;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_system_error3=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_system_error3=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+ echo "$as_me:$LINENO: result: $ac_system_error3" >&5
+echo "${ECHO_T}$ac_system_error3" >&6
+ if test x"$ac_system_error3" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ENOLINK 1
+_ACEOF
+
+ fi
+
+ echo "$as_me:$LINENO: checking for EPROTO" >&5
+echo $ECHO_N "checking for EPROTO... $ECHO_C" >&6
+ if test "${ac_system_error_4+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <errno.h>
+int
+main ()
+{
+ int i = EPROTO;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_system_error_4=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_system_error_4=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+ echo "$as_me:$LINENO: result: $ac_system_error_4" >&5
+echo "${ECHO_T}$ac_system_error_4" >&6
+ if test x"$ac_system_error_4" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_EPROTO 1
+_ACEOF
+
+ fi
+
+ echo "$as_me:$LINENO: checking for ENODATA" >&5
+echo $ECHO_N "checking for ENODATA... $ECHO_C" >&6
+ if test "${ac_system_error_5+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <errno.h>
+int
+main ()
+{
+ int i = ENODATA;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_system_error_5=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_system_error_5=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+ echo "$as_me:$LINENO: result: $ac_system_error_5" >&5
+echo "${ECHO_T}$ac_system_error_5" >&6
+ if test x"$ac_system_error_5" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ENODATA 1
+_ACEOF
+
+ fi
+
+ echo "$as_me:$LINENO: checking for ENOSR" >&5
+echo $ECHO_N "checking for ENOSR... $ECHO_C" >&6
+ if test "${ac_system_error_6+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <errno.h>
+int
+main ()
+{
+ int i = ENOSR;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_system_error_6=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_system_error_6=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+ echo "$as_me:$LINENO: result: $ac_system_error_6" >&5
+echo "${ECHO_T}$ac_system_error_6" >&6
+ if test x"$ac_system_error_6" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ENOSR 1
+_ACEOF
+
+ fi
+
+ echo "$as_me:$LINENO: checking for ENOSTR" >&5
+echo $ECHO_N "checking for ENOSTR... $ECHO_C" >&6
+ if test "${ac_system_error_7+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <errno.h>
+int
+main ()
+{
+ int i = ENOSTR;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_system_error_7=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_system_error_7=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+ echo "$as_me:$LINENO: result: $ac_system_error_7" >&5
+echo "${ECHO_T}$ac_system_error_7" >&6
+ if test x"$ac_system_error_7" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ENOSTR 1
+_ACEOF
+
+ fi
+
+ echo "$as_me:$LINENO: checking for ETIME" >&5
+echo $ECHO_N "checking for ETIME... $ECHO_C" >&6
+ if test "${ac_system_error_8+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <errno.h>
+int
+main ()
+{
+ int i = ETIME;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_system_error_8=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_system_error_8=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+ echo "$as_me:$LINENO: result: $ac_system_error_8" >&5
+echo "${ECHO_T}$ac_system_error_8" >&6
+ if test x"$ac_system_error_8" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ETIME 1
+_ACEOF
+
+ fi
+
+ echo "$as_me:$LINENO: checking for sys_nerr" >&5
+echo $ECHO_N "checking for sys_nerr... $ECHO_C" >&6
+ if test "${ac_system_error9+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <errno.h>
+int
+main ()
+{
+ int i = sys_nerr;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_system_error9=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_system_error9=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+ echo "$as_me:$LINENO: result: $ac_system_error9" >&5
+echo "${ECHO_T}$ac_system_error9" >&6
+ if test x"$ac_system_error9" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SYS_NERR 1
+_ACEOF
+
+ fi
+
+
# No surprises, no surprises...
echo "$as_me:$LINENO: checking for thread model used by GCC" >&5
@@ -16571,7 +17151,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style.
cat > conftest.$ac_ext << EOF
-#line 16574 "configure"
+#line 17154 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 5d1d947a881..4ad8d0ebfad 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -92,11 +92,11 @@ AC_SUBST(enable_static)
## than just ignoring the results. Faster /and/ more correct, win win.
GLIBCXX_ENABLE_HOSTED
-# Check for compiler support that doesn't require linking.
+# Enable compiler support that doesn't require linking.
GLIBCXX_ENABLE_SJLJ_EXCEPTIONS
GLIBCXX_ENABLE_PCH($is_hosted)
-# Enable all the variable C++ runtime options.
+# Enable all the variable C++ runtime options that doesn't require linking.
GLIBCXX_ENABLE_CSTDIO
GLIBCXX_ENABLE_CLOCALE
GLIBCXX_ENABLE_ALLOCATOR
@@ -110,6 +110,9 @@ GLIBCXX_ENABLE_DEBUG([no])
GLIBCXX_ENABLE_CXX_FLAGS
GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no])
+# Checks for operating systems support that don't require linking.
+GLIBCXX_CHECK_SYSTEM_ERROR
+
# No surprises, no surprises...
GLIBCXX_ENABLE_THREADS
GLIBCXX_ENABLE_ATOMIC_BUILTINS
diff --git a/libstdc++-v3/docs/doxygen/user.cfg.in b/libstdc++-v3/docs/doxygen/user.cfg.in
index 73fe6777d4d..1484c78f68f 100644
--- a/libstdc++-v3/docs/doxygen/user.cfg.in
+++ b/libstdc++-v3/docs/doxygen/user.cfg.in
@@ -532,6 +532,7 @@ INPUT = @srcdir@/docs/doxygen/doxygroups.cc \
include/stdexcept \
include/streambuf \
include/string \
+ include/system_error \
include/tuple \
include/type_traits \
include/unordered_map \
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index b7a2a96c2c4..c51128bd9af 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -58,6 +58,7 @@ std_headers = \
${std_srcdir}/stdexcept \
${std_srcdir}/streambuf \
${std_srcdir}/string \
+ ${std_srcdir}/system_error \
${std_srcdir}/tuple \
${std_srcdir}/type_traits \
${std_srcdir}/unordered_map \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 876563f5761..f6e69b0e85b 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -303,6 +303,7 @@ std_headers = \
${std_srcdir}/stdexcept \
${std_srcdir}/streambuf \
${std_srcdir}/string \
+ ${std_srcdir}/system_error \
${std_srcdir}/tuple \
${std_srcdir}/type_traits \
${std_srcdir}/unordered_map \
diff --git a/libstdc++-v3/include/bits/functional_hash.h b/libstdc++-v3/include/bits/functional_hash.h
index 022c5caf4cc..d5658fe4c50 100644
--- a/libstdc++-v3/include/bits/functional_hash.h
+++ b/libstdc++-v3/include/bits/functional_hash.h
@@ -59,5 +59,21 @@
# undef _GLIBCXX_INCLUDE_AS_CXX0X
#endif
+#include <system_error>
+
+namespace std
+{
+ template<>
+ struct hash<error_code> : public unary_function<error_code, size_t>
+ {
+ size_t
+ operator()(error_code __e) const
+ {
+ const char* __p = reinterpret_cast<const char*>(&__e);
+ return _Fnv_hash<>::hash(__p, sizeof(__e));
+ }
+ };
+}
+
#endif // _FUNCTIONAL_HASH_H
diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream
index 2287756513c..67dcc555cff 100644
--- a/libstdc++-v3/include/std/ostream
+++ b/libstdc++-v3/include/std/ostream
@@ -45,6 +45,10 @@
#include <ios>
#include <bits/ostream_insert.h>
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# include <system_error>
+#endif
+
_GLIBCXX_BEGIN_NAMESPACE(std)
// [27.6.2.1] Template class basic_ostream
@@ -531,6 +535,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ return (__out << reinterpret_cast<const char*>(__s)); }
//@}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _CharT, typename _Traits>
+ inline basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __out, const error_code& __e)
+{ return (__out << __e.category().name().c_str() << ':' << __e.value()); }
+#endif
+
// [27.6.2.7] standard basic_ostream manipulators
/**
* @brief Write a newline and flush the stream.
diff --git a/libstdc++-v3/include/std/system_error b/libstdc++-v3/include/std/system_error
new file mode 100644
index 00000000000..e5b65ed5fc8
--- /dev/null
+++ b/libstdc++-v3/include/std/system_error
@@ -0,0 +1,265 @@
+// <system_error> -*- C++ -*-
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file include/system_error
+ * This is a Standard C++ Library header.
+ */
+
+#ifndef _GLIBCXX_SYSTEM_ERROR
+#define _GLIBCXX_SYSTEM_ERROR 1
+
+#pragma GCC system_header
+
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# include <c++0x_warning.h>
+#endif
+
+#include <bits/c++config.h>
+#include <cerrno>
+#include <iosfwd>
+#include <stdexcept>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ class system_error;
+ class error_code;
+ class error_category;
+
+ extern const error_category& system_category;
+
+ enum posix_errno
+ {
+ address_family_not_supported = EAFNOSUPPORT,
+ address_in_use = EADDRINUSE,
+ address_not_available = EADDRNOTAVAIL,
+ already_connected = EISCONN,
+ argument_list_too_long = E2BIG,
+ argument_out_of_domain = EDOM,
+ bad_address = EFAULT,
+ bad_file_descriptor = EBADF,
+ bad_message = EBADMSG,
+ broken_pipe = EPIPE,
+ connection_aborted = ECONNABORTED,
+ connection_already_in_progress = EALREADY,
+ connection_refused = ECONNREFUSED,
+ connection_reset = ECONNRESET,
+ cross_device_link = EXDEV,
+ destination_address_required = EDESTADDRREQ,
+ device_or_resource_busy = EBUSY,
+ directory_not_empty = ENOTEMPTY,
+ executable_format_error = ENOEXEC,
+ file_exists = EEXIST,
+ file_too_large = EFBIG,
+ filename_too_long = ENAMETOOLONG,
+ function_not_supported = ENOSYS,
+ host_unreachable = EHOSTUNREACH,
+ identifier_removed = EIDRM,
+ illegal_byte_sequence = EILSEQ,
+ inappropriate_io_control_operation = ENOTTY,
+ interrupted = EINTR,
+ invalid_argument = EINVAL,
+ invalid_seek = ESPIPE,
+ io_error = EIO,
+ is_a_directory = EISDIR,
+ message_size = EMSGSIZE,
+ network_down = ENETDOWN,
+ network_reset = ENETRESET,
+ network_unreachable = ENETUNREACH,
+ no_buffer_space = ENOBUFS,
+ no_child_process = ECHILD,
+
+#ifdef _GLIBCXX_HAVE_ENOLINK
+ no_link = ENOLINK,
+#endif
+ no_lock_available = ENOLCK,
+
+#ifdef _GLIBCXX_HAVE_ENODATA
+ no_message_available = ENODATA,
+#endif
+
+ no_message = ENOMSG,
+ no_protocol_option = ENOPROTOOPT,
+ no_space_on_device = ENOSPC,
+
+#ifdef _GLIBCXX_HAVE_ENOSR
+ no_stream_resources = ENOSR,
+#endif
+
+ no_such_device_or_address = ENXIO,
+ no_such_device = ENODEV,
+ no_such_file_or_directory = ENOENT,
+ no_such_process = ESRCH,
+ not_a_directory = ENOTDIR,
+ not_a_socket = ENOTSOCK,
+
+#ifdef _GLIBCXX_HAVE_ENOSTR
+ not_a_stream = ENOSTR,
+#endif
+
+ not_connected = ENOTCONN,
+ not_enough_memory = ENOMEM,
+ not_supported = ENOTSUP,
+ operation_canceled = ECANCELED,
+ operation_in_progress = EINPROGRESS,
+ operation_not_permitted = EPERM,
+ operation_not_supported = EOPNOTSUPP,
+ operation_would_block = EWOULDBLOCK,
+#ifdef _GLIBCXX_HAVE_EOWNERDEAD
+ owner_dead = EOWNERDEAD,
+#endif
+ permission_denied = EACCES,
+#ifdef _GLIBCXX_HAVE_EPROTO
+ protocol_error = EPROTO,
+#endif
+ protocol_not_supported = EPROTONOSUPPORT,
+ read_only_file_system = EROFS,
+ resource_deadlock_would_occur = EDEADLK,
+ resource_unavailable_try_again = EAGAIN,
+ result_out_of_range = ERANGE,
+#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE
+ state_not_recoverable = ENOTRECOVERABLE,
+#endif
+
+#ifdef _GLIBCXX_HAVE_ETIME
+ stream_timeout = ETIME,
+#endif
+
+ text_file_busy = ETXTBSY,
+ timed_out = ETIMEDOUT,
+ too_many_files_open_in_system = ENFILE,
+ too_many_files_open = EMFILE,
+ too_many_links = EMLINK,
+ too_many_synbolic_link_levels = ELOOP,
+ value_too_large = EOVERFLOW,
+ wrong_protocol_type = EPROTOTYPE,
+ no_posix_equivalent = 1L << 16
+ };
+
+ struct error_category
+ {
+ error_category() { }
+
+ bool
+ operator==(const error_category& __other) const
+ { return this == &__other; }
+
+ bool
+ operator!=(const error_category& __other) const
+ { return this != &__other; }
+
+ virtual posix_errno
+ posix(int __v) const = 0;
+
+ virtual const string&
+ name() const = 0;
+
+ private:
+ error_category(const error_category&);
+
+ error_category&
+ operator=(const error_category&);
+ };
+
+ struct error_code
+ {
+ error_code() throw()
+ : _M_value(0), _M_cat(&system_category) { }
+
+ error_code(int __v, const error_category& __cat) throw()
+ : _M_value(__v), _M_cat(&__cat) { }
+
+ error_code(posix_errno __v)
+ : _M_value(__v), _M_cat(&system_category) { }
+
+ void
+ assign(int __v, const error_category& __cat) throw()
+ {
+ _M_value = __v;
+ _M_cat = &__cat;
+ }
+
+ void
+ clear() throw()
+ {
+ _M_value = 0;
+ _M_cat = &system_category;
+ }
+
+ int
+ value() const throw() { return _M_value; }
+
+ const error_category&
+ category() const { return *_M_cat; }
+
+ posix_errno
+ posix() const throw() { return this->category().posix(_M_value); }
+
+ // Safe bool idiom.
+ // explicit operator bool() const throw()
+ // { return _M_value != 0; }
+ typedef void (*__bool_type)();
+
+ static void __not_bool_type() { }
+
+ operator __bool_type() const throw()
+ { return _M_value != 0 ? &__not_bool_type : false; }
+
+ bool operator==(const error_code& __other) const
+ { return value() == __other.value() && category() == __other.category(); }
+
+ bool operator!=(const error_code& __other) const
+ { return !(this == &__other); }
+
+ private:
+ int _M_value;
+ const error_category* _M_cat;
+ };
+
+ class system_error : public std::runtime_error
+ {
+ private:
+ error_code _M_code;
+
+ public:
+ system_error(const string& __what, error_code __ec = error_code())
+ : runtime_error(__what), _M_code(__ec) { }
+
+ system_error(const string& __what, int __v, const error_category& __ecat)
+ : runtime_error(__what), _M_code(error_code(__v, __ecat)) { }
+
+ virtual ~system_error() throw();
+
+ const error_code&
+ code() const throw() { return _M_code; }
+ };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
+
diff --git a/libstdc++-v3/include/tr1_impl/random b/libstdc++-v3/include/tr1_impl/random
index 8d2b9eed911..e855307dace 100644
--- a/libstdc++-v3/include/tr1_impl/random
+++ b/libstdc++-v3/include/tr1_impl/random
@@ -1604,7 +1604,11 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
result_type
_M_call(_UniformRandomNumberGenerator& __urng,
result_type __min, result_type __max, true_type)
- { return result_type(__urng() % (__max - __min + 1)) + __min; }
+ {
+ typedef typename __gnu_cxx::__add_unsigned<typename
+ _UniformRandomNumberGenerator::result_type>::__type __utype;
+ return result_type(__utype(__urng()) % (__max - __min + 1)) + __min;
+ }
template<typename _UniformRandomNumberGenerator>
result_type
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index 818735a73ef..cd2aad64b65 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -152,6 +152,7 @@ sources = \
localename.cc \
stdexcept.cc \
strstream.cc \
+ system_error.cc \
tree.cc \
allocator-inst.cc \
concept-inst.cc \
@@ -204,6 +205,12 @@ concept-inst.lo: concept-inst.cc
concept-inst.o: concept-inst.cc
$(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
+# Use special rules for the C++0x sources so that the proper flags are passed.
+system_error.lo: system_error.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+system_error.o: system_error.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
if GLIBCXX_LDBL_COMPAT
# Use special rules for compatibility-ldbl.cc compilation, as we need to
# pass -mlong-double-64.
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index 49ea3b3b273..184b903b6e9 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -72,12 +72,12 @@ am__libstdc___la_SOURCES_DIST = bitmap_allocator.cc pool_allocator.cc \
ctype.cc debug.cc debug_list.cc functexcept.cc globals_io.cc \
ios.cc ios_failure.cc ios_init.cc ios_locale.cc limits.cc \
list.cc locale.cc locale_init.cc locale_facets.cc \
- localename.cc stdexcept.cc strstream.cc tree.cc \
- allocator-inst.cc concept-inst.cc fstream-inst.cc ext-inst.cc \
- ios-inst.cc iostream-inst.cc istream-inst.cc istream.cc \
- locale-inst.cc misc-inst.cc ostream-inst.cc sstream-inst.cc \
- streambuf-inst.cc streambuf.cc string-inst.cc valarray-inst.cc \
- wlocale-inst.cc wstring-inst.cc atomicity.cc \
+ localename.cc stdexcept.cc strstream.cc system_error.cc \
+ tree.cc allocator-inst.cc concept-inst.cc fstream-inst.cc \
+ ext-inst.cc ios-inst.cc iostream-inst.cc istream-inst.cc \
+ istream.cc locale-inst.cc misc-inst.cc ostream-inst.cc \
+ sstream-inst.cc streambuf-inst.cc streambuf.cc string-inst.cc \
+ valarray-inst.cc wlocale-inst.cc wstring-inst.cc atomicity.cc \
codecvt_members.cc collate_members.cc ctype_members.cc \
messages_members.cc monetary_members.cc numeric_members.cc \
time_members.cc basic_file.cc c++locale.cc \
@@ -92,13 +92,13 @@ am__objects_4 = bitmap_allocator.lo pool_allocator.lo mt_allocator.lo \
debug_list.lo functexcept.lo globals_io.lo ios.lo \
ios_failure.lo ios_init.lo ios_locale.lo limits.lo list.lo \
locale.lo locale_init.lo locale_facets.lo localename.lo \
- stdexcept.lo strstream.lo tree.lo allocator-inst.lo \
- concept-inst.lo fstream-inst.lo ext-inst.lo ios-inst.lo \
- iostream-inst.lo istream-inst.lo istream.lo locale-inst.lo \
- misc-inst.lo ostream-inst.lo sstream-inst.lo streambuf-inst.lo \
- streambuf.lo string-inst.lo valarray-inst.lo wlocale-inst.lo \
- wstring-inst.lo $(am__objects_1) $(am__objects_2) \
- $(am__objects_3)
+ stdexcept.lo strstream.lo system_error.lo tree.lo \
+ allocator-inst.lo concept-inst.lo fstream-inst.lo ext-inst.lo \
+ ios-inst.lo iostream-inst.lo istream-inst.lo istream.lo \
+ locale-inst.lo misc-inst.lo ostream-inst.lo sstream-inst.lo \
+ streambuf-inst.lo streambuf.lo string-inst.lo valarray-inst.lo \
+ wlocale-inst.lo wstring-inst.lo $(am__objects_1) \
+ $(am__objects_2) $(am__objects_3)
am_libstdc___la_OBJECTS = $(am__objects_4)
libstdc___la_OBJECTS = $(am_libstdc___la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
@@ -378,6 +378,7 @@ sources = \
localename.cc \
stdexcept.cc \
strstream.cc \
+ system_error.cc \
tree.cc \
allocator-inst.cc \
concept-inst.cc \
@@ -786,6 +787,12 @@ concept-inst.lo: concept-inst.cc
concept-inst.o: concept-inst.cc
$(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
+# Use special rules for the C++0x sources so that the proper flags are passed.
+system_error.lo: system_error.cc
+ $(LTCXXCOMPILE) -std=gnu++0x -c $<
+system_error.o: system_error.cc
+ $(CXXCOMPILE) -std=gnu++0x -c $<
+
# Use special rules for compatibility-ldbl.cc compilation, as we need to
# pass -mlong-double-64.
@GLIBCXX_LDBL_COMPAT_TRUE@compatibility-ldbl.lo: compatibility-ldbl.cc
diff --git a/libstdc++-v3/src/system_error.cc b/libstdc++-v3/src/system_error.cc
new file mode 100644
index 00000000000..191625435eb
--- /dev/null
+++ b/libstdc++-v3/src/system_error.cc
@@ -0,0 +1,71 @@
+// <system_error> implementation file
+
+// Copyright (C) 2007
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <cstring>
+#include <system_error>
+#include <bits/functexcept.h>
+#include <limits>
+
+namespace
+{
+ struct gnu_error_category : public std::error_category
+ {
+ virtual const std::string&
+ name() const
+ {
+ static const std::string category("GNU");
+ return category;
+ }
+
+ virtual std::posix_errno
+ posix(int __v) const
+ {
+#ifdef _GLIBCXX_HAVE_SYS_NERR
+ const int last_errorno = sys_nerr;
+#else
+ const int last_errorno = std::numeric_limits<int>::max();
+#endif
+ if (__v > 0 && __v <= last_errorno)
+ return std::posix_errno(__v);
+ else
+ return std::no_posix_equivalent;
+ }
+ };
+
+ const gnu_error_category gnu_category;
+}
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ const error_category& system_category = gnu_category;
+
+ system_error::~system_error() throw() { }
+
+_GLIBCXX_END_NAMESPACE
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc
new file mode 100644
index 00000000000..766009c429e
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc
@@ -0,0 +1,56 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <system_error>
+#include <testsuite_hooks.h>
+
+namespace __gnu_test
+{
+ struct test_category : public std::error_category
+ {
+ virtual std::posix_errno
+ posix(int __v) const
+ { return std::posix_errno(__v); }
+
+ virtual const std::string&
+ name() const
+ {
+ static std::string s("__gnu_test::test_category");
+ return s;
+ }
+ };
+}
+
+int main()
+{
+ bool test __attribute__((unused)) = true;
+
+ __gnu_test::test_category c1;
+ __gnu_test::test_category c2(c1);
+
+ return 0;
+}
+
+// { dg-error "is private" "" { target *-*-* } 183 }
+// { dg-error "within this context" "" { target *-*-* } 29 }
+// { dg-error "first required here" "" { target *-*-* } 48 }
+// { dg-excess-errors "copy constructor" }
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/default.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/default.cc
new file mode 100644
index 00000000000..ae4f5b33bee
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/default.cc
@@ -0,0 +1,61 @@
+// { dg-options "-std=gnu++0x" }
+// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <system_error>
+#include <testsuite_hooks.h>
+
+namespace __gnu_test
+{
+ struct test_category : public std::error_category
+ {
+ virtual std::posix_errno
+ posix(int __v) const
+ { return std::posix_errno(__v); }
+
+ virtual const std::string&
+ name() const
+ {
+ static std::string s("__gnu_test::test_category");
+ return s;
+ }
+ };
+
+ struct test_derived_category : public test_category
+ {
+ virtual const std::string&
+ name() const
+ {
+ static std::string s("__gnu_test::test_derived_category");
+ return s;
+ }
+ };
+}
+
+int main()
+{
+ bool test __attribute__((unused)) = true;
+
+ // 1
+ __gnu_test::test_category c1;
+ __gnu_test::test_derived_category c2;
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/equal.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/equal.cc
new file mode 100644
index 00000000000..4d5b4cd80ba
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/equal.cc
@@ -0,0 +1,62 @@
+// { dg-options "-std=gnu++0x" }
+// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <system_error>
+#include <testsuite_hooks.h>
+
+namespace __gnu_test
+{
+ struct test_category : public std::error_category
+ {
+ virtual std::posix_errno
+ posix(int __v) const
+ { return std::posix_errno(__v); }
+
+ virtual const std::string&
+ name() const
+ {
+ static std::string s("__gnu_test::test_category");
+ return s;
+ }
+ };
+
+ struct test_derived_category : public test_category
+ {
+ virtual const std::string&
+ name() const
+ {
+ static std::string s("__gnu_test::test_derived_category");
+ return s;
+ }
+ };
+}
+
+int main()
+{
+ bool test __attribute__((unused)) = true;
+
+ __gnu_test::test_category c1;
+ __gnu_test::test_derived_category c2;
+ VERIFY( c1 == c1 );
+ VERIFY( !(c1 == c2) );
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/not_equal.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/not_equal.cc
new file mode 100644
index 00000000000..7d5f8d3021d
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/not_equal.cc
@@ -0,0 +1,62 @@
+// { dg-options "-std=gnu++0x" }
+// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <system_error>
+#include <testsuite_hooks.h>
+
+namespace __gnu_test
+{
+ struct test_category : public std::error_category
+ {
+ virtual std::posix_errno
+ posix(int __v) const
+ { return std::posix_errno(__v); }
+
+ virtual const std::string&
+ name() const
+ {
+ static std::string s("__gnu_test::test_category");
+ return s;
+ }
+ };
+
+ struct test_derived_category : public test_category
+ {
+ virtual const std::string&
+ name() const
+ {
+ static std::string s("__gnu_test::test_derived_category");
+ return s;
+ }
+ };
+}
+
+int main()
+{
+ bool test __attribute__((unused)) = true;
+
+ __gnu_test::test_category c1;
+ __gnu_test::test_derived_category c2;
+ VERIFY( !(c1 != c1) );
+ VERIFY( c1 != c2 );
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc
new file mode 100644
index 00000000000..8732e2891dc
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc
@@ -0,0 +1,63 @@
+// { dg-options "-std=gnu++0x" }
+// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <system_error>
+#include <testsuite_hooks.h>
+
+namespace __gnu_test
+{
+ struct test_category : public std::error_category
+ {
+ virtual std::posix_errno
+ posix(int __v) const
+ { return std::posix_errno(__v); }
+
+ virtual const std::string&
+ name() const
+ {
+ static std::string s("__gnu_test::test_category");
+ return s;
+ }
+ };
+}
+
+int main()
+{
+ bool test __attribute__((unused)) = true;
+
+ // 1
+ std::error_code e1;
+ VERIFY( e1.value() == 0 );
+ VERIFY( e1.category() == std::system_category );
+
+ // 2
+ const __gnu_test::test_category cat;
+ std::error_code e2(e1.value(), cat);
+ VERIFY( e2.value() == e1.value() );
+ VERIFY( e2.category() == cat );
+
+ // 3
+ std::error_code e3(std::operation_not_supported);
+ VERIFY( e3.value() == int(std::operation_not_supported) );
+ VERIFY( e3.category() == std::system_category );
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool.cc
new file mode 100644
index 00000000000..f4cd48cc6bd
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=gnu++0x" }
+// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <system_error>
+#include <testsuite_hooks.h>
+
+// unspecified bool operator positive tests
+int main()
+{
+ bool test __attribute__((unused)) = true;
+ bool b;
+
+ // 1
+ std::error_code e1;
+ if (e1)
+ {
+ VERIFY( false );
+ }
+
+ // 2
+ std::error_code e2(std::operation_not_supported);
+ if (e2)
+ {
+ VERIFY( true );
+ }
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool_neg.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool_neg.cc
new file mode 100644
index 00000000000..3bf89ba7357
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool_neg.cc
@@ -0,0 +1,34 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ std::error_code e;
+ int i = e;
+
+ return 0;
+}
+
+// { dg-error "invalid conversion" "" { target *-*-* } 29 }
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc
new file mode 100644
index 00000000000..e94c52adbb5
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc
@@ -0,0 +1,58 @@
+// { dg-options "-std=gnu++0x" }
+// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <system_error>
+#include <testsuite_hooks.h>
+
+namespace __gnu_test
+{
+ struct test_category : public std::error_category
+ {
+ virtual std::posix_errno
+ posix(int __v) const
+ { return std::posix_errno(__v); }
+
+ virtual const std::string&
+ name() const
+ {
+ static std::string s("__gnu_test::test_category");
+ return s;
+ }
+ };
+}
+
+// unspecified bool operator positive tests
+int main()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::error_code e1;
+ std::error_code e2(std::operation_not_supported);
+
+ VERIFY( e1 == e1 );
+ VERIFY( !(e1 == e2) );
+
+ const __gnu_test::test_category cat;
+ std::error_code e3(e2.value(), cat);
+ VERIFY( !(e2 == e3) );
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc
new file mode 100644
index 00000000000..de487ee98a9
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc
@@ -0,0 +1,58 @@
+// { dg-options "-std=gnu++0x" }
+// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <system_error>
+#include <testsuite_hooks.h>
+
+namespace __gnu_test
+{
+ struct test_category : public std::error_category
+ {
+ virtual std::posix_errno
+ posix(int __v) const
+ { return std::posix_errno(__v); }
+
+ virtual const std::string&
+ name() const
+ {
+ static std::string s("__gnu_test::test_category");
+ return s;
+ }
+ };
+}
+
+// unspecified bool operator positive tests
+int main()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::error_code e1;
+ std::error_code e2(std::operation_not_supported);
+
+ VERIFY( !(e1 != e1) );
+ VERIFY( e1 != e2 );
+
+ const __gnu_test::test_category cat;
+ std::error_code e3(e2.value(), cat);
+ VERIFY( e2 != e3 );
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/hash/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/std_c++0x_neg.cc
index 2155ca898bc..fc04cf55fb9 100644
--- a/libstdc++-v3/testsuite/23_containers/hash/requirements/explicit_instantiation.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/std_c++0x_neg.cc
@@ -1,4 +1,3 @@
-// { dg-options "-std=gnu++0x" }
// { dg-do compile }
// Copyright (C) 2007 Free Software Foundation, Inc.
@@ -8,17 +7,20 @@
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
-//
+
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02110-1301, USA.
-#include <functional>
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <system_error> // { dg-excess-errors "In file included from" }
+
+// { dg-error "upcoming ISO" "" { target *-*-* } 36 }
+
+
-template class std::hash<bool>;
diff --git a/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/types_std_c++0x.cc b/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/types_std_c++0x.cc
new file mode 100644
index 00000000000..742ef29a77c
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/types_std_c++0x.cc
@@ -0,0 +1,142 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <system_error>
+
+namespace gnu
+{
+ using std::system_error;
+ using std::error_code;
+ using std::error_category;
+ using std::system_category;
+
+ using std::posix_errno;
+ using std::address_family_not_supported;
+ using std::address_in_use;
+ using std::address_not_available;
+ using std::already_connected;
+ using std::argument_list_too_long;
+ using std::argument_out_of_domain;
+ using std:: bad_address;
+ using std::bad_file_descriptor;
+ using std::bad_message;
+ using std::broken_pipe;
+ using std::connection_aborted;
+ using std::connection_already_in_progress;
+ using std::connection_refused;
+ using std::connection_reset;
+ using std::cross_device_link;
+ using std::destination_address_required;
+ using std::device_or_resource_busy;
+ using std::directory_not_empty;
+ using std::executable_format_error;
+ using std::file_exists;
+ using std::file_too_large;
+ using std::filename_too_long;
+ using std::function_not_supported;
+ using std::host_unreachable;
+ using std::identifier_removed;
+ using std::illegal_byte_sequence;
+ using std::inappropriate_io_control_operation;
+ using std::interrupted;
+ using std::invalid_argument;
+ using std::invalid_seek;
+ using std::io_error;
+ using std::is_a_directory;
+ using std::message_size;
+ using std::network_down;
+ using std::network_reset;
+ using std::network_unreachable;
+ using std::no_buffer_space;
+ using std::no_child_process;
+
+#ifdef _GLIBCXX_HAVE_ENOLINK
+ using std::no_link;
+#endif
+
+ using std::no_lock_available;
+
+#ifdef _GLIBCXX_HAVE_ENODATA
+ using std::no_message_available;
+#endif
+
+ using std::no_message;
+ using std::no_posix_equivalent;
+ using std::no_protocol_option;
+ using std::no_space_on_device;
+
+#ifdef _GLIBCXX_HAVE_ENOSR
+ using std::no_stream_resources;
+#endif
+
+ using std::no_such_device_or_address;
+ using std::no_such_device;
+ using std::no_such_file_or_directory;
+ using std::no_such_process;
+ using std::not_a_directory;
+ using std::not_a_socket;
+
+#ifdef _GLIBCXX_HAVE_ENOSTR
+ using std::not_a_stream;
+#endif
+
+ using std::not_connected;
+ using std::not_enough_memory;
+ using std::not_supported;
+ using std::operation_canceled;
+ using std::operation_in_progress;
+ using std::operation_not_permitted;
+ using std::operation_not_supported;
+ using std::operation_would_block;
+
+#ifdef _GLIBCXX_HAVE_EOWNERDEAD
+ using std::owner_dead;
+#endif
+
+ using std::permission_denied;
+
+#ifdef _GLIBCXX_HAVE_EPROTO
+ using std::protocol_error;
+#endif
+
+ using std::protocol_not_supported;
+ using std::read_only_file_system;
+ using std::resource_deadlock_would_occur;
+ using std::resource_unavailable_try_again;
+ using std::result_out_of_range;
+
+#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE
+ using std::state_not_recoverable;
+#endif
+
+#ifdef _GLIBCXX_HAVE_ETIME
+ using std::stream_timeout;
+#endif
+
+ using std::text_file_busy;
+ using std::timed_out;
+ using std::too_many_files_open_in_system;
+ using std::too_many_files_open;
+ using std::too_many_links;
+ using std::too_many_synbolic_link_levels;
+ using std::value_too_large;
+ using std::wrong_protocol_type;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc
new file mode 100644
index 00000000000..5348e5b15c6
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc
@@ -0,0 +1,47 @@
+// { dg-options "-std=gnu++0x" }
+// 2007-06-05 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <cstring>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ bool test __attribute__((unused)) = true;
+ const std::string s("too late: boulangerie out of pain au raisin");
+ const std::error_code e(std::operation_not_supported);
+
+ // 1
+ {
+ std::system_error err1(s, e);
+ VERIFY( err1.code() == e );
+ VERIFY( std::strcmp(err1.runtime_error::what(), s.c_str()) == 0 );
+ }
+
+ // 2
+ {
+ std::system_error err2(s, 95, std::system_category);
+ VERIFY( err2.code() == std::error_code(95, std::system_category) );
+ VERIFY( std::strcmp(err2.runtime_error::what(), s.c_str()) == 0 );
+ }
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc
new file mode 100644
index 00000000000..09ba2fd13e4
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc
@@ -0,0 +1,31 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do run { xfail *-*-* } }
+// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com>
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <system_error>
+#include <testsuite_api.h>
+
+int main()
+{
+ typedef std::system_error test_type;
+ __gnu_test::diamond_derivation<test_type, false>::test();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-1.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-1.cc
new file mode 100644
index 00000000000..c178e542a3c
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-1.cc
@@ -0,0 +1,59 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 19.1 Exception classes
+
+#include <string>
+#include <system_error>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// libstdc++/1972
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::string s("lack of sunlight, no water error");
+
+ // 1
+ std::system_error obj1 = std::system_error(s);
+
+ // 2
+ std::system_error obj2(s);
+
+ VERIFY( std::strcmp(obj1.what(), s.data()) == 0 );
+ VERIFY( std::strcmp(obj2.what(), s.data()) == 0 );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+ std::string s("lack of sunlight error");
+ std::system_error x(s);
+
+ VERIFY( std::strcmp(x.what(), s.data()) == 0 );
+}
+
+int main(void)
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-2.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-2.cc
new file mode 100644
index 00000000000..eb8e14c9cc1
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-2.cc
@@ -0,0 +1,51 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 19.1 Exception classes
+
+#include <string>
+#include <system_error>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// libstdc++/2089
+class fuzzy_logic : public std::system_error
+{
+public:
+ fuzzy_logic() : std::system_error("whoa") { }
+};
+
+void test03()
+{
+ bool test __attribute__((unused)) = true;
+ try
+ { throw fuzzy_logic(); }
+ catch(const fuzzy_logic& obj)
+ { VERIFY( std::strcmp("whoa", obj.what()) == 0 ); }
+ catch(...)
+ { VERIFY( false ); }
+}
+
+int main(void)
+{
+ test03();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc
new file mode 100644
index 00000000000..23d99a87d94
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc
@@ -0,0 +1,69 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <string>
+#include <system_error>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// test copy ctors, assignment operators, and persistence of member string data
+// libstdc++/1972
+// via Greg Bumgardner <bumgard@roguewave.com>
+void allocate_on_stack(void)
+{
+ const size_t num = 512;
+ __extension__ char array[num];
+ for (size_t i = 0; i < num; i++)
+ array[i]=0;
+}
+
+void test04()
+{
+ bool test __attribute__((unused)) = true;
+ const std::string s("CA ISO emergency once again:immediate power down");
+ const char* strlit1 = "wish I lived in Palo Alto";
+ const char* strlit2 = "...or Santa Barbara";
+ std::system_error obj1(s);
+
+ // block 01
+ {
+ const std::string s2(strlit1);
+ std::system_error obj2(s2);
+ obj1 = obj2;
+ }
+ allocate_on_stack();
+ VERIFY( std::strcmp(strlit1, obj1.what()) == 0 );
+
+ // block 02
+ {
+ const std::string s3(strlit2);
+ std::system_error obj3 = std::system_error(s3);
+ obj1 = obj3;
+ }
+ allocate_on_stack();
+ VERIFY( std::strcmp(strlit2, obj1.what()) == 0 );
+}
+
+int main(void)
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc
new file mode 100644
index 00000000000..e6df84f6007
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc
@@ -0,0 +1,45 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 19.1 Exception classes
+
+#include <cstring>
+#include <string>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+// Make sure each invocation of what() doesn't grow the message.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ std::string s("after nine thirty, this request cannot be met");
+
+ std::system_error obj = std::system_error(s, std::invalid_argument);
+ std::string s1(obj.what());
+ std::string s2(obj.what());
+ VERIFY( s1 == s2 );
+}
+
+int main(void)
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-big.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-big.cc
new file mode 100644
index 00000000000..765bcbf19fe
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-big.cc
@@ -0,0 +1,41 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <cstring>
+#include <string>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+// Can construct and return 10k character error string.
+void test01()
+{
+ typedef std::system_error test_type;
+
+ bool test __attribute__((unused)) = true;
+ const std::string xxx(10000, 'x');
+ test_type t(xxx);
+ VERIFY( std::strcmp(t.what(), xxx.c_str()) == 0 );
+}
+
+int main(void)
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/function_objects/bad_function_call/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/20_util/bad_function_call/cons_virtual_derivation.cc
index 6cc46c02a51..6cc46c02a51 100644
--- a/libstdc++-v3/testsuite/20_util/function_objects/bad_function_call/cons_virtual_derivation.cc
+++ b/libstdc++-v3/testsuite/20_util/bad_function_call/cons_virtual_derivation.cc
diff --git a/libstdc++-v3/testsuite/20_util/hash/operators/size_t.cc b/libstdc++-v3/testsuite/20_util/hash/operators/size_t.cc
new file mode 100644
index 00000000000..89e82cd4a90
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/hash/operators/size_t.cc
@@ -0,0 +1,55 @@
+// { dg-options "-std=gnu++0x" }
+// 2007-08-20 <benjamin@redhat.com>
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <functional>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+template<typename T>
+ void
+ do_test()
+ {
+ bool test __attribute__((unused)) = true;
+
+ typedef T value_type;
+ typedef std::hash<value_type> hash_type;
+ using std::size_t;
+
+ value_type v; // default initialized is fine, same value all that matters.
+ hash_type h1;
+ size_t r1 = size_t(h1(v));
+
+ hash_type h2;
+ size_t r2 = size_t(h2(v));
+
+ VERIFY( r1 == r2 );
+ }
+
+void test01()
+{
+ do_test<std::error_code>();
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/hash/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/hash/requirements/explicit_instantiation.cc
new file mode 100644
index 00000000000..7b82eeeab2f
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/hash/requirements/explicit_instantiation.cc
@@ -0,0 +1,48 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301, USA.
+
+#include <functional>
+#include <string>
+#include <system_error>
+
+// Verify that we can instantiate hash for every required type.
+template class std::hash<bool>;
+template class std::hash<char>;
+template class std::hash<signed char>;
+template class std::hash<unsigned char>;
+template class std::hash<short>;
+template class std::hash<int>;
+template class std::hash<long>;
+template class std::hash<unsigned short>;
+template class std::hash<unsigned int>;
+template class std::hash<unsigned long>;
+template class std::hash<float>;
+template class std::hash<double>;
+template class std::hash<long double>;
+template class std::hash<void*>;
+template class std::hash<std::string>;
+template class std::hash<std::error_code>;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+template class std::hash<wchar_t>;
+template class std::hash<std::wstring>;
+#endif
+
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc
new file mode 100644
index 00000000000..3cac92847e8
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc
@@ -0,0 +1,74 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <ostream>
+#include <sstream>
+#include <system_error>
+#include <algorithm>
+#include <testsuite_hooks.h>
+
+// Effects: os << ec.category().name() << ':' << ec.value();
+void test()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ char buf[64];
+ error_code e1;
+ error_code e2(bad_address);
+ string s, s1, s2;
+
+ {
+ ostringstream ostr;
+ ostr << e1 << endl;
+ s1 = ostr.str();
+
+ if (ostr.rdstate() & ios_base::eofbit)
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( find(s1.begin(), s1.end(), ':') != s1.end() );
+
+ sprintf(buf, "%i", e1.value());
+ s = buf;
+ VERIFY( s1.find(s) != string::npos);
+
+ {
+ ostringstream ostr;
+ ostr << e2 << endl;
+ s2 = ostr.str();
+
+ if (ostr.rdstate() & ios_base::eofbit)
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( find(s2.begin(), s2.end(), ':') != s2.end() );
+
+ sprintf(buf, "%i", e2.value());
+ s = buf;
+ VERIFY( s2.find(s) != string::npos);
+}
+
+int
+main()
+{
+ test();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc
new file mode 100644
index 00000000000..a83c9cbb71d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc
@@ -0,0 +1,75 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2007 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <ostream>
+#include <sstream>
+#include <system_error>
+#include <algorithm>
+#include <wchar.h>
+#include <testsuite_hooks.h>
+
+// Effects: os << ec.category().name() << ':' << ec.value();
+void test()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ wchar_t buf[64];
+ error_code e1;
+ error_code e2(bad_address);
+ wstring s, s1, s2;
+
+ {
+ wostringstream ostr;
+ ostr << e1 << endl;
+ s1 = ostr.str();
+
+ if (ostr.rdstate() & ios_base::eofbit)
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( find(s1.begin(), s1.end(), L':') != s1.end() );
+
+ swprintf(buf, 64, L"%i", e1.value());
+ s = buf;
+ VERIFY( s1.find(s) != string::npos);
+
+ {
+ wostringstream ostr;
+ ostr << e2 << endl;
+ s2 = ostr.str();
+
+ if (ostr.rdstate() & ios_base::eofbit)
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( find(s2.begin(), s2.end(), L':') != s2.end() );
+
+ swprintf(buf, 64, L"%i", e2.value());
+ s = buf;
+ VERIFY( s2.find(s) != string::npos);
+}
+
+int
+main()
+{
+ test();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/33128.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/33128.cc
new file mode 100644
index 00000000000..bf10eddbf7d
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/33128.cc
@@ -0,0 +1,43 @@
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 5.1.7.1 Class template uniform_int
+// 5.1.1 [7] Table 17
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+// libstdc++/33128
+int test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::tr1::mt19937 rng;
+ std::tr1::uniform_int<> six(1,6);
+ std::tr1::variate_generator<std::tr1::mt19937, std::tr1::uniform_int<> >
+ die(rng, six);
+
+ int val = die();
+ VERIFY( val >= 1 && val <= 6 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/hash/operators/size_t.cc b/libstdc++-v3/testsuite/tr1/6_containers/hash/operators/size_t.cc
new file mode 100644
index 00000000000..067a9f51da0
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/hash/operators/size_t.cc
@@ -0,0 +1,75 @@
+// 2007-08-20 <benjamin@redhat.com>
+//
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 6.3.3 Class template hash
+
+#include <tr1/functional>
+#include <string>
+#include <testsuite_hooks.h>
+
+template<typename T>
+ void
+ do_test()
+ {
+ bool test __attribute__((unused)) = true;
+
+ typedef T value_type;
+ typedef std::tr1::hash<value_type> hash_type;
+ using std::size_t;
+
+ value_type v; // default initialized is fine, same value all that matters.
+ hash_type h1;
+ size_t r1 = size_t(h1(v));
+
+ hash_type h2;
+ size_t r2 = size_t(h2(v));
+
+ VERIFY( r1 == r2 );
+ }
+
+void test01()
+{
+ do_test<bool>();
+ do_test<char>();
+ do_test<signed char>();
+ do_test<unsigned char>();
+ do_test<short>();
+ do_test<int>();
+ do_test<long>();
+ do_test<unsigned short>();
+ do_test<unsigned int>();
+ do_test<unsigned long>();
+ do_test<int*>();
+ do_test<std::string>();
+ do_test<float>();
+ do_test<double>();
+ do_test<long double>();
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ do_test<wchar_t>();
+ do_test<std::wstring>();
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}