Merge branches/gcc-4_9-branch rev 213803
authoryroux <yroux@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 14 Aug 2014 08:19:37 +0000 (08:19 +0000)
committeryroux <yroux@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 14 Aug 2014 08:19:37 +0000 (08:19 +0000)
git-svn-id: svn://gcc.gnu.org/svn/gcc/branches/linaro/gcc-4_9-branch@213943 138bc75d-0d04-0410-961f-82ee72b054a4

491 files changed:
ChangeLog
config/ChangeLog
config/mh-alpha-linux [new file with mode: 0644]
configure
configure.ac
gcc/BASE-VER
gcc/ChangeLog
gcc/DATESTAMP
gcc/DEV-PHASE
gcc/c-family/ChangeLog
gcc/c-family/array-notation-common.c
gcc/c-family/c-gimplify.c
gcc/c/ChangeLog
gcc/c/c-array-notation.c
gcc/config.gcc
gcc/config/aarch64/aarch64-linux.h
gcc/config/alpha/elf.h
gcc/config/arm/t-rtems-eabi
gcc/config/cris/constraints.md
gcc/config/cris/cris-protos.h
gcc/config/cris/cris.c
gcc/config/cris/cris.h
gcc/config/cris/cris.md
gcc/config/cris/predicates.md
gcc/config/i386/avx512fintrin.h
gcc/config/i386/i386.c
gcc/config/i386/ia32intrin.h
gcc/config/i386/sse.md
gcc/config/nios2/rtems.h [new file with mode: 0644]
gcc/config/nios2/t-rtems [new file with mode: 0644]
gcc/config/rs6000/freebsd64.h
gcc/config/rs6000/linux64.h
gcc/config/rs6000/rs6000-protos.h
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.h
gcc/config/rs6000/rs6000.md
gcc/config/rs6000/sysv4.h
gcc/config/sh/predicates.md
gcc/config/sh/sh.c
gcc/config/sparc/sync.md
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/cp-array-notation.c
gcc/cp/init.c
gcc/cp/parser.c
gcc/cp/semantics.c
gcc/cp/tree.c
gcc/expr.c
gcc/fortran/ChangeLog
gcc/fortran/dependency.c
gcc/fortran/simplify.c
gcc/go/gofrontend/parse.cc
gcc/haifa-sched.c
gcc/lra-constraints.c
gcc/omp-low.c
gcc/sched-deps.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/cilk-plus/AN/pr61455-2.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/cilk-plus/AN/pr61455.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/cilk-plus/AN/pr61963.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/pr61741.c [new file with mode: 0644]
gcc/testsuite/g++.dg/compat/struct-layout-1.exp
gcc/testsuite/g++.dg/cpp0x/constexpr-array7.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/constexpr-empty7.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/rv-cond1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/expr/cond12.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/restrict2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ipa/pr61160-1.C
gcc/testsuite/g++.dg/ipa/pr61160-2.C
gcc/testsuite/gcc.c-torture/compile/pr60655-1.c
gcc/testsuite/gcc.c-torture/execute/20050316-1.x
gcc/testsuite/gcc.c-torture/execute/20050316-3.x [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/20050604-1.x
gcc/testsuite/gcc.c-torture/execute/pr23135.x [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/pr61375.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-4.c
gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-5.c
gcc/testsuite/gcc.dg/atomic/stdatomic-flag.c
gcc/testsuite/gcc.dg/pr51879-18.c
gcc/testsuite/gcc.dg/pr57233.c
gcc/testsuite/gcc.dg/stack-usage-2.c
gcc/testsuite/gcc.dg/torture/pr61964.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/ssa-copyprop-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512f-vfixupimmpd-2.c
gcc/testsuite/gcc.target/i386/avx512f-vfixupimmps-2.c
gcc/testsuite/gcc.target/i386/avx512f-vfixupimmsd-2.c
gcc/testsuite/gcc.target/i386/avx512f-vfixupimmss-2.c
gcc/testsuite/gcc.target/i386/avx512f-vpermi2d-2.c
gcc/testsuite/gcc.target/i386/avx512f-vpermi2pd-2.c
gcc/testsuite/gcc.target/i386/avx512f-vpermi2ps-2.c
gcc/testsuite/gcc.target/i386/avx512f-vpermi2q-2.c
gcc/testsuite/gcc.target/i386/avx512f-vpermt2d-2.c
gcc/testsuite/gcc.target/i386/avx512f-vpermt2pd-2.c
gcc/testsuite/gcc.target/i386/avx512f-vpermt2ps-2.c
gcc/testsuite/gcc.target/i386/avx512f-vpermt2q-2.c
gcc/testsuite/gcc.target/i386/pr61794.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr61801.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr61855.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr61923.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/pr60102.c [new file with mode: 0644]
gcc/testsuite/gfortran.dg/dependency_44.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/dot_product_3.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pr45636.f90
gcc/testsuite/gnat.dg/pack20.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/pack20.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/pack20_pkg.ads [new file with mode: 0644]
gcc/toplev.c
gcc/tree-ssa-copy.c
gcc/tree-ssa-loop-ivopts.c
gcc/tree-ssa-math-opts.c
gcc/tree-ssa-tail-merge.c
libgcc/ChangeLog
libgcc/config/rs6000/linux-unwind.h
libgfortran/ChangeLog
libgfortran/generated/all_l1.c
libgfortran/generated/all_l16.c
libgfortran/generated/all_l2.c
libgfortran/generated/all_l4.c
libgfortran/generated/all_l8.c
libgfortran/generated/any_l1.c
libgfortran/generated/any_l16.c
libgfortran/generated/any_l2.c
libgfortran/generated/any_l4.c
libgfortran/generated/any_l8.c
libgfortran/generated/bessel_r10.c
libgfortran/generated/bessel_r16.c
libgfortran/generated/bessel_r4.c
libgfortran/generated/bessel_r8.c
libgfortran/generated/count_16_l.c
libgfortran/generated/count_1_l.c
libgfortran/generated/count_2_l.c
libgfortran/generated/count_4_l.c
libgfortran/generated/count_8_l.c
libgfortran/generated/cshift1_16.c
libgfortran/generated/cshift1_4.c
libgfortran/generated/cshift1_8.c
libgfortran/generated/eoshift1_16.c
libgfortran/generated/eoshift1_4.c
libgfortran/generated/eoshift1_8.c
libgfortran/generated/eoshift3_16.c
libgfortran/generated/eoshift3_4.c
libgfortran/generated/eoshift3_8.c
libgfortran/generated/iall_i1.c
libgfortran/generated/iall_i16.c
libgfortran/generated/iall_i2.c
libgfortran/generated/iall_i4.c
libgfortran/generated/iall_i8.c
libgfortran/generated/iany_i1.c
libgfortran/generated/iany_i16.c
libgfortran/generated/iany_i2.c
libgfortran/generated/iany_i4.c
libgfortran/generated/iany_i8.c
libgfortran/generated/in_pack_c10.c
libgfortran/generated/in_pack_c16.c
libgfortran/generated/in_pack_c4.c
libgfortran/generated/in_pack_c8.c
libgfortran/generated/in_pack_i1.c
libgfortran/generated/in_pack_i16.c
libgfortran/generated/in_pack_i2.c
libgfortran/generated/in_pack_i4.c
libgfortran/generated/in_pack_i8.c
libgfortran/generated/in_pack_r10.c
libgfortran/generated/in_pack_r16.c
libgfortran/generated/in_pack_r4.c
libgfortran/generated/in_pack_r8.c
libgfortran/generated/iparity_i1.c
libgfortran/generated/iparity_i16.c
libgfortran/generated/iparity_i2.c
libgfortran/generated/iparity_i4.c
libgfortran/generated/iparity_i8.c
libgfortran/generated/matmul_c10.c
libgfortran/generated/matmul_c16.c
libgfortran/generated/matmul_c4.c
libgfortran/generated/matmul_c8.c
libgfortran/generated/matmul_i1.c
libgfortran/generated/matmul_i16.c
libgfortran/generated/matmul_i2.c
libgfortran/generated/matmul_i4.c
libgfortran/generated/matmul_i8.c
libgfortran/generated/matmul_l16.c
libgfortran/generated/matmul_l4.c
libgfortran/generated/matmul_l8.c
libgfortran/generated/matmul_r10.c
libgfortran/generated/matmul_r16.c
libgfortran/generated/matmul_r4.c
libgfortran/generated/matmul_r8.c
libgfortran/generated/maxloc0_16_i1.c
libgfortran/generated/maxloc0_16_i16.c
libgfortran/generated/maxloc0_16_i2.c
libgfortran/generated/maxloc0_16_i4.c
libgfortran/generated/maxloc0_16_i8.c
libgfortran/generated/maxloc0_16_r10.c
libgfortran/generated/maxloc0_16_r16.c
libgfortran/generated/maxloc0_16_r4.c
libgfortran/generated/maxloc0_16_r8.c
libgfortran/generated/maxloc0_4_i1.c
libgfortran/generated/maxloc0_4_i16.c
libgfortran/generated/maxloc0_4_i2.c
libgfortran/generated/maxloc0_4_i4.c
libgfortran/generated/maxloc0_4_i8.c
libgfortran/generated/maxloc0_4_r10.c
libgfortran/generated/maxloc0_4_r16.c
libgfortran/generated/maxloc0_4_r4.c
libgfortran/generated/maxloc0_4_r8.c
libgfortran/generated/maxloc0_8_i1.c
libgfortran/generated/maxloc0_8_i16.c
libgfortran/generated/maxloc0_8_i2.c
libgfortran/generated/maxloc0_8_i4.c
libgfortran/generated/maxloc0_8_i8.c
libgfortran/generated/maxloc0_8_r10.c
libgfortran/generated/maxloc0_8_r16.c
libgfortran/generated/maxloc0_8_r4.c
libgfortran/generated/maxloc0_8_r8.c
libgfortran/generated/maxloc1_16_i1.c
libgfortran/generated/maxloc1_16_i16.c
libgfortran/generated/maxloc1_16_i2.c
libgfortran/generated/maxloc1_16_i4.c
libgfortran/generated/maxloc1_16_i8.c
libgfortran/generated/maxloc1_16_r10.c
libgfortran/generated/maxloc1_16_r16.c
libgfortran/generated/maxloc1_16_r4.c
libgfortran/generated/maxloc1_16_r8.c
libgfortran/generated/maxloc1_4_i1.c
libgfortran/generated/maxloc1_4_i16.c
libgfortran/generated/maxloc1_4_i2.c
libgfortran/generated/maxloc1_4_i4.c
libgfortran/generated/maxloc1_4_i8.c
libgfortran/generated/maxloc1_4_r10.c
libgfortran/generated/maxloc1_4_r16.c
libgfortran/generated/maxloc1_4_r4.c
libgfortran/generated/maxloc1_4_r8.c
libgfortran/generated/maxloc1_8_i1.c
libgfortran/generated/maxloc1_8_i16.c
libgfortran/generated/maxloc1_8_i2.c
libgfortran/generated/maxloc1_8_i4.c
libgfortran/generated/maxloc1_8_i8.c
libgfortran/generated/maxloc1_8_r10.c
libgfortran/generated/maxloc1_8_r16.c
libgfortran/generated/maxloc1_8_r4.c
libgfortran/generated/maxloc1_8_r8.c
libgfortran/generated/maxval_i1.c
libgfortran/generated/maxval_i16.c
libgfortran/generated/maxval_i2.c
libgfortran/generated/maxval_i4.c
libgfortran/generated/maxval_i8.c
libgfortran/generated/maxval_r10.c
libgfortran/generated/maxval_r16.c
libgfortran/generated/maxval_r4.c
libgfortran/generated/maxval_r8.c
libgfortran/generated/minloc0_16_i1.c
libgfortran/generated/minloc0_16_i16.c
libgfortran/generated/minloc0_16_i2.c
libgfortran/generated/minloc0_16_i4.c
libgfortran/generated/minloc0_16_i8.c
libgfortran/generated/minloc0_16_r10.c
libgfortran/generated/minloc0_16_r16.c
libgfortran/generated/minloc0_16_r4.c
libgfortran/generated/minloc0_16_r8.c
libgfortran/generated/minloc0_4_i1.c
libgfortran/generated/minloc0_4_i16.c
libgfortran/generated/minloc0_4_i2.c
libgfortran/generated/minloc0_4_i4.c
libgfortran/generated/minloc0_4_i8.c
libgfortran/generated/minloc0_4_r10.c
libgfortran/generated/minloc0_4_r16.c
libgfortran/generated/minloc0_4_r4.c
libgfortran/generated/minloc0_4_r8.c
libgfortran/generated/minloc0_8_i1.c
libgfortran/generated/minloc0_8_i16.c
libgfortran/generated/minloc0_8_i2.c
libgfortran/generated/minloc0_8_i4.c
libgfortran/generated/minloc0_8_i8.c
libgfortran/generated/minloc0_8_r10.c
libgfortran/generated/minloc0_8_r16.c
libgfortran/generated/minloc0_8_r4.c
libgfortran/generated/minloc0_8_r8.c
libgfortran/generated/minloc1_16_i1.c
libgfortran/generated/minloc1_16_i16.c
libgfortran/generated/minloc1_16_i2.c
libgfortran/generated/minloc1_16_i4.c
libgfortran/generated/minloc1_16_i8.c
libgfortran/generated/minloc1_16_r10.c
libgfortran/generated/minloc1_16_r16.c
libgfortran/generated/minloc1_16_r4.c
libgfortran/generated/minloc1_16_r8.c
libgfortran/generated/minloc1_4_i1.c
libgfortran/generated/minloc1_4_i16.c
libgfortran/generated/minloc1_4_i2.c
libgfortran/generated/minloc1_4_i4.c
libgfortran/generated/minloc1_4_i8.c
libgfortran/generated/minloc1_4_r10.c
libgfortran/generated/minloc1_4_r16.c
libgfortran/generated/minloc1_4_r4.c
libgfortran/generated/minloc1_4_r8.c
libgfortran/generated/minloc1_8_i1.c
libgfortran/generated/minloc1_8_i16.c
libgfortran/generated/minloc1_8_i2.c
libgfortran/generated/minloc1_8_i4.c
libgfortran/generated/minloc1_8_i8.c
libgfortran/generated/minloc1_8_r10.c
libgfortran/generated/minloc1_8_r16.c
libgfortran/generated/minloc1_8_r4.c
libgfortran/generated/minloc1_8_r8.c
libgfortran/generated/minval_i1.c
libgfortran/generated/minval_i16.c
libgfortran/generated/minval_i2.c
libgfortran/generated/minval_i4.c
libgfortran/generated/minval_i8.c
libgfortran/generated/minval_r10.c
libgfortran/generated/minval_r16.c
libgfortran/generated/minval_r4.c
libgfortran/generated/minval_r8.c
libgfortran/generated/norm2_r10.c
libgfortran/generated/norm2_r16.c
libgfortran/generated/norm2_r4.c
libgfortran/generated/norm2_r8.c
libgfortran/generated/pack_c10.c
libgfortran/generated/pack_c16.c
libgfortran/generated/pack_c4.c
libgfortran/generated/pack_c8.c
libgfortran/generated/pack_i1.c
libgfortran/generated/pack_i16.c
libgfortran/generated/pack_i2.c
libgfortran/generated/pack_i4.c
libgfortran/generated/pack_i8.c
libgfortran/generated/pack_r10.c
libgfortran/generated/pack_r16.c
libgfortran/generated/pack_r4.c
libgfortran/generated/pack_r8.c
libgfortran/generated/parity_l1.c
libgfortran/generated/parity_l16.c
libgfortran/generated/parity_l2.c
libgfortran/generated/parity_l4.c
libgfortran/generated/parity_l8.c
libgfortran/generated/product_c10.c
libgfortran/generated/product_c16.c
libgfortran/generated/product_c4.c
libgfortran/generated/product_c8.c
libgfortran/generated/product_i1.c
libgfortran/generated/product_i16.c
libgfortran/generated/product_i2.c
libgfortran/generated/product_i4.c
libgfortran/generated/product_i8.c
libgfortran/generated/product_r10.c
libgfortran/generated/product_r16.c
libgfortran/generated/product_r4.c
libgfortran/generated/product_r8.c
libgfortran/generated/reshape_c10.c
libgfortran/generated/reshape_c16.c
libgfortran/generated/reshape_c4.c
libgfortran/generated/reshape_c8.c
libgfortran/generated/reshape_i16.c
libgfortran/generated/reshape_i4.c
libgfortran/generated/reshape_i8.c
libgfortran/generated/reshape_r10.c
libgfortran/generated/reshape_r16.c
libgfortran/generated/reshape_r4.c
libgfortran/generated/reshape_r8.c
libgfortran/generated/shape_i16.c
libgfortran/generated/shape_i4.c
libgfortran/generated/shape_i8.c
libgfortran/generated/spread_c10.c
libgfortran/generated/spread_c16.c
libgfortran/generated/spread_c4.c
libgfortran/generated/spread_c8.c
libgfortran/generated/spread_i1.c
libgfortran/generated/spread_i16.c
libgfortran/generated/spread_i2.c
libgfortran/generated/spread_i4.c
libgfortran/generated/spread_i8.c
libgfortran/generated/spread_r10.c
libgfortran/generated/spread_r16.c
libgfortran/generated/spread_r4.c
libgfortran/generated/spread_r8.c
libgfortran/generated/sum_c10.c
libgfortran/generated/sum_c16.c
libgfortran/generated/sum_c4.c
libgfortran/generated/sum_c8.c
libgfortran/generated/sum_i1.c
libgfortran/generated/sum_i16.c
libgfortran/generated/sum_i2.c
libgfortran/generated/sum_i4.c
libgfortran/generated/sum_i8.c
libgfortran/generated/sum_r10.c
libgfortran/generated/sum_r16.c
libgfortran/generated/sum_r4.c
libgfortran/generated/sum_r8.c
libgfortran/generated/transpose_c10.c
libgfortran/generated/transpose_c16.c
libgfortran/generated/transpose_c4.c
libgfortran/generated/transpose_c8.c
libgfortran/generated/transpose_i16.c
libgfortran/generated/transpose_i4.c
libgfortran/generated/transpose_i8.c
libgfortran/generated/transpose_r10.c
libgfortran/generated/transpose_r16.c
libgfortran/generated/transpose_r4.c
libgfortran/generated/transpose_r8.c
libgfortran/generated/unpack_c10.c
libgfortran/generated/unpack_c16.c
libgfortran/generated/unpack_c4.c
libgfortran/generated/unpack_c8.c
libgfortran/generated/unpack_i1.c
libgfortran/generated/unpack_i16.c
libgfortran/generated/unpack_i2.c
libgfortran/generated/unpack_i4.c
libgfortran/generated/unpack_i8.c
libgfortran/generated/unpack_r10.c
libgfortran/generated/unpack_r16.c
libgfortran/generated/unpack_r4.c
libgfortran/generated/unpack_r8.c
libgfortran/intrinsics/cshift0.c
libgfortran/intrinsics/eoshift0.c
libgfortran/intrinsics/eoshift2.c
libgfortran/intrinsics/pack_generic.c
libgfortran/intrinsics/reshape_generic.c
libgfortran/intrinsics/spread_generic.c
libgfortran/intrinsics/string_intrinsics_inc.c
libgfortran/intrinsics/transpose_generic.c
libgfortran/intrinsics/unpack_generic.c
libgfortran/io/list_read.c
libgfortran/io/transfer.c
libgfortran/io/unit.c
libgfortran/io/write.c
libgfortran/libgfortran.h
libgfortran/m4/bessel.m4
libgfortran/m4/cshift1.m4
libgfortran/m4/eoshift1.m4
libgfortran/m4/eoshift3.m4
libgfortran/m4/iforeach.m4
libgfortran/m4/ifunction.m4
libgfortran/m4/ifunction_logical.m4
libgfortran/m4/in_pack.m4
libgfortran/m4/matmul.m4
libgfortran/m4/matmull.m4
libgfortran/m4/pack.m4
libgfortran/m4/reshape.m4
libgfortran/m4/shape.m4
libgfortran/m4/spread.m4
libgfortran/m4/transpose.m4
libgfortran/m4/unpack.m4
libgfortran/runtime/convert_char.c
libgfortran/runtime/environ.c
libgfortran/runtime/in_pack_generic.c
libgfortran/runtime/memory.c
libgo/runtime/go-caller.c
libgomp/ChangeLog
libgomp/libgomp.h
libgomp/task.c
libgomp/testsuite/libgomp.c/depend-10.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/depend-5.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/depend-6.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/depend-7.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/depend-8.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/depend-9.c [new file with mode: 0644]
libitm/ChangeLog
libobjc/ChangeLog
libobjc/encoding.c
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/atomic_base.h
libstdc++-v3/include/bits/hashtable.h
libstdc++-v3/include/bits/random.h
libstdc++-v3/include/bits/random.tcc
libstdc++-v3/include/experimental/string_view
libstdc++-v3/include/experimental/string_view.tcc
libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
libstdc++-v3/include/ext/random.tcc
libstdc++-v3/include/ext/rope
libstdc++-v3/include/std/condition_variable
libstdc++-v3/include/std/future
libstdc++-v3/include/std/mutex
libstdc++-v3/libsupc++/atexit_thread.cc
libstdc++-v3/python/libstdcxx/v6/printers.py
libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/61667.cc [new file with mode: 0644]
libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/30_threads/async/forced_unwind.cc [new file with mode: 0644]
libstdc++-v3/testsuite/30_threads/packaged_task/forced_unwind.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/string_view/cons/char/1.cc
libstdc++-v3/testsuite/experimental/string_view/cons/wchar_t/1.cc
libstdc++-v3/testsuite/experimental/string_view/operations/copy/char/1.cc
libstdc++-v3/testsuite/experimental/string_view/operations/copy/wchar_t/1.cc
libstdc++-v3/testsuite/experimental/string_view/operations/data/char/1.cc
libstdc++-v3/testsuite/experimental/string_view/operations/data/wchar_t/1.cc
libstdc++-v3/testsuite/experimental/string_view/operations/to_string/1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/pr60037.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/rope/61946.cc [new file with mode: 0644]
libstdc++-v3/testsuite/lib/gdb-test.exp
libstdc++-v3/testsuite/util/testsuite_iterators.h

index 38c20fd..b526895 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-07-26  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/47230
+       * configure.ac (alpha*-*-linux*): Use mh-alpha-linux.
+       * configure: Regenerate.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
@@ -9,7 +15,7 @@
 2014-04-04  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR bootstrap/60620
-       * Makefile.def (dependencies): Make gnattools depend on libstdc++-v3. 
+       * Makefile.def (dependencies): Make gnattools depend on libstdc++-v3.
        * Makefile.in: Regenerate.
 
 2014-03-28  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
@@ -47,7 +53,8 @@
 
 2014-03-07  Denis Chertykov  <chertykov@gmail.com>
 
-       * MAINTAINERS: Remove avr maintainers: Anatoly Sokolov and Eric Weddington
+       * MAINTAINERS: Remove avr maintainers: Anatoly Sokolov
+       and Eric Weddington
 
 2014-03-07  Jakub Jelinek  <jakub@redhat.com>
 
index df19ebf..cb6dcaa 100644 (file)
@@ -1,3 +1,8 @@
+2014-07-26  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/47230
+       * mh-alpha-linux: New file.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
diff --git a/config/mh-alpha-linux b/config/mh-alpha-linux
new file mode 100644 (file)
index 0000000..9a9244b
--- /dev/null
@@ -0,0 +1,3 @@
+# Prevent GPREL16 relocation truncation
+LDFLAGS += -Wl,--no-relax
+BOOT_LDFLAGS += -Wl,--no-relax
index 3f217a2..d1c67e5 100755 (executable)
--- a/configure
+++ b/configure
@@ -3868,6 +3868,9 @@ fi
   *-mingw*)
     host_makefile_frag="config/mh-mingw"
     ;;
+  alpha*-*-linux*)
+    host_makefile_frag="config/mh-alpha-linux"
+    ;;
   hppa*-hp-hpux10*)
     host_makefile_frag="config/mh-pa-hpux10"
     ;;
index 3c7b1ff..1bab680 100644 (file)
@@ -1177,6 +1177,9 @@ case "${host}" in
   *-mingw*)
     host_makefile_frag="config/mh-mingw"
     ;;
+  alpha*-*-linux*)
+    host_makefile_frag="config/mh-alpha-linux"
+    ;;
   hppa*-hp-hpux10*)
     host_makefile_frag="config/mh-pa-hpux10"
     ;;
index 5b341fd..dad10c7 100644 (file)
@@ -1 +1 @@
-4.9.1
+4.9.2
index ffa472f..de2ef23 100644 (file)
+2014-08-08  Guozhi Wei  <carrot@google.com>
+
+       * config/rs6000/rs6000.md (*movdi_internal64): Add a new constraint.
+
+2014-08-07  Ilya Tocar  <ilya.tocar@intel.com>
+
+       * config/i386/sse.md (vec_extract_lo_<mode><mask_name>): Fix
+       constraint.
+
+2014-08-06  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR debug/61923
+       * haifa-sched.c (advance_one_cycle): Fix dump.
+       (schedule_block): Don't advance cycle if we are already at the
+       beginning of the cycle.
+
+2014-08-06  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/61320
+       * tree-ssa-loop-ivopts.c (may_be_unaligned_p): Properly
+       handle misaligned loads.
+
+2014-08-04  Rohit  <rohitarulraj@freescale.com>
+
+       PR target/60102
+       * config/rs6000/rs6000.c
+       (rs6000_reg_names): Add SPE high register names.
+       (alt_reg_names): Likewise.
+       (rs6000_dwarf_register_span): For SPE high registers, replace
+       dwarf register numbers with GCC hard register numbers.
+       (rs6000_init_dwarf_reg_sizes_extra): Likewise.
+       (rs6000_dbx_register_number): For SPE high registers, return dwarf
+       register number for the corresponding GCC hard register number.
+       * config/rs6000/rs6000.h
+       (FIRST_PSEUDO_REGISTER): Update based on 32 newly added GCC hard
+       register numbers for SPE high registers.
+       (DWARF_FRAME_REGISTERS):  Likewise.
+       (DWARF_REG_TO_UNWIND_COLUMN): Likewise.
+       (DWARF_FRAME_REGNUM): Likewise.
+       (FIXED_REGISTERS): Likewise.
+       (CALL_USED_REGISTERS): Likewise.
+       (CALL_REALLY_USED_REGISTERS): Likewise.
+       (REG_ALLOC_ORDER): Likewise.
+       (enum reg_class): Likewise.
+       (REG_CLASS_NAMES): Likewise.
+       (REG_CLASS_CONTENTS): Likewise.
+       (SPE_HIGH_REGNO_P): New macro to identify SPE high registers.
+
+2014-08-01  Vladimir Makarov  <vmakarov@redhat.com>
+
+       * lra-constraints.c (remove_inheritance_pseudos): Process
+       destination pseudo too.
+
+2014-08-01  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       Backport from mainline
+       2014-06-13  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       PR tree-optimization/61375
+       * tree-ssa-math-opts.c (find_bswap_or_nop_1): Cancel optimization if
+       symbolic number cannot be represented in an unsigned HOST_WIDE_INT.
+       (execute_optimize_bswap): Cancel optimization if CHAR_BIT != 8.
+
+2014-08-01  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/61964
+       * tree-ssa-tail-merge.c (gimple_equal_p): Handle non-SSA LHS solely
+       by structural equality.
+
+2014-07-31  Oleg Endo  <olegendo@gcc.gnu.org>
+
+       Backport from mainline
+       2014-07-31  Oleg Endo  <olegendo@gcc.gnu.org>
+
+       PR target/61844
+       * config/sh/sh.c (sh_legitimate_address_p,
+       sh_legitimize_reload_address): Handle reg+reg address modes when
+       ALLOW_INDEXED_ADDRESS is false.
+       * config/sh/predicates.md (general_movsrc_operand,
+       general_movdst_operand): Likewise.
+
+2014-07-25  Uros Bizjak  <ubizjak@gmail.com>
+
+       Backport from mainline
+       2014-07-14  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/61656
+       * config/i386/i386.c (classify_argument): Don't merge classes above
+       number of words.
+
+2014-07-25  Uros Bizjak  <ubizjak@gmail.com>
+
+       * config/alpha/elf.h: Define TARGET_UNWIND_TABLES_DEFAULT.
+
+2014-07-24  Kyle McMartin  <kyle@redhat.com>
+
+        * config/aarch64/aarch64-linux.h (TARGET_ASM_FILE_END): Define.
+
+2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       * config/rs6000/rs6000-protos.h (rs6000_special_adjust_field_align_p):
+       Add prototype.
+       * config/rs6000/rs6000.c (rs6000_special_adjust_field_align_p): New
+       function.  Issue -Wpsabi warning if future GCC releases will use
+       different field alignment rules for this type.
+       * config/rs6000/sysv4.h (ADJUST_FIELD_ALIGN): Call it.
+       * config/rs6000/linux64.h (ADJUST_FIELD_ALIGN): Likewise.
+       * config/rs6000/freebsd64.h (ADJUST_FIELD_ALIGN): Likewise.
+
+2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       * config/rs6000/rs6000.c (rs6000_function_arg_boundary): Issue
+       -Wpsabi note when encountering a type where future GCC releases
+       will apply different alignment requirements.
+
+2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       * config/rs6000/rs6000.c (rs6000_function_arg): If a float argument
+       does not fit fully into floating-point registers, and there is still
+       space in the register parameter area, issue -Wpsabi note that the ABI
+       will change in a future GCC release.
+
+2014-07-23  Sebastian Huber  <sebastian.huber@embedded-brains.de>
+
+       * config/arm/t-rtems-eabi: Add
+       mthumb/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard,
+       mthumb/march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard,
+       mbig-endian/mthumb/march=armv7-r, and
+       mbig-endian/mthumb/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard
+       multilibs.
+
+2014-07-23  Sebastian Huber  <sebastian.huber@embedded-brains.de>
+           Chris Johns <chrisj@rtems.org>
+           Joel Sherrill <joel.sherrill@oarcorp.com>
+
+       * config.gcc: Add nios2-*-rtems*.
+       * config/nios2/rtems.h: New file.
+       * gcc/config/nios2/t-rtems: New file.
+
+2014-07-21  Peter Bergner  <bergner@vnet.ibm.com>
+
+       * config/rs6000/sysv4.h (LIBASAN_EARLY_SPEC): Define.
+       (LIBTSAN_EARLY_SPEC): Likewise.
+
+2014-07-21  Uros Bizjak  <ubizjak@gmail.com>
+
+       Backport from mainline
+       2014-07-21  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/61855
+       * config/i386/avx512fintrin.h: Move constants for mantissa extraction
+       out of #ifdef __OPTIMIZE__.
+
+2014-07-20  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * expr.c (store_field): Handle VOIDmode for calls that return values
+       in multiple locations.
+
+2014-07-19  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * toplev.c (output_stack_usage): Adjust the location of the warning.
+
+2014-07-19  Daniel Cederman  <cederman@gaisler.com>
+
+       * config/sparc/sync.md (*membar_storeload_leon3): New insn.
+       (*membar_storeload): Disable for LEON3.
+
+2014-07-18  Uros Bizjak  <ubizjak@gmail.com>
+
+       Backport from mainline
+       2014-07-16  David Wohlferd  <dw@LimeGreenSocks.com>
+
+       PR target/61662
+       * config/i386/ia32intrin.h: Use __LP64__ to determine size of long.
+
+2014-07-18  Uros Bizjak  <ubizjak@gmail.com>
+
+       Backport from mainline
+       2014-07-18  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/61794
+       * config/i386/sse.md (avx512f_vextract<shuffletype>32x4_1_maskm):
+       Fix instruction constraint.
+       (<mask_codefor>avx512f_vextract<shuffletype>32x4_1<mask_name>): Ditto.
+
+2014-07-17  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2014-07-14  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/61779
+       * tree-ssa-copy.c (copy_prop_visit_cond_stmt): Always try
+       simplifying a condition.
+
+2014-07-17  Richard Biener  <rguenther@suse.de>
+
+       PR rtl-optimization/61801
+       * sched-deps.c (sched_analyze_2): For ASM_OPERANDS and ASM_INPUT
+       don't set reg_pending_barrier if it appears in a debug-insn.
+
+2014-07-17  Hans-Peter Nilsson  <hp@axis.com>
+
+       Backport from trunk.
+       PR target/61737.
+       * config/cris/cris.c (TARGET_LEGITIMATE_CONSTANT_P)
+       (TARGET_CANNOT_FORCE_CONST_MEM): Define.
+       (cris_cannot_force_const_mem, cris_legitimate_constant_p): New
+       functions.
+       (cris_print_index, cris_print_operand, cris_constant_index_p)
+       (cris_side_effect_mode_ok): Replace CONSTANT_P with CRIS_CONSTANT_P.
+       (cris_address_cost): Ditto last CONSTANT_P.
+       (cris_symbol_type_of): Rename from cris_pic_symbol_type_of.  All
+       callers changed.  Yield cris_offsettable_symbol for non-PIC
+       constant symbolic expressions including labels.  Yield cris_unspec
+       for all unspecs.
+       (cris_expand_pic_call_address): New parameter MARKERP.  Set its
+       target to pic_offset_table_rtx for calls that will likely go
+       through PLT, const0_rtx when they can't.  All callers changed.
+       Assert flag_pic.  Use CONSTANT_P, not CONSTANT_ADDRESS_P, for
+       symbolic expressions to be PICified.  Remove second, redundant,
+       assert on can_create_pseudo_p returning non-zero.  Use
+       replace_equiv_address_nv, not replace_equiv_address, for final
+       operand update.
+       * config/cris/cris.md ("movsi"): Move variable t to pattern
+       toplevel. Adjust assert for new cris_symbol_type member.  Use
+       CONSTANT_P instead of CONSTANT_ADDRESS_P.
+       ("*movsi_internal") <case 9>: Make check for valid unspec operands
+       for lapc stricter.
+       <case CRIS_UNSPEC_PCREL, CRIS_UNSPEC_PLT_PCREL>: Clear condition codes.
+       ("call", "call_value"): Use second incoming operand as a marker
+       for pic-offset-table-register being used.
+       ("*expanded_call_non_v32", "*expanded_call_v32")
+       ("*expanded_call_value_non_v32", "*expanded_call_value_v32"): For
+       second incoming operand to CALL, match cris_call_type_marker.
+       ("*expanded_call_value_side"): Ditto.  Disable before reload_completed.
+       ("*expanded_call_side"): Ditto.  Fix typo in comment.
+       (moverside, movemside peepholes): Check for CRIS_CONSTANT_P, not
+       CONSTANT_P.
+       * config/cris/predicates.md ("cris_call_type_marker"): New predicate.
+       * config/cris/cris.h (CRIS_CONSTANT_P): New macro.
+       (enum cris_symbol_type): Rename from cris_pic_symbol_type.  All
+       users changed.  Add members cris_offsettable_symbol and cris_unspec.
+       (cris_symbol_type): Rename from cris_pic_symbol_type.
+       * config/cris/constraints.md ("T"): Use CRIS_CONSTANT_P, not
+       just CONSTANT_P.
+       * config/cris/cris-protos.h (cris_symbol_type_of,
+       cris_expand_pic_call_address): Adjust prototypes.
+       (cris_legitimate_constant_p): New prototype.
+
+       * config.gcc (crisv32-*-linux* | cris-*-linux*): Do not override
+       an existing tmake_file.  Don't add t-slibgcc and t-linux.
+
+2014-07-16  Jakub Jelinek  <jakub@redhat.com>
+
+       * omp-low.c (create_omp_child_function): Don't set DECL_NAMELESS
+       on the FUNCTION_DECL.
+
+       * BASE-VER: Set to 4.9.1.
+       * DEV-PHASE: Set to prerelease.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
 
 2014-07-10  Cary Coutant  <ccoutant@google.com>
 
-        Backport from trunk at r212211.
+       Backport from trunk at r212211.
 
        * dwarf2out.c (remove_addr_table_entry): Remove unnecessary hash table
-        lookup.
+       lookup.
        (resolve_addr_in_expr): When replacing the rtx in a location list
-        entry, get a new address table entry.
+       entry, get a new address table entry.
        (dwarf2out_finish): Call index_location_lists even if there are no
-        addr_index_table entries yet.
+       addr_index_table entries yet.
 
 2014-07-10  Tom G. Christensen  <tgc@jupiterrise.com>
 
        PR target/61062
        * config/arm/arm_neon.h (vtrn_s8, vtrn_s16, vtrn_u8, vtrn_u16, vtrn_p8,
        vtrn_p16, vtrn_s32, vtrn_f32, vtrn_u32, vtrnq_s8, vtrnq_s16, vtrnq_s32,
-       vtrnq_f32, vtrnq_u8, vtrnq_u16, vtrnq_u32, vtrnq_p8, vtrnq_p16, vzip_s8,
-       vzip_s16, vzip_u8, vzip_u16, vzip_p8, vzip_p16, vzip_s32, vzip_f32,
-       vzip_u32, vzipq_s8, vzipq_s16, vzipq_s32, vzipq_f32, vzipq_u8,
-       vzipq_u16, vzipq_u32, vzipq_p8, vzipq_p16, vuzp_s8, vuzp_s16, vuzp_s32,
-       vuzp_f32, vuzp_u8, vuzp_u16, vuzp_u32, vuzp_p8, vuzp_p16, vuzpq_s8,
-       vuzpq_s16, vuzpq_s32, vuzpq_f32, vuzpq_u8, vuzpq_u16, vuzpq_u32,
-       vuzpq_p8, vuzpq_p16): Correct mask for bigendian.
+       vtrnq_f32, vtrnq_u8, vtrnq_u16, vtrnq_u32, vtrnq_p8, vtrnq_p16,
+       vzip_s8, vzip_s16, vzip_u8, vzip_u16, vzip_p8, vzip_p16, vzip_s32,
+       vzip_f32, vzip_u32, vzipq_s8, vzipq_s16, vzipq_s32, vzipq_f32,
+       vzipq_u8, vzipq_u16, vzipq_u32, vzipq_p8, vzipq_p16, vuzp_s8, vuzp_s16,
+       vuzp_s32, vuzp_f32, vuzp_u8, vuzp_u16, vuzp_u32, vuzp_p8, vuzp_p16,
+       vuzpq_s8, vuzpq_s16, vuzpq_s32, vuzpq_f32, vuzpq_u8, vuzpq_u16,
+       vuzpq_u32, vuzpq_p8, vuzpq_p16): Correct mask for bigendian.
 
 
 2014-07-09  Alan Lawrence  <alan.lawrence@arm.com>
        2014-06-24  Jakub Jelinek  <jakub@redhat.com>
 
        * gimplify.c (gimplify_scan_omp_clauses) <case OMP_CLAUSE_MAP,
-       OMP_CLAUSE_TO, OMP_CLAUSE_FROM): Make sure OMP_CLAUSE_SIZE is
-       non-NULL.
+       OMP_CLAUSE_TO, OMP_CLAUSE_FROM): Make sure OMP_CLAUSE_SIZE is non-NULL.
        <case OMP_CLAUSE_ALIGNED>: Gimplify OMP_CLAUSE_ALIGNED_ALIGNMENT.
-       (gimplify_adjust_omp_clauses_1): Make sure OMP_CLAUSE_SIZE is
-       non-NULL.
+       (gimplify_adjust_omp_clauses_1): Make sure OMP_CLAUSE_SIZE is non-NULL.
        (gimplify_adjust_omp_clauses): Likewise.
        * omp-low.c (lower_rec_simd_input_clauses,
        lower_rec_input_clauses, expand_omp_simd): Handle non-constant
 
        2014-06-18  Jakub Jelinek  <jakub@redhat.com>
 
-       * gimplify.c (omp_notice_variable): If n is non-NULL
-       and no flags change in ORT_TARGET region, don't jump to
-       do_outer.
+       * gimplify.c (omp_notice_variable): If n is non-NULL and no flags
+       change in ORT_TARGET region, don't jump to do_outer.
        (struct gimplify_adjust_omp_clauses_data): New type.
        (gimplify_adjust_omp_clauses_1): Adjust for data being
        a struct gimplify_adjust_omp_clauses_data pointer instead
        gimple_seq * argument to omp_finish_clause hook.
        * omp-low.c (scan_sharing_clauses): Call scan_omp_op on
        non-DECL_P OMP_CLAUSE_DECL if ctx->outer.
-       (scan_omp_parallel, lower_omp_for): When adding
-       _LOOPTEMP_ clause var, add it to outer ctx's decl_map
-       as identity.
+       (scan_omp_parallel, lower_omp_for): When adding _LOOPTEMP_ clause var,
+       add it to outer ctx's decl_map as identity.
        * tree-core.h (OMP_CLAUSE_MAP_TO_PSET): New map kind.
        * tree-nested.c (convert_nonlocal_omp_clauses,
        convert_local_omp_clauses): Handle various OpenMP 4.0 clauses.
-       * tree-pretty-print.c (dump_omp_clause): Handle
-       OMP_CLAUSE_MAP_TO_PSET.
+       * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_MAP_TO_PSET.
 
        2014-06-10  Jakub Jelinek  <jakub@redhat.com>
 
        OMP_CLAUSE_LINEAR_STMT.
        * omp-low.c (lower_rec_input_clauses): Fix typo.
        (maybe_add_implicit_barrier_cancel, lower_omp_1): Add
-       cast between Fortran boolean_type_node and C _Bool if
-       needed.
+       cast between Fortran boolean_type_node and C _Bool if needed.
 
 2014-06-30  Jason Merrill  <jason@redhat.com>
 
        (aarch64_sqdmlsl_lane<mode>): Likewise.
        (aarch64_sqdmull_lane<mode>): Likewise.
        (aarch64_sqdmull2_lane<mode>): Likewise.
-       (aarch64_sqdmlal_laneq<mode>):
-       Replace VCON usage with VCONQ.
+       (aarch64_sqdmlal_laneq<mode>): Replace VCON usage with VCONQ.
        Emit aarch64_sqdmlal_laneq<mode>_internal insn.
        (aarch64_sqdmlal2_laneq<mode>): Emit
        aarch64_sqdmlal2_laneq<mode>_internal insn.
index 518bca4..fb37762 100644 (file)
@@ -1 +1 @@
-20140716
+20140811
index e69de29..373fbc6 100644 (file)
@@ -0,0 +1 @@
+prerelease
index 8e7fa2f..549cbe2 100644 (file)
@@ -1,3 +1,19 @@
+2014-08-01  Igor Zamyatin  <igor.zamyatin@intel.com>
+
+       PR middle-end/61455
+       * array-notation-common.c (extract_array_notation_exprs): Handling
+       of DECL_EXPR added.
+
+2014-07-17  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2014-07-09  Richard Biener  <rguenther@suse.de>
+
+       PR c-family/61741
+       * c-gimplify.c (c_gimplify_expr): Gimplify self-modify expressions
+       using unsigned arithmetic if overflow does not wrap instead of
+       if overflow is undefined.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index c010039..84f6f45 100644 (file)
@@ -329,6 +329,14 @@ extract_array_notation_exprs (tree node, bool ignore_builtin_fn,
       vec_safe_push (*array_list, node);
       return;
     }
+  if (TREE_CODE (node) == DECL_EXPR)
+    {
+      tree x = DECL_EXPR_DECL (node);
+      if (DECL_INITIAL (x))
+       extract_array_notation_exprs (DECL_INITIAL (x),
+                                     ignore_builtin_fn,
+                                     array_list);
+    }
   else if (TREE_CODE (node) == STATEMENT_LIST)
     {
       tree_stmt_iterator ii_tsi;
index 737be4d..9308580 100644 (file)
@@ -199,9 +199,7 @@ c_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED,
        tree type = TREE_TYPE (TREE_OPERAND (*expr_p, 0));
        if (INTEGRAL_TYPE_P (type) && c_promoting_integer_type_p (type))
          {
-           if (TYPE_OVERFLOW_UNDEFINED (type)
-               || ((flag_sanitize & SANITIZE_SI_OVERFLOW)
-                   && !TYPE_OVERFLOW_WRAPS (type)))
+           if (!TYPE_OVERFLOW_WRAPS (type))
              type = unsigned_type_for (type);
            return gimplify_self_mod_expr (expr_p, pre_p, post_p, 1, type);
          }
index 4816d5c..f475f7e 100644 (file)
@@ -1,3 +1,9 @@
+2014-08-01  Igor Zamyatin  <igor.zamyatin@intel.com>
+
+       PR middle-end/61455
+       * c-array-notation.c (expand_array_notations): Handling
+       of DECL_EXPR added.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index 2305e1e..be08f53 100644 (file)
@@ -1265,6 +1265,25 @@ expand_array_notations (tree *tp, int *walk_subtrees, void *)
                                         rhs_loc, rhs, TREE_TYPE (rhs));
       }
       break;
+    case DECL_EXPR:
+      {
+       tree x = DECL_EXPR_DECL (*tp);
+       if (DECL_INITIAL (x))
+         {
+           location_t loc = DECL_SOURCE_LOCATION (x);
+           tree lhs = x;
+           tree rhs = DECL_INITIAL (x);
+           DECL_INITIAL (x) = NULL;
+           tree new_modify_expr = build_modify_expr (loc, lhs,
+                                                     TREE_TYPE (lhs),
+                                                     NOP_EXPR,
+                                                     loc, rhs,
+                                                     TREE_TYPE(rhs));
+           expand_array_notations (&new_modify_expr, walk_subtrees, NULL);
+           *tp = new_modify_expr;
+         }
+      }
+      break;
     case CALL_EXPR:
       *tp = fix_array_notation_call_expr (*tp);
       break;
index f421b50..a566304 100644 (file)
@@ -431,7 +431,7 @@ nds32*)
 nios2-*-*)
        cpu_type=nios2
        extra_options="${extra_options} g.opt"
-       ;;      
+       ;;
 picochip-*-*)
         cpu_type=picochip
         ;;
@@ -1128,8 +1128,7 @@ cris-*-elf | cris-*-none)
        ;;
 crisv32-*-linux* | cris-*-linux*)
        tm_file="dbxelf.h elfos.h ${tm_file} gnu-user.h linux.h glibc-stdint.h cris/linux.h"
-       # We need to avoid using t-linux, so override default tmake_file
-       tmake_file="cris/t-cris cris/t-linux t-slibgcc t-linux"
+       tmake_file="${tmake_file} cris/t-cris cris/t-linux"
        extra_options="${extra_options} cris/linux.opt"
        case $target in
          cris-*-*)
@@ -2155,6 +2154,10 @@ nios2-*-*)
                tm_file="${tm_file} newlib-stdint.h nios2/elf.h"
                extra_options="${extra_options} nios2/elf.opt"
                ;;
+       nios2-*-rtems*)
+               tm_file="${tm_file} newlib-stdint.h nios2/rtems.h rtems.h"
+               tmake_file="${tmake_file} t-rtems nios2/t-rtems"
+               ;;
         esac
        ;;
 pdp11-*-*)
index 48beafb..8d20310 100644 (file)
@@ -44,4 +44,6 @@
     }                                          \
   while (0)
 
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
+
 #endif  /* GCC_AARCH64_LINUX_H */
index 5a6803a..ec90fca 100644 (file)
@@ -126,6 +126,10 @@ do {                                                                       \
   "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
    %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
 
+/* This variable should be set to 'true' if the target ABI requires
+   unwinding tables even when exceptions are not used.  */
+#define TARGET_UNWIND_TABLES_DEFAULT true
+
 /* Select a format to encode pointers in exception handling data.  CODE
    is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
    true if the symbol may be affected by dynamic relocations.
index d81fbf7..92c4dcb 100644 (file)
 # Custom RTEMS EABI multilibs
 
-MULTILIB_OPTIONS  = mthumb march=armv6-m/march=armv7-a/march=armv7-r/march=armv7-m mfpu=neon mfloat-abi=hard
-MULTILIB_DIRNAMES = thumb armv6-m armv7-a armv7-r armv7-m neon hard
+MULTILIB_OPTIONS  = mbig-endian mthumb march=armv6-m/march=armv7-a/march=armv7-r/march=armv7-m mfpu=neon/mfpu=vfpv3-d16/mfpu=fpv4-sp-d16 mfloat-abi=hard
+MULTILIB_DIRNAMES = eb thumb armv6-m armv7-a armv7-r armv7-m neon vfpv3-d16 fpv4-sp-d16 hard
 
 # Enumeration of multilibs
 
 MULTILIB_EXCEPTIONS =
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=neon/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=neon
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=vfpv3-d16
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=fpv4-sp-d16
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=neon/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=neon
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=vfpv3-d16
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=fpv4-sp-d16
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=neon/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=neon
+# MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=vfpv3-d16
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=fpv4-sp-d16
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfloat-abi=hard
+# MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=neon/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=neon
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=vfpv3-d16
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=fpv4-sp-d16
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=neon/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=neon
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=vfpv3-d16
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=fpv4-sp-d16
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mthumb
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=neon/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=neon
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=vfpv3-d16
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=fpv4-sp-d16
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=neon/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=neon
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=vfpv3-d16
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=fpv4-sp-d16
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=neon/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=neon
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=vfpv3-d16
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=fpv4-sp-d16
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=neon/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=neon
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=vfpv3-d16
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=fpv4-sp-d16
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m
+MULTILIB_EXCEPTIONS += mbig-endian/mfpu=neon/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mfpu=neon
+MULTILIB_EXCEPTIONS += mbig-endian/mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mfpu=vfpv3-d16
+MULTILIB_EXCEPTIONS += mbig-endian/mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian/mfpu=fpv4-sp-d16
+MULTILIB_EXCEPTIONS += mbig-endian/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mbig-endian
 MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=neon/mfloat-abi=hard
 MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=neon
+MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=vfpv3-d16
+MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=fpv4-sp-d16
 MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfloat-abi=hard
 # MULTILIB_EXCEPTIONS += mthumb/march=armv6-m
 # MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=neon/mfloat-abi=hard
 MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=neon
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=vfpv3-d16
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=fpv4-sp-d16
 MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfloat-abi=hard
 # MULTILIB_EXCEPTIONS += mthumb/march=armv7-a
 MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=neon/mfloat-abi=hard
 MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=neon
+# MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=vfpv3-d16
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=fpv4-sp-d16
 MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfloat-abi=hard
 # MULTILIB_EXCEPTIONS += mthumb/march=armv7-r
 MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=neon/mfloat-abi=hard
 MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=neon
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=vfpv3-d16
+# MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=fpv4-sp-d16
 MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfloat-abi=hard
 # MULTILIB_EXCEPTIONS += mthumb/march=armv7-m
 MULTILIB_EXCEPTIONS += mthumb/mfpu=neon/mfloat-abi=hard
 MULTILIB_EXCEPTIONS += mthumb/mfpu=neon
+MULTILIB_EXCEPTIONS += mthumb/mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mthumb/mfpu=vfpv3-d16
+MULTILIB_EXCEPTIONS += mthumb/mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mthumb/mfpu=fpv4-sp-d16
 MULTILIB_EXCEPTIONS += mthumb/mfloat-abi=hard
 # MULTILIB_EXCEPTIONS += mthumb
 MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=neon/mfloat-abi=hard
 MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=neon
+MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=vfpv3-d16
+MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=fpv4-sp-d16
 MULTILIB_EXCEPTIONS += march=armv6-m/mfloat-abi=hard
 MULTILIB_EXCEPTIONS += march=armv6-m
 MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=neon/mfloat-abi=hard
 MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=neon
+MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=vfpv3-d16
+MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=fpv4-sp-d16
 MULTILIB_EXCEPTIONS += march=armv7-a/mfloat-abi=hard
 MULTILIB_EXCEPTIONS += march=armv7-a
 MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=neon/mfloat-abi=hard
 MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=neon
+MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=vfpv3-d16
+MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=fpv4-sp-d16
 MULTILIB_EXCEPTIONS += march=armv7-r/mfloat-abi=hard
 MULTILIB_EXCEPTIONS += march=armv7-r
 MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=neon/mfloat-abi=hard
 MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=neon
+MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=vfpv3-d16
+MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=fpv4-sp-d16
 MULTILIB_EXCEPTIONS += march=armv7-m/mfloat-abi=hard
 MULTILIB_EXCEPTIONS += march=armv7-m
 MULTILIB_EXCEPTIONS += mfpu=neon/mfloat-abi=hard
 MULTILIB_EXCEPTIONS += mfpu=neon
+MULTILIB_EXCEPTIONS += mfpu=vfpv3-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mfpu=vfpv3-d16
+MULTILIB_EXCEPTIONS += mfpu=fpv4-sp-d16/mfloat-abi=hard
+MULTILIB_EXCEPTIONS += mfpu=fpv4-sp-d16
 MULTILIB_EXCEPTIONS += mfloat-abi=hard
index 651fbed..f927cca 100644 (file)
                                                       reload_in_progress
                                                       || reload_completed)"))
            ;; Just an explicit indirect reference: [const]?
-           (match_test "CONSTANT_P (XEXP (op, 0))")
+           (match_test "CRIS_CONSTANT_P (XEXP (op, 0))")
            ;; Something that is indexed; [...+...]?
            (and (match_code "plus" "0")
                      ;; A BDAP constant: [reg+(8|16|32)bit offset]?
 (define_constraint "U"
   "@internal"
   (and (match_test "flag_pic")
+       ;; We're just interested in the ..._or_callable_symbol part.
+       ;; (Using CRIS_CONSTANT_P would exclude that too.)
        (match_test "CONSTANT_P (op)")
        (match_operand 0 "cris_nonmemory_operand_or_callable_symbol")))
 
index 0fdcafe..b09babd 100644 (file)
@@ -31,8 +31,9 @@ extern bool cris_cc0_user_requires_cmp (rtx);
 extern rtx cris_return_addr_rtx (int, rtx);
 extern rtx cris_split_movdx (rtx *);
 extern int cris_legitimate_pic_operand (rtx);
-extern enum cris_pic_symbol_type cris_pic_symbol_type_of (const_rtx);
+extern enum cris_symbol_type cris_symbol_type_of (const_rtx);
 extern bool cris_valid_pic_const (const_rtx, bool);
+extern bool cris_legitimate_constant_p (enum machine_mode, rtx);
 extern bool cris_constant_index_p (const_rtx);
 extern bool cris_base_p (const_rtx, bool);
 extern bool cris_base_or_autoincr_p (const_rtx, bool);
@@ -46,7 +47,7 @@ extern int cris_cfun_uses_pic_table (void);
 extern void cris_asm_output_case_end (FILE *, int, rtx);
 extern rtx cris_gen_movem_load (rtx, rtx, int);
 extern rtx cris_emit_movem_store (rtx, rtx, int, bool);
-extern void cris_expand_pic_call_address (rtx *);
+extern void cris_expand_pic_call_address (rtx *, rtx *);
 extern void cris_order_for_addsi3 (rtx *, int);
 extern void cris_emit_trap_for_misalignment (rtx);
 #endif /* RTX_CODE */
index 209f127..c15139f 100644 (file)
@@ -147,6 +147,7 @@ static rtx cris_function_incoming_arg (cumulative_args_t,
 static void cris_function_arg_advance (cumulative_args_t, enum machine_mode,
                                       const_tree, bool);
 static tree cris_md_asm_clobbers (tree, tree, tree);
+static bool cris_cannot_force_const_mem (enum machine_mode, rtx);
 
 static void cris_option_override (void);
 
@@ -214,6 +215,9 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION;
 #undef TARGET_LEGITIMATE_ADDRESS_P
 #define TARGET_LEGITIMATE_ADDRESS_P cris_legitimate_address_p
 
+#undef TARGET_LEGITIMATE_CONSTANT_P
+#define TARGET_LEGITIMATE_CONSTANT_P cris_legitimate_constant_p
+
 #undef TARGET_PREFERRED_RELOAD_CLASS
 #define TARGET_PREFERRED_RELOAD_CLASS cris_preferred_reload_class
 
@@ -248,6 +252,10 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION;
 #define TARGET_FUNCTION_ARG_ADVANCE cris_function_arg_advance
 #undef TARGET_MD_ASM_CLOBBERS
 #define TARGET_MD_ASM_CLOBBERS cris_md_asm_clobbers
+
+#undef TARGET_CANNOT_FORCE_CONST_MEM
+#define TARGET_CANNOT_FORCE_CONST_MEM cris_cannot_force_const_mem
+
 #undef TARGET_FRAME_POINTER_REQUIRED
 #define TARGET_FRAME_POINTER_REQUIRED cris_frame_pointer_required
 
@@ -506,6 +514,21 @@ cris_cfun_uses_pic_table (void)
   return crtl->uses_pic_offset_table;
 }
 
+/* Worker function for TARGET_CANNOT_FORCE_CONST_MEM.
+   We can't put PIC addresses in the constant pool, not even the ones that
+   can be reached as pc-relative as we can't tell when or how to do that.  */
+
+static bool
+cris_cannot_force_const_mem (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x)
+{
+  enum cris_symbol_type t = cris_symbol_type_of (x);
+
+  return
+    t == cris_unspec
+    || t == cris_got_symbol
+    || t == cris_rel_symbol;
+}
+
 /* Given an rtx, return the text string corresponding to the CODE of X.
    Intended for use in the assembly language output section of a
    define_insn.  */
@@ -601,7 +624,7 @@ cris_print_index (rtx index, FILE *file)
 
   if (REG_P (index))
     fprintf (file, "$%s.b", reg_names[REGNO (index)]);
-  else if (CONSTANT_P (index))
+  else if (CRIS_CONSTANT_P (index))
     cris_output_addr_const (file, index);
   else if (GET_CODE (index) == MULT)
     {
@@ -1041,7 +1064,7 @@ cris_print_operand (FILE *file, rtx x, int code)
       /* If this is a GOT symbol, force it to be emitted as :GOT and
         :GOTPLT regardless of -fpic (i.e. not as :GOT16, :GOTPLT16).
         Avoid making this too much of a special case.  */
-      if (flag_pic == 1 && CONSTANT_P (operand))
+      if (flag_pic == 1 && CRIS_CONSTANT_P (operand))
        {
          int flag_pic_save = flag_pic;
 
@@ -1161,7 +1184,7 @@ cris_print_operand (FILE *file, rtx x, int code)
     default:
       /* No need to handle all strange variants, let output_addr_const
         do it for us.  */
-      if (CONSTANT_P (operand))
+      if (CRIS_CONSTANT_P (operand))
        {
          cris_output_addr_const (file, operand);
          return;
@@ -1358,7 +1381,7 @@ reg_ok_for_index_p (const_rtx x, bool strict)
 bool
 cris_constant_index_p (const_rtx x)
 {
-  return (CONSTANT_P (x) && (!flag_pic || cris_valid_pic_const (x, true)));
+  return (CRIS_CONSTANT_P (x) && (!flag_pic || cris_valid_pic_const (x, true)));
 }
 
 /* True if X is a valid base register.  */
@@ -1467,6 +1490,29 @@ cris_legitimate_address_p (enum machine_mode mode, rtx x, bool strict)
   return false;
 }
 
+/* Worker function for TARGET_LEGITIMATE_CONSTANT_P.  We have to handle
+   PIC constants that aren't legitimized.  FIXME: there used to be a
+   guarantee that the target LEGITIMATE_CONSTANT_P didn't have to handle
+   PIC constants, but no more (4.7 era); testcase: glibc init-first.c.
+   While that may be seen as a bug, that guarantee seems a wart by design,
+   so don't bother; fix the documentation instead.  */
+
+bool
+cris_legitimate_constant_p (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x)
+{
+  enum cris_symbol_type t;
+
+  if (flag_pic)
+    return LEGITIMATE_PIC_OPERAND_P (x);
+
+  t = cris_symbol_type_of (x);
+
+  return
+    t == cris_no_symbol
+    || t == cris_offsettable_symbol
+    || t == cris_unspec;
+}
+
 /* Worker function for LEGITIMIZE_RELOAD_ADDRESS.  */
 
 bool
@@ -2214,7 +2260,7 @@ cris_address_cost (rtx x, enum machine_mode mode ATTRIBUTE_UNUSED,
        return (2 + 2) / 2;
 
       /* A BDAP with some other constant is 2 bytes extra.  */
-      if (CONSTANT_P (tem2))
+      if (CRIS_CONSTANT_P (tem2))
        return (2 + 2 + 2) / 2;
 
       /* BDAP with something indirect should have a higher cost than
@@ -2312,7 +2358,7 @@ cris_side_effect_mode_ok (enum rtx_code code, rtx *ops,
        return 0;
 
       /* Check allowed cases, like [r(+)?].[bwd] and const.  */
-      if (CONSTANT_P (val_rtx))
+      if (CRIS_CONSTANT_P (val_rtx))
        return 1;
 
       if (MEM_P (val_rtx)
@@ -2464,32 +2510,34 @@ cris_valid_pic_const (const_rtx x, bool any_operand)
        gcc_unreachable ();
       }
 
-  return cris_pic_symbol_type_of (x) == cris_no_symbol;
+  return cris_symbol_type_of (x) == cris_no_symbol;
 }
 
-/* Helper function to find the right PIC-type symbol to generate,
+/* Helper function to find the right symbol-type to generate,
    given the original (non-PIC) representation.  */
 
-enum cris_pic_symbol_type
-cris_pic_symbol_type_of (const_rtx x)
+enum cris_symbol_type
+cris_symbol_type_of (const_rtx x)
 {
   switch (GET_CODE (x))
     {
     case SYMBOL_REF:
-      return SYMBOL_REF_LOCAL_P (x)
-       ? cris_rel_symbol : cris_got_symbol;
+      return flag_pic
+       ? (SYMBOL_REF_LOCAL_P (x)
+          ? cris_rel_symbol : cris_got_symbol)
+       : cris_offsettable_symbol;
 
     case LABEL_REF:
-      return cris_rel_symbol;
+      return flag_pic ? cris_rel_symbol : cris_offsettable_symbol;
 
     case CONST:
-      return cris_pic_symbol_type_of (XEXP (x, 0));
+      return cris_symbol_type_of (XEXP (x, 0));
 
     case PLUS:
     case MINUS:
       {
-       enum cris_pic_symbol_type t1 = cris_pic_symbol_type_of (XEXP (x, 0));
-       enum cris_pic_symbol_type t2 = cris_pic_symbol_type_of (XEXP (x, 1));
+       enum cris_symbol_type t1 = cris_symbol_type_of (XEXP (x, 0));
+       enum cris_symbol_type t2 = cris_symbol_type_of (XEXP (x, 1));
 
        gcc_assert (t1 == cris_no_symbol || t2 == cris_no_symbol);
 
@@ -2504,9 +2552,7 @@ cris_pic_symbol_type_of (const_rtx x)
       return cris_no_symbol;
 
     case UNSPEC:
-      /* Likely an offsettability-test attempting to add a constant to
-        a GOTREAD symbol, which can't be handled.  */
-      return cris_invalid_pic_symbol;
+      return cris_unspec;
 
     default:
       fatal_insn ("unrecognized supposed constant", x);
@@ -3714,19 +3760,19 @@ cris_emit_movem_store (rtx dest, rtx nregs_rtx, int increment,
 /* Worker function for expanding the address for PIC function calls.  */
 
 void
-cris_expand_pic_call_address (rtx *opp)
+cris_expand_pic_call_address (rtx *opp, rtx *markerp)
 {
   rtx op = *opp;
 
-  gcc_assert (MEM_P (op));
+  gcc_assert (flag_pic && MEM_P (op));
   op = XEXP (op, 0);
 
   /* It might be that code can be generated that jumps to 0 (or to a
      specific address).  Don't die on that.  (There is a
      testcase.)  */
-  if (CONSTANT_ADDRESS_P (op) && !CONST_INT_P (op))
+  if (CONSTANT_P (op) && !CONST_INT_P (op))
     {
-      enum cris_pic_symbol_type t = cris_pic_symbol_type_of (op);
+      enum cris_symbol_type t = cris_symbol_type_of (op);
 
       CRIS_ASSERT (can_create_pseudo_p ());
 
@@ -3752,18 +3798,21 @@ cris_expand_pic_call_address (rtx *opp)
            }
          else
            op = force_reg (Pmode, op);
+
+         /* A local call.  */
+         *markerp = const0_rtx;
        }
       else if (t == cris_got_symbol)
        {
          if (TARGET_AVOID_GOTPLT)
            {
              /* Change a "jsr sym" into (allocate register rM, rO)
-                "move.d (const (unspec [sym rPIC] CRIS_UNSPEC_PLT_GOTREL)),rM"
+                "move.d (const (unspec [sym] CRIS_UNSPEC_PLT_GOTREL)),rM"
                 "add.d rPIC,rM,rO", "jsr rO" for pre-v32 and
-                "jsr (const (unspec [sym rPIC] CRIS_UNSPEC_PLT_PCREL))"
+                "jsr (const (unspec [sym] CRIS_UNSPEC_PLT_PCREL))"
                 for v32.  */
              rtx tem, rm, ro;
-             gcc_assert (can_create_pseudo_p ());
+
              crtl->uses_pic_offset_table = 1;
              tem = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, op),
                                    TARGET_V32
@@ -3817,14 +3866,27 @@ cris_expand_pic_call_address (rtx *opp)
              MEM_NOTRAP_P (mem) = 1;
              op = mem;
            }
+
+         /* We need to prepare this call to go through the PLT; we
+            need to make GOT available.  */
+         *markerp = pic_offset_table_rtx;
        }
       else
-       /* Can't possibly get a GOT-needing-fixup for a function-call,
-          right?  */
+       /* Can't possibly get anything else for a function-call, right?  */
        fatal_insn ("unidentifiable call op", op);
 
-      *opp = replace_equiv_address (*opp, op);
+      /* If the validizing variant is called, it will try to validize
+        the address as a valid any-operand constant, but as it's only
+        valid for calls and moves, it will fail and always be forced
+        into a register.  */
+      *opp = replace_equiv_address_nv (*opp, op);
     }
+  else
+    /* Can't tell what locality a call to a non-constant address has;
+       better make the GOT register alive at it.
+       FIXME: Can we see whether the register has known constant
+       contents?  */
+    *markerp = pic_offset_table_rtx;
 }
 
 /* Make sure operands are in the right order for an addsi3 insn as
index 37b562e..c5aa83e 100644 (file)
@@ -794,6 +794,12 @@ struct cum_args {int regs;};
     }                                                                  \
   while (0)
 
+/* The mode argument to cris_legitimate_constant_p isn't used, so just
+   pass a cheap dummy.  N.B. we have to cast away const from the
+   parameter rather than adjust the parameter, as it's type is mandated
+   by the TARGET_LEGITIMATE_CONSTANT_P target hook interface.  */
+#define CRIS_CONSTANT_P(X) \
+  (CONSTANT_P (X) && cris_legitimate_constant_p (VOIDmode, CONST_CAST_RTX (X)))
 
 /* Node: Condition Code */
 
@@ -833,13 +839,14 @@ struct cum_args {int regs;};
 
 /* Helper type.  */
 
-enum cris_pic_symbol_type
+enum cris_symbol_type
   {
     cris_no_symbol = 0,
     cris_got_symbol = 1,
     cris_rel_symbol = 2,
     cris_got_symbol_needing_fixup = 3,
-    cris_invalid_pic_symbol = 4
+    cris_unspec = 7,
+    cris_offsettable_symbol = 8
   };
 
 #define PIC_OFFSET_TABLE_REGNUM (flag_pic ? CRIS_GOT_REGNUM : INVALID_REGNUM)
index 47f6451..18b9787 100644 (file)
     (match_operand:SI 1 "cris_general_operand_or_symbol" ""))]
   ""
 {
+  enum cris_symbol_type t;
+
   /* If the output goes to a MEM, make sure we have zero or a register as
      input.  */
   if (MEM_P (operands[0])
      valid symbol?  Can we exclude global PIC addresses with an added
      offset?  */
     if (flag_pic
-       && CONSTANT_ADDRESS_P (operands[1])
+       && CONSTANT_P (operands[1])
        && !cris_valid_pic_const (operands[1], false))
       {
-       enum cris_pic_symbol_type t = cris_pic_symbol_type_of (operands[1]);
+       t = cris_symbol_type_of (operands[1]);
 
-       gcc_assert (t != cris_no_symbol);
+       gcc_assert (t != cris_no_symbol && t != cris_offsettable_symbol);
 
        if (! REG_S_P (operands[0]))
          {
         if (!flag_pic
             && (GET_CODE (operands[1]) == SYMBOL_REF
                 || GET_CODE (operands[1]) == LABEL_REF
-                || GET_CODE (operands[1]) == CONST))
+                || (GET_CODE (operands[1]) == CONST
+                    && (GET_CODE (XEXP (operands[1], 0)) != UNSPEC
+                        || (XINT (XEXP (operands[1], 0), 1)
+                            == CRIS_UNSPEC_PLT_PCREL)
+                        || (XINT (XEXP (operands[1], 0), 1)
+                            == CRIS_UNSPEC_PCREL)))))
           {
             /* FIXME: Express this through (set_attr cc none) instead,
                since we can't express the ``none'' at this point.  FIXME:
          case CRIS_UNSPEC_PCREL:
          case CRIS_UNSPEC_PLT_PCREL:
            gcc_assert (TARGET_V32);
+           /* LAPC doesn't set condition codes; clear them to make the
+              (equivalence-marked) result of this insn not presumed
+              present.  This instruction can be a PIC symbol load (for
+              a hidden symbol) which for weak symbols will be followed
+              by a test for NULL.  */
+           CC_STATUS_INIT;
            return "lapc %1,%0";
 
          default:
 {
   gcc_assert (MEM_P (operands[0]));
   if (flag_pic)
-    cris_expand_pic_call_address (&operands[0]);
+    cris_expand_pic_call_address (&operands[0], &operands[1]);
+  else
+    operands[1] = const0_rtx;
 })
 
-;; Accept *anything* as operand 1.  Accept operands for operand 0 in
-;; order of preference.
+;; Accept operands for operand 0 in order of preference.
 
 (define_insn "*expanded_call_non_v32"
   [(call (mem:QI (match_operand:SI 0 "general_operand" "r,Q>,g"))
-        (match_operand 1 "" ""))
+        (match_operand:SI 1 "cris_call_type_marker" "rM,rM,rM"))
    (clobber (reg:SI CRIS_SRP_REGNUM))]
   "!TARGET_V32"
   "jsr %0")
   [(call
     (mem:QI
      (match_operand:SI 0 "cris_nonmemory_operand_or_callable_symbol" "n,r,U,i"))
-    (match_operand 1 "" ""))
+    (match_operand:SI 1 "cris_call_type_marker" "rM,rM,rM,rM"))
    (clobber (reg:SI CRIS_SRP_REGNUM))]
   "TARGET_V32"
   "@
 ;; Parallel when calculating and reusing address of indirect pointer
 ;; with simple offset.  (Makes most sense with PIC.)  It looks a bit
 ;; wrong not to have the clobber last, but that's the way combine
-;; generates it (except it doesn' look into the *inner* mem, so this
+;; generates it (except it doesn't look into the *inner* mem, so this
 ;; just matches a peephole2).  FIXME: investigate that.
 (define_insn "*expanded_call_side"
   [(call (mem:QI
          (mem:SI
           (plus:SI (match_operand:SI 0 "cris_bdap_operand" "%r,  r,r")
                    (match_operand:SI 1 "cris_bdap_operand" "r>Rn,r,>Rn"))))
-        (match_operand 2 "" ""))
+        (match_operand:SI 2 "cris_call_type_marker" "rM,rM,rM"))
    (clobber (reg:SI CRIS_SRP_REGNUM))
    (set (match_operand:SI 3 "register_operand" "=*0,r,r")
        (plus:SI (match_dup 0)
                 (match_dup 1)))]
-  "!TARGET_AVOID_GOTPLT && !TARGET_V32"
+  ;; Disabled until after reload until we can avoid an output reload for
+  ;; operand 3 (being forbidden for call insns).
+  "reload_completed && !TARGET_AVOID_GOTPLT && !TARGET_V32"
   "jsr [%3=%0%S1]")
 
 (define_expand "call_value"
 {
   gcc_assert (MEM_P (operands[1]));
   if (flag_pic)
-    cris_expand_pic_call_address (&operands[1]);
+    cris_expand_pic_call_address (&operands[1], &operands[2]);
+  else
+    operands[2] = const0_rtx;
 })
 
-;; Accept *anything* as operand 2.  The validity other than "general" of
+;; The validity other than "general" of
 ;; operand 0 will be checked elsewhere.  Accept operands for operand 1 in
 ;; order of preference (Q includes r, but r is shorter, faster).
 ;;  We also accept a PLT symbol.  We output it as [rPIC+sym:GOTPLT] rather
 (define_insn "*expanded_call_value_non_v32"
   [(set (match_operand 0 "nonimmediate_operand" "=g,g,g")
        (call (mem:QI (match_operand:SI 1 "general_operand" "r,Q>,g"))
-             (match_operand 2 "" "")))
+             (match_operand:SI 2 "cris_call_type_marker" "rM,rM,rM")))
    (clobber (reg:SI CRIS_SRP_REGNUM))]
   "!TARGET_V32"
   "Jsr %1"
          (mem:SI
           (plus:SI (match_operand:SI 1 "cris_bdap_operand" "%r,  r,r")
                    (match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn"))))
-             (match_operand 3 "" "")))
+        (match_operand:SI 3 "cris_call_type_marker" "rM,rM,rM")))
    (clobber (reg:SI CRIS_SRP_REGNUM))
    (set (match_operand:SI 4 "register_operand" "=*1,r,r")
        (plus:SI (match_dup 1)
                 (match_dup 2)))]
-  "!TARGET_AVOID_GOTPLT && !TARGET_V32"
+  ;; Disabled until after reload until we can avoid an output reload for
+  ;; operand 4 (being forbidden for call insns).
+  "reload_completed && !TARGET_AVOID_GOTPLT && !TARGET_V32"
   "Jsr [%4=%1%S2]"
   [(set_attr "cc" "clobber")])
 
     (call
      (mem:QI
       (match_operand:SI 1 "cris_nonmemory_operand_or_callable_symbol" "n,r,U,i"))
-     (match_operand 2 "" "")))
+     (match_operand:SI 2 "cris_call_type_marker" "rM,rM,rM,rM")))
    (clobber (reg:SI 16))]
   "TARGET_V32"
   "@
   /* Make sure we have canonical RTX so we match the insn pattern -
      not a constant in the first operand.  We also require the order
      (plus reg mem) to match the final pattern.  */
-  if (CONSTANT_P (otherop) || MEM_P (otherop))
+  if (CRIS_CONSTANT_P (otherop) || MEM_P (otherop))
     {
       operands[7] = operands[1];
       operands[8] = otherop;
   /* Make sure we have canonical RTX so we match the insn pattern -
      not a constant in the first operand.  We also require the order
      (plus reg mem) to match the final pattern.  */
-  if (CONSTANT_P (otherop) || MEM_P (otherop))
+  if (CRIS_CONSTANT_P (otherop) || MEM_P (otherop))
     {
       operands[7] = operands[1];
       operands[8] = otherop;
index 0169b0b..ddb090e 100644 (file)
   (ior (match_operand 0 "general_operand")
        (and (match_code "const, symbol_ref, label_ref")
                    ; The following test is actually just an assertion.
-           (match_test "cris_pic_symbol_type_of (op) != cris_no_symbol"))))
+           (match_test "cris_symbol_type_of (op) != cris_no_symbol"))))
 
 ;; A predicate for the anon movsi expansion, one that fits a PCREL
 ;; operand as well as general_operand.
        (ior (match_operand 0 "memory_operand")
            (match_test "cris_general_operand_or_symbol (XEXP (op, 0),
                                                         Pmode)"))))
+
+;; A marker for the call-insn: (const_int 0) for a call to a
+;; hidden or static function and non-pic and
+;; pic_offset_table_rtx for a call that *might* go through the
+;; PLT.
+
+(define_predicate "cris_call_type_marker"
+  (ior (and (match_operand 0 "const_int_operand")
+           (match_test "op == const0_rtx"))
+       (and (and (match_operand 0 "register_operand")
+                (match_test "op == pic_offset_table_rtx"))
+           (match_test "flag_pic != 0"))))
index 314895a..c4caa5a 100644 (file)
@@ -8103,6 +8103,22 @@ _mm512_stream_load_si512 (void *__P)
   return __builtin_ia32_movntdqa512 ((__v8di *)__P);
 }
 
+/* Constants for mantissa extraction */
+typedef enum
+{
+  _MM_MANT_NORM_1_2,           /* interval [1, 2)      */
+  _MM_MANT_NORM_p5_2,          /* interval [0.5, 2)    */
+  _MM_MANT_NORM_p5_1,          /* interval [0.5, 1)    */
+  _MM_MANT_NORM_p75_1p5                /* interval [0.75, 1.5) */
+} _MM_MANTISSA_NORM_ENUM;
+
+typedef enum
+{
+  _MM_MANT_SIGN_src,           /* sign = sign(SRC)     */
+  _MM_MANT_SIGN_zero,          /* sign = 0             */
+  _MM_MANT_SIGN_nan            /* DEST = NaN if sign(SRC) = 1 */
+} _MM_MANTISSA_SIGN_ENUM;
+
 #ifdef __OPTIMIZE__
 extern __inline __m128
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
@@ -8182,22 +8198,6 @@ _mm512_maskz_getexp_round_pd (__mmask8 __U, __m512d __A, const int __R)
                                                    (__mmask8) __U, __R);
 }
 
-/* Constants for mantissa extraction */
-typedef enum
-{
-  _MM_MANT_NORM_1_2,           /* interval [1, 2)      */
-  _MM_MANT_NORM_p5_2,          /* interval [0.5, 2)    */
-  _MM_MANT_NORM_p5_1,          /* interval [0.5, 1)    */
-  _MM_MANT_NORM_p75_1p5                /* interval [0.75, 1.5) */
-} _MM_MANTISSA_NORM_ENUM;
-
-typedef enum
-{
-  _MM_MANT_SIGN_src,           /* sign = sign(SRC)     */
-  _MM_MANT_SIGN_zero,          /* sign = 0             */
-  _MM_MANT_SIGN_nan            /* DEST = NaN if sign(SRC) = 1 */
-} _MM_MANTISSA_SIGN_ENUM;
-
 extern __inline __m512d
 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 _mm512_getmant_round_pd (__m512d __A, _MM_MANTISSA_NORM_ENUM __B,
index 6dc6888..0a6e644 100644 (file)
@@ -6552,7 +6552,7 @@ classify_argument (enum machine_mode mode, const_tree type,
                                           bit_offset);
                  if (!num)
                    return 0;
-                 for (i = 0; i < num; i++)
+                 for (i = 0; i < num && i < words; i++)
                    classes[i] = merge_classes (subclasses[i], classes[i]);
                }
            }
index 5e7c893..614b0fa 100644 (file)
@@ -256,11 +256,7 @@ __writeeflags (unsigned long long X)
 
 #define _bswap64(a)            __bswapq(a)
 #define _popcnt64(a)           __popcntq(a)
-#define _lrotl(a,b)            __rolq((a), (b))
-#define _lrotr(a,b)            __rorq((a), (b))
 #else
-#define _lrotl(a,b)            __rold((a), (b))
-#define _lrotr(a,b)            __rord((a), (b))
 
 /* Read flags register */
 extern __inline unsigned int
@@ -280,6 +276,16 @@ __writeeflags (unsigned int X)
 
 #endif
 
+/* On LP64 systems, longs are 64-bit.  Use the appropriate rotate
+ * function.  */
+#ifdef __LP64__
+#define _lrotl(a,b)            __rolq((a), (b))
+#define _lrotr(a,b)            __rorq((a), (b))
+#else
+#define _lrotl(a,b)            __rold((a), (b))
+#define _lrotr(a,b)            __rord((a), (b))
+#endif
+
 #define _bit_scan_forward(a)   __bsfd(a)
 #define _bit_scan_reverse(a)   __bsrd(a)
 #define _bswap(a)              __bswapd(a)
index 72a4d6d..c700425 100644 (file)
              (match_operand 5  "const_0_to_15_operand")]))
          (match_operand:<ssequartermode> 6 "memory_operand" "0")
          (match_operand:QI 7 "register_operand" "Yk")))]
-  "TARGET_AVX512F && (INTVAL (operands[2]) = INTVAL (operands[3]) - 1)
-  && (INTVAL (operands[3]) = INTVAL (operands[4]) - 1)
-  && (INTVAL (operands[4]) = INTVAL (operands[5]) - 1)"
+  "TARGET_AVX512F
+   && (INTVAL (operands[2]) == (INTVAL (operands[3]) - 1)
+       && INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
+       && INTVAL (operands[4]) == (INTVAL (operands[5]) - 1))"
 {
   operands[2] = GEN_INT ((INTVAL (operands[2])) >> 2);
   return "vextract<shuffletype>32x4\t{%2, %1, %0%{%7%}|%0%{%7%}, %1, %2}";
             (match_operand 3  "const_0_to_15_operand")
             (match_operand 4  "const_0_to_15_operand")
             (match_operand 5  "const_0_to_15_operand")])))]
-  "TARGET_AVX512F && (INTVAL (operands[2]) = INTVAL (operands[3]) - 1)
-  && (INTVAL (operands[3]) = INTVAL (operands[4]) - 1)
-  && (INTVAL (operands[4]) = INTVAL (operands[5]) - 1)"
+  "TARGET_AVX512F
+   && (INTVAL (operands[2]) == (INTVAL (operands[3]) - 1)
+       && INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
+       && INTVAL (operands[4]) == (INTVAL (operands[5]) - 1))"
 {
   operands[2] = GEN_INT ((INTVAL (operands[2])) >> 2);
   return "vextract<shuffletype>32x4\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
    (set_attr "mode" "<sseinsnmode>")])
 
 (define_insn "vec_extract_lo_<mode><mask_name>"
-  [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
+  [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>,v")
        (vec_select:<ssehalfvecmode>
-         (match_operand:V8FI 1 "nonimmediate_operand" "vm")
+         (match_operand:V8FI 1 "nonimmediate_operand" "v,m")
          (parallel [(const_int 0) (const_int 1)
             (const_int 2) (const_int 3)])))]
   "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
diff --git a/gcc/config/nios2/rtems.h b/gcc/config/nios2/rtems.h
new file mode 100644 (file)
index 0000000..18caa58
--- /dev/null
@@ -0,0 +1,34 @@
+/* Definitions for rtems targeting a NIOS2 using ELF.
+   Copyright (C) 2011-2014 Free Software Foundation, Inc.
+
+   Contributed by Chris Johns (chrisj@rtems.org).
+
+This file is part of GCC.
+
+GCC 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, or (at your option)
+any later version.
+
+GCC 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/>.  */
+
+/* Specify predefined symbols in preprocessor.  */
+#define TARGET_OS_CPP_BUILTINS()        \
+do {                                    \
+  builtin_define ("__rtems__");         \
+  builtin_define ("__USE_INIT_FINI__"); \
+  builtin_assert ("system=rtems");      \
+} while (0)
+
+/* This toolchain implements the ABI for Linux Systems documented in the
+   Nios II Processor Reference Handbook.
+
+   This is done so RTEMS targets have Thread Local Storage like Linux.  */
+#define TARGET_LINUX_ABI 1
diff --git a/gcc/config/nios2/t-rtems b/gcc/config/nios2/t-rtems
new file mode 100644 (file)
index 0000000..f95fa3c
--- /dev/null
@@ -0,0 +1,133 @@
+# Custom RTEMS multilibs
+
+MULTILIB_OPTIONS = mhw-mul mhw-mulx mhw-div mcustom-fadds=253 mcustom-fdivs=255 mcustom-fmuls=252 mcustom-fsubs=254
+
+# Enumeration of multilibs
+
+# MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mhw-div/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mhw-div/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mhw-div/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mhw-div/mcustom-fadds=253/mcustom-fdivs=255
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mhw-div/mcustom-fadds=253/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mhw-div/mcustom-fadds=253/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mhw-div/mcustom-fadds=253/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mhw-div/mcustom-fadds=253
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mhw-div/mcustom-fdivs=255/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mhw-div/mcustom-fdivs=255/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mhw-div/mcustom-fdivs=255/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mhw-div/mcustom-fdivs=255
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mhw-div/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mhw-div/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mhw-div/mcustom-fsubs=254
+# MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mhw-div
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mcustom-fadds=253/mcustom-fdivs=255
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mcustom-fadds=253/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mcustom-fadds=253/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mcustom-fadds=253/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mcustom-fadds=253
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mcustom-fdivs=255/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mcustom-fdivs=255/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mcustom-fdivs=255/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mcustom-fdivs=255
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-mulx
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-div/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-div/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-div/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-div/mcustom-fadds=253/mcustom-fdivs=255
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-div/mcustom-fadds=253/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-div/mcustom-fadds=253/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-div/mcustom-fadds=253/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-div/mcustom-fadds=253
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-div/mcustom-fdivs=255/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-div/mcustom-fdivs=255/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-div/mcustom-fdivs=255/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-div/mcustom-fdivs=255
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-div/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-div/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-div/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mhw-div
+MULTILIB_EXCEPTIONS += mhw-mul/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mul/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mcustom-fadds=253/mcustom-fdivs=255
+MULTILIB_EXCEPTIONS += mhw-mul/mcustom-fadds=253/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mcustom-fadds=253/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mul/mcustom-fadds=253/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mcustom-fadds=253
+MULTILIB_EXCEPTIONS += mhw-mul/mcustom-fdivs=255/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mcustom-fdivs=255/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mul/mcustom-fdivs=255/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mcustom-fdivs=255
+MULTILIB_EXCEPTIONS += mhw-mul/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mul/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mul/mcustom-fsubs=254
+# MULTILIB_EXCEPTIONS += mhw-mul
+MULTILIB_EXCEPTIONS += mhw-mulx/mhw-div/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mulx/mhw-div/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mulx/mhw-div/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mulx/mhw-div/mcustom-fadds=253/mcustom-fdivs=255
+MULTILIB_EXCEPTIONS += mhw-mulx/mhw-div/mcustom-fadds=253/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mulx/mhw-div/mcustom-fadds=253/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mulx/mhw-div/mcustom-fadds=253/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mulx/mhw-div/mcustom-fadds=253
+MULTILIB_EXCEPTIONS += mhw-mulx/mhw-div/mcustom-fdivs=255/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mulx/mhw-div/mcustom-fdivs=255/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mulx/mhw-div/mcustom-fdivs=255/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mulx/mhw-div/mcustom-fdivs=255
+MULTILIB_EXCEPTIONS += mhw-mulx/mhw-div/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mulx/mhw-div/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mulx/mhw-div/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mulx/mhw-div
+MULTILIB_EXCEPTIONS += mhw-mulx/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mulx/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mulx/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mulx/mcustom-fadds=253/mcustom-fdivs=255
+MULTILIB_EXCEPTIONS += mhw-mulx/mcustom-fadds=253/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mulx/mcustom-fadds=253/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mulx/mcustom-fadds=253/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mulx/mcustom-fadds=253
+MULTILIB_EXCEPTIONS += mhw-mulx/mcustom-fdivs=255/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mulx/mcustom-fdivs=255/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mulx/mcustom-fdivs=255/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mulx/mcustom-fdivs=255
+MULTILIB_EXCEPTIONS += mhw-mulx/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mulx/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-mulx/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-mulx
+MULTILIB_EXCEPTIONS += mhw-div/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-div/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-div/mcustom-fadds=253/mcustom-fdivs=255/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-div/mcustom-fadds=253/mcustom-fdivs=255
+MULTILIB_EXCEPTIONS += mhw-div/mcustom-fadds=253/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-div/mcustom-fadds=253/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-div/mcustom-fadds=253/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-div/mcustom-fadds=253
+MULTILIB_EXCEPTIONS += mhw-div/mcustom-fdivs=255/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-div/mcustom-fdivs=255/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-div/mcustom-fdivs=255/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-div/mcustom-fdivs=255
+MULTILIB_EXCEPTIONS += mhw-div/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-div/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mhw-div/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mhw-div
+MULTILIB_EXCEPTIONS += mcustom-fadds=253/mcustom-fdivs=255/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mcustom-fadds=253/mcustom-fdivs=255/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mcustom-fadds=253/mcustom-fdivs=255/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mcustom-fadds=253/mcustom-fdivs=255
+MULTILIB_EXCEPTIONS += mcustom-fadds=253/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mcustom-fadds=253/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mcustom-fadds=253/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mcustom-fadds=253
+MULTILIB_EXCEPTIONS += mcustom-fdivs=255/mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mcustom-fdivs=255/mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mcustom-fdivs=255/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mcustom-fdivs=255
+MULTILIB_EXCEPTIONS += mcustom-fmuls=252/mcustom-fsubs=254
+MULTILIB_EXCEPTIONS += mcustom-fmuls=252
+MULTILIB_EXCEPTIONS += mcustom-fsubs=254
index 4f678f6..1f3ef19 100644 (file)
@@ -367,7 +367,7 @@ extern int dot_symbols;
 /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given.  */
 #undef  ADJUST_FIELD_ALIGN
 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
-  ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE)     \
+  (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED))           \
    ? 128                                                                \
    : (TARGET_64BIT                                                      \
       && TARGET_ALIGN_NATURAL == 0                                      \
index dbc9a52..0ca05d2 100644 (file)
@@ -246,7 +246,7 @@ extern int dot_symbols;
 /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given.  */
 #undef  ADJUST_FIELD_ALIGN
 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
-  ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE)    \
+  (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED))           \
    ? 128                                                               \
    : (TARGET_64BIT                                                     \
       && TARGET_ALIGN_NATURAL == 0                                     \
index 785f6ce..067a74a 100644 (file)
@@ -155,6 +155,7 @@ extern void rs6000_split_logical (rtx [], enum rtx_code, bool, bool, bool, rtx);
 
 #ifdef TREE_CODE
 extern unsigned int rs6000_data_alignment (tree, unsigned int, enum data_align);
+extern bool rs6000_special_adjust_field_align_p (tree, unsigned int);
 extern unsigned int rs6000_special_round_type_align (tree, unsigned int,
                                                     unsigned int);
 extern unsigned int darwin_rs6000_special_round_type_align (tree, unsigned int,
index bf67e72..6894205 100644 (file)
@@ -1221,7 +1221,12 @@ char rs6000_reg_names[][8] =
       /* Soft frame pointer.  */
       "sfp",
       /* HTM SPR registers.  */
-      "tfhar", "tfiar", "texasr"
+      "tfhar", "tfiar", "texasr",
+      /* SPE High registers.  */
+      "0",  "1",  "2",  "3",  "4",  "5",  "6",  "7",
+      "8",  "9", "10", "11", "12", "13", "14", "15",
+     "16", "17", "18", "19", "20", "21", "22", "23",
+     "24", "25", "26", "27", "28", "29", "30", "31"
 };
 
 #ifdef TARGET_REGNAMES
@@ -1249,7 +1254,12 @@ static const char alt_reg_names[][8] =
   /* Soft frame pointer.  */
   "sfp",
   /* HTM SPR registers.  */
-  "tfhar", "tfiar", "texasr"
+  "tfhar", "tfiar", "texasr",
+  /* SPE High registers.  */
+  "%rh0",  "%rh1",  "%rh2",  "%rh3",  "%rh4",  "%rh5",  "%rh6",   "%rh7",
+  "%rh8",  "%rh9",  "%rh10", "%r11",  "%rh12", "%rh13", "%rh14", "%rh15",
+  "%rh16", "%rh17", "%rh18", "%rh19", "%rh20", "%rh21", "%rh22", "%rh23",
+  "%rh24", "%rh25", "%rh26", "%rh27", "%rh28", "%rh29", "%rh30", "%rh31"
 };
 #endif
 
@@ -5871,6 +5881,34 @@ rs6000_data_alignment (tree type, unsigned int align, enum data_align how)
   return align;
 }
 
+/* Previous GCC releases forced all vector types to have 16-byte alignment.  */
+
+bool
+rs6000_special_adjust_field_align_p (tree field, unsigned int computed)
+{
+  if (TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (field)) == VECTOR_TYPE)
+    {
+      if (computed != 128)
+       {
+         static bool warned;
+         if (!warned && warn_psabi)
+           {
+             warned = true;
+             inform (input_location,
+                     "the layout of aggregates containing vectors with"
+                     " %d-byte alignment will change in a future GCC release",
+                     computed / BITS_PER_UNIT);
+           }
+       }
+      /* GCC 4.8/4.9 Note: To avoid any ABI change on a release branch, we
+        keep the special treatment of vector types, but warn if there will
+        be differences in future GCC releases.  */
+      return true;
+    }
+
+  return false;
+}
+
 /* AIX increases natural record alignment to doubleword if the first
    field is an FP double while the FP fields remain word aligned.  */
 
@@ -9180,14 +9218,51 @@ rs6000_function_arg_boundary (enum machine_mode mode, const_tree type)
           || (type && TREE_CODE (type) == VECTOR_TYPE
               && int_size_in_bytes (type) >= 16))
     return 128;
-  else if (((TARGET_MACHO && rs6000_darwin64_abi)
-           || DEFAULT_ABI == ABI_ELFv2
-            || (DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm))
-          && mode == BLKmode
-          && type && TYPE_ALIGN (type) > 64)
+
+  /* Aggregate types that need > 8 byte alignment are quadword-aligned
+     in the parameter area in the ELFv2 ABI, and in the AIX ABI unless
+     -mcompat-align-parm is used.  */
+  if (((DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm)
+       || DEFAULT_ABI == ABI_ELFv2)
+      && type && TYPE_ALIGN (type) > 64)
+    {
+      /* "Aggregate" means any AGGREGATE_TYPE except for single-element
+         or homogeneous float/vector aggregates here.  We already handled
+         vector aggregates above, but still need to check for float here. */
+      bool aggregate_p = (AGGREGATE_TYPE_P (type)
+                         && !SCALAR_FLOAT_MODE_P (elt_mode));
+
+      /* We used to check for BLKmode instead of the above aggregate type
+        check.  Warn when this results in any difference to the ABI.  */
+      if (aggregate_p != (mode == BLKmode))
+       {
+         static bool warned;
+         if (!warned && warn_psabi)
+           {
+             warned = true;
+             inform (input_location,
+                     "the ABI of passing aggregates with %d-byte alignment"
+                     " will change in a future GCC release",
+                     (int) TYPE_ALIGN (type) / BITS_PER_UNIT);
+           }
+       }
+
+      /* GCC 4.8/4.9 Note: To avoid any ABI change on a release branch, we
+        keep using the BLKmode check, but warn if there will be differences
+        in future GCC releases.  */
+      if (mode == BLKmode)
+       return 128;
+    }
+
+  /* Similar for the Darwin64 ABI.  Note that for historical reasons we
+     implement the "aggregate type" check as a BLKmode check here; this
+     means certain aggregate types are in fact not aligned.  */
+  if (TARGET_MACHO && rs6000_darwin64_abi
+      && mode == BLKmode
+      && type && TYPE_ALIGN (type) > 64)
     return 128;
-  else
-    return PARM_BOUNDARY;
+
+  return PARM_BOUNDARY;
 }
 
 /* The offset in words to the start of the parameter save area.  */
@@ -10225,6 +10300,7 @@ rs6000_function_arg (cumulative_args_t cum_v, enum machine_mode mode,
          rtx r, off;
          int i, k = 0;
          unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3;
+         int fpr_words;
 
          /* Do we also need to pass this argument in the parameter
             save area?  */
@@ -10253,6 +10329,37 @@ rs6000_function_arg (cumulative_args_t cum_v, enum machine_mode mode,
              rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off);
            }
 
+         /* If there were not enough FPRs to hold the argument, the rest
+            usually goes into memory.  However, if the current position
+            is still within the register parameter area, a portion may
+            actually have to go into GPRs.
+
+            Note that it may happen that the portion of the argument
+            passed in the first "half" of the first GPR was already
+            passed in the last FPR as well.
+
+            For unnamed arguments, we already set up GPRs to cover the
+            whole argument in rs6000_psave_function_arg, so there is
+            nothing further to do at this point.
+
+            GCC 4.8/4.9 Note: This was implemented incorrectly in earlier
+            GCC releases.  To avoid any ABI change on the release branch,
+            we retain that original implementation here, but warn if we
+            encounter a case where the ABI will change in the future.  */
+         fpr_words = (i * GET_MODE_SIZE (elt_mode)) / (TARGET_32BIT ? 4 : 8);
+         if (i < n_elts && align_words + fpr_words < GP_ARG_NUM_REG
+             && cum->nargs_prototype > 0)
+            {
+             static bool warned;
+             if (!warned && warn_psabi)
+               {
+                 warned = true;
+                 inform (input_location,
+                         "the ABI of passing homogeneous float aggregates"
+                         " will change in a future GCC release");
+               }
+           }
+
          return rs6000_finish_function_arg (mode, rvec, k);
        }
       else if (align_words < GP_ARG_NUM_REG)
@@ -31074,13 +31181,13 @@ rs6000_dwarf_register_span (rtx reg)
     {
       if (BYTES_BIG_ENDIAN)
        {
-         parts[2 * i] = gen_rtx_REG (SImode, regno + 1200);
+         parts[2 * i] = gen_rtx_REG (SImode, regno + FIRST_SPE_HIGH_REGNO);
          parts[2 * i + 1] = gen_rtx_REG (SImode, regno);
        }
       else
        {
          parts[2 * i] = gen_rtx_REG (SImode, regno);
-         parts[2 * i + 1] = gen_rtx_REG (SImode, regno + 1200);
+         parts[2 * i + 1] = gen_rtx_REG (SImode, regno + FIRST_SPE_HIGH_REGNO);
        }
     }
 
@@ -31100,11 +31207,11 @@ rs6000_init_dwarf_reg_sizes_extra (tree address)
       rtx mem = gen_rtx_MEM (BLKmode, addr);
       rtx value = gen_int_mode (4, mode);
 
-      for (i = 1201; i < 1232; i++)
+      for (i = FIRST_SPE_HIGH_REGNO; i < LAST_SPE_HIGH_REGNO+1; i++)
        {
-         int column = DWARF_REG_TO_UNWIND_COLUMN (i);
-         HOST_WIDE_INT offset
-           = DWARF_FRAME_REGNUM (column) * GET_MODE_SIZE (mode);
+         int column = DWARF_REG_TO_UNWIND_COLUMN
+               (DWARF2_FRAME_REG_OUT (DWARF_FRAME_REGNUM (i), true));
+         HOST_WIDE_INT offset = column * GET_MODE_SIZE (mode);
 
          emit_move_insn (adjust_address (mem, mode, offset), value);
        }
@@ -31123,9 +31230,9 @@ rs6000_init_dwarf_reg_sizes_extra (tree address)
 
       for (i = FIRST_ALTIVEC_REGNO; i < LAST_ALTIVEC_REGNO+1; i++)
        {
-         int column = DWARF_REG_TO_UNWIND_COLUMN (i);
-         HOST_WIDE_INT offset
-           = DWARF_FRAME_REGNUM (column) * GET_MODE_SIZE (mode);
+         int column = DWARF_REG_TO_UNWIND_COLUMN
+               (DWARF2_FRAME_REG_OUT (DWARF_FRAME_REGNUM (i), true));
+         HOST_WIDE_INT offset = column * GET_MODE_SIZE (mode);
 
          emit_move_insn (adjust_address (mem, mode, offset), value);
        }
@@ -31157,9 +31264,8 @@ rs6000_dbx_register_number (unsigned int regno)
     return 99;
   if (regno == SPEFSCR_REGNO)
     return 612;
-  /* SPE high reg number.  We get these values of regno from
-     rs6000_dwarf_register_span.  */
-  gcc_assert (regno >= 1200 && regno < 1232);
+  if (SPE_HIGH_REGNO_P (regno))
+    return regno - FIRST_SPE_HIGH_REGNO + 1200;
   return regno;
 }
 
index 2b5d033..102191d 100644 (file)
@@ -930,35 +930,36 @@ enum data_align { align_abi, align_opt, align_both };
 
    The 3 HTM registers aren't also included in DWARF_FRAME_REGISTERS.  */
 
-#define FIRST_PSEUDO_REGISTER 117
+#define FIRST_PSEUDO_REGISTER 149
 
 /* This must be included for pre gcc 3.0 glibc compatibility.  */
 #define PRE_GCC3_DWARF_FRAME_REGISTERS 77
 
-/* Add 32 dwarf columns for synthetic SPE registers.  */
-#define DWARF_FRAME_REGISTERS ((FIRST_PSEUDO_REGISTER - 4) + 32)
+/* True if register is an SPE High register.  */
+#define SPE_HIGH_REGNO_P(N) \
+  ((N) >= FIRST_SPE_HIGH_REGNO && (N) <= LAST_SPE_HIGH_REGNO)
+
+/* SPE high registers added as hard regs.
+   The sfp register and 3 HTM registers
+   aren't included in DWARF_FRAME_REGISTERS.  */
+#define DWARF_FRAME_REGISTERS (FIRST_PSEUDO_REGISTER - 4)
 
 /* The SPE has an additional 32 synthetic registers, with DWARF debug
    info numbering for these registers starting at 1200.  While eh_frame
    register numbering need not be the same as the debug info numbering,
-   we choose to number these regs for eh_frame at 1200 too.  This allows
-   future versions of the rs6000 backend to add hard registers and
-   continue to use the gcc hard register numbering for eh_frame.  If the
-   extra SPE registers in eh_frame were numbered starting from the
-   current value of FIRST_PSEUDO_REGISTER, then if FIRST_PSEUDO_REGISTER
-   changed we'd need to introduce a mapping in DWARF_FRAME_REGNUM to
-   avoid invalidating older SPE eh_frame info.
+   we choose to number these regs for eh_frame at 1200 too.
 
    We must map them here to avoid huge unwinder tables mostly consisting
    of unused space.  */
 #define DWARF_REG_TO_UNWIND_COLUMN(r) \
-  ((r) > 1200 ? ((r) - 1200 + (DWARF_FRAME_REGISTERS - 32)) : (r))
+  ((r) >= 1200 ? ((r) - 1200 + (DWARF_FRAME_REGISTERS - 32)) : (r))
 
 /* Use standard DWARF numbering for DWARF debugging information.  */
 #define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number (REGNO)
 
 /* Use gcc hard register numbering for eh_frame.  */
-#define DWARF_FRAME_REGNUM(REGNO) (REGNO)
+#define DWARF_FRAME_REGNUM(REGNO) \
+  (SPE_HIGH_REGNO_P (REGNO) ? ((REGNO) - FIRST_SPE_HIGH_REGNO + 1200) : (REGNO))
 
 /* Map register numbers held in the call frame info that gcc has
    collected using DWARF_FRAME_REGNUM to those that should be output in
@@ -992,7 +993,10 @@ enum data_align { align_abi, align_opt, align_both };
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
    1, 1                                                   \
-   , 1, 1, 1, 1, 1, 1                             \
+   , 1, 1, 1, 1, 1, 1,                            \
+   /* SPE High registers.  */                     \
+   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
+   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1  \
 }
 
 /* 1 for registers not available across function calls.
@@ -1012,7 +1016,10 @@ enum data_align { align_abi, align_opt, align_both };
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
    1, 1                                                   \
-   , 1, 1, 1, 1, 1, 1                             \
+   , 1, 1, 1, 1, 1, 1,                            \
+   /* SPE High registers.  */                     \
+   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
+   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1  \
 }
 
 /* Like `CALL_USED_REGISTERS' except this macro doesn't require that
@@ -1031,7 +1038,10 @@ enum data_align { align_abi, align_opt, align_both };
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
    0, 0                                                   \
-   , 0, 0, 0, 0, 0, 0                             \
+   , 0, 0, 0, 0, 0, 0,                            \
+   /* SPE High registers.  */                     \
+   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
+   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  \
 }
 
 #define TOTAL_ALTIVEC_REGS     (LAST_ALTIVEC_REGNO - FIRST_ALTIVEC_REGNO + 1)
@@ -1114,7 +1124,10 @@ enum data_align { align_abi, align_opt, align_both };
    96, 95, 94, 93, 92, 91,                                     \
    108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97,    \
    109, 110,                                                   \
-   111, 112, 113, 114, 115, 116                                        \
+   111, 112, 113, 114, 115, 116,                               \
+   117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,  \
+   129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140,  \
+   141, 142, 143, 144, 145, 146, 147, 148                      \
 }
 
 /* True if register is floating-point.  */
@@ -1349,6 +1362,7 @@ enum reg_class
   CR_REGS,
   NON_FLOAT_REGS,
   CA_REGS,
+  SPE_HIGH_REGS,
   ALL_REGS,
   LIM_REG_CLASSES
 };
@@ -1380,6 +1394,7 @@ enum reg_class
   "CR_REGS",                                                           \
   "NON_FLOAT_REGS",                                                    \
   "CA_REGS",                                                           \
+  "SPE_HIGH_REGS",                                                     \
   "ALL_REGS"                                                           \
 }
 
@@ -1387,30 +1402,54 @@ enum reg_class
    This is an initializer for a vector of HARD_REG_SET
    of length N_REG_CLASSES.  */
 
-#define REG_CLASS_CONTENTS                                                  \
-{                                                                           \
-  { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* NO_REGS */         \
-  { 0xfffffffe, 0x00000000, 0x00000008, 0x00020000 }, /* BASE_REGS */       \
-  { 0xffffffff, 0x00000000, 0x00000008, 0x00020000 }, /* GENERAL_REGS */     \
-  { 0x00000000, 0xffffffff, 0x00000000, 0x00000000 }, /* FLOAT_REGS */       \
-  { 0x00000000, 0x00000000, 0xffffe000, 0x00001fff }, /* ALTIVEC_REGS */     \
-  { 0x00000000, 0xffffffff, 0xffffe000, 0x00001fff }, /* VSX_REGS */        \
-  { 0x00000000, 0x00000000, 0x00000000, 0x00002000 }, /* VRSAVE_REGS */             \
-  { 0x00000000, 0x00000000, 0x00000000, 0x00004000 }, /* VSCR_REGS */       \
-  { 0x00000000, 0x00000000, 0x00000000, 0x00008000 }, /* SPE_ACC_REGS */     \
-  { 0x00000000, 0x00000000, 0x00000000, 0x00010000 }, /* SPEFSCR_REGS */     \
-  { 0x00000000, 0x00000000, 0x00000000, 0x00040000 }, /* SPR_REGS */     \
-  { 0xffffffff, 0xffffffff, 0x00000008, 0x00020000 }, /* NON_SPECIAL_REGS */ \
-  { 0x00000000, 0x00000000, 0x00000002, 0x00000000 }, /* LINK_REGS */       \
-  { 0x00000000, 0x00000000, 0x00000004, 0x00000000 }, /* CTR_REGS */        \
-  { 0x00000000, 0x00000000, 0x00000006, 0x00000000 }, /* LINK_OR_CTR_REGS */ \
-  { 0x00000000, 0x00000000, 0x00000006, 0x00002000 }, /* SPECIAL_REGS */     \
-  { 0xffffffff, 0x00000000, 0x0000000e, 0x00022000 }, /* SPEC_OR_GEN_REGS */ \
-  { 0x00000000, 0x00000000, 0x00000010, 0x00000000 }, /* CR0_REGS */        \
-  { 0x00000000, 0x00000000, 0x00000ff0, 0x00000000 }, /* CR_REGS */         \
-  { 0xffffffff, 0x00000000, 0x00000ffe, 0x00020000 }, /* NON_FLOAT_REGS */   \
-  { 0x00000000, 0x00000000, 0x00001000, 0x00000000 }, /* CA_REGS */         \
-  { 0xffffffff, 0xffffffff, 0xfffffffe, 0x0007ffff }  /* ALL_REGS */        \
+#define REG_CLASS_CONTENTS                                             \
+{                                                                      \
+  /* NO_REGS.  */                                                      \
+  { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },      \
+  /* BASE_REGS.  */                                                    \
+  { 0xfffffffe, 0x00000000, 0x00000008, 0x00020000, 0x00000000 },      \
+  /* GENERAL_REGS.  */                                                 \
+  { 0xffffffff, 0x00000000, 0x00000008, 0x00020000, 0x00000000 },      \
+  /* FLOAT_REGS.  */                                                   \
+  { 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000 },      \
+  /* ALTIVEC_REGS.  */                                                 \
+  { 0x00000000, 0x00000000, 0xffffe000, 0x00001fff, 0x00000000 },      \
+  /* VSX_REGS.  */                                                     \
+  { 0x00000000, 0xffffffff, 0xffffe000, 0x00001fff, 0x00000000 },      \
+  /* VRSAVE_REGS.  */                                                  \
+  { 0x00000000, 0x00000000, 0x00000000, 0x00002000, 0x00000000 },      \
+  /* VSCR_REGS.  */                                                    \
+  { 0x00000000, 0x00000000, 0x00000000, 0x00004000, 0x00000000 },      \
+  /* SPE_ACC_REGS.  */                                                 \
+  { 0x00000000, 0x00000000, 0x00000000, 0x00008000, 0x00000000 },      \
+  /* SPEFSCR_REGS.  */                                                 \
+  { 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000 },      \
+  /* SPR_REGS.  */                                                     \
+  { 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0x00000000 },      \
+  /* NON_SPECIAL_REGS.  */                                             \
+  { 0xffffffff, 0xffffffff, 0x00000008, 0x00020000, 0x00000000 },      \
+  /* LINK_REGS.  */                                                    \
+  { 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000 },      \
+  /* CTR_REGS.  */                                                     \
+  { 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000 },      \
+  /* LINK_OR_CTR_REGS.  */                                             \
+  { 0x00000000, 0x00000000, 0x00000006, 0x00000000, 0x00000000 },      \
+  /* SPECIAL_REGS.  */                                                 \
+  { 0x00000000, 0x00000000, 0x00000006, 0x00002000, 0x00000000 },      \
+  /* SPEC_OR_GEN_REGS.  */                                             \
+  { 0xffffffff, 0x00000000, 0x0000000e, 0x00022000, 0x00000000 },      \
+  /* CR0_REGS.  */                                                     \
+  { 0x00000000, 0x00000000, 0x00000010, 0x00000000, 0x00000000 },      \
+  /* CR_REGS.  */                                                      \
+  { 0x00000000, 0x00000000, 0x00000ff0, 0x00000000, 0x00000000 },      \
+  /* NON_FLOAT_REGS.  */                                               \
+  { 0xffffffff, 0x00000000, 0x00000ffe, 0x00020000, 0x00000000 },      \
+  /* CA_REGS.  */                                                      \
+  { 0x00000000, 0x00000000, 0x00001000, 0x00000000, 0x00000000 },      \
+  /* SPE_HIGH_REGS.  */                                                        \
+  { 0x00000000, 0x00000000, 0x00000000, 0xffe00000, 0x001fffff },      \
+  /* ALL_REGS.  */                                                     \
+  { 0xffffffff, 0xffffffff, 0xfffffffe, 0xffe7ffff, 0x001fffff }       \
 }
 
 /* The same information, inverted:
@@ -2349,6 +2388,39 @@ extern char rs6000_reg_names[][8];       /* register names (0 vs. %r0).  */
   &rs6000_reg_names[114][0],   /* tfhar  */                            \
   &rs6000_reg_names[115][0],   /* tfiar  */                            \
   &rs6000_reg_names[116][0],   /* texasr  */                           \
+                                                                       \
+  &rs6000_reg_names[117][0],   /* SPE rh0.  */                         \
+  &rs6000_reg_names[118][0],   /* SPE rh1.  */                         \
+  &rs6000_reg_names[119][0],   /* SPE rh2.  */                         \
+  &rs6000_reg_names[120][0],   /* SPE rh3.  */                         \
+  &rs6000_reg_names[121][0],   /* SPE rh4.  */                         \
+  &rs6000_reg_names[122][0],   /* SPE rh5.  */                         \
+  &rs6000_reg_names[123][0],   /* SPE rh6.  */                         \
+  &rs6000_reg_names[124][0],   /* SPE rh7.  */                         \
+  &rs6000_reg_names[125][0],   /* SPE rh8.  */                         \
+  &rs6000_reg_names[126][0],   /* SPE rh9.  */                         \
+  &rs6000_reg_names[127][0],   /* SPE rh10.  */                        \
+  &rs6000_reg_names[128][0],   /* SPE rh11.  */                        \
+  &rs6000_reg_names[129][0],   /* SPE rh12.  */                        \
+  &rs6000_reg_names[130][0],   /* SPE rh13.  */                        \
+  &rs6000_reg_names[131][0],   /* SPE rh14.  */                        \
+  &rs6000_reg_names[132][0],   /* SPE rh15.  */                        \
+  &rs6000_reg_names[133][0],   /* SPE rh16.  */                        \
+  &rs6000_reg_names[134][0],   /* SPE rh17.  */                        \
+  &rs6000_reg_names[135][0],   /* SPE rh18.  */                        \
+  &rs6000_reg_names[136][0],   /* SPE rh19.  */                        \
+  &rs6000_reg_names[137][0],   /* SPE rh20.  */                        \
+  &rs6000_reg_names[138][0],   /* SPE rh21.  */                        \
+  &rs6000_reg_names[139][0],   /* SPE rh22.  */                        \
+  &rs6000_reg_names[140][0],   /* SPE rh22.  */                        \
+  &rs6000_reg_names[141][0],   /* SPE rh24.  */                        \
+  &rs6000_reg_names[142][0],   /* SPE rh25.  */                        \
+  &rs6000_reg_names[143][0],   /* SPE rh26.  */                        \
+  &rs6000_reg_names[144][0],   /* SPE rh27.  */                        \
+  &rs6000_reg_names[145][0],   /* SPE rh28.  */                        \
+  &rs6000_reg_names[146][0],   /* SPE rh29.  */                        \
+  &rs6000_reg_names[147][0],   /* SPE rh30.  */                        \
+  &rs6000_reg_names[148][0],   /* SPE rh31.  */                        \
 }
 
 /* Table of additional register names to use in user input.  */
@@ -2404,7 +2476,17 @@ extern char rs6000_reg_names[][8];       /* register names (0 vs. %r0).  */
   {"vs56", 101},{"vs57", 102},{"vs58", 103},{"vs59", 104},      \
   {"vs60", 105},{"vs61", 106},{"vs62", 107},{"vs63", 108},     \
   /* Transactional Memory Facility (HTM) Registers.  */                \
-  {"tfhar",  114}, {"tfiar",  115}, {"texasr",  116} }
+  {"tfhar",  114}, {"tfiar",  115}, {"texasr",  116},          \
+  /* SPE high registers.  */                                   \
+  {"rh0",  117}, {"rh1",  118}, {"rh2",  119}, {"rh3",  120},  \
+  {"rh4",  121}, {"rh5",  122}, {"rh6",  123}, {"rh7",  124},  \
+  {"rh8",  125}, {"rh9",  126}, {"rh10", 127}, {"rh11", 128},  \
+  {"rh12", 129}, {"rh13", 130}, {"rh14", 131}, {"rh15", 132},  \
+  {"rh16", 133}, {"rh17", 134}, {"rh18", 135}, {"rh19", 136},  \
+  {"rh20", 137}, {"rh21", 138}, {"rh22", 139}, {"rh23", 140},  \
+  {"rh24", 141}, {"rh25", 142}, {"rh26", 143}, {"rh27", 144},  \
+  {"rh28", 145}, {"rh29", 146}, {"rh30", 147}, {"rh31", 148},  \
+}
 
 /* This is how to output an element of a case-vector that is relative.  */
 
index 26d0d15..bc49447 100644 (file)
@@ -56,6 +56,8 @@
    (TFHAR_REGNO                        114)
    (TFIAR_REGNO                        115)
    (TEXASR_REGNO               116)
+   (FIRST_SPE_HIGH_REGNO       117)
+   (LAST_SPE_HIGH_REGNO                148)
   ])
 
 ;;
 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
 
 (define_insn "*movdi_internal64"
-  [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,r,?*wg,r,?*wm")
-       (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,*wg,r,*wm,r"))]
+  [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,r,?*wg,r,?*wm,?*wm")
+       (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,*wg,r,*wm,r,O"))]
   "TARGET_POWERPC64
    && (gpc_reg_operand (operands[0], DImode)
        || gpc_reg_operand (operands[1], DImode))"
    mftgpr %0,%1
    mffgpr %0,%1
    mfvsrd %0,%x1
-   mtvsrd %x0,%1"
+   mtvsrd %x0,%1
+   xxlxor %x0,%x0,%x0"
   [(set_attr_alternative "type"
       [(if_then_else
         (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
        (const_string "mftgpr")
        (const_string "mffgpr")
        (const_string "mftgpr")
-       (const_string "mffgpr")])
-   (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4,4")])
+       (const_string "mffgpr")
+       (const_string "vecsimple")])
+   (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4,4,4")])
 
 ;; Generate all one-bits and clear left or right.
 ;; Use (and:DI (rotate:DI ...)) to avoid anddi3 unnecessary clobber.
index d04e6e4..d1f7dea 100644 (file)
@@ -292,7 +292,7 @@ do {                                                                        \
 /* An expression for the alignment of a structure field FIELD if the
    alignment computed in the usual way is COMPUTED.  */
 #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED)                                  \
-       ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE)     \
+       (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED))            \
         ? 128 : COMPUTED)
 
 #undef  BIGGEST_FIELD_ALIGNMENT
@@ -949,3 +949,19 @@ ncrtn.o%s"
 #define TARGET_USES_SYSV4_OPT 1
 
 #undef DBX_REGISTER_NUMBER
+
+/* Link -lasan early on the command line.  For -static-libasan, don't link
+   it for -shared link, the executable should be compiled with -static-libasan
+   in that case, and for executable link link with --{,no-}whole-archive around
+   it to force everything into the executable.  And similarly for -ltsan.  */
+#if defined(HAVE_LD_STATIC_DYNAMIC)
+#undef LIBASAN_EARLY_SPEC
+#define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \
+  "%{static-libasan:%{!shared:" \
+  LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \
+  LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}"
+#undef LIBTSAN_EARLY_SPEC
+#define LIBTSAN_EARLY_SPEC "%{static-libtsan:%{!shared:" \
+  LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \
+  LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}"
+#endif
index 31f2e1f..73bb880 100644 (file)
       rtx mem_rtx = MEM_P (op) ? op : SUBREG_REG (op);
       rtx x = XEXP (mem_rtx, 0);
 
+      if (! ALLOW_INDEXED_ADDRESS
+         && GET_CODE (x) == PLUS && REG_P (XEXP (x, 0)) && REG_P (XEXP (x, 1)))
+       return false;
+
       if ((mode == QImode || mode == HImode)
          && GET_CODE (x) == PLUS
          && REG_P (XEXP (x, 0))
       rtx mem_rtx = MEM_P (op) ? op : SUBREG_REG (op);
       rtx x = XEXP (mem_rtx, 0);
 
+      if (! ALLOW_INDEXED_ADDRESS
+         && GET_CODE (x) == PLUS && REG_P (XEXP (x, 0)) && REG_P (XEXP (x, 1)))
+       return false;
+
       if ((mode == QImode || mode == HImode)
          && GET_CODE (x) == PLUS
          && REG_P (XEXP (x, 0))
index 12724a2..62dcf0c 100644 (file)
@@ -10207,6 +10207,10 @@ sh_legitimate_index_p (enum machine_mode mode, rtx op, bool consider_sh2a,
 static bool
 sh_legitimate_address_p (enum machine_mode mode, rtx x, bool strict)
 {
+  if (! ALLOW_INDEXED_ADDRESS
+      && GET_CODE (x) == PLUS && REG_P (XEXP (x, 0)) && REG_P (XEXP (x, 1)))
+    return false;
+
   if (REG_P (x) && REGNO (x) == GBR_REG)
     return true;
 
@@ -10436,6 +10440,28 @@ sh_legitimize_reload_address (rtx *p, enum machine_mode mode, int opnum,
   enum reload_type type = (enum reload_type) itype;
   const int mode_sz = GET_MODE_SIZE (mode);
 
+  if (! ALLOW_INDEXED_ADDRESS
+      && GET_CODE (*p) == PLUS
+      && REG_P (XEXP (*p, 0)) && REG_P (XEXP (*p, 1)))
+    {
+      *p = copy_rtx (*p);
+      push_reload (*p, NULL_RTX, p, NULL,
+                  BASE_REG_CLASS, Pmode, VOIDmode, 0, 0, opnum, type);
+      return true;
+    }
+
+  if (! ALLOW_INDEXED_ADDRESS
+      && GET_CODE (*p) == PLUS
+      && GET_CODE (XEXP (*p, 0)) == PLUS)
+    {
+      rtx sum = gen_rtx_PLUS (Pmode, XEXP (XEXP (*p, 0), 0),
+                                    XEXP (XEXP (*p, 0), 1));
+      *p = gen_rtx_PLUS (Pmode, sum, XEXP (*p, 1));
+      push_reload (sum, NULL_RTX, &XEXP (*p, 0), NULL,
+                  BASE_REG_CLASS, Pmode, VOIDmode, 0, 0, opnum, type);
+      return true;
+    }
+
   if (TARGET_SHMEDIA)
     return false;
 
index e6e237f..98ac0d3 100644 (file)
   "stbar"
   [(set_attr "type" "multi")])
 
+;; For LEON3, STB has the effect of membar #StoreLoad.
+(define_insn "*membar_storeload_leon3"
+  [(set (match_operand:BLK 0 "" "")
+       (unspec:BLK [(match_dup 0) (const_int 2)] UNSPEC_MEMBAR))]
+  "TARGET_LEON3"
+  "stb\t%%g0, [%%sp-1]"
+  [(set_attr "type" "store")])
+
 ;; For V8, LDSTUB has the effect of membar #StoreLoad.
 (define_insn "*membar_storeload"
   [(set (match_operand:BLK 0 "" "")
        (unspec:BLK [(match_dup 0) (const_int 2)] UNSPEC_MEMBAR))]
-  "TARGET_V8"
+  "TARGET_V8 && !TARGET_LEON3"
   "ldstub\t[%%sp-1], %%g0"
   [(set_attr "type" "multi")])
 
index b0a474d..297f2af 100644 (file)
@@ -1,3 +1,34 @@
+2014-08-07  Jason Merrill  <jason@redhat.com>
+
+       PR c++/61959
+       * semantics.c (cxx_eval_bare_aggregate): Handle POINTER_PLUS_EXPR.
+
+       PR c++/61994
+       * init.c (build_vec_init): Leave atype an ARRAY_TYPE
+       if we're just returning an INIT_EXPR.
+
+       PR c++/60872
+       * call.c (standard_conversion): Don't try to apply restrict to void.
+
+       PR c++/58714
+       * tree.c (stabilize_expr): A stabilized prvalue is an xvalue.
+
+2014-08-01  Igor Zamyatin  <igor.zamyatin@intel.com>
+
+       * cp-array-notation.c (expand_an_in_modify_expr): Fix the misprint
+       in error output.
+
+2014-08-01  Igor Zamyatin  <igor.zamyatin@intel.com>
+
+       PR other/61963
+       * parser.c (cp_parser_array_notation): Added check for array_type.
+
+2014-08-01  Igor Zamyatin  <igor.zamyatin@intel.com>
+
+       PR middle-end/61455
+       * cp-array-notation.c (expand_array_notation_exprs): Handling of
+       DECL_EXPR improved. Changed handling for INIT_EXPR.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index 7c11a53..cd053f0 100644 (file)
@@ -1208,9 +1208,10 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
               && TREE_CODE (TREE_TYPE (from)) != FUNCTION_TYPE)
        {
          tree nfrom = TREE_TYPE (from);
+         /* Don't try to apply restrict to void.  */
+         int quals = cp_type_quals (nfrom) & ~TYPE_QUAL_RESTRICT;
          from = build_pointer_type
-           (cp_build_qualified_type (void_type_node, 
-                                     cp_type_quals (nfrom)));
+           (cp_build_qualified_type (void_type_node, quals));
          conv = build_conv (ck_ptr, from, conv);
        }
       else if (TYPE_PTRDATAMEM_P (from))
index fed60c9..de9cc40 100644 (file)
@@ -607,7 +607,7 @@ expand_an_in_modify_expr (location_t location, tree lhs,
     
   if (lhs_rank == 0 && rhs_rank != 0)
     {
-      error_at (location, "%qD cannot be scalar when %qD is not", lhs, rhs);
+      error_at (location, "%qE cannot be scalar when %qE is not", lhs, rhs);
       return error_mark_node;
     }
   if (lhs_rank != 0 && rhs_rank != 0 && lhs_rank != rhs_rank)
@@ -1147,13 +1147,13 @@ expand_array_notation_exprs (tree t)
     case PARM_DECL:
     case NON_LVALUE_EXPR:
     case NOP_EXPR:
-    case INIT_EXPR:
     case ADDR_EXPR:
     case ARRAY_REF:
     case BIT_FIELD_REF:
     case VECTOR_CST:
     case COMPLEX_CST:
       return t;
+    case INIT_EXPR:
     case MODIFY_EXPR:
       if (contains_array_notation_expr (t))
        t = expand_an_in_modify_expr (loc, TREE_OPERAND (t, 0), NOP_EXPR, 
@@ -1175,13 +1175,24 @@ expand_array_notation_exprs (tree t)
        return t;
       }
     case DECL_EXPR:
-      {
-       tree x = DECL_EXPR_DECL (t);
-       if (t && TREE_CODE (x) != FUNCTION_DECL)
+      if (contains_array_notation_expr (t))
+       {
+         tree x = DECL_EXPR_DECL (t);
          if (DECL_INITIAL (x))
-           t = expand_unary_array_notation_exprs (t);
+           {
+             location_t loc = DECL_SOURCE_LOCATION (x);
+             tree lhs = x;
+             tree rhs = DECL_INITIAL (x);
+             DECL_INITIAL (x) = NULL;
+             tree new_modify_expr = build_modify_expr (loc, lhs,
+                                                       TREE_TYPE (lhs),
+                                                       NOP_EXPR,
+                                                       loc, rhs,
+                                                       TREE_TYPE(rhs));
+             t = expand_array_notation_exprs (new_modify_expr);
+           }
+       }
       return t;
-      }
     case STATEMENT_LIST:
       {
        tree_stmt_iterator i;
index 960c39c..e772164 100644 (file)
@@ -3846,6 +3846,13 @@ build_vec_init (tree base, tree maxindex, tree init,
 
   stmt_expr = finish_init_stmts (is_global, stmt_expr, compound_stmt);
 
+  current_stmt_tree ()->stmts_are_full_exprs_p = destroy_temps;
+
+  if (errors)
+    return error_mark_node;
+  if (const_init)
+    return build2 (INIT_EXPR, atype, obase, const_init);
+
   /* Now make the result have the correct type.  */
   if (TREE_CODE (atype) == ARRAY_TYPE)
     {
@@ -3855,12 +3862,6 @@ build_vec_init (tree base, tree maxindex, tree init,
       TREE_NO_WARNING (stmt_expr) = 1;
     }
 
-  current_stmt_tree ()->stmts_are_full_exprs_p = destroy_temps;
-
-  if (const_init)
-    return build2 (INIT_EXPR, atype, obase, const_init);
-  if (errors)
-    return error_mark_node;
   return stmt_expr;
 }
 
index 054f160..e6f9430 100644 (file)
@@ -6306,7 +6306,7 @@ cp_parser_array_notation (location_t loc, cp_parser *parser, tree *init_index,
   parser->colon_corrects_to_scope_p = saved_colon_corrects;
 
   if (*init_index == error_mark_node || length_index == error_mark_node
-      || stride == error_mark_node)
+      || stride == error_mark_node || array_type == error_mark_node)
     {
       if (cp_lexer_peek_token (parser->lexer)->type == CPP_CLOSE_SQUARE)
        cp_lexer_consume_token (parser->lexer);
index d6f3a73..352fe3c 100644 (file)
@@ -8955,7 +8955,9 @@ cxx_eval_bare_aggregate (const constexpr_call *call, tree t,
          constructor_elt *inner = base_field_constructor_elt (n, ce->index);
          inner->value = elt;
        }
-      else if (ce->index && TREE_CODE (ce->index) == NOP_EXPR)
+      else if (ce->index
+              && (TREE_CODE (ce->index) == NOP_EXPR
+                  || TREE_CODE (ce->index) == POINTER_PLUS_EXPR))
        {
          /* This is an initializer for an empty base; now that we've
             checked that it's constant, we can ignore it.  */
index 622ba99..2820ba0 100644 (file)
@@ -3795,6 +3795,10 @@ stabilize_expr (tree exp, tree* initp)
     {
       init_expr = get_target_expr (exp);
       exp = TARGET_EXPR_SLOT (init_expr);
+      if (CLASS_TYPE_P (TREE_TYPE (exp)))
+       exp = move (exp);
+      else
+       exp = rvalue (exp);
     }
   else
     {
index 3989eb7..b3b7ad2 100644 (file)
@@ -6585,7 +6585,7 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos,
        {
          HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (exp));
          rtx temp_target;
-         if (mode == BLKmode)
+         if (mode == BLKmode || mode == VOIDmode)
            mode = smallest_mode_for_size (size * BITS_PER_UNIT, MODE_INT);
          temp_target = gen_reg_rtx (mode);
          emit_group_store (temp_target, temp, TREE_TYPE (exp), size);
index c705bce..b6a2651 100644 (file)
@@ -1,3 +1,18 @@
+2014-08-10  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       Backport from trunk
+       PR fortran/61999
+       * simplify.c (gfc_simplify_dot_product): Convert types of
+       vectors before calculating the result.
+
+2014-07-19  Paul Thomas  <pault@gcc.gnu.org>
+
+       Backport from mainline
+       PR fortran/61780
+       * dependency.c (gfc_dep_resolver): Index the 'reverse' array so
+       that elements are skipped. This then correctly aligns 'reverse'
+       with the scalarizer loops.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index a24a470..f9b975a 100644 (file)
@@ -2023,6 +2023,7 @@ int
 gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse)
 {
   int n;
+  int m;
   gfc_dependency fin_dep;
   gfc_dependency this_dep;
 
@@ -2072,6 +2073,8 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse)
              break;
            }
 
+         /* Index for the reverse array.  */
+         m = -1;
          for (n=0; n < lref->u.ar.dimen; n++)
            {
              /* Handle dependency when either of array reference is vector
@@ -2118,38 +2121,44 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse)
                 The ability to reverse or not is set by previous conditions
                 in this dimension.  If reversal is not activated, the
                 value GFC_DEP_BACKWARD is reset to GFC_DEP_OVERLAP.  */
+
+             /* Get the indexing right for the scalarizing loop. If this
+                is an element, there is no corresponding loop.  */
+             if (lref->u.ar.dimen_type[n] != DIMEN_ELEMENT)
+               m++;
+
              if (rref->u.ar.dimen_type[n] == DIMEN_RANGE
                    && lref->u.ar.dimen_type[n] == DIMEN_RANGE)
                {
                  /* Set reverse if backward dependence and not inhibited.  */
-                 if (reverse && reverse[n] == GFC_ENABLE_REVERSE)
-                   reverse[n] = (this_dep == GFC_DEP_BACKWARD) ?
-                                GFC_REVERSE_SET : reverse[n];
+                 if (reverse && reverse[m] == GFC_ENABLE_REVERSE)
+                   reverse[m] = (this_dep == GFC_DEP_BACKWARD) ?
+                                GFC_REVERSE_SET : reverse[m];
 
                  /* Set forward if forward dependence and not inhibited.  */
-                 if (reverse && reverse[n] == GFC_ENABLE_REVERSE)
-                   reverse[n] = (this_dep == GFC_DEP_FORWARD) ?
-                                GFC_FORWARD_SET : reverse[n];
+                 if (reverse && reverse[m] == GFC_ENABLE_REVERSE)
+                   reverse[m] = (this_dep == GFC_DEP_FORWARD) ?
+                                GFC_FORWARD_SET : reverse[m];
 
                  /* Flag up overlap if dependence not compatible with
                     the overall state of the expression.  */
-                 if (reverse && reverse[n] == GFC_REVERSE_SET
+                 if (reverse && reverse[m] == GFC_REVERSE_SET
                        && this_dep == GFC_DEP_FORWARD)
                    {
-                     reverse[n] = GFC_INHIBIT_REVERSE;
+                     reverse[m] = GFC_INHIBIT_REVERSE;
                      this_dep = GFC_DEP_OVERLAP;
                    }
-                 else if (reverse && reverse[n] == GFC_FORWARD_SET
+                 else if (reverse && reverse[m] == GFC_FORWARD_SET
                        && this_dep == GFC_DEP_BACKWARD)
                    {
-                     reverse[n] = GFC_INHIBIT_REVERSE;
+                     reverse[m] = GFC_INHIBIT_REVERSE;
                      this_dep = GFC_DEP_OVERLAP;
                    }
 
                  /* If no intention of reversing or reversing is explicitly
                     inhibited, convert backward dependence to overlap.  */
                  if ((reverse == NULL && this_dep == GFC_DEP_BACKWARD)
-                     || (reverse != NULL && reverse[n] == GFC_INHIBIT_REVERSE))
+                     || (reverse != NULL && reverse[m] == GFC_INHIBIT_REVERSE))
                    this_dep = GFC_DEP_OVERLAP;
                }
 
index 96d0f21..d205523 100644 (file)
@@ -1878,13 +1878,22 @@ gfc_simplify_dim (gfc_expr *x, gfc_expr *y)
 gfc_expr*
 gfc_simplify_dot_product (gfc_expr *vector_a, gfc_expr *vector_b)
 {
+
+  gfc_expr temp;
+
   if (!is_constant_array_expr (vector_a)
       || !is_constant_array_expr (vector_b))
     return NULL;
 
   gcc_assert (vector_a->rank == 1);
   gcc_assert (vector_b->rank == 1);
-  gcc_assert (gfc_compare_types (&vector_a->ts, &vector_b->ts));
+
+  temp.expr_type = EXPR_OP;
+  gfc_clear_ts (&temp.ts);
+  temp.value.op.op = INTRINSIC_NONE;
+  temp.value.op.op1 = vector_a;
+  temp.value.op.op2 = vector_b;
+  gfc_type_convert_binary (&temp, 1);
 
   return compute_dot_product (vector_a, 1, 0, vector_b, 1, 0, true);
 }
index 7614e6f..7a9faaa 100644 (file)
@@ -2865,7 +2865,10 @@ Parse::function_lit()
   // For a function literal, the next token must be a '{'.  If we
   // don't see that, then we may have a type expression.
   if (!this->peek_token()->is_op(OPERATOR_LCURLY))
-    return Expression::make_type(type, location);
+    {
+      hold_enclosing_vars.swap(this->enclosing_vars_);
+      return Expression::make_type(type, location);
+    }
 
   bool hold_is_erroneous_function = this->is_erroneous_function_;
   if (fntype_is_error)
index 2d66e5c..653cb82 100644 (file)
@@ -2972,7 +2972,7 @@ advance_one_cycle (void)
 {
   advance_state (curr_state);
   if (sched_verbose >= 6)
-    fprintf (sched_dump, ";;\tAdvanced a state.\n");
+    fprintf (sched_dump, ";;\tAdvance the current state.\n");
 }
 
 /* Update register pressure after scheduling INSN.  */
@@ -6007,6 +6007,7 @@ schedule_block (basic_block *target_bb, state_t init_state)
   modulo_insns_scheduled = 0;
 
   ls.modulo_epilogue = false;
+  ls.first_cycle_insn_p = true;
 
   /* Loop until all the insns in BB are scheduled.  */
   while ((*current_sched_info->schedule_more_p) ())
@@ -6077,7 +6078,6 @@ schedule_block (basic_block *target_bb, state_t init_state)
       if (must_backtrack)
        goto do_backtrack;
 
-      ls.first_cycle_insn_p = true;
       ls.shadows_only_p = false;
       cycle_issued_insns = 0;
       ls.can_issue_more = issue_rate;
@@ -6363,11 +6363,13 @@ schedule_block (basic_block *target_bb, state_t init_state)
              break;
            }
        }
+      ls.first_cycle_insn_p = true;
     }
   if (ls.modulo_epilogue)
     success = true;
  end_schedule:
-  advance_one_cycle ();
+  if (!ls.first_cycle_insn_p)
+    advance_one_cycle ();
   perform_replacements_new_cycle ();
   if (modulo_ii > 0)
     {
index 3970081..3691ab8 100644 (file)
@@ -5752,6 +5752,20 @@ remove_inheritance_pseudos (bitmap remove_pseudos)
                        SUBREG_REG (SET_SRC (set)) = SET_SRC (prev_set);
                      else
                        SET_SRC (set) = SET_SRC (prev_set);
+                     /* As we are finishing with processing the insn
+                        here, check the destination too as it might
+                        inheritance pseudo for another pseudo.  */
+                     if (bitmap_bit_p (remove_pseudos, dregno)
+                         && bitmap_bit_p (&lra_inheritance_pseudos, dregno)
+                         && (restore_regno
+                             = lra_reg_info[dregno].restore_regno) >= 0)
+                       {
+                         if (GET_CODE (SET_DEST (set)) == SUBREG)
+                           SUBREG_REG (SET_DEST (set))
+                             = regno_reg_rtx[restore_regno];
+                         else
+                           SET_DEST (set) = regno_reg_rtx[restore_regno];
+                       }
                      lra_push_insn_and_update_insn_regno_info (curr_insn);
                      lra_set_used_insn_alternative_by_uid
                        (INSN_UID (curr_insn), -1);
index a605c45..1753cad 100644 (file)
@@ -1872,7 +1872,6 @@ create_omp_child_function (omp_context *ctx, bool task_copy)
   TREE_STATIC (decl) = 1;
   TREE_USED (decl) = 1;
   DECL_ARTIFICIAL (decl) = 1;
-  DECL_NAMELESS (decl) = 1;
   DECL_IGNORED_P (decl) = 0;
   TREE_PUBLIC (decl) = 0;
   DECL_UNINLINABLE (decl) = 1;
index efc4223..df29bd3 100644 (file)
@@ -2750,7 +2750,8 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx insn)
           Consider for instance a volatile asm that changes the fpu rounding
           mode.  An insn should not be moved across this even if it only uses
           pseudo-regs because it might give an incorrectly rounded result.  */
-       if (code != ASM_OPERANDS || MEM_VOLATILE_P (x))
+       if ((code != ASM_OPERANDS || MEM_VOLATILE_P (x))
+           && !DEBUG_INSN_P (insn))
          reg_pending_barrier = TRUE_BARRIER;
 
        /* For all ASM_OPERANDS, we must traverse the vector of input operands.
index e383be4..7a351f2 100644 (file)
@@ -1,3 +1,183 @@
+2014-08-10  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       Backport from trunk
+       PR fortran/61999
+       * gfortran.dg/dot_product_3.f90:  New test case.
+
+2014-08-07  John David Anglin  <danglin@gcc.gnu.org>
+
+       PR tree-optimization/60707
+       * gfortran.dg/pr45636.f90: xfail on 32-bit hppa*-*-*.
+
+       * gcc.dg/atomic/c11-atomic-exec-4.c: Undefine _POSIX_C_SOURCE before
+       defining in dg-options.
+       * gcc.dg/atomic/c11-atomic-exec-5.c: Likewise.
+
+       * gcc.dg/atomic/stdatomic-flag.c: Add xfail comment.
+
+       * gcc.c-torture/compile/pr60655-1.c: Don't add -fdata-sections option
+       on 32-bit hppa-hpux.
+
+       * gcc.dg/pr57233.c: Add -fno-common option on hppa*-*-hpux*.
+
+2014-08-07  Petr Murzin  <petr.murzin@intel.com>
+
+       * gcc.target/i386/avx512f-vfixupimmpd-2.c: Include float.h instead of
+       values.h, change MAXDOUBLE for DBL_MAX.
+       * gcc.target/i386/avx512f-vfixupimmsd-2.c: Ditto.
+       * gcc.target/i386/avx512f-vfixupimmps-2.c: Include float.h instead of
+       values.h, change MAXFLOAT for FLT_MAX.
+       * gcc.target/i386/avx512f-vfixupimmss-2.c: Ditto.
+       * gcc.target/i386/avx512f-vpermi2d-2.c: Do not include values.h.
+       * gcc.target/i386/avx512f-vpermi2pd-2.c: Ditto.
+       * gcc.target/i386/avx512f-vpermi2ps-2.c: Ditto.
+       * gcc.target/i386/avx512f-vpermi2q-2.c: Ditto.
+       * gcc.target/i386/avx512f-vpermt2d-2.c: Ditto.
+       * gcc.target/i386/avx512f-vpermt2pd-2.c: Ditto.
+       * gcc.target/i386/avx512f-vpermt2ps-2.c: Ditto.
+       * gcc.target/i386/avx512f-vpermt2q-2.c: Ditto.
+
+2014-08-06  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR debug/61923
+       * gcc.target/i386/pr61923.c: New test.
+
+2014-08-06  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/61801
+       * gcc.target/i386/pr61801.c: Rewritten.
+
+2014-08-04  Rohit  <rohitarulraj@freescale.com>
+
+       PR target/60102
+       * gcc.target/powerpc/pr60102.c: New testcase.
+
+2014-08-01  Igor Zamyatin  <igor.zamyatin@intel.com>
+
+       PR other/61963
+       * c-c++-common/cilk-plus/AN/pr61963.c: New test.
+
+2014-08-01  Igor Zamyatin  <igor.zamyatin@intel.com>
+
+       PR middle-end/61455
+       * c-c++-common/cilk-plus/AN/pr61455.c: New test.
+       * c-c++-common/cilk-plus/AN/pr61455-2.c: Likewise.
+
+2014-08-01  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       Backport from mainline
+       2014-06-13  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       PR tree-optimization/61375
+       * gcc.c-torture/execute/pr61375-1.c: New test.
+
+2014-08-01  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/61964
+       * gcc.dg/torture/pr61964.c: New testcase.
+       * gcc.dg/pr51879-18.c: XFAIL.
+
+2014-07-28  Richard Biener  <rguenther@suse.de>
+
+       PR rtl-optimization/61801
+       * gcc.target/i386/pr61801.c: Fix testcase.
+
+2014-07-28  Richard Biener  <rguenther@suse.de>
+
+       PR rtl-optimization/61801
+       * gcc.target/i386/pr61801.c: New testcase.
+
+2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       Backport from mainline
+       2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       * gcc.target/powerpc/ppc64-abi-warn-3.c: New test.
+
+       * gcc.c-torture/execute/20050316-1.x: Add -Wno-psabi.
+       * gcc.c-torture/execute/20050604-1.x: Add -Wno-psabi.
+       * gcc.c-torture/execute/20050316-3.x: New file.  Add -Wno-psabi.
+       * gcc.c-torture/execute/pr23135.x: Likewise.
+
+2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       Backport from mainline
+       2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       * gcc.target/powerpc/ppc64-abi-warn-2.c: New test.
+
+2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       Backport from mainline
+       2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       * gcc.target/powerpc/ppc64-abi-warn-1.c: New test.
+
+2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       Backport from mainline
+       2014-07-24  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       * g++.dg/compat/struct-layout-1.exp: Load g++-dg.exp.
+
+2014-07-24  Martin Jambor  <mjambor@suse.cz>
+
+       PR ipa/61160
+       * g++.dg/ipa/pr61160-2.C (main): Return zero.
+       * g++.dg/ipa/pr61160-3.C (main): Likewise.
+
+2014-07-21  Uros Bizjak  <ubizjak@gmail.com>
+
+       Backport from mainline
+       2014-07-21  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/61855
+       * gcc.target/i386/pr61855.c: New test.
+
+2014-07-20  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/pack20.ad[sb]: New test.
+       * gnat.dg/pack20_pkg.ads: New helper.
+
+2014-07-19  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc.dg/stack-usage-2.c: Adjust.
+
+2014-07-19  Paul Thomas  <pault@gcc.gnu.org>
+
+       Backport from mainline
+       PR fortran/61780
+       * gfortran.dg/dependency_44.f90 : New test
+
+2014-07-18  Uros Bizjak  <ubizjak@gmail.com>
+
+       Backport from mainline
+       2014-07-18  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/61794
+       * gcc.target/i386/pr61794.c: New test.
+
+2014-07-17  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2014-07-10  Richard Biener  <rguenther@suse.de>
+
+       PR c-family/61741
+       * c-c++-common/torture/pr61741.c: Use signed char.
+
+       2014-07-09  Richard Biener  <rguenther@suse.de>
+
+       PR c-family/61741
+       * c-c++-common/torture/pr61741.c: New testcase.
+
+2014-07-17  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2014-07-14  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/61779
+       * gcc.dg/tree-ssa/ssa-copyprop-2.c: New testcase.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
        2014-06-09  Alan Lawrence  <alan.lawrence@arm.com>
 
        PR target/61062
-       * gcc.target/arm/pr48252.c (main): Expect same result as endian-neutral.
+       * gcc.target/arm/pr48252.c (main): Expect same result as
+       endian-neutral.
 
 2014-07-08  Jakub Jelinek  <jakub@redhat.com>
 
 
 2014-07-08  Alan Lawrence  <alan.lawrence@arm.com>
 
-        Backport r211502 from mainline.
-        2014-06-10  Alan Lawrence  <alan.lawrence@arm.com>
+       Backport r211502 from mainline.
+       2014-06-10  Alan Lawrence  <alan.lawrence@arm.com>
 
        PR target/59843
        * gcc.dg/vect/vect-singleton_1.c: New file.
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/pr61455-2.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr61455-2.c
new file mode 100644 (file)
index 0000000..60b4248
--- /dev/null
@@ -0,0 +1,13 @@
+/* PR c++/61455 */
+/* { dg-options "-fcilkplus" } */
+
+int a[3] = {2, 3, 4};
+
+int main ()
+{
+  int c = 10;
+  int b = __sec_reduce_add(a[:]);
+  if (b+c != 19)
+    __builtin_abort();
+  return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/pr61455.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr61455.c
new file mode 100644 (file)
index 0000000..35a11b6
--- /dev/null
@@ -0,0 +1,9 @@
+/* PR c++/61455 */
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+void foo ()
+{
+  int a[2];
+  int b = a[:]; /* { dg-error "cannot be scalar" } */
+}
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/pr61963.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr61963.c
new file mode 100644 (file)
index 0000000..dfa713c
--- /dev/null
@@ -0,0 +1,9 @@
+/* PR other/61963 */
+/* { dg-do compile } */
+/* { dg-options "-fcilkplus" } */
+
+void f (int * int *a) /* { dg-error "expected" } */
+{
+    a[0:64] = 0; /* { dg-error "was not declared" "" { target c++ } 7 } */
+    a[0:64] = 0;
+}
diff --git a/gcc/testsuite/c-c++-common/pr61741.c b/gcc/testsuite/c-c++-common/pr61741.c
new file mode 100644 (file)
index 0000000..a2bc4bd
--- /dev/null
@@ -0,0 +1,22 @@
+/* { dg-do run } */
+
+int a = 1, b;
+
+void
+foo (void)
+{
+  signed char c = 0;
+  for (; a; a--)
+    for (; c >= 0; c++);
+  if (!c)
+    b = 1;
+}
+
+int
+main ()
+{
+  foo ();
+  if (b != 0)
+    __builtin_abort ();
+  return 0;
+}
index 13211c2..4c7d4c4 100644 (file)
@@ -89,6 +89,9 @@ proc compat-use-tst-compiler { } {
 # This must be done after the compat-use-*-compiler definitions.
 load_lib compat.exp
 
+# Provide the g++-dg-prune routine (gcc-dp.exp is loaded by compat.exp)
+load_lib g++-dg.exp
+
 g++_init
 
 # Save variables for the C++ compiler under test, which each test will
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array7.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array7.C
new file mode 100644 (file)
index 0000000..8f74675
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/61994
+// { dg-do compile { target c++11 } }
+
+struct A { int i,j; };
+
+struct X {
+  A a = {1,1};
+};
+
+constexpr X table[1][1] = {{ {} }};
+
+#define SA(X) static_assert(X,#X)
+SA(table[0][0].a.i == 1);
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-empty7.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-empty7.C
new file mode 100644 (file)
index 0000000..f491994
--- /dev/null
@@ -0,0 +1,28 @@
+// PR c++/61959
+// { dg-do compile { target c++11 } }
+
+template <class Coord> struct BasePoint
+{
+  Coord x, y;
+  constexpr BasePoint (Coord, Coord) : x (0), y (0) {}
+};
+template <class T> struct BaseCoord
+{
+  int value;
+  constexpr BaseCoord (T) : value (1) {}
+};
+template <class units> struct IntCoordTyped : BaseCoord<int>, units
+{
+  typedef BaseCoord Super;
+  constexpr IntCoordTyped (int) : Super (0) {}
+};
+template <class units>
+struct IntPointTyped : BasePoint<IntCoordTyped<units> >, units
+{
+  typedef BasePoint<IntCoordTyped<units> > Super;
+  constexpr IntPointTyped (int, int) : Super (0, 0) {}
+};
+struct A
+{
+};
+IntPointTyped<A> a (0, 0);
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv-cond1.C b/gcc/testsuite/g++.dg/cpp0x/rv-cond1.C
new file mode 100644 (file)
index 0000000..a8f598f
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/58714
+// { dg-do compile { target c++11 } }
+
+struct X {
+  X& operator=(const X&) = delete;
+  X& operator=(X&& ) = default;
+};
+
+void f(bool t) {
+  X a, b;
+  *(t ? &a : &b) = X();
+  (t ? a : b) = X();
+}
diff --git a/gcc/testsuite/g++.dg/expr/cond12.C b/gcc/testsuite/g++.dg/expr/cond12.C
new file mode 100644 (file)
index 0000000..9134f81
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/58714
+// { dg-do run }
+
+struct X {
+    X& operator=(const X&){}
+    X& operator=(X&){__builtin_abort();}
+};
+
+int main(int argv,char**) {
+  X a, b;
+  ((argv > 2) ? a : b) = X();
+}
diff --git a/gcc/testsuite/g++.dg/ext/restrict2.C b/gcc/testsuite/g++.dg/ext/restrict2.C
new file mode 100644 (file)
index 0000000..f053210
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/60872
+// { dg-options "" }
+
+typedef double *__restrict T;
+void f(T* p)
+{
+  void *p2 = p;
+}
index a0fbb5f..69bd6a6 100644 (file)
@@ -27,5 +27,6 @@ void *test (MMixin & anExample)
 int main ()
 {
   CExample c;
-  return (test (c) != &c);
+  test (c);
+  return 0;
 }
index 1011bd1..dd925d2 100644 (file)
@@ -39,5 +39,6 @@ void *test (MMixin & anExample)
 int main ()
 {
   CExample c;
-  return (test (c) != &c);
+  test (c);
+  return 0;
 }
index 6f84f6e..1e1e460 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-options "-fdata-sections" } */
+/* { dg-options "-fdata-sections" { target { ! { { hppa*-*-hpux* } && { ! lp64 } } } } } */
 
 typedef unsigned char unit;
 typedef unit *unitptr;
index 121fcfe..cb2d28f 100644 (file)
@@ -4,4 +4,5 @@ if { [check_effective_target_int16] } {
        return 1
 }
 
+set additional_flags "-Wno-psabi"
 return 0;
diff --git a/gcc/testsuite/gcc.c-torture/execute/20050316-3.x b/gcc/testsuite/gcc.c-torture/execute/20050316-3.x
new file mode 100644 (file)
index 0000000..cb7b119
--- /dev/null
@@ -0,0 +1,2 @@
+set additional_flags "-Wno-psabi"
+return 0
index f5b4aaa..756242d 100644 (file)
@@ -6,4 +6,5 @@ if { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
        set additional_flags "-mno-mmx"
 }
 
+set additional_flags "-Wno-psabi"
 return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr23135.x b/gcc/testsuite/gcc.c-torture/execute/pr23135.x
new file mode 100644 (file)
index 0000000..cb7b119
--- /dev/null
@@ -0,0 +1,2 @@
+set additional_flags "-Wno-psabi"
+return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr61375.c b/gcc/testsuite/gcc.c-torture/execute/pr61375.c
new file mode 100644 (file)
index 0000000..6fb4693
--- /dev/null
@@ -0,0 +1,35 @@
+#ifdef __UINT64_TYPE__
+typedef __UINT64_TYPE__ uint64_t;
+#else
+typedef unsigned long long uint64_t;
+#endif
+
+#ifndef __SIZEOF_INT128__
+#define __int128 long long
+#endif
+
+/* Some version of bswap optimization would ICE when analyzing a mask constant
+   too big for an HOST_WIDE_INT (PR61375).  */
+
+__attribute__ ((noinline, noclone)) uint64_t
+uint128_central_bitsi_ior (unsigned __int128 in1, uint64_t in2)
+{
+  __int128 mask = (__int128)0xffff << 56;
+  return ((in1 & mask) >> 56) | in2;
+}
+
+int
+main (int argc)
+{
+  __int128 in = 1;
+#ifdef __SIZEOF_INT128__
+  in <<= 64;
+#endif
+  if (sizeof (uint64_t) * __CHAR_BIT__ != 64)
+    return 0;
+  if (sizeof (unsigned __int128) * __CHAR_BIT__ != 128)
+    return 0;
+  if (uint128_central_bitsi_ior (in, 2) != 0x102)
+    __builtin_abort ();
+  return 0;
+}
index 1558200..b03d2c8 100644 (file)
@@ -2,7 +2,7 @@
    operating properly when operations on the same variable are carried
    out in two threads.  */
 /* { dg-do run } */
-/* { dg-options "-std=c11 -pedantic-errors -pthread -D_POSIX_C_SOURCE=200809L" } */
+/* { dg-options "-std=c11 -pedantic-errors -pthread -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L" } */
 /* { dg-additional-options "-D_XOPEN_SOURCE=600" { target *-*-solaris2.1[0-9]* } }
 /* { dg-require-effective-target pthread } */
 
index bc87de4..e3e0aae 100644 (file)
@@ -3,7 +3,7 @@
    iterations of the compare-and-exchange loop are needed, exceptions
    get properly cleared).  */
 /* { dg-do run } */
-/* { dg-options "-std=c11 -pedantic-errors -pthread -D_POSIX_C_SOURCE=200809L" } */
+/* { dg-options "-std=c11 -pedantic-errors -pthread -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L" } */
 /* { dg-additional-options "-D_XOPEN_SOURCE=600" { target *-*-solaris2.1[0-9]* } }
 /* { dg-require-effective-target fenv_exceptions } */
 /* { dg-require-effective-target pthread } */
index c1a63f1..515d5d8 100644 (file)
@@ -1,4 +1,5 @@
 /* Test atomic_flag routines for existence and execution.  */
+/* The test needs a lockless atomic implementation.  */
 /* { dg-do run { xfail hppa*-*-hpux* } } */
 /* { dg-options "-std=c11 -pedantic-errors" } */
 
index 95629f1..9b3cb80 100644 (file)
@@ -13,5 +13,5 @@ void bar (int c, int *p)
     *q = foo ();
 }
 
-/* { dg-final { scan-tree-dump-times "foo \\(" 1 "pre"} } */
+/* { dg-final { scan-tree-dump-times "foo \\(" 1 "pre" { xfail *-*-* } } } */
 /* { dg-final { cleanup-tree-dump "pre" } } */
index 58c0534..484844e 100644 (file)
@@ -1,6 +1,7 @@
 /* PR tree-optimization/57233 */
 /* { dg-do run { target { ilp32 || lp64 } } } */
 /* { dg-options "-O2" } */
+/* { dg-additional-options "-fno-common" { target hppa*-*-hpux* } } */
 
 typedef unsigned V4 __attribute__((vector_size(4 * sizeof (int))));
 typedef unsigned V8 __attribute__((vector_size(8 * sizeof (int))));
index d3c17a8..df7e55f 100644 (file)
@@ -1,33 +1,32 @@
 /* { dg-do compile } */
 /* { dg-options "-Wstack-usage=512" } */
 
-int foo1 (void)
+int foo1 (void)  /* { dg-bogus "stack usage" } */
 {
   char arr[16];
   arr[0] = 1;
   return 0;
-} /* { dg-bogus "stack usage" } */
+}
 
-int foo2 (void)
+int foo2 (void)  /* { dg-warning "stack usage is \[0-9\]* bytes" } */
 {
   char arr[1024];
   arr[0] = 1;
   return 0;
-} /* { dg-warning "stack usage is \[0-9\]* bytes" } */
+}
 
-int foo3 (void)
+int foo3 (void) /* { dg-warning "stack usage might be \[0-9\]* bytes" } */
 {
   char arr[1024] __attribute__((aligned (512)));
   arr[0] = 1;
   /* Force dynamic realignment of argument pointer.  */
   __builtin_apply ((void (*)()) foo2, 0, 0);
   return 0;
+}
 
-} /* { dg-warning "stack usage might be \[0-9\]* bytes" } */
-
-int foo4 (int n)
+int foo4 (int n) /* { dg-warning "stack usage might be unbounded" } */
 {
   char arr[n];
   arr[0] = 1;
   return 0;
-} /* { dg-warning "stack usage might be unbounded" } */
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr61964.c b/gcc/testsuite/gcc.dg/torture/pr61964.c
new file mode 100644 (file)
index 0000000..a03cfdc
--- /dev/null
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+
+extern void abort (void);
+
+struct node { struct node *next, *prev; } node;
+struct head { struct node *first; } heads[5];
+int k = 2;
+struct head *head = &heads[2];
+
+static int __attribute__((noinline))
+foo()
+{
+  node.prev = (void *)head;
+  head->first = &node;
+
+  struct node *n = head->first;
+  struct head *h = &heads[k];
+
+  if (n->prev == (void *)h)
+    h->first = n->next;
+  else
+    n->prev->next = n->next;
+
+  n->next = h->first;
+  return n->next == &node;
+}
+
+int main()
+{
+  if (foo ())
+    abort ();
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-copyprop-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-copyprop-2.c
new file mode 100644 (file)
index 0000000..9757013
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-Og -fdump-tree-optimized" } */
+
+extern long long __sdt_unsp;
+void
+f(void)
+{
+  for (;;)
+    __asm__ ("%0" :: "i" (((!__extension__ (__builtin_constant_p ((((unsigned long long) (__typeof (__builtin_choose_expr (((__builtin_classify_type (0) + 3) & -4) == 4, (0), 0U))) __sdt_unsp) ) == 0) )) ? 1 : -1) ));
+}
+
+/* { dg-final { scan-tree-dump-not "PHI" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
index d4ddd32..995b446 100644 (file)
@@ -10,7 +10,8 @@
 #define SIZE (AVX512F_LEN / 64)
 #include "avx512f-mask-type.h"
 #include "math.h"
-#include "values.h"
+#include "float.h"
+
 
 static void
 CALC (double *r, double src, long long tbl)
@@ -60,10 +61,10 @@ CALC (double *r, double src, long long tbl)
       *r = M_PI_2;
       break;
     case 14:
-      *r = MAXDOUBLE;
+      *r = DBL_MAX;
       break;
     case 15:
-      *r = -MAXDOUBLE;
+      *r = -DBL_MAX;
       break;
     default:
       abort ();
index 6c2539d..edb149c 100644 (file)
@@ -10,7 +10,7 @@
 #define SIZE (AVX512F_LEN / 32)
 #include "avx512f-mask-type.h"
 #include "math.h"
-#include "values.h"
+#include "float.h"
 
 static void
 CALC (float *r, float src, int tbl)
@@ -60,10 +60,10 @@ CALC (float *r, float src, int tbl)
       *r = M_PI_2;
       break;
     case 14:
-      *r = MAXFLOAT;
+      *r = FLT_MAX;
       break;
     case 15:
-      *r = -MAXFLOAT;
+      *r = -FLT_MAX;
       break;
     default:
       abort ();
index 1344c7f..1b66a98 100644 (file)
@@ -6,7 +6,7 @@
 #include "avx512f-check.h"
 #include "avx512f-helper.h"
 #include <math.h>
-#include <values.h>
+#include <float.h>
 #include "avx512f-mask-type.h"
 
 void
@@ -57,10 +57,10 @@ compute_fixupimmpd (double *r, double src, long long tbl)
       *r = M_PI_2;
       break;
     case 14:
-      *r = MAXDOUBLE;
+      *r = DBL_MAX;
       break;
     case 15:
-      *r = -MAXDOUBLE;
+      *r = -DBL_MAX;
       break;
     default:
       abort ();
index 25e165f..87883ba 100644 (file)
@@ -6,7 +6,7 @@
 #include "avx512f-check.h"
 #include "avx512f-helper.h"
 #include <math.h>
-#include <values.h>
+#include <float.h>
 #include "avx512f-mask-type.h"
 
 void
@@ -57,10 +57,10 @@ compute_fixupimmps (float *r, float src, int tbl)
       *r = M_PI_2;
       break;
     case 14:
-      *r = MAXFLOAT;
+      *r = FLT_MAX;
       break;
     case 15:
-      *r = -MAXFLOAT;
+      *r = -FLT_MAX;
       break;
     default:
       abort ();
index 9aa104b..6205cc5 100644 (file)
@@ -9,7 +9,6 @@
 #define SIZE (AVX512F_LEN / 32)
 #include "avx512f-mask-type.h"
 #include "math.h"
-#include "values.h"
 
 static void
 CALC (int *dst, int *src1, int *ind, int *src2)
index a2daca0..0bb5b4c 100644 (file)
@@ -9,7 +9,6 @@
 #define SIZE (AVX512F_LEN / 64)
 #include "avx512f-mask-type.h"
 #include "math.h"
-#include "values.h"
 
 static void
 CALC (double *dst, double *src1, long long *ind, double *src2)
index 56215cf..f8038ef 100644 (file)
@@ -9,7 +9,6 @@
 #define SIZE (AVX512F_LEN / 32)
 #include "avx512f-mask-type.h"
 #include "math.h"
-#include "values.h"
 
 static void
 CALC (float *dst, float *src1, int *ind, float *src2)
index 9d7b9be..0268afb 100644 (file)
@@ -9,7 +9,6 @@
 #define SIZE (AVX512F_LEN / 64)
 #include "avx512f-mask-type.h"
 #include "math.h"
-#include "values.h"
 
 static void
 CALC (long long *dst, long long *src1, long long *ind, long long *src2)
index ef8d195..bba108a 100644 (file)
@@ -9,7 +9,6 @@
 #define SIZE (AVX512F_LEN / 32)
 #include "avx512f-mask-type.h"
 #include "math.h"
-#include "values.h"
 
 static void
 CALC (int *dst, int *src1, int *ind, int *src2)
index 511a470..4891c85 100644 (file)
@@ -9,7 +9,6 @@
 #define SIZE (AVX512F_LEN / 64)
 #include "avx512f-mask-type.h"
 #include "math.h"
-#include "values.h"
 
 static void
 CALC (double *dst, double *src1, long long *ind, double *src2)
index cd35d12..a3d57c4 100644 (file)
@@ -9,7 +9,6 @@
 #define SIZE (AVX512F_LEN / 32)
 #include "avx512f-mask-type.h"
 #include "math.h"
-#include "values.h"
 
 static void
 CALC (float *dst, float *src1, int *ind, float *src2)
index 5f449ad..57fe3d4 100644 (file)
@@ -9,7 +9,6 @@
 #define SIZE (AVX512F_LEN / 64)
 #include "avx512f-mask-type.h"
 #include "math.h"
-#include "values.h"
 
 static void
 CALC (long long *dst, long long *src1, long long *ind, long long *src2)
diff --git a/gcc/testsuite/gcc.target/i386/pr61794.c b/gcc/testsuite/gcc.target/i386/pr61794.c
new file mode 100644 (file)
index 0000000..5f8e7d0
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f" } */
+
+#include <x86intrin.h>
+
+__m512i zmm;
+__m128i xmm;
+
+void test (void)
+{
+  xmm = _mm512_extracti32x4_epi32 (zmm, 0);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr61801.c b/gcc/testsuite/gcc.target/i386/pr61801.c
new file mode 100644 (file)
index 0000000..d0d08cc
--- /dev/null
@@ -0,0 +1,21 @@
+/* PR rtl-optimization/61801 */
+/* { dg-do compile } */
+/* { dg-options "-Os -fcompare-debug" } */
+
+int a, c;
+int bar (void);
+void baz (void);
+
+void
+foo (void)
+{
+  int d;
+  if (bar ())
+    {
+      int e;
+      baz ();
+      asm volatile ("" : "=a" (e) : "0" (a), "i" (0));
+      d = e;
+    }
+  c = d;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr61855.c b/gcc/testsuite/gcc.target/i386/pr61855.c
new file mode 100644 (file)
index 0000000..09c62ae
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f" } */
+
+#include <x86intrin.h>
+
+__m512 test (__m512 x)
+{
+  return _mm512_getmant_ps(x, _MM_MANT_NORM_1_2, _MM_MANT_SIGN_zero);
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/pr61923.c b/gcc/testsuite/gcc.target/i386/pr61923.c
new file mode 100644 (file)
index 0000000..458158c
--- /dev/null
@@ -0,0 +1,36 @@
+/* PR debug/61923 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcompare-debug" } */
+
+typedef struct
+{
+  struct
+  {
+    struct
+    {
+      char head;
+    } tickets;
+  };
+} arch_spinlock_t;
+struct ext4_map_blocks
+{
+  int m_lblk;
+  int m_len;
+  int m_flags;
+};
+int ext4_da_map_blocks_ei_0;
+void fn1 (int p1, struct ext4_map_blocks *p2)
+{
+  int ret;
+  if (p2->m_flags)
+    {
+      ext4_da_map_blocks_ei_0++;
+      arch_spinlock_t *lock;
+      switch (sizeof *&lock->tickets.head)
+      case 1:
+      asm("" : "+m"(*&lock->tickets.head) : ""(0));
+      __asm__("");
+      ret = 0;
+    }
+  fn2 (p2->m_lblk, p2->m_len);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c
new file mode 100644 (file)
index 0000000..6e0d548
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
+/* { dg-options "-mabi=elfv2" } */
+
+struct f8
+  {
+    float x[8];
+  };
+
+void test (struct f8 a, struct f8 b) /* { dg-message "note: the ABI of passing homogeneous float aggregates will change" } */
+{
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c
new file mode 100644 (file)
index 0000000..c4820e9
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
+
+struct test
+  {
+    long a __attribute__((aligned (16)));
+  };
+
+void test (struct test a) /* { dg-message "note: the ABI of passing aggregates with 16-byte alignment will change" } */
+{
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c
new file mode 100644 (file)
index 0000000..830de6b
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-maltivec" } */
+
+struct test
+  {
+    int a __attribute__((vector_size (8)));
+  }; /* { dg-message "note: the layout of aggregates containing vectors with 8-byte alignment will change" } */
+
diff --git a/gcc/testsuite/gcc.target/powerpc/pr60102.c b/gcc/testsuite/gcc.target/powerpc/pr60102.c
new file mode 100644 (file)
index 0000000..d32e41d
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-skip-if "not an SPE target" { ! powerpc_spe_nocache } { "*" } { "" } } */
+/* { dg-options "-mcpu=8548 -mspe -mabi=spe -g -mfloat-gprs=double" } */
+
+double
+pr60102 (double x, int m)
+{
+  double y;
+  y =  m % 2 ? x : 1;
+  return y;
+}
diff --git a/gcc/testsuite/gfortran.dg/dependency_44.f90 b/gcc/testsuite/gfortran.dg/dependency_44.f90
new file mode 100644 (file)
index 0000000..ebfeec6
--- /dev/null
@@ -0,0 +1,36 @@
+! { dg-do run }
+! Tests fix for PR61780 in which the loop reversal mechanism was
+! not accounting for the first index being an element so that no
+! loop in this dimension is created.
+!
+! Contributed by Manfred Tietze on clf.
+!
+program prgm3
+    implicit none
+    integer, parameter :: n = 10, k = 3
+    integer :: i, j
+    integer, dimension(n,n) :: y
+    integer :: res1(n), res2(n)
+
+1   format(10i5)
+
+!initialize
+    do i=1,n
+        do j=1,n
+            y(i,j) = n*i + j
+        end do
+    end do
+    res2 = y(k,:)
+
+!shift right
+    y(k,4:n) = y(k,3:n-1)
+    y(k,3) = 0
+    res1 = y(k,:)
+    y(k,:) = res2
+    y(k,n:4:-1) = y(k,n-1:3:-1)
+    y(k,3) = 0
+    res2 = y(k,:)
+!    print *, res1
+!    print *, res2
+    if (any(res1 /= res2)) call abort ()
+end program prgm3
diff --git a/gcc/testsuite/gfortran.dg/dot_product_3.f90 b/gcc/testsuite/gfortran.dg/dot_product_3.f90
new file mode 100644 (file)
index 0000000..6e11556
--- /dev/null
@@ -0,0 +1,15 @@
+! { dg-do compile }
+! { dg-options "-fdump-tree-original" }
+! PR 61999 - this used to ICE.
+! Original test case by A. Kasahara
+program main
+   use, intrinsic:: iso_fortran_env, only: output_unit
+
+   implicit none
+
+   write(output_unit, *) dot_product([1, 2], [2.0, 3.0])
+
+   stop
+end program main
+! { dg-final { scan-tree-dump-times "8\\.0e\\+0" 1 "original" } }
+! { dg-final { cleanup-tree-dump "original" } }
index ee7cf38..c80dda4 100644 (file)
@@ -10,5 +10,5 @@ program main
   b = y
   call sub(a, b)
 end program main
-! { dg-final { scan-tree-dump-times "memset" 0 "forwprop2" { xfail { mips*-*-* && { ! nomips16 } } } } }
+! { dg-final { scan-tree-dump-times "memset" 0 "forwprop2" { xfail { { hppa*-*-* && { ! lp64 } } || { mips*-*-* && { ! nomips16 } } } } } }
 ! { dg-final { cleanup-tree-dump "forwprop2" } }
diff --git a/gcc/testsuite/gnat.dg/pack20.adb b/gcc/testsuite/gnat.dg/pack20.adb
new file mode 100644 (file)
index 0000000..5ec3e93
--- /dev/null
@@ -0,0 +1,9 @@
+package body Pack20 is
+
+   procedure Proc (A : Rec) is
+      Local : Rec := A;
+   begin
+      Modify (Local.Fixed);
+   end;
+
+end Pack20;
diff --git a/gcc/testsuite/gnat.dg/pack20.ads b/gcc/testsuite/gnat.dg/pack20.ads
new file mode 100644 (file)
index 0000000..ddfb9d8
--- /dev/null
@@ -0,0 +1,15 @@
+-- { dg-do compile }
+
+with Pack20_Pkg; use Pack20_Pkg;
+
+package Pack20 is
+
+   type Rec is record
+      Simple_Type  : Integer;
+      Fixed        : String_Ptr;
+   end record;
+   pragma Pack (Rec);
+
+   procedure Proc (A : Rec);
+
+end Pack20;
diff --git a/gcc/testsuite/gnat.dg/pack20_pkg.ads b/gcc/testsuite/gnat.dg/pack20_pkg.ads
new file mode 100644 (file)
index 0000000..8f3c554
--- /dev/null
@@ -0,0 +1,7 @@
+package Pack20_Pkg is
+
+   type String_Ptr is access all String;
+
+   procedure Modify (Fixed : in out String_Ptr);
+
+end Pack20_Pkg;
index 0f7d452..d646faf 100644 (file)
@@ -1052,16 +1052,19 @@ output_stack_usage (void)
 
   if (warn_stack_usage >= 0)
     {
+      const location_t loc = DECL_SOURCE_LOCATION (current_function_decl);
+
       if (stack_usage_kind == DYNAMIC)
-       warning (OPT_Wstack_usage_, "stack usage might be unbounded");
+       warning_at (loc, OPT_Wstack_usage_, "stack usage might be unbounded");
       else if (stack_usage > warn_stack_usage)
        {
          if (stack_usage_kind == DYNAMIC_BOUNDED)
-           warning (OPT_Wstack_usage_, "stack usage might be %wd bytes",
-                    stack_usage);
+           warning_at (loc,
+                       OPT_Wstack_usage_, "stack usage might be %wd bytes",
+                       stack_usage);
          else
-           warning (OPT_Wstack_usage_, "stack usage is %wd bytes",
-                    stack_usage);
+           warning_at (loc, OPT_Wstack_usage_, "stack usage is %wd bytes",
+                       stack_usage);
        }
     }
 }
index 02f4743..a3d8392 100644 (file)
@@ -235,38 +235,26 @@ copy_prop_visit_cond_stmt (gimple stmt, edge *taken_edge_p)
   enum ssa_prop_result retval = SSA_PROP_VARYING;
   location_t loc = gimple_location (stmt);
 
-  tree op0 = gimple_cond_lhs (stmt);
-  tree op1 = gimple_cond_rhs (stmt);
+  tree op0 = valueize_val (gimple_cond_lhs (stmt));
+  tree op1 = valueize_val (gimple_cond_rhs (stmt));
 
-  /* The only conditionals that we may be able to compute statically
-     are predicates involving two SSA_NAMEs.  */
-  if (TREE_CODE (op0) == SSA_NAME && TREE_CODE (op1) == SSA_NAME)
+  /* See if we can determine the predicate's value.  */
+  if (dump_file && (dump_flags & TDF_DETAILS))
     {
-      op0 = valueize_val (op0);
-      op1 = valueize_val (op1);
-
-      /* See if we can determine the predicate's value.  */
-      if (dump_file && (dump_flags & TDF_DETAILS))
-       {
-         fprintf (dump_file, "Trying to determine truth value of ");
-         fprintf (dump_file, "predicate ");
-         print_gimple_stmt (dump_file, stmt, 0, 0);
-       }
+      fprintf (dump_file, "Trying to determine truth value of ");
+      fprintf (dump_file, "predicate ");
+      print_gimple_stmt (dump_file, stmt, 0, 0);
+    }
 
-      /* We can fold COND and get a useful result only when we have
-        the same SSA_NAME on both sides of a comparison operator.  */
-      if (op0 == op1)
-       {
-         tree folded_cond = fold_binary_loc (loc, gimple_cond_code (stmt),
-                                          boolean_type_node, op0, op1);
-         if (folded_cond)
-           {
-             basic_block bb = gimple_bb (stmt);
-             *taken_edge_p = find_taken_edge (bb, folded_cond);
-             if (*taken_edge_p)
-               retval = SSA_PROP_INTERESTING;
-           }
-       }
+  /* Fold COND and see whether we get a useful result.  */
+  tree folded_cond = fold_binary_loc (loc, gimple_cond_code (stmt),
+                                     boolean_type_node, op0, op1);
+  if (folded_cond)
+    {
+      basic_block bb = gimple_bb (stmt);
+      *taken_edge_p = find_taken_edge (bb, folded_cond);
+      if (*taken_edge_p)
+       retval = SSA_PROP_INTERESTING;
     }
 
   if (dump_file && (dump_flags & TDF_DETAILS) && *taken_edge_p)
index 8bc4e8f..78f036e 100644 (file)
@@ -1679,6 +1679,8 @@ may_be_unaligned_p (tree ref, tree step)
     return false;
 
   unsigned int align = TYPE_ALIGN (TREE_TYPE (ref));
+  if (GET_MODE_ALIGNMENT (TYPE_MODE (TREE_TYPE (ref))) > align)
+    align = GET_MODE_ALIGNMENT (TYPE_MODE (TREE_TYPE (ref)));
 
   unsigned HOST_WIDE_INT bitpos;
   unsigned int ref_align;
index 292ced1..0e8d54d 100644 (file)
@@ -1749,6 +1749,8 @@ find_bswap_1 (gimple stmt, struct symbolic_number *n, int limit)
          size = TYPE_PRECISION (n->type);
          if (size % BITS_PER_UNIT != 0)
            return NULL_TREE;
+         if (size > HOST_BITS_PER_WIDEST_INT)
+           return NULL_TREE;
          size /= BITS_PER_UNIT;
          n->n = (sizeof (HOST_WIDEST_INT) < 8 ? 0 :
                  (unsigned HOST_WIDEST_INT)0x08070605 << 32 | 0x04030201);
@@ -1792,6 +1794,8 @@ find_bswap_1 (gimple stmt, struct symbolic_number *n, int limit)
            type_size = TYPE_PRECISION (type);
            if (type_size % BITS_PER_UNIT != 0)
              return NULL_TREE;
+           if (type_size > (int) HOST_BITS_PER_WIDEST_INT)
+             return NULL_TREE;
 
            /* Sign extension: result is dependent on the value.  */
            old_type_size = TYPE_PRECISION (n->type);
@@ -1932,7 +1936,7 @@ execute_optimize_bswap (void)
   bool changed = false;
   tree bswap16_type = NULL_TREE, bswap32_type = NULL_TREE, bswap64_type = NULL_TREE;
 
-  if (BITS_PER_UNIT != 8)
+  if (BITS_PER_UNIT != 8 || CHAR_BIT != 8)
     return 0;
 
   if (sizeof (HOST_WIDEST_INT) < 8)
index aa7f829..09e9b24 100644 (file)
@@ -1159,17 +1159,9 @@ gimple_equal_p (same_succ same_succ, gimple s1, gimple s2)
       lhs2 = gimple_get_lhs (s2);
       if (TREE_CODE (lhs1) != SSA_NAME
          && TREE_CODE (lhs2) != SSA_NAME)
-       {
-         /* If the vdef is the same, it's the same statement.  */
-         if (vn_valueize (gimple_vdef (s1))
-             == vn_valueize (gimple_vdef (s2)))
-           return true;
-
-         /* Test for structural equality.  */
-         return (operand_equal_p (lhs1, lhs2, 0)
-                 && gimple_operand_equal_value_p (gimple_assign_rhs1 (s1),
-                                                  gimple_assign_rhs1 (s2)));
-       }
+       return (operand_equal_p (lhs1, lhs2, 0)
+               && gimple_operand_equal_value_p (gimple_assign_rhs1 (s1),
+                                                gimple_assign_rhs1 (s2)));
       else if (TREE_CODE (lhs1) == SSA_NAME
               && TREE_CODE (lhs2) == SSA_NAME)
        return vn_valueize (lhs1) == vn_valueize (lhs2);
index 575715b..3bc241c 100644 (file)
@@ -1,3 +1,9 @@
+2014-08-04  Rohit  <rohitarulraj@freescale.com>
+
+       PR target/60102
+       * config/rs6000/linux-unwind.h (ppc_fallback_frame_state): Update
+       based on change in SPE high register numbers and 3 HTM registers.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index c5b006e..ffb4f07 100644 (file)
@@ -274,8 +274,8 @@ ppc_fallback_frame_state (struct _Unwind_Context *context,
 #ifdef __SPE__
   for (i = 14; i < 32; i++)
     {
-      fs->regs.reg[i + FIRST_PSEUDO_REGISTER - 1].how = REG_SAVED_OFFSET;
-      fs->regs.reg[i + FIRST_PSEUDO_REGISTER - 1].loc.offset
+      fs->regs.reg[i + FIRST_SPE_HIGH_REGNO - 4].how = REG_SAVED_OFFSET;
+      fs->regs.reg[i + FIRST_SPE_HIGH_REGNO - 4].loc.offset
        = (long) &regs->vregs - new_cfa + 4 * i;
     }
 #endif
index bd35d8e..89f2c8a 100644 (file)
@@ -1,3 +1,57 @@
+2014-07-31  Janne Blomqvist  <jb@gcc.gnu.org>
+
+       Backport from mainline
+       CVE-2014-5044
+        * libgfortran.h (xmallocarray): New prototype.
+        * runtime/memory.c (xmallocarray): New function.
+        (xcalloc): Check for nonzero separately instead of multiplying.
+        * generated/*.c: Regenerated.
+        * intrinsics/cshift0.c (cshift0): Call xmallocarray instead of
+        xmalloc.
+        * intrinsics/eoshift0.c (eoshift0): Likewise.
+        * intrinsics/eoshift2.c (eoshift2): Likewise.
+        * intrinsics/pack_generic.c (pack_internal): Likewise.
+        (pack_s_internal): Likewise.
+        * intrinsics/reshape_generic.c (reshape_internal): Likewise.
+        * intrinsics/spread_generic.c (spread_internal): Likewise.
+        (spread_internal_scalar): Likewise.
+        * intrinsics/string_intrinsics_inc.c (string_trim): Likewise.
+        (string_minmax): Likewise.
+        * intrinsics/transpose_generic.c (transpose_internal): Likewise.
+        * intrinsics/unpack_generic.c (unpack_internal): Likewise.
+        * io/list_read.c (nml_touch_nodes): Don't cast xmalloc return value.
+        * io/transfer.c (st_set_nml_var): Call xmallocarray instead of
+        xmalloc.
+        * io/unit.c (get_internal_unit): Likewise.
+        (filename_from_unit): Don't cast xmalloc return value.
+        * io/write.c (nml_write_obj): Likewise, formatting.
+        * m4/bessel.m4 (bessel_jn_r'rtype_kind`): Call xmallocarray
+        instead of xmalloc.
+        (besse_yn_r'rtype_kind`): Likewise.
+        * m4/cshift1.m4 (cshift1): Likewise.
+        * m4/eoshift1.m4 (eoshift1): Likewise.
+        * m4/eoshift3.m4 (eoshift3): Likewise.
+        * m4/iforeach.m4: Likewise.
+        * m4/ifunction.m4: Likewise.
+        * m4/ifunction_logical.m4 (name`'rtype_qual`_'atype_code):
+        Likewise.
+        * m4/in_pack.m4 (internal_pack_'rtype_ccode`): Likewise.
+        * m4/matmul.m4 (matmul_'rtype_code`): Likewise.
+        * m4/matmull.m4 (matmul_'rtype_code`): Likewise.
+        * m4/pack.m4 (pack_'rtype_code`): Likewise.
+        * m4/reshape.m4 (reshape_'rtype_ccode`): Likewise.
+        * m4/shape.m4 (shape_'rtype_kind`): Likewise.
+        * m4/spread.m4 (spread_'rtype_code`): Likewise.
+        (spread_scalar_'rtype_code`): Likewise.
+        * m4/transpose.m4 (transpose_'rtype_code`): Likewise.
+        * m4/unpack.m4 (unpack0_'rtype_code`): Likewise.
+        (unpack1_'rtype_code`): Likewise.
+        * runtime/convert_char.c (convert_char1_to_char4): Likewise.
+        (convert_char4_to_char1): Simplify.
+        * runtime/environ.c (init_unformatted): Call xmallocarray instead
+        of xmalloc.
+        * runtime/in_pack_generic.c (internal_pack): Likewise.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index ed95622..0f008b9 100644 (file)
@@ -101,8 +101,7 @@ all_l1 (gfc_array_l1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_LOGICAL_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -111,7 +110,7 @@ all_l1 (gfc_array_l1 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1));
     }
   else
     {
index a23001b..a9f85b4 100644 (file)
@@ -101,8 +101,7 @@ all_l16 (gfc_array_l16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_LOGICAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -111,7 +110,7 @@ all_l16 (gfc_array_l16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16));
     }
   else
     {
index 28235d6..3ef4a1d 100644 (file)
@@ -101,8 +101,7 @@ all_l2 (gfc_array_l2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_LOGICAL_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -111,7 +110,7 @@ all_l2 (gfc_array_l2 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_2));
     }
   else
     {
index 601b7c3..58dab4f 100644 (file)
@@ -101,8 +101,7 @@ all_l4 (gfc_array_l4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_LOGICAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -111,7 +110,7 @@ all_l4 (gfc_array_l4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_4));
     }
   else
     {
index f0041dc..4293aaa 100644 (file)
@@ -101,8 +101,7 @@ all_l8 (gfc_array_l8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_LOGICAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -111,7 +110,7 @@ all_l8 (gfc_array_l8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_8));
     }
   else
     {
index b94c847..46387fd 100644 (file)
@@ -101,8 +101,7 @@ any_l1 (gfc_array_l1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_LOGICAL_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -111,7 +110,7 @@ any_l1 (gfc_array_l1 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1));
     }
   else
     {
index a821352..b29fdd9 100644 (file)
@@ -101,8 +101,7 @@ any_l16 (gfc_array_l16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_LOGICAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -111,7 +110,7 @@ any_l16 (gfc_array_l16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16));
     }
   else
     {
index 7f4eabc..a63c593 100644 (file)
@@ -101,8 +101,7 @@ any_l2 (gfc_array_l2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_LOGICAL_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -111,7 +110,7 @@ any_l2 (gfc_array_l2 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_2));
     }
   else
     {
index 8ec451a..ccd35d7 100644 (file)
@@ -101,8 +101,7 @@ any_l4 (gfc_array_l4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_LOGICAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -111,7 +110,7 @@ any_l4 (gfc_array_l4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_4));
     }
   else
     {
index 47957a7..e089ea8 100644 (file)
@@ -101,8 +101,7 @@ any_l8 (gfc_array_l8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_LOGICAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -111,7 +110,7 @@ any_l8 (gfc_array_l8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_8));
     }
   else
     {
index 980bf84..14b93e9 100644 (file)
@@ -55,7 +55,7 @@ bessel_jn_r10 (gfc_array_r10 * const restrict ret, int n1, int n2, GFC_REAL_10 x
     {
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * size);
+      ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_10));
       ret->offset = 0;
     }
 
@@ -122,7 +122,7 @@ bessel_yn_r10 (gfc_array_r10 * const restrict ret, int n1, int n2,
     {
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * size);
+      ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_10));
       ret->offset = 0;
     }
 
index d5757c9..d64fa9c 100644 (file)
@@ -59,7 +59,7 @@ bessel_jn_r16 (gfc_array_r16 * const restrict ret, int n1, int n2, GFC_REAL_16 x
     {
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * size);
+      ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_16));
       ret->offset = 0;
     }
 
@@ -126,7 +126,7 @@ bessel_yn_r16 (gfc_array_r16 * const restrict ret, int n1, int n2,
     {
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * size);
+      ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_16));
       ret->offset = 0;
     }
 
index 6b6129f..a86bb5f 100644 (file)
@@ -55,7 +55,7 @@ bessel_jn_r4 (gfc_array_r4 * const restrict ret, int n1, int n2, GFC_REAL_4 x)
     {
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * size);
+      ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_4));
       ret->offset = 0;
     }
 
@@ -122,7 +122,7 @@ bessel_yn_r4 (gfc_array_r4 * const restrict ret, int n1, int n2,
     {
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * size);
+      ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_4));
       ret->offset = 0;
     }
 
index a80a766..8401887 100644 (file)
@@ -55,7 +55,7 @@ bessel_jn_r8 (gfc_array_r8 * const restrict ret, int n1, int n2, GFC_REAL_8 x)
     {
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * size);
+      ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_8));
       ret->offset = 0;
     }
 
@@ -122,7 +122,7 @@ bessel_yn_r8 (gfc_array_r8 * const restrict ret, int n1, int n2,
     {
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * size);
+      ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_8));
       ret->offset = 0;
     }
 
index f690236..c6c0b5b 100644 (file)
@@ -101,8 +101,7 @@ count_16_l (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -111,7 +110,7 @@ count_16_l (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index 359a2f9..15d270d 100644 (file)
@@ -101,8 +101,7 @@ count_1_l (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -111,7 +110,7 @@ count_1_l (gfc_array_i1 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
     }
   else
     {
index 0dd51a1..fd9b3d3 100644 (file)
@@ -101,8 +101,7 @@ count_2_l (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -111,7 +110,7 @@ count_2_l (gfc_array_i2 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
     }
   else
     {
index 7879ce8..1e15256 100644 (file)
@@ -101,8 +101,7 @@ count_4_l (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -111,7 +110,7 @@ count_4_l (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index 21516f5..97962a4 100644 (file)
@@ -101,8 +101,7 @@ count_8_l (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -111,7 +110,7 @@ count_8_l (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 77fc3bf..b0cc767 100644 (file)
@@ -80,7 +80,7 @@ cshift1 (gfc_array_char * const restrict ret,
     {
       int i;
 
-      ret->base_addr = xmalloc (size * arraysize);
+      ret->base_addr = xmallocarray (arraysize, size);
       ret->offset = 0;
       ret->dtype = array->dtype;
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
index 8accb4c..5ea8a6a 100644 (file)
@@ -80,7 +80,7 @@ cshift1 (gfc_array_char * const restrict ret,
     {
       int i;
 
-      ret->base_addr = xmalloc (size * arraysize);
+      ret->base_addr = xmallocarray (arraysize, size);
       ret->offset = 0;
       ret->dtype = array->dtype;
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
index 6c809a9..5c4dbc3 100644 (file)
@@ -80,7 +80,7 @@ cshift1 (gfc_array_char * const restrict ret,
     {
       int i;
 
-      ret->base_addr = xmalloc (size * arraysize);
+      ret->base_addr = xmallocarray (arraysize, size);
       ret->offset = 0;
       ret->dtype = array->dtype;
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
index 188589f..566d807 100644 (file)
@@ -105,8 +105,8 @@ eoshift1 (gfc_array_char * const restrict ret,
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
         }
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (size * arraysize);
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (arraysize, size);
 
     }
   else if (unlikely (compile_options.bounds_check))
index 81e8550..bd5faba 100644 (file)
@@ -105,8 +105,8 @@ eoshift1 (gfc_array_char * const restrict ret,
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
         }
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (size * arraysize);
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (arraysize, size);
 
     }
   else if (unlikely (compile_options.bounds_check))
index eff6f76..814f81a 100644 (file)
@@ -105,8 +105,8 @@ eoshift1 (gfc_array_char * const restrict ret,
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
         }
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (size * arraysize);
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (arraysize, size);
 
     }
   else if (unlikely (compile_options.bounds_check))
index fc5203d..5e09df2 100644 (file)
@@ -89,7 +89,7 @@ eoshift3 (gfc_array_char * const restrict ret,
     {
       int i;
 
-      ret->base_addr = xmalloc (size * arraysize);
+      ret->base_addr = xmallocarray (arraysize, size);
       ret->offset = 0;
       ret->dtype = array->dtype;
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
@@ -107,8 +107,8 @@ eoshift3 (gfc_array_char * const restrict ret,
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
         }
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (size * arraysize);
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (arraysize, size);
 
     }
   else if (unlikely (compile_options.bounds_check))
index ee2b568..970402c 100644 (file)
@@ -89,7 +89,7 @@ eoshift3 (gfc_array_char * const restrict ret,
     {
       int i;
 
-      ret->base_addr = xmalloc (size * arraysize);
+      ret->base_addr = xmallocarray (arraysize, size);
       ret->offset = 0;
       ret->dtype = array->dtype;
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
@@ -107,8 +107,8 @@ eoshift3 (gfc_array_char * const restrict ret,
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
         }
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (size * arraysize);
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (arraysize, size);
 
     }
   else if (unlikely (compile_options.bounds_check))
index b2e6d26..991eb91 100644 (file)
@@ -89,7 +89,7 @@ eoshift3 (gfc_array_char * const restrict ret,
     {
       int i;
 
-      ret->base_addr = xmalloc (size * arraysize);
+      ret->base_addr = xmallocarray (arraysize, size);
       ret->offset = 0;
       ret->dtype = array->dtype;
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
@@ -107,8 +107,8 @@ eoshift3 (gfc_array_char * const restrict ret,
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
         }
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (size * arraysize);
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (arraysize, size);
 
     }
   else if (unlikely (compile_options.bounds_check))
index ac36bac..da0ce4d 100644 (file)
@@ -97,10 +97,9 @@ iall_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ miall_i1 (gfc_array_i1 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ miall_i1 (gfc_array_i1 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
     }
   else
@@ -430,8 +428,7 @@ siall_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ siall_i1 (gfc_array_i1 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
     }
   else
     {
index de33361..a3f39d3 100644 (file)
@@ -97,10 +97,9 @@ iall_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ miall_i16 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ miall_i16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -430,8 +428,7 @@ siall_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ siall_i16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index a347036..4ca06a8 100644 (file)
@@ -97,10 +97,9 @@ iall_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ miall_i2 (gfc_array_i2 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ miall_i2 (gfc_array_i2 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
     }
   else
@@ -430,8 +428,7 @@ siall_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ siall_i2 (gfc_array_i2 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
     }
   else
     {
index 55e09b8..8ff15f4 100644 (file)
@@ -97,10 +97,9 @@ iall_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ miall_i4 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ miall_i4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -430,8 +428,7 @@ siall_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ siall_i4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index 9c7f88d..08932d4 100644 (file)
@@ -97,10 +97,9 @@ iall_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ miall_i8 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ miall_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -430,8 +428,7 @@ siall_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ siall_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 2ce620b..999230a 100644 (file)
@@ -97,10 +97,9 @@ iany_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ miany_i1 (gfc_array_i1 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ miany_i1 (gfc_array_i1 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
     }
   else
@@ -430,8 +428,7 @@ siany_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ siany_i1 (gfc_array_i1 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
     }
   else
     {
index 38e28d1..9410db4 100644 (file)
@@ -97,10 +97,9 @@ iany_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ miany_i16 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ miany_i16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -430,8 +428,7 @@ siany_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ siany_i16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index 7a4b79c..7068bb1 100644 (file)
@@ -97,10 +97,9 @@ iany_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ miany_i2 (gfc_array_i2 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ miany_i2 (gfc_array_i2 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
     }
   else
@@ -430,8 +428,7 @@ siany_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ siany_i2 (gfc_array_i2 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
     }
   else
     {
index 126c2fa..62034cf 100644 (file)
@@ -97,10 +97,9 @@ iany_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ miany_i4 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ miany_i4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -430,8 +428,7 @@ siany_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ siany_i4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index ee2a07f..f347d69 100644 (file)
@@ -97,10 +97,9 @@ iany_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ miany_i8 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ miany_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -430,8 +428,7 @@ siany_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ siany_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index ff3bb33..9148af5 100644 (file)
@@ -76,7 +76,7 @@ internal_pack_c10 (gfc_array_c10 * source)
     return source->base_addr;
 
   /* Allocate storage for the destination.  */
-  destptr = (GFC_COMPLEX_10 *)xmalloc (ssize * sizeof (GFC_COMPLEX_10));
+  destptr = xmallocarray (ssize, sizeof (GFC_COMPLEX_10));
   dest = destptr;
   src = source->base_addr;
   stride0 = stride[0];
index a3e9612..e109efc 100644 (file)
@@ -76,7 +76,7 @@ internal_pack_c16 (gfc_array_c16 * source)
     return source->base_addr;
 
   /* Allocate storage for the destination.  */
-  destptr = (GFC_COMPLEX_16 *)xmalloc (ssize * sizeof (GFC_COMPLEX_16));
+  destptr = xmallocarray (ssize, sizeof (GFC_COMPLEX_16));
   dest = destptr;
   src = source->base_addr;
   stride0 = stride[0];
index 2959354..3afdaf3 100644 (file)
@@ -76,7 +76,7 @@ internal_pack_c4 (gfc_array_c4 * source)
     return source->base_addr;
 
   /* Allocate storage for the destination.  */
-  destptr = (GFC_COMPLEX_4 *)xmalloc (ssize * sizeof (GFC_COMPLEX_4));
+  destptr = xmallocarray (ssize, sizeof (GFC_COMPLEX_4));
   dest = destptr;
   src = source->base_addr;
   stride0 = stride[0];
index e63ea9d..995a367 100644 (file)
@@ -76,7 +76,7 @@ internal_pack_c8 (gfc_array_c8 * source)
     return source->base_addr;
 
   /* Allocate storage for the destination.  */
-  destptr = (GFC_COMPLEX_8 *)xmalloc (ssize * sizeof (GFC_COMPLEX_8));
+  destptr = xmallocarray (ssize, sizeof (GFC_COMPLEX_8));
   dest = destptr;
   src = source->base_addr;
   stride0 = stride[0];
index 2356102..2ee5e28 100644 (file)
@@ -76,7 +76,7 @@ internal_pack_1 (gfc_array_i1 * source)
     return source->base_addr;
 
   /* Allocate storage for the destination.  */
-  destptr = (GFC_INTEGER_1 *)xmalloc (ssize * sizeof (GFC_INTEGER_1));
+  destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_1));
   dest = destptr;
   src = source->base_addr;
   stride0 = stride[0];
index e271a89..ac6bb4f 100644 (file)
@@ -76,7 +76,7 @@ internal_pack_16 (gfc_array_i16 * source)
     return source->base_addr;
 
   /* Allocate storage for the destination.  */
-  destptr = (GFC_INTEGER_16 *)xmalloc (ssize * sizeof (GFC_INTEGER_16));
+  destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_16));
   dest = destptr;
   src = source->base_addr;
   stride0 = stride[0];
index 391e27d..f42a892 100644 (file)
@@ -76,7 +76,7 @@ internal_pack_2 (gfc_array_i2 * source)
     return source->base_addr;
 
   /* Allocate storage for the destination.  */
-  destptr = (GFC_INTEGER_2 *)xmalloc (ssize * sizeof (GFC_INTEGER_2));
+  destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_2));
   dest = destptr;
   src = source->base_addr;
   stride0 = stride[0];
index 6ba0277..acde25a 100644 (file)
@@ -76,7 +76,7 @@ internal_pack_4 (gfc_array_i4 * source)
     return source->base_addr;
 
   /* Allocate storage for the destination.  */
-  destptr = (GFC_INTEGER_4 *)xmalloc (ssize * sizeof (GFC_INTEGER_4));
+  destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_4));
   dest = destptr;
   src = source->base_addr;
   stride0 = stride[0];
index 4c05043..5be3544 100644 (file)
@@ -76,7 +76,7 @@ internal_pack_8 (gfc_array_i8 * source)
     return source->base_addr;
 
   /* Allocate storage for the destination.  */
-  destptr = (GFC_INTEGER_8 *)xmalloc (ssize * sizeof (GFC_INTEGER_8));
+  destptr = xmallocarray (ssize, sizeof (GFC_INTEGER_8));
   dest = destptr;
   src = source->base_addr;
   stride0 = stride[0];
index 75dec30..c4680d8 100644 (file)
@@ -76,7 +76,7 @@ internal_pack_r10 (gfc_array_r10 * source)
     return source->base_addr;
 
   /* Allocate storage for the destination.  */
-  destptr = (GFC_REAL_10 *)xmalloc (ssize * sizeof (GFC_REAL_10));
+  destptr = xmallocarray (ssize, sizeof (GFC_REAL_10));
   dest = destptr;
   src = source->base_addr;
   stride0 = stride[0];
index a37623a..ff09d14 100644 (file)
@@ -76,7 +76,7 @@ internal_pack_r16 (gfc_array_r16 * source)
     return source->base_addr;
 
   /* Allocate storage for the destination.  */
-  destptr = (GFC_REAL_16 *)xmalloc (ssize * sizeof (GFC_REAL_16));
+  destptr = xmallocarray (ssize, sizeof (GFC_REAL_16));
   dest = destptr;
   src = source->base_addr;
   stride0 = stride[0];
index 5a28ff0..34fe582 100644 (file)
@@ -76,7 +76,7 @@ internal_pack_r4 (gfc_array_r4 * source)
     return source->base_addr;
 
   /* Allocate storage for the destination.  */
-  destptr = (GFC_REAL_4 *)xmalloc (ssize * sizeof (GFC_REAL_4));
+  destptr = xmallocarray (ssize, sizeof (GFC_REAL_4));
   dest = destptr;
   src = source->base_addr;
   stride0 = stride[0];
index 7c4fa42..b0728c9 100644 (file)
@@ -76,7 +76,7 @@ internal_pack_r8 (gfc_array_r8 * source)
     return source->base_addr;
 
   /* Allocate storage for the destination.  */
-  destptr = (GFC_REAL_8 *)xmalloc (ssize * sizeof (GFC_REAL_8));
+  destptr = xmallocarray (ssize, sizeof (GFC_REAL_8));
   dest = destptr;
   src = source->base_addr;
   stride0 = stride[0];
index 9ccbd55..fdccc3d 100644 (file)
@@ -97,10 +97,9 @@ iparity_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ miparity_i1 (gfc_array_i1 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ miparity_i1 (gfc_array_i1 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
     }
   else
@@ -430,8 +428,7 @@ siparity_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ siparity_i1 (gfc_array_i1 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
     }
   else
     {
index 6a4d032..7a572ba 100644 (file)
@@ -97,10 +97,9 @@ iparity_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ miparity_i16 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ miparity_i16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -430,8 +428,7 @@ siparity_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ siparity_i16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index cb0d8a9..49233fb 100644 (file)
@@ -97,10 +97,9 @@ iparity_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ miparity_i2 (gfc_array_i2 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ miparity_i2 (gfc_array_i2 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
     }
   else
@@ -430,8 +428,7 @@ siparity_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ siparity_i2 (gfc_array_i2 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
     }
   else
     {
index 689f0c1..1551e51 100644 (file)
@@ -97,10 +97,9 @@ iparity_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ miparity_i4 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ miparity_i4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -430,8 +428,7 @@ siparity_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ siparity_i4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index de84f56..a745bb6 100644 (file)
@@ -97,10 +97,9 @@ iparity_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ miparity_i8 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ miparity_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -430,8 +428,7 @@ siparity_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ siparity_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 53a8c6a..0ff7d58 100644 (file)
@@ -124,7 +124,7 @@ matmul_c10 (gfc_array_c10 * const restrict retarray,
         }
 
       retarray->base_addr
-       = xmalloc (sizeof (GFC_COMPLEX_10) * size0 ((array_t *) retarray));
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_10));
       retarray->offset = 0;
     }
     else if (unlikely (compile_options.bounds_check))
index 00ddc13..a5fea00 100644 (file)
@@ -124,7 +124,7 @@ matmul_c16 (gfc_array_c16 * const restrict retarray,
         }
 
       retarray->base_addr
-       = xmalloc (sizeof (GFC_COMPLEX_16) * size0 ((array_t *) retarray));
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_16));
       retarray->offset = 0;
     }
     else if (unlikely (compile_options.bounds_check))
index cdb92c4..b5b0ecb 100644 (file)
@@ -124,7 +124,7 @@ matmul_c4 (gfc_array_c4 * const restrict retarray,
         }
 
       retarray->base_addr
-       = xmalloc (sizeof (GFC_COMPLEX_4) * size0 ((array_t *) retarray));
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_4));
       retarray->offset = 0;
     }
     else if (unlikely (compile_options.bounds_check))
index 6a223d0..077b709 100644 (file)
@@ -124,7 +124,7 @@ matmul_c8 (gfc_array_c8 * const restrict retarray,
         }
 
       retarray->base_addr
-       = xmalloc (sizeof (GFC_COMPLEX_8) * size0 ((array_t *) retarray));
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_8));
       retarray->offset = 0;
     }
     else if (unlikely (compile_options.bounds_check))
index bc24f11..72c998a 100644 (file)
@@ -124,7 +124,7 @@ matmul_i1 (gfc_array_i1 * const restrict retarray,
         }
 
       retarray->base_addr
-       = xmalloc (sizeof (GFC_INTEGER_1) * size0 ((array_t *) retarray));
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_1));
       retarray->offset = 0;
     }
     else if (unlikely (compile_options.bounds_check))
index 74fe262..59cd80b 100644 (file)
@@ -124,7 +124,7 @@ matmul_i16 (gfc_array_i16 * const restrict retarray,
         }
 
       retarray->base_addr
-       = xmalloc (sizeof (GFC_INTEGER_16) * size0 ((array_t *) retarray));
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_16));
       retarray->offset = 0;
     }
     else if (unlikely (compile_options.bounds_check))
index 8627361..6fddc4f 100644 (file)
@@ -124,7 +124,7 @@ matmul_i2 (gfc_array_i2 * const restrict retarray,
         }
 
       retarray->base_addr
-       = xmalloc (sizeof (GFC_INTEGER_2) * size0 ((array_t *) retarray));
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_2));
       retarray->offset = 0;
     }
     else if (unlikely (compile_options.bounds_check))
index 37e5d5b..f62cb56 100644 (file)
@@ -124,7 +124,7 @@ matmul_i4 (gfc_array_i4 * const restrict retarray,
         }
 
       retarray->base_addr
-       = xmalloc (sizeof (GFC_INTEGER_4) * size0 ((array_t *) retarray));
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_4));
       retarray->offset = 0;
     }
     else if (unlikely (compile_options.bounds_check))
index 892822a..6d52490 100644 (file)
@@ -124,7 +124,7 @@ matmul_i8 (gfc_array_i8 * const restrict retarray,
         }
 
       retarray->base_addr
-       = xmalloc (sizeof (GFC_INTEGER_8) * size0 ((array_t *) retarray));
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_8));
       retarray->offset = 0;
     }
     else if (unlikely (compile_options.bounds_check))
index bc60030..370db07 100644 (file)
@@ -88,7 +88,7 @@ matmul_l16 (gfc_array_l16 * const restrict retarray,
         }
           
       retarray->base_addr
-       = xmalloc (sizeof (GFC_LOGICAL_16) * size0 ((array_t *) retarray));
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_LOGICAL_16));
       retarray->offset = 0;
     }
     else if (unlikely (compile_options.bounds_check))
index d464e62..d901e3c 100644 (file)
@@ -88,7 +88,7 @@ matmul_l4 (gfc_array_l4 * const restrict retarray,
         }
           
       retarray->base_addr
-       = xmalloc (sizeof (GFC_LOGICAL_4) * size0 ((array_t *) retarray));
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_LOGICAL_4));
       retarray->offset = 0;
     }
     else if (unlikely (compile_options.bounds_check))
index 0fd6bad..5862c8d 100644 (file)
@@ -88,7 +88,7 @@ matmul_l8 (gfc_array_l8 * const restrict retarray,
         }
           
       retarray->base_addr
-       = xmalloc (sizeof (GFC_LOGICAL_8) * size0 ((array_t *) retarray));
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_LOGICAL_8));
       retarray->offset = 0;
     }
     else if (unlikely (compile_options.bounds_check))
index e222044..6c9656a 100644 (file)
@@ -124,7 +124,7 @@ matmul_r10 (gfc_array_r10 * const restrict retarray,
         }
 
       retarray->base_addr
-       = xmalloc (sizeof (GFC_REAL_10) * size0 ((array_t *) retarray));
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_10));
       retarray->offset = 0;
     }
     else if (unlikely (compile_options.bounds_check))
index 335feb0..fbe8e09 100644 (file)
@@ -124,7 +124,7 @@ matmul_r16 (gfc_array_r16 * const restrict retarray,
         }
 
       retarray->base_addr
-       = xmalloc (sizeof (GFC_REAL_16) * size0 ((array_t *) retarray));
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_16));
       retarray->offset = 0;
     }
     else if (unlikely (compile_options.bounds_check))
index bb07efa..f80c8bf 100644 (file)
@@ -124,7 +124,7 @@ matmul_r4 (gfc_array_r4 * const restrict retarray,
         }
 
       retarray->base_addr
-       = xmalloc (sizeof (GFC_REAL_4) * size0 ((array_t *) retarray));
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_4));
       retarray->offset = 0;
     }
     else if (unlikely (compile_options.bounds_check))
index a3bc842..7aec3b3 100644 (file)
@@ -124,7 +124,7 @@ matmul_r8 (gfc_array_r8 * const restrict retarray,
         }
 
       retarray->base_addr
-       = xmalloc (sizeof (GFC_REAL_8) * size0 ((array_t *) retarray));
+       = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_8));
       retarray->offset = 0;
     }
     else if (unlikely (compile_options.bounds_check))
index 01d6e77..d205d24 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_16_i1 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_16_i1 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index c24b4be..3d8e3dc 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_16_i16 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_16_i16 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 1a0f2b6..93f5cc4 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_16_i2 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_16_i2 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 005a963..6858c8f 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_16_i4 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_16_i4 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 2643b82..f324b02 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_16_i8 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_16_i8 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 714a523..03560f7 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_16_r10 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_16_r10 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 5a2ecb3..aeb2e81 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_16_r16 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_16_r16 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 5556429..a88774e 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_16_r4 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_16_r4 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 2ae92c9..8704cad 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_16_r8 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_16_r8 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 2470b49..8e75ec9 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_4_i1 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_4_i1 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 850a26c..67383b6 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_4_i16 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_4_i16 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 8971519..3991bd6 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_4_i2 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_4_i2 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 9ad21d7..0a714c3 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_4_i4 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_4_i4 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 7e1e3a4..c32c6fb 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_4_i8 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_4_i8 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 4d1d980..d2d7f2e 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_4_r10 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_4_r10 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 0d37cda..e9d8620 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_4_r16 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_4_r16 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 6db50f8..c402868 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_4_r4 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_4_r4 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 610f757..5057e9c 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_4_r8 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_4_r8 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 6e1d049..95d027d 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_8_i1 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_8_i1 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index aa2d6e3..1fa391b 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_8_i16 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_8_i16 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index b9fd82b..d98a1a2 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_8_i2 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_8_i2 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 36bba3e..56a7748 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_8_i4 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_8_i4 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index e808928..dd1fe2c 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_8_i8 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_8_i8 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index fba75b9..2c8394c 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_8_r10 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_8_r10 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 24e317e..4ebf6f4 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_8_r16 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_8_r16 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 88dc2b2..893adad 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_8_r4 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_8_r4 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 23c1115..e234343 100644 (file)
@@ -58,7 +58,7 @@ maxloc0_8_r8 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -199,7 +199,7 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -367,7 +367,7 @@ smaxloc0_8_r8 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 0602fc9..4d1bea0 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_16_i1 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_16_i1 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_16_i1 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index 3f8c517..eb9b2a0 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_16_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_16_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_16_i16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index f284210..91a0800 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_16_i2 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_16_i2 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_16_i2 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index 35fcc2a..c680351 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_16_i4 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_16_i4 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_16_i4 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index b2c945c..ea164dc 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index d898dde..4d5ed45 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_16_r10 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_16_r10 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_16_r10 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index 28e2db4..572d916 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_16_r16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_16_r16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_16_r16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index f7f85a7..d9aef3e 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_16_r4 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_16_r4 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_16_r4 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index 69c82d3..d1014cd 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_16_r8 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_16_r8 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_16_r8 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index fde1947..1ab44ab 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_4_i1 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_4_i1 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_4_i1 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index c7b32b3..59bb2a3 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index 2a16a0b..794fde0 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_4_i2 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_4_i2 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_4_i2 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index 7c693e1..d10e937 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_4_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_4_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_4_i4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index 45188e1..b761b82 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index bd0e0f8..f1d522d 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_4_r10 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_4_r10 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_4_r10 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index 37428b2..deaf571 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_4_r16 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_4_r16 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_4_r16 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index a42c7b4..bc64495 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_4_r4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_4_r4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_4_r4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index 85b7965..af09cb3 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index 4c5d55e..caaabe7 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_8_i1 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_8_i1 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_8_i1 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 6779d6a..384635c 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 2fe5696..731c723 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_8_i2 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_8_i2 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_8_i2 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index ae06e9e..26fdf83 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index d8d7b68..a7f43d1 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 2b44cbb..f996db4 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_8_r10 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_8_r10 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_8_r10 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index bcee801..d3ae5cb 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_8_r16 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_8_r16 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_8_r16 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 57a039d..c282cf7 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_8_r4 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_8_r4 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_8_r4 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index c113680..13446e0 100644 (file)
@@ -98,10 +98,9 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -485,8 +483,7 @@ smaxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ smaxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 18d4eff..eadec5c 100644 (file)
@@ -97,10 +97,9 @@ maxval_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -286,8 +285,7 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -299,7 +297,7 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
     }
   else
@@ -472,8 +470,7 @@ smaxval_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -482,7 +479,7 @@ smaxval_i1 (gfc_array_i1 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
     }
   else
     {
index 6815eb2..b83dd18 100644 (file)
@@ -97,10 +97,9 @@ maxval_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -286,8 +285,7 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -299,7 +297,7 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -472,8 +470,7 @@ smaxval_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -482,7 +479,7 @@ smaxval_i16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index 5b99b34..72bb3b4 100644 (file)
@@ -97,10 +97,9 @@ maxval_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -286,8 +285,7 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -299,7 +297,7 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
     }
   else
@@ -472,8 +470,7 @@ smaxval_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -482,7 +479,7 @@ smaxval_i2 (gfc_array_i2 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
     }
   else
     {
index ff19f9c..c939a0a 100644 (file)
@@ -97,10 +97,9 @@ maxval_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -286,8 +285,7 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -299,7 +297,7 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -472,8 +470,7 @@ smaxval_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -482,7 +479,7 @@ smaxval_i4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index d708c34..50ee398 100644 (file)
@@ -97,10 +97,9 @@ maxval_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -286,8 +285,7 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -299,7 +297,7 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -472,8 +470,7 @@ smaxval_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -482,7 +479,7 @@ smaxval_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 759198b..b16d263 100644 (file)
@@ -97,10 +97,9 @@ maxval_r10 (gfc_array_r10 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -286,8 +285,7 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -299,7 +297,7 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
 
     }
   else
@@ -472,8 +470,7 @@ smaxval_r10 (gfc_array_r10 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -482,7 +479,7 @@ smaxval_r10 (gfc_array_r10 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
     }
   else
     {
index b16c4cb..df6f2b0 100644 (file)
@@ -97,10 +97,9 @@ maxval_r16 (gfc_array_r16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -286,8 +285,7 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -299,7 +297,7 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
 
     }
   else
@@ -472,8 +470,7 @@ smaxval_r16 (gfc_array_r16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -482,7 +479,7 @@ smaxval_r16 (gfc_array_r16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
     }
   else
     {
index db68885..edccaeb 100644 (file)
@@ -97,10 +97,9 @@ maxval_r4 (gfc_array_r4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -286,8 +285,7 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -299,7 +297,7 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
 
     }
   else
@@ -472,8 +470,7 @@ smaxval_r4 (gfc_array_r4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -482,7 +479,7 @@ smaxval_r4 (gfc_array_r4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
     }
   else
     {
index ea0c8d8..bfbfa98 100644 (file)
@@ -97,10 +97,9 @@ maxval_r8 (gfc_array_r8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -286,8 +285,7 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -299,7 +297,7 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
 
     }
   else
@@ -472,8 +470,7 @@ smaxval_r8 (gfc_array_r8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -482,7 +479,7 @@ smaxval_r8 (gfc_array_r8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
     }
   else
     {
index f70d9ff..ccd89f0 100644 (file)
@@ -58,7 +58,7 @@ minloc0_16_i1 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_16_i1 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_16_i1 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 7962415..65050b9 100644 (file)
@@ -58,7 +58,7 @@ minloc0_16_i16 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_16_i16 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index e06f9f9..9fb6325 100644 (file)
@@ -58,7 +58,7 @@ minloc0_16_i2 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_16_i2 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_16_i2 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 099ac7e..999ac4b 100644 (file)
@@ -58,7 +58,7 @@ minloc0_16_i4 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_16_i4 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 2361c85..3c2e3c3 100644 (file)
@@ -58,7 +58,7 @@ minloc0_16_i8 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_16_i8 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 9777ed1..c661cdc 100644 (file)
@@ -58,7 +58,7 @@ minloc0_16_r10 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_16_r10 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 6d3a349..c455e92 100644 (file)
@@ -58,7 +58,7 @@ minloc0_16_r16 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_16_r16 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 6db57e8..779935e 100644 (file)
@@ -58,7 +58,7 @@ minloc0_16_r4 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_16_r4 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 41e94b4..d902376 100644 (file)
@@ -58,7 +58,7 @@ minloc0_16_r8 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_16_r8 (gfc_array_i16 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index a2acfa9..a9e902d 100644 (file)
@@ -58,7 +58,7 @@ minloc0_4_i1 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_4_i1 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_4_i1 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 9205254..7981c28 100644 (file)
@@ -58,7 +58,7 @@ minloc0_4_i16 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_4_i16 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 087e924..59439fa 100644 (file)
@@ -58,7 +58,7 @@ minloc0_4_i2 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_4_i2 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_4_i2 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index e8d43a8..5731a43 100644 (file)
@@ -58,7 +58,7 @@ minloc0_4_i4 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_4_i4 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index d2c81e7..50b8e16 100644 (file)
@@ -58,7 +58,7 @@ minloc0_4_i8 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_4_i8 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 25c7c5a..2701a85 100644 (file)
@@ -58,7 +58,7 @@ minloc0_4_r10 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_4_r10 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index c41a9f3..fca50b3 100644 (file)
@@ -58,7 +58,7 @@ minloc0_4_r16 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_4_r16 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 08f733f..0469a52 100644 (file)
@@ -58,7 +58,7 @@ minloc0_4_r4 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_4_r4 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 590138f..7be43c4 100644 (file)
@@ -58,7 +58,7 @@ minloc0_4_r8 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_4_r8 (gfc_array_i4 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 2bce394..60bfe81 100644 (file)
@@ -58,7 +58,7 @@ minloc0_8_i1 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_8_i1 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_8_i1 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 32a2b5a..27ddd4f 100644 (file)
@@ -58,7 +58,7 @@ minloc0_8_i16 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_8_i16 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index a0061d2..38a4aa6 100644 (file)
@@ -58,7 +58,7 @@ minloc0_8_i2 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_8_i2 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_8_i2 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 3ea2487..5586ea9 100644 (file)
@@ -58,7 +58,7 @@ minloc0_8_i4 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_8_i4 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index afc6d44..1f21d26 100644 (file)
@@ -58,7 +58,7 @@ minloc0_8_i8 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_8_i8 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 6abc03d..df34ca3 100644 (file)
@@ -58,7 +58,7 @@ minloc0_8_r10 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_8_r10 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 322951e..d8769ec 100644 (file)
@@ -58,7 +58,7 @@ minloc0_8_r16 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_8_r16 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index c9896d7..b8ab0c9 100644 (file)
@@ -58,7 +58,7 @@ minloc0_8_r4 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_8_r4 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index edada90..ff67f1e 100644 (file)
@@ -58,7 +58,7 @@ minloc0_8_r8 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -199,7 +199,7 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -367,7 +367,7 @@ sminloc0_8_r8 (gfc_array_i8 * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index d47e946..a9b2d96 100644 (file)
@@ -98,10 +98,9 @@ minloc1_16_i1 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_16_i1 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_16_i1 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index aca08c0..1e52c22 100644 (file)
@@ -98,10 +98,9 @@ minloc1_16_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_16_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_16_i16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index 27eb379..7617b9e 100644 (file)
@@ -98,10 +98,9 @@ minloc1_16_i2 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_16_i2 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_16_i2 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index 4a30ac1..9729d11 100644 (file)
@@ -98,10 +98,9 @@ minloc1_16_i4 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_16_i4 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_16_i4 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index 4021ac2..00421b2 100644 (file)
@@ -98,10 +98,9 @@ minloc1_16_i8 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_16_i8 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_16_i8 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index c8eadc3..fb1401b 100644 (file)
@@ -98,10 +98,9 @@ minloc1_16_r10 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_16_r10 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_16_r10 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index 6aa1de8..0312868 100644 (file)
@@ -98,10 +98,9 @@ minloc1_16_r16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_16_r16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_16_r16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index 67e5564..af5b67d 100644 (file)
@@ -98,10 +98,9 @@ minloc1_16_r4 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_16_r4 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_16_r4 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index 1fcef6c..dd2be3b 100644 (file)
@@ -98,10 +98,9 @@ minloc1_16_r8 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_16_r8 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_16_r8 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index 863f873..b0bf6ef 100644 (file)
@@ -98,10 +98,9 @@ minloc1_4_i1 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_4_i1 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_4_i1 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index 9a81558..882b4b4 100644 (file)
@@ -98,10 +98,9 @@ minloc1_4_i16 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_4_i16 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_4_i16 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index 6657c9f..877af7a 100644 (file)
@@ -98,10 +98,9 @@ minloc1_4_i2 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_4_i2 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_4_i2 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index 36e9552..3a87270 100644 (file)
@@ -98,10 +98,9 @@ minloc1_4_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_4_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_4_i4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index c5d7828..22e43bf 100644 (file)
@@ -98,10 +98,9 @@ minloc1_4_i8 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_4_i8 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_4_i8 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index f55791c..624006c 100644 (file)
@@ -98,10 +98,9 @@ minloc1_4_r10 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_4_r10 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_4_r10 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index 99163f4..f32b608 100644 (file)
@@ -98,10 +98,9 @@ minloc1_4_r16 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_4_r16 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_4_r16 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index 9e85745..0ed5fe9 100644 (file)
@@ -98,10 +98,9 @@ minloc1_4_r4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_4_r4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_4_r4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index 75f2a5f..c780a42 100644 (file)
@@ -98,10 +98,9 @@ minloc1_4_r8 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_4_r8 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_4_r8 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index 8c065ec..6f8c7d9 100644 (file)
@@ -98,10 +98,9 @@ minloc1_8_i1 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_8_i1 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_8_i1 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 68c9617..07cb011 100644 (file)
@@ -98,10 +98,9 @@ minloc1_8_i16 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_8_i16 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_8_i16 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 3e4f4f0..9ea0bf4 100644 (file)
@@ -98,10 +98,9 @@ minloc1_8_i2 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index b0e753a..5e433cc 100644 (file)
@@ -98,10 +98,9 @@ minloc1_8_i4 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_8_i4 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_8_i4 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index a7fec90..364cf32 100644 (file)
@@ -98,10 +98,9 @@ minloc1_8_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_8_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_8_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 6b3e80f..901cf91 100644 (file)
@@ -98,10 +98,9 @@ minloc1_8_r10 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_8_r10 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_8_r10 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 7b69876..7bf17ea 100644 (file)
@@ -98,10 +98,9 @@ minloc1_8_r16 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_8_r16 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_8_r16 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 13d40ea..5edb92f 100644 (file)
@@ -98,10 +98,9 @@ minloc1_8_r4 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_8_r4 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_8_r4 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 51151f2..405b9e1 100644 (file)
@@ -98,10 +98,9 @@ minloc1_8_r8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -294,8 +293,7 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -307,7 +305,7 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -485,8 +483,7 @@ sminloc1_8_r8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -495,7 +492,7 @@ sminloc1_8_r8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 261dac8..da7405b 100644 (file)
@@ -97,10 +97,9 @@ minval_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -286,8 +285,7 @@ mminval_i1 (gfc_array_i1 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -299,7 +297,7 @@ mminval_i1 (gfc_array_i1 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
     }
   else
@@ -472,8 +470,7 @@ sminval_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -482,7 +479,7 @@ sminval_i1 (gfc_array_i1 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
     }
   else
     {
index c75db96..11cbeac 100644 (file)
@@ -97,10 +97,9 @@ minval_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -286,8 +285,7 @@ mminval_i16 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -299,7 +297,7 @@ mminval_i16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -472,8 +470,7 @@ sminval_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -482,7 +479,7 @@ sminval_i16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index 5e7a364..e208b57 100644 (file)
@@ -97,10 +97,9 @@ minval_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -286,8 +285,7 @@ mminval_i2 (gfc_array_i2 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -299,7 +297,7 @@ mminval_i2 (gfc_array_i2 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
     }
   else
@@ -472,8 +470,7 @@ sminval_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -482,7 +479,7 @@ sminval_i2 (gfc_array_i2 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
     }
   else
     {
index a8aed7d..68ba76e 100644 (file)
@@ -97,10 +97,9 @@ minval_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -286,8 +285,7 @@ mminval_i4 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -299,7 +297,7 @@ mminval_i4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -472,8 +470,7 @@ sminval_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -482,7 +479,7 @@ sminval_i4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index 1d489bc..b089358 100644 (file)
@@ -97,10 +97,9 @@ minval_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -286,8 +285,7 @@ mminval_i8 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -299,7 +297,7 @@ mminval_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -472,8 +470,7 @@ sminval_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -482,7 +479,7 @@ sminval_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 9181e21..e9e6afe 100644 (file)
@@ -97,10 +97,9 @@ minval_r10 (gfc_array_r10 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -286,8 +285,7 @@ mminval_r10 (gfc_array_r10 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -299,7 +297,7 @@ mminval_r10 (gfc_array_r10 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
 
     }
   else
@@ -472,8 +470,7 @@ sminval_r10 (gfc_array_r10 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -482,7 +479,7 @@ sminval_r10 (gfc_array_r10 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
     }
   else
     {
index 85aaa5d..e4e3827 100644 (file)
@@ -97,10 +97,9 @@ minval_r16 (gfc_array_r16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -286,8 +285,7 @@ mminval_r16 (gfc_array_r16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -299,7 +297,7 @@ mminval_r16 (gfc_array_r16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
 
     }
   else
@@ -472,8 +470,7 @@ sminval_r16 (gfc_array_r16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -482,7 +479,7 @@ sminval_r16 (gfc_array_r16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
     }
   else
     {
index 19a258c..515b2db 100644 (file)
@@ -97,10 +97,9 @@ minval_r4 (gfc_array_r4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -286,8 +285,7 @@ mminval_r4 (gfc_array_r4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -299,7 +297,7 @@ mminval_r4 (gfc_array_r4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
 
     }
   else
@@ -472,8 +470,7 @@ sminval_r4 (gfc_array_r4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -482,7 +479,7 @@ sminval_r4 (gfc_array_r4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
     }
   else
     {
index d2f9639..c61656f 100644 (file)
@@ -97,10 +97,9 @@ minval_r8 (gfc_array_r8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -286,8 +285,7 @@ mminval_r8 (gfc_array_r8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -299,7 +297,7 @@ mminval_r8 (gfc_array_r8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
 
     }
   else
@@ -472,8 +470,7 @@ sminval_r8 (gfc_array_r8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -482,7 +479,7 @@ sminval_r8 (gfc_array_r8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
     }
   else
     {
index 44028cc..0145c99 100644 (file)
@@ -101,10 +101,9 @@ norm2_r10 (gfc_array_r10 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
index c036edc..46329d5 100644 (file)
@@ -105,10 +105,9 @@ norm2_r16 (gfc_array_r16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
index dcf78da..067dbee 100644 (file)
@@ -101,10 +101,9 @@ norm2_r4 (gfc_array_r4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
index 1bda1c5..51c8942 100644 (file)
@@ -101,10 +101,9 @@ norm2_r8 (gfc_array_r8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
index 9fcacf1..90866a8 100644 (file)
@@ -167,8 +167,8 @@ pack_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array,
 
          ret->offset = 0;
 
-         /* xmalloc allocates a single byte for zero size.  */
-         ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_10) * total);
+         /* xmallocarray allocates a single byte for zero size.  */
+         ret->base_addr = xmallocarray (total, sizeof (GFC_COMPLEX_10));
 
          if (total == 0)
            return;
index 0e3db34..60f60d1 100644 (file)
@@ -167,8 +167,8 @@ pack_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array,
 
          ret->offset = 0;
 
-         /* xmalloc allocates a single byte for zero size.  */
-         ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_16) * total);
+         /* xmallocarray allocates a single byte for zero size.  */
+         ret->base_addr = xmallocarray (total, sizeof (GFC_COMPLEX_16));
 
          if (total == 0)
            return;
index f17d35a..36a9f94 100644 (file)
@@ -167,8 +167,8 @@ pack_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array,
 
          ret->offset = 0;
 
-         /* xmalloc allocates a single byte for zero size.  */
-         ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_4) * total);
+         /* xmallocarray allocates a single byte for zero size.  */
+         ret->base_addr = xmallocarray (total, sizeof (GFC_COMPLEX_4));
 
          if (total == 0)
            return;
index f291b46..38880c1 100644 (file)
@@ -167,8 +167,8 @@ pack_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array,
 
          ret->offset = 0;
 
-         /* xmalloc allocates a single byte for zero size.  */
-         ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_8) * total);
+         /* xmallocarray allocates a single byte for zero size.  */
+         ret->base_addr = xmallocarray (total, sizeof (GFC_COMPLEX_8));
 
          if (total == 0)
            return;
index b70127d..933cf9a 100644 (file)
@@ -167,8 +167,8 @@ pack_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array,
 
          ret->offset = 0;
 
-         /* xmalloc allocates a single byte for zero size.  */
-         ret->base_addr = xmalloc (sizeof (GFC_INTEGER_1) * total);
+         /* xmallocarray allocates a single byte for zero size.  */
+         ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_1));
 
          if (total == 0)
            return;
index da1faef..01d32ad 100644 (file)
@@ -167,8 +167,8 @@ pack_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array,
 
          ret->offset = 0;
 
-         /* xmalloc allocates a single byte for zero size.  */
-         ret->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * total);
+         /* xmallocarray allocates a single byte for zero size.  */
+         ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_16));
 
          if (total == 0)
            return;
index 0481720..de329ab 100644 (file)
@@ -167,8 +167,8 @@ pack_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array,
 
          ret->offset = 0;
 
-         /* xmalloc allocates a single byte for zero size.  */
-         ret->base_addr = xmalloc (sizeof (GFC_INTEGER_2) * total);
+         /* xmallocarray allocates a single byte for zero size.  */
+         ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_2));
 
          if (total == 0)
            return;
index 0a0b4ba..93ac356 100644 (file)
@@ -167,8 +167,8 @@ pack_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array,
 
          ret->offset = 0;
 
-         /* xmalloc allocates a single byte for zero size.  */
-         ret->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * total);
+         /* xmallocarray allocates a single byte for zero size.  */
+         ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_4));
 
          if (total == 0)
            return;
index 183a0fe..ec7b427 100644 (file)
@@ -167,8 +167,8 @@ pack_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array,
 
          ret->offset = 0;
 
-         /* xmalloc allocates a single byte for zero size.  */
-         ret->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * total);
+         /* xmallocarray allocates a single byte for zero size.  */
+         ret->base_addr = xmallocarray (total, sizeof (GFC_INTEGER_8));
 
          if (total == 0)
            return;
index d1c2297..8b3e816 100644 (file)
@@ -167,8 +167,8 @@ pack_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array,
 
          ret->offset = 0;
 
-         /* xmalloc allocates a single byte for zero size.  */
-         ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * total);
+         /* xmallocarray allocates a single byte for zero size.  */
+         ret->base_addr = xmallocarray (total, sizeof (GFC_REAL_10));
 
          if (total == 0)
            return;
index 59a6f58..598ef8e 100644 (file)
@@ -167,8 +167,8 @@ pack_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array,
 
          ret->offset = 0;
 
-         /* xmalloc allocates a single byte for zero size.  */
-         ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * total);
+         /* xmallocarray allocates a single byte for zero size.  */
+         ret->base_addr = xmallocarray (total, sizeof (GFC_REAL_16));
 
          if (total == 0)
            return;
index 86ec8ff..955a812 100644 (file)
@@ -167,8 +167,8 @@ pack_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array,
 
          ret->offset = 0;
 
-         /* xmalloc allocates a single byte for zero size.  */
-         ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * total);
+         /* xmallocarray allocates a single byte for zero size.  */
+         ret->base_addr = xmallocarray (total, sizeof (GFC_REAL_4));
 
          if (total == 0)
            return;
index 6d7c155..d0bb227 100644 (file)
@@ -167,8 +167,8 @@ pack_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array,
 
          ret->offset = 0;
 
-         /* xmalloc allocates a single byte for zero size.  */
-         ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * total);
+         /* xmallocarray allocates a single byte for zero size.  */
+         ret->base_addr = xmallocarray (total, sizeof (GFC_REAL_8));
 
          if (total == 0)
            return;
index f71e9ad..ff81d1a 100644 (file)
@@ -98,10 +98,9 @@ parity_l1 (gfc_array_l1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_LOGICAL_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
index ba50d96..66970d0 100644 (file)
@@ -98,10 +98,9 @@ parity_l16 (gfc_array_l16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_LOGICAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
index b719eb8..5942257 100644 (file)
@@ -98,10 +98,9 @@ parity_l2 (gfc_array_l2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_LOGICAL_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_2));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
index 7274d72..4f8a9f9 100644 (file)
@@ -98,10 +98,9 @@ parity_l4 (gfc_array_l4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_LOGICAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
index 9c4e571..73b1d9f 100644 (file)
@@ -98,10 +98,9 @@ parity_l8 (gfc_array_l8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_LOGICAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
index 6b2ea5f..7b32583 100644 (file)
@@ -97,10 +97,9 @@ product_c10 (gfc_array_c10 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
 
     }
   else
@@ -430,8 +428,7 @@ sproduct_c10 (gfc_array_c10 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ sproduct_c10 (gfc_array_c10 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
     }
   else
     {
index 42d5dcd..4f31e1b 100644 (file)
@@ -97,10 +97,9 @@ product_c16 (gfc_array_c16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
 
     }
   else
@@ -430,8 +428,7 @@ sproduct_c16 (gfc_array_c16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ sproduct_c16 (gfc_array_c16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
     }
   else
     {
index 04d3cf9..038c502 100644 (file)
@@ -97,10 +97,9 @@ product_c4 (gfc_array_c4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
 
     }
   else
@@ -430,8 +428,7 @@ sproduct_c4 (gfc_array_c4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ sproduct_c4 (gfc_array_c4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
     }
   else
     {
index 184e1bc..a941a6c 100644 (file)
@@ -97,10 +97,9 @@ product_c8 (gfc_array_c8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
 
     }
   else
@@ -430,8 +428,7 @@ sproduct_c8 (gfc_array_c8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ sproduct_c8 (gfc_array_c8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
     }
   else
     {
index 0a8bc26..39d94fc 100644 (file)
@@ -97,10 +97,9 @@ product_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
     }
   else
@@ -430,8 +428,7 @@ sproduct_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ sproduct_i1 (gfc_array_i1 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
     }
   else
     {
index 97c774a..a89070a 100644 (file)
@@ -97,10 +97,9 @@ product_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -430,8 +428,7 @@ sproduct_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ sproduct_i16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index 86d85ee..c8e04ef 100644 (file)
@@ -97,10 +97,9 @@ product_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
     }
   else
@@ -430,8 +428,7 @@ sproduct_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ sproduct_i2 (gfc_array_i2 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
     }
   else
     {
index 6e73740..1d3b9cf 100644 (file)
@@ -97,10 +97,9 @@ product_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -430,8 +428,7 @@ sproduct_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ sproduct_i4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index c49f572..7d61b9b 100644 (file)
@@ -97,10 +97,9 @@ product_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -430,8 +428,7 @@ sproduct_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ sproduct_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 5aa8563..16aa305 100644 (file)
@@ -97,10 +97,9 @@ product_r10 (gfc_array_r10 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
 
     }
   else
@@ -430,8 +428,7 @@ sproduct_r10 (gfc_array_r10 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ sproduct_r10 (gfc_array_r10 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
     }
   else
     {
index 63bf372..3bb085f 100644 (file)
@@ -97,10 +97,9 @@ product_r16 (gfc_array_r16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
 
     }
   else
@@ -430,8 +428,7 @@ sproduct_r16 (gfc_array_r16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ sproduct_r16 (gfc_array_r16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
     }
   else
     {
index 2d85213..18dfdde 100644 (file)
@@ -97,10 +97,9 @@ product_r4 (gfc_array_r4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
 
     }
   else
@@ -430,8 +428,7 @@ sproduct_r4 (gfc_array_r4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ sproduct_r4 (gfc_array_r4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
     }
   else
     {
index 9cb1a17..7ac062a 100644 (file)
@@ -97,10 +97,9 @@ product_r8 (gfc_array_r8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
 
     }
   else
@@ -430,8 +428,7 @@ sproduct_r8 (gfc_array_r8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ sproduct_r8 (gfc_array_r8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
     }
   else
     {
index e516e07..a7fb560 100644 (file)
@@ -111,11 +111,11 @@ reshape_c10 (gfc_array_c10 * const restrict ret,
       ret->offset = 0;
 
       if (unlikely (rs < 1))
-        alloc_size = 1;
+        alloc_size = 0;
       else
-        alloc_size = rs * sizeof (GFC_COMPLEX_10);
+        alloc_size = rs;
 
-      ret->base_addr = xmalloc (alloc_size);
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
     }
 
index c374af8..a8186f9 100644 (file)
@@ -111,11 +111,11 @@ reshape_c16 (gfc_array_c16 * const restrict ret,
       ret->offset = 0;
 
       if (unlikely (rs < 1))
-        alloc_size = 1;
+        alloc_size = 0;
       else
-        alloc_size = rs * sizeof (GFC_COMPLEX_16);
+        alloc_size = rs;
 
-      ret->base_addr = xmalloc (alloc_size);
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
     }
 
index b004302..1aa1934 100644 (file)
@@ -111,11 +111,11 @@ reshape_c4 (gfc_array_c4 * const restrict ret,
       ret->offset = 0;
 
       if (unlikely (rs < 1))
-        alloc_size = 1;
+        alloc_size = 0;
       else
-        alloc_size = rs * sizeof (GFC_COMPLEX_4);
+        alloc_size = rs;
 
-      ret->base_addr = xmalloc (alloc_size);
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
     }
 
index 345dccc..5b7f796 100644 (file)
@@ -111,11 +111,11 @@ reshape_c8 (gfc_array_c8 * const restrict ret,
       ret->offset = 0;
 
       if (unlikely (rs < 1))
-        alloc_size = 1;
+        alloc_size = 0;
       else
-        alloc_size = rs * sizeof (GFC_COMPLEX_8);
+        alloc_size = rs;
 
-      ret->base_addr = xmalloc (alloc_size);
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
     }
 
index f05a937..b766e1a 100644 (file)
@@ -111,11 +111,11 @@ reshape_16 (gfc_array_i16 * const restrict ret,
       ret->offset = 0;
 
       if (unlikely (rs < 1))
-        alloc_size = 1;
+        alloc_size = 0;
       else
-        alloc_size = rs * sizeof (GFC_INTEGER_16);
+        alloc_size = rs;
 
-      ret->base_addr = xmalloc (alloc_size);
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
     }
 
index 174b4ca..4831857 100644 (file)
@@ -111,11 +111,11 @@ reshape_4 (gfc_array_i4 * const restrict ret,
       ret->offset = 0;
 
       if (unlikely (rs < 1))
-        alloc_size = 1;
+        alloc_size = 0;
       else
-        alloc_size = rs * sizeof (GFC_INTEGER_4);
+        alloc_size = rs;
 
-      ret->base_addr = xmalloc (alloc_size);
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
     }
 
index c377752..1729d48 100644 (file)
@@ -111,11 +111,11 @@ reshape_8 (gfc_array_i8 * const restrict ret,
       ret->offset = 0;
 
       if (unlikely (rs < 1))
-        alloc_size = 1;
+        alloc_size = 0;
       else
-        alloc_size = rs * sizeof (GFC_INTEGER_8);
+        alloc_size = rs;
 
-      ret->base_addr = xmalloc (alloc_size);
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
     }
 
index ee2c47f..f1dd44a 100644 (file)
@@ -111,11 +111,11 @@ reshape_r10 (gfc_array_r10 * const restrict ret,
       ret->offset = 0;
 
       if (unlikely (rs < 1))
-        alloc_size = 1;
+        alloc_size = 0;
       else
-        alloc_size = rs * sizeof (GFC_REAL_10);
+        alloc_size = rs;
 
-      ret->base_addr = xmalloc (alloc_size);
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
     }
 
index 61c8de4..360b18f 100644 (file)
@@ -111,11 +111,11 @@ reshape_r16 (gfc_array_r16 * const restrict ret,
       ret->offset = 0;
 
       if (unlikely (rs < 1))
-        alloc_size = 1;
+        alloc_size = 0;
       else
-        alloc_size = rs * sizeof (GFC_REAL_16);
+        alloc_size = rs;
 
-      ret->base_addr = xmalloc (alloc_size);
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
     }
 
index d7ca64f..e06cb54 100644 (file)
@@ -111,11 +111,11 @@ reshape_r4 (gfc_array_r4 * const restrict ret,
       ret->offset = 0;
 
       if (unlikely (rs < 1))
-        alloc_size = 1;
+        alloc_size = 0;
       else
-        alloc_size = rs * sizeof (GFC_REAL_4);
+        alloc_size = rs;
 
-      ret->base_addr = xmalloc (alloc_size);
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
     }
 
index 9700a58..08888a8 100644 (file)
@@ -111,11 +111,11 @@ reshape_r8 (gfc_array_r8 * const restrict ret,
       ret->offset = 0;
 
       if (unlikely (rs < 1))
-        alloc_size = 1;
+        alloc_size = 0;
       else
-        alloc_size = rs * sizeof (GFC_REAL_8);
+        alloc_size = rs;
 
-      ret->base_addr = xmalloc (alloc_size);
+      ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
     }
 
index c23f6d4..c504756 100644 (file)
@@ -49,7 +49,7 @@ shape_16 (gfc_array_i16 * const restrict ret,
     {
       GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1);
       ret->offset = 0;
-      ret->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank);
+      ret->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16));
     }
 
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
index 1abac16..0a56fe9 100644 (file)
@@ -49,7 +49,7 @@ shape_4 (gfc_array_i4 * const restrict ret,
     {
       GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1);
       ret->offset = 0;
-      ret->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank);
+      ret->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4));
     }
 
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
index 707d26c..6e9dc22 100644 (file)
@@ -49,7 +49,7 @@ shape_8 (gfc_array_i8 * const restrict ret,
     {
       GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1);
       ret->offset = 0;
-      ret->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank);
+      ret->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8));
     }
 
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
index ad58e34..592443e 100644 (file)
@@ -101,8 +101,8 @@ spread_c10 (gfc_array_c10 *ret, const gfc_array_c10 *source,
        }
       ret->offset = 0;
 
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_10));
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_10));
       if (rs <= 0)
         return;
     }
@@ -244,7 +244,7 @@ spread_scalar_c10 (gfc_array_c10 *ret, const GFC_COMPLEX_10 *source,
 
   if (ret->base_addr == NULL)
     {
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_10));
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_10));
       ret->offset = 0;
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
     }
index 31e82ac..0fce566 100644 (file)
@@ -101,8 +101,8 @@ spread_c16 (gfc_array_c16 *ret, const gfc_array_c16 *source,
        }
       ret->offset = 0;
 
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_16));
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_16));
       if (rs <= 0)
         return;
     }
@@ -244,7 +244,7 @@ spread_scalar_c16 (gfc_array_c16 *ret, const GFC_COMPLEX_16 *source,
 
   if (ret->base_addr == NULL)
     {
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_16));
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_16));
       ret->offset = 0;
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
     }
index f17c6ba..5d1e86b 100644 (file)
@@ -101,8 +101,8 @@ spread_c4 (gfc_array_c4 *ret, const gfc_array_c4 *source,
        }
       ret->offset = 0;
 
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_4));
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_4));
       if (rs <= 0)
         return;
     }
@@ -244,7 +244,7 @@ spread_scalar_c4 (gfc_array_c4 *ret, const GFC_COMPLEX_4 *source,
 
   if (ret->base_addr == NULL)
     {
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_4));
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_4));
       ret->offset = 0;
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
     }
index 07347a2..f8b0da8 100644 (file)
@@ -101,8 +101,8 @@ spread_c8 (gfc_array_c8 *ret, const gfc_array_c8 *source,
        }
       ret->offset = 0;
 
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_8));
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_8));
       if (rs <= 0)
         return;
     }
@@ -244,7 +244,7 @@ spread_scalar_c8 (gfc_array_c8 *ret, const GFC_COMPLEX_8 *source,
 
   if (ret->base_addr == NULL)
     {
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_8));
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_8));
       ret->offset = 0;
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
     }
index 083d26e..44aef16 100644 (file)
@@ -101,8 +101,8 @@ spread_i1 (gfc_array_i1 *ret, const gfc_array_i1 *source,
        }
       ret->offset = 0;
 
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_1));
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_1));
       if (rs <= 0)
         return;
     }
@@ -244,7 +244,7 @@ spread_scalar_i1 (gfc_array_i1 *ret, const GFC_INTEGER_1 *source,
 
   if (ret->base_addr == NULL)
     {
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_1));
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_1));
       ret->offset = 0;
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
     }
index fb565c3..f4ad018 100644 (file)
@@ -101,8 +101,8 @@ spread_i16 (gfc_array_i16 *ret, const gfc_array_i16 *source,
        }
       ret->offset = 0;
 
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_16));
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_16));
       if (rs <= 0)
         return;
     }
@@ -244,7 +244,7 @@ spread_scalar_i16 (gfc_array_i16 *ret, const GFC_INTEGER_16 *source,
 
   if (ret->base_addr == NULL)
     {
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_16));
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_16));
       ret->offset = 0;
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
     }
index 5895594..02e7628 100644 (file)
@@ -101,8 +101,8 @@ spread_i2 (gfc_array_i2 *ret, const gfc_array_i2 *source,
        }
       ret->offset = 0;
 
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_2));
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_2));
       if (rs <= 0)
         return;
     }
@@ -244,7 +244,7 @@ spread_scalar_i2 (gfc_array_i2 *ret, const GFC_INTEGER_2 *source,
 
   if (ret->base_addr == NULL)
     {
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_2));
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_2));
       ret->offset = 0;
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
     }
index 4cb64b0..0c8d927 100644 (file)
@@ -101,8 +101,8 @@ spread_i4 (gfc_array_i4 *ret, const gfc_array_i4 *source,
        }
       ret->offset = 0;
 
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_4));
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_4));
       if (rs <= 0)
         return;
     }
@@ -244,7 +244,7 @@ spread_scalar_i4 (gfc_array_i4 *ret, const GFC_INTEGER_4 *source,
 
   if (ret->base_addr == NULL)
     {
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_4));
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_4));
       ret->offset = 0;
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
     }
index 2013c89..402c746 100644 (file)
@@ -101,8 +101,8 @@ spread_i8 (gfc_array_i8 *ret, const gfc_array_i8 *source,
        }
       ret->offset = 0;
 
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_8));
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_8));
       if (rs <= 0)
         return;
     }
@@ -244,7 +244,7 @@ spread_scalar_i8 (gfc_array_i8 *ret, const GFC_INTEGER_8 *source,
 
   if (ret->base_addr == NULL)
     {
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_8));
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_8));
       ret->offset = 0;
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
     }
index d43f745..248186e 100644 (file)
@@ -101,8 +101,8 @@ spread_r10 (gfc_array_r10 *ret, const gfc_array_r10 *source,
        }
       ret->offset = 0;
 
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_10));
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_10));
       if (rs <= 0)
         return;
     }
@@ -244,7 +244,7 @@ spread_scalar_r10 (gfc_array_r10 *ret, const GFC_REAL_10 *source,
 
   if (ret->base_addr == NULL)
     {
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_10));
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_10));
       ret->offset = 0;
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
     }
index f7452a1..50aef10 100644 (file)
@@ -101,8 +101,8 @@ spread_r16 (gfc_array_r16 *ret, const gfc_array_r16 *source,
        }
       ret->offset = 0;
 
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_16));
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_16));
       if (rs <= 0)
         return;
     }
@@ -244,7 +244,7 @@ spread_scalar_r16 (gfc_array_r16 *ret, const GFC_REAL_16 *source,
 
   if (ret->base_addr == NULL)
     {
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_16));
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_16));
       ret->offset = 0;
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
     }
index b5383fa..fab55c7 100644 (file)
@@ -101,8 +101,8 @@ spread_r4 (gfc_array_r4 *ret, const gfc_array_r4 *source,
        }
       ret->offset = 0;
 
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_4));
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_4));
       if (rs <= 0)
         return;
     }
@@ -244,7 +244,7 @@ spread_scalar_r4 (gfc_array_r4 *ret, const GFC_REAL_4 *source,
 
   if (ret->base_addr == NULL)
     {
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_4));
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_4));
       ret->offset = 0;
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
     }
index 78bbcdc..6076638 100644 (file)
@@ -101,8 +101,8 @@ spread_r8 (gfc_array_r8 *ret, const gfc_array_r8 *source,
        }
       ret->offset = 0;
 
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_8));
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_8));
       if (rs <= 0)
         return;
     }
@@ -244,7 +244,7 @@ spread_scalar_r8 (gfc_array_r8 *ret, const GFC_REAL_8 *source,
 
   if (ret->base_addr == NULL)
     {
-      ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_8));
+      ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_8));
       ret->offset = 0;
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
     }
index cb5fff6..176623d 100644 (file)
@@ -97,10 +97,9 @@ sum_c10 (gfc_array_c10 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ msum_c10 (gfc_array_c10 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ msum_c10 (gfc_array_c10 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
 
     }
   else
@@ -430,8 +428,7 @@ ssum_c10 (gfc_array_c10 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ ssum_c10 (gfc_array_c10 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
     }
   else
     {
index 3f616ec..055a659 100644 (file)
@@ -97,10 +97,9 @@ sum_c16 (gfc_array_c16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ msum_c16 (gfc_array_c16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ msum_c16 (gfc_array_c16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
 
     }
   else
@@ -430,8 +428,7 @@ ssum_c16 (gfc_array_c16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ ssum_c16 (gfc_array_c16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
     }
   else
     {
index ec5160e..6fab436 100644 (file)
@@ -97,10 +97,9 @@ sum_c4 (gfc_array_c4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ msum_c4 (gfc_array_c4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ msum_c4 (gfc_array_c4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
 
     }
   else
@@ -430,8 +428,7 @@ ssum_c4 (gfc_array_c4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ ssum_c4 (gfc_array_c4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
     }
   else
     {
index 946c722..c3d3580 100644 (file)
@@ -97,10 +97,9 @@ sum_c8 (gfc_array_c8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ msum_c8 (gfc_array_c8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ msum_c8 (gfc_array_c8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
 
     }
   else
@@ -430,8 +428,7 @@ ssum_c8 (gfc_array_c8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ ssum_c8 (gfc_array_c8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
     }
   else
     {
index 477581f..88ee333 100644 (file)
@@ -97,10 +97,9 @@ sum_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ msum_i1 (gfc_array_i1 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ msum_i1 (gfc_array_i1 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
 
     }
   else
@@ -430,8 +428,7 @@ ssum_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ ssum_i1 (gfc_array_i1 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
     }
   else
     {
index 52c12a7..dc35e07 100644 (file)
@@ -97,10 +97,9 @@ sum_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ msum_i16 (gfc_array_i16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ msum_i16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
 
     }
   else
@@ -430,8 +428,7 @@ ssum_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ ssum_i16 (gfc_array_i16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
index af6e29d..05c0882 100644 (file)
@@ -97,10 +97,9 @@ sum_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ msum_i2 (gfc_array_i2 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ msum_i2 (gfc_array_i2 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
 
     }
   else
@@ -430,8 +428,7 @@ ssum_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ ssum_i2 (gfc_array_i2 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
     }
   else
     {
index 87b10c7..3653883 100644 (file)
@@ -97,10 +97,9 @@ sum_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ msum_i4 (gfc_array_i4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ msum_i4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
 
     }
   else
@@ -430,8 +428,7 @@ ssum_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ ssum_i4 (gfc_array_i4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
index bc8b52e..d2878df 100644 (file)
@@ -97,10 +97,9 @@ sum_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ msum_i8 (gfc_array_i8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ msum_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
 
     }
   else
@@ -430,8 +428,7 @@ ssum_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ ssum_i8 (gfc_array_i8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 97bb66f..cb5169c 100644 (file)
@@ -97,10 +97,9 @@ sum_r10 (gfc_array_r10 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ msum_r10 (gfc_array_r10 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ msum_r10 (gfc_array_r10 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
 
     }
   else
@@ -430,8 +428,7 @@ ssum_r10 (gfc_array_r10 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ ssum_r10 (gfc_array_r10 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
     }
   else
     {
index c089cfd..6c67f29 100644 (file)
@@ -97,10 +97,9 @@ sum_r16 (gfc_array_r16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ msum_r16 (gfc_array_r16 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ msum_r16 (gfc_array_r16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
 
     }
   else
@@ -430,8 +428,7 @@ ssum_r16 (gfc_array_r16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ ssum_r16 (gfc_array_r16 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
     }
   else
     {
index 2fea0b7..a3a4b59 100644 (file)
@@ -97,10 +97,9 @@ sum_r4 (gfc_array_r4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ msum_r4 (gfc_array_r4 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ msum_r4 (gfc_array_r4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
 
     }
   else
@@ -430,8 +428,7 @@ ssum_r4 (gfc_array_r4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ ssum_r4 (gfc_array_r4 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
     }
   else
     {
index e52795d..0cbf649 100644 (file)
@@ -97,10 +97,9 @@ sum_r8 (gfc_array_r8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -272,8 +271,7 @@ msum_r8 (gfc_array_r8 * const restrict retarray,
 
        }
 
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -285,7 +283,7 @@ msum_r8 (gfc_array_r8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
 
     }
   else
@@ -430,8 +428,7 @@ ssum_r8 (gfc_array_r8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -440,7 +437,7 @@ ssum_r8 (gfc_array_r8 * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
     }
   else
     {
index e558833..bd20122 100644 (file)
@@ -60,7 +60,8 @@ transpose_c10 (gfc_array_c10 * const restrict ret,
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
-      ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_10) * size0 ((array_t *) ret));
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
+                                     sizeof (GFC_COMPLEX_10));
       ret->offset = 0;
     } else if (unlikely (compile_options.bounds_check))
     {
index f11128e..044509f 100644 (file)
@@ -60,7 +60,8 @@ transpose_c16 (gfc_array_c16 * const restrict ret,
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
-      ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_16) * size0 ((array_t *) ret));
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
+                                     sizeof (GFC_COMPLEX_16));
       ret->offset = 0;
     } else if (unlikely (compile_options.bounds_check))
     {
index f1e5fce..c6dd905 100644 (file)
@@ -60,7 +60,8 @@ transpose_c4 (gfc_array_c4 * const restrict ret,
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
-      ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_4) * size0 ((array_t *) ret));
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
+                                     sizeof (GFC_COMPLEX_4));
       ret->offset = 0;
     } else if (unlikely (compile_options.bounds_check))
     {
index 46fde20..cd5926b 100644 (file)
@@ -60,7 +60,8 @@ transpose_c8 (gfc_array_c8 * const restrict ret,
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
-      ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_8) * size0 ((array_t *) ret));
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
+                                     sizeof (GFC_COMPLEX_8));
       ret->offset = 0;
     } else if (unlikely (compile_options.bounds_check))
     {
index 236fcf1..44aff01 100644 (file)
@@ -60,7 +60,8 @@ transpose_i16 (gfc_array_i16 * const restrict ret,
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
-      ret->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * size0 ((array_t *) ret));
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
+                                     sizeof (GFC_INTEGER_16));
       ret->offset = 0;
     } else if (unlikely (compile_options.bounds_check))
     {
index ba87530..e6844fc 100644 (file)
@@ -60,7 +60,8 @@ transpose_i4 (gfc_array_i4 * const restrict ret,
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
-      ret->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * size0 ((array_t *) ret));
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
+                                     sizeof (GFC_INTEGER_4));
       ret->offset = 0;
     } else if (unlikely (compile_options.bounds_check))
     {
index 5514f80..df4a28a 100644 (file)
@@ -60,7 +60,8 @@ transpose_i8 (gfc_array_i8 * const restrict ret,
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
-      ret->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * size0 ((array_t *) ret));
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
+                                     sizeof (GFC_INTEGER_8));
       ret->offset = 0;
     } else if (unlikely (compile_options.bounds_check))
     {
index a7b5706..2ce0579 100644 (file)
@@ -60,7 +60,8 @@ transpose_r10 (gfc_array_r10 * const restrict ret,
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * size0 ((array_t *) ret));
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
+                                     sizeof (GFC_REAL_10));
       ret->offset = 0;
     } else if (unlikely (compile_options.bounds_check))
     {
index 3b9681a..5009d16 100644 (file)
@@ -60,7 +60,8 @@ transpose_r16 (gfc_array_r16 * const restrict ret,
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * size0 ((array_t *) ret));
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
+                                     sizeof (GFC_REAL_16));
       ret->offset = 0;
     } else if (unlikely (compile_options.bounds_check))
     {
index edf43cb..71f70fc 100644 (file)
@@ -60,7 +60,8 @@ transpose_r4 (gfc_array_r4 * const restrict ret,
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * size0 ((array_t *) ret));
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
+                                     sizeof (GFC_REAL_4));
       ret->offset = 0;
     } else if (unlikely (compile_options.bounds_check))
     {
index 852bcdb..9f541e0 100644 (file)
@@ -60,7 +60,8 @@ transpose_r8 (gfc_array_r8 * const restrict ret,
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
-      ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * size0 ((array_t *) ret));
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
+                                     sizeof (GFC_REAL_8));
       ret->offset = 0;
     } else if (unlikely (compile_options.bounds_check))
     {
index dcdb88d..6fc2bdc 100644 (file)
@@ -99,7 +99,7 @@ unpack0_c10 (gfc_array_c10 *ret, const gfc_array_c10 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_10));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_10));
     }
   else
     {
@@ -244,7 +244,7 @@ unpack1_c10 (gfc_array_c10 *ret, const gfc_array_c10 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_10));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_10));
     }
   else
     {
index e7a5331..443a51e 100644 (file)
@@ -99,7 +99,7 @@ unpack0_c16 (gfc_array_c16 *ret, const gfc_array_c16 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_16));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_16));
     }
   else
     {
@@ -244,7 +244,7 @@ unpack1_c16 (gfc_array_c16 *ret, const gfc_array_c16 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_16));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_16));
     }
   else
     {
index 927a4c3..c8b30f5 100644 (file)
@@ -99,7 +99,7 @@ unpack0_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_4));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_4));
     }
   else
     {
@@ -244,7 +244,7 @@ unpack1_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_4));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_4));
     }
   else
     {
index f58a987..60d9de1 100644 (file)
@@ -99,7 +99,7 @@ unpack0_c8 (gfc_array_c8 *ret, const gfc_array_c8 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_8));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_8));
     }
   else
     {
@@ -244,7 +244,7 @@ unpack1_c8 (gfc_array_c8 *ret, const gfc_array_c8 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_8));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_8));
     }
   else
     {
index d6c6ee3..522ce74 100644 (file)
@@ -99,7 +99,7 @@ unpack0_i1 (gfc_array_i1 *ret, const gfc_array_i1 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_1));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_1));
     }
   else
     {
@@ -244,7 +244,7 @@ unpack1_i1 (gfc_array_i1 *ret, const gfc_array_i1 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_1));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_1));
     }
   else
     {
index 2a59725..7e0d1f7 100644 (file)
@@ -99,7 +99,7 @@ unpack0_i16 (gfc_array_i16 *ret, const gfc_array_i16 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_16));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_16));
     }
   else
     {
@@ -244,7 +244,7 @@ unpack1_i16 (gfc_array_i16 *ret, const gfc_array_i16 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_16));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_16));
     }
   else
     {
index 7aeca50..b0d21dc 100644 (file)
@@ -99,7 +99,7 @@ unpack0_i2 (gfc_array_i2 *ret, const gfc_array_i2 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_2));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_2));
     }
   else
     {
@@ -244,7 +244,7 @@ unpack1_i2 (gfc_array_i2 *ret, const gfc_array_i2 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_2));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_2));
     }
   else
     {
index 2a385ff..beac196 100644 (file)
@@ -99,7 +99,7 @@ unpack0_i4 (gfc_array_i4 *ret, const gfc_array_i4 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_4));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_4));
     }
   else
     {
@@ -244,7 +244,7 @@ unpack1_i4 (gfc_array_i4 *ret, const gfc_array_i4 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_4));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_4));
     }
   else
     {
index 399bd35..75cd2e9 100644 (file)
@@ -99,7 +99,7 @@ unpack0_i8 (gfc_array_i8 *ret, const gfc_array_i8 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_8));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_8));
     }
   else
     {
@@ -244,7 +244,7 @@ unpack1_i8 (gfc_array_i8 *ret, const gfc_array_i8 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_8));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_8));
     }
   else
     {
index 406395c..926a457 100644 (file)
@@ -99,7 +99,7 @@ unpack0_r10 (gfc_array_r10 *ret, const gfc_array_r10 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_10));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_10));
     }
   else
     {
@@ -244,7 +244,7 @@ unpack1_r10 (gfc_array_r10 *ret, const gfc_array_r10 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_10));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_10));
     }
   else
     {
index 0f70e57..6fff184 100644 (file)
@@ -99,7 +99,7 @@ unpack0_r16 (gfc_array_r16 *ret, const gfc_array_r16 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_16));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_16));
     }
   else
     {
@@ -244,7 +244,7 @@ unpack1_r16 (gfc_array_r16 *ret, const gfc_array_r16 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_16));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_16));
     }
   else
     {
index 8b0dde1..c900874 100644 (file)
@@ -99,7 +99,7 @@ unpack0_r4 (gfc_array_r4 *ret, const gfc_array_r4 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_4));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_4));
     }
   else
     {
@@ -244,7 +244,7 @@ unpack1_r4 (gfc_array_r4 *ret, const gfc_array_r4 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_4));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_4));
     }
   else
     {
index 13e3540..5999a51 100644 (file)
@@ -99,7 +99,7 @@ unpack0_r8 (gfc_array_r8 *ret, const gfc_array_r8 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_8));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_8));
     }
   else
     {
@@ -244,7 +244,7 @@ unpack1_r8 (gfc_array_r8 *ret, const gfc_array_r8 *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_8));
+      ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_8));
     }
   else
     {
index 12f8289..f983754 100644 (file)
@@ -79,8 +79,8 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array,
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
         }
 
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (size * arraysize);
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (arraysize, size);
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 1857ab0..7d37213 100644 (file)
@@ -86,8 +86,8 @@ eoshift0 (gfc_array_char * ret, const gfc_array_char * array,
 
         }
 
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (size * arraysize);
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (arraysize, size);
     }
   else if (unlikely (compile_options.bounds_check))
     {
index ed26492..c7ec5cf 100644 (file)
@@ -78,8 +78,8 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
       ret->offset = 0;
       ret->dtype = array->dtype;
 
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (size * arraysize);
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (arraysize, size);
 
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
         {
index 9924223..3fbfa0a 100644 (file)
@@ -152,8 +152,8 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array,
          GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
 
          ret->offset = 0;
-         /* xmalloc allocates a single byte for zero size.  */
-         ret->base_addr = xmalloc (size * total);
+         /* xmallocarray allocates a single byte for zero size.  */
+         ret->base_addr = xmallocarray (total, size);
 
          if (total == 0)
            return;      /* In this case, nothing remains to be done.  */
@@ -519,7 +519,7 @@ pack_s_internal (gfc_array_char *ret, const gfc_array_char *array,
 
       ret->offset = 0;
 
-      ret->base_addr = xmalloc (size * total);
+      ret->base_addr = xmallocarray (total, size);
 
       if (total == 0)
        return;
index 3b2e994..f742051 100644 (file)
@@ -99,11 +99,11 @@ reshape_internal (parray *ret, parray *source, shape_type *shape,
       ret->offset = 0;
 
       if (unlikely (rs < 1))
-       alloc_size = 1;
+       alloc_size = 0; /* xmalloc will allocate 1 byte.  */
       else
-       alloc_size = rs * size;
+       alloc_size = rs;
 
-      ret->base_addr = xmalloc (alloc_size);
+      ret->base_addr = xmallocarray (alloc_size, size);
 
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
     }
index 0fe5722..f3f23b8 100644 (file)
@@ -100,7 +100,7 @@ spread_internal (gfc_array_char *ret, const gfc_array_char *source,
          GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * size);
+      ret->base_addr = xmallocarray (rs, size);
 
       if (rs <= 0)
        return;
@@ -245,7 +245,7 @@ spread_internal_scalar (gfc_array_char *ret, const char *source,
 
   if (ret->base_addr == NULL)
     {
-      ret->base_addr = xmalloc (ncopies * size);
+      ret->base_addr = xmallocarray (ncopies, size);
       ret->offset = 0;
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
     }
index 84182af..5c50366 100644 (file)
@@ -164,7 +164,7 @@ string_trim (gfc_charlen_type *len, CHARTYPE **dest, gfc_charlen_type slen,
   else
     {
       /* Allocate space for result string.  */
-      *dest = xmalloc (*len * sizeof (CHARTYPE));
+      *dest = xmallocarray (*len, sizeof (CHARTYPE));
 
       /* Copy string if necessary.  */
       memcpy (*dest, src, *len * sizeof (CHARTYPE));
@@ -442,7 +442,7 @@ string_minmax (gfc_charlen_type *rlen, CHARTYPE **dest, int op, int nargs, ...)
     *dest = &zero_length_string;
   else
     {
-      CHARTYPE *tmp = xmalloc (*rlen * sizeof (CHARTYPE));
+      CHARTYPE *tmp = xmallocarray (*rlen, sizeof (CHARTYPE));
       memcpy (tmp, res, reslen * sizeof (CHARTYPE));
       MEMSET (&tmp[reslen], ' ', *rlen - reslen);
       *dest = tmp;
index 5ee12ee..a5e2947 100644 (file)
@@ -60,7 +60,7 @@ transpose_internal (gfc_array_char *ret, gfc_array_char *source)
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
-      ret->base_addr = xmalloc (size * size0 ((array_t*)ret));
+      ret->base_addr = xmallocarray (size0 ((array_t*)ret), size);
       ret->offset = 0;
     }
   else if (unlikely (compile_options.bounds_check))
index 5d12cc1..4bd9927 100644 (file)
@@ -125,7 +125,7 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * size);
+      ret->base_addr = xmallocarray (rs, size);
     }
   else
     {
index d871ce9..b64189a 100644 (file)
@@ -2407,7 +2407,7 @@ nml_touch_nodes (namelist_info * nl)
 {
   index_type len = strlen (nl->var_name) + 1;
   int dim;
-  char * ext_name = (char*)xmalloc (len + 1);
+  char * ext_name = xmalloc (len + 1);
   memcpy (ext_name, nl->var_name, len-1);
   memcpy (ext_name + len - 1, "%", 2);
   for (nl = nl->next; nl; nl = nl->next)
index cfe92ca..60b6012 100644 (file)
@@ -3786,9 +3786,9 @@ st_set_nml_var (st_parameter_dt *dtp, void * var_addr, char * var_name,
   if (nml->var_rank > 0)
     {
       nml->dim = (descriptor_dimension*)
-                  xmalloc (nml->var_rank * sizeof (descriptor_dimension));
+       xmallocarray (nml->var_rank, sizeof (descriptor_dimension));
       nml->ls = (array_loop_spec*)
-                 xmalloc (nml->var_rank * sizeof (array_loop_spec));
+       xmallocarray (nml->var_rank, sizeof (array_loop_spec));
     }
   else
     {
index 385818a..d191a8a 100644 (file)
@@ -454,7 +454,7 @@ get_internal_unit (st_parameter_dt *dtp)
     {
       iunit->rank = GFC_DESCRIPTOR_RANK (dtp->internal_unit_desc);
       iunit->ls = (array_loop_spec *)
-       xmalloc (iunit->rank * sizeof (array_loop_spec));
+       xmallocarray (iunit->rank, sizeof (array_loop_spec));
       dtp->internal_unit_len *=
        init_loop_spec (dtp->internal_unit_desc, iunit->ls, &start_record);
 
index eccbe7e..f76ec67 100644 (file)
@@ -1864,7 +1864,7 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset,
              base_var_name_len = base ? strlen (base->var_name) : 0;
              ext_name_len = base_name_len + base_var_name_len 
                + strlen (obj->var_name) + obj->var_rank * NML_DIGITS + 1;
-             ext_name = (char*)xmalloc (ext_name_len);
+             ext_name = xmalloc (ext_name_len);
 
              memcpy (ext_name, base_name, base_name_len);
              clen = strlen (obj->var_name + base_var_name_len);
@@ -1893,7 +1893,7 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset,
              /* Now obj_name.  */
 
              obj_name_len = strlen (obj->var_name) + 1;
-             obj_name = xmalloc (obj_name_len+1);
+             obj_name = xmalloc (obj_name_len + 1);
              memcpy (obj_name, obj->var_name, obj_name_len-1);
              memcpy (obj_name + obj_name_len-1, "%", 2);
 
index 0d6f432..e01d215 100644 (file)
@@ -768,6 +768,9 @@ internal_proto(get_fpu_rounding_mode);
 extern void *xmalloc (size_t) __attribute__ ((malloc));
 internal_proto(xmalloc);
 
+extern void *xmallocarray (size_t, size_t) __attribute__ ((malloc));
+internal_proto(xmallocarray);
+
 extern void *xcalloc (size_t, size_t) __attribute__ ((malloc));
 internal_proto(xcalloc);
 
index 15127e5..36ffd33 100644 (file)
@@ -56,7 +56,7 @@ bessel_jn_r'rtype_kind` ('rtype` * const restrict ret, int n1, int n2, 'rtype_na
     {
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
-      ret->base_addr = xmalloc (sizeof ('rtype_name`) * size);
+      ret->base_addr = xmallocarray (size, sizeof ('rtype_name`));
       ret->offset = 0;
     }
 
@@ -123,7 +123,7 @@ bessel_yn_r'rtype_kind` ('rtype` * const restrict ret, int n1, int n2,
     {
       size_t size = n2 < n1 ? 0 : n2-n1+1; 
       GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
-      ret->base_addr = xmalloc (sizeof ('rtype_name`) * size);
+      ret->base_addr = xmallocarray (size, sizeof ('rtype_name`));
       ret->offset = 0;
     }
 
index 602bf9e..e743e9e 100644 (file)
@@ -81,7 +81,7 @@ cshift1 (gfc_array_char * const restrict ret,
     {
       int i;
 
-      ret->base_addr = xmalloc (size * arraysize);
+      ret->base_addr = xmallocarray (arraysize, size);
       ret->offset = 0;
       ret->dtype = array->dtype;
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
index c373afe..df785ec 100644 (file)
@@ -106,8 +106,8 @@ eoshift1 (gfc_array_char * const restrict ret,
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
         }
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (size * arraysize);
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (arraysize, size);
 
     }
   else if (unlikely (compile_options.bounds_check))
index f1997df..1a257d9 100644 (file)
@@ -90,7 +90,7 @@ eoshift3 (gfc_array_char * const restrict ret,
     {
       int i;
 
-      ret->base_addr = xmalloc (size * arraysize);
+      ret->base_addr = xmallocarray (arraysize, size);
       ret->offset = 0;
       ret->dtype = array->dtype;
       for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
@@ -108,8 +108,8 @@ eoshift3 (gfc_array_char * const restrict ret,
          GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
 
         }
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (size * arraysize);
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (arraysize, size);
 
     }
   else if (unlikely (compile_options.bounds_check))
index a875a2a..2b916af 100644 (file)
@@ -30,7 +30,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (rtype_name) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (rtype_name));
     }
   else
     {
@@ -133,7 +133,7 @@ void
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (rtype_name) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (rtype_name));
     }
   else
     {
@@ -264,7 +264,7 @@ void
       GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
       retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
       retarray->offset = 0;
-      retarray->base_addr = xmalloc (sizeof (rtype_name) * rank);
+      retarray->base_addr = xmallocarray (rank, sizeof (rtype_name));
     }
   else if (unlikely (compile_options.bounds_check))
     {
index 1555aeb..b4de9a8 100644 (file)
@@ -85,10 +85,9 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
-      retarray->base_addr = xmalloc (alloc_size);
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
       if (alloc_size == 0)
        {
          /* Make sure we have a zero-sized array.  */
@@ -260,8 +259,7 @@ void
 
        }
 
-      alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -273,7 +271,7 @@ void
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
 
     }
   else
@@ -417,8 +415,7 @@ void
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -427,7 +424,7 @@ void
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
     }
   else
     {
index 13dd7a9..fd3afb0 100644 (file)
@@ -89,8 +89,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
 
-      alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
-                  * extent[rank-1];
+      alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
       if (alloc_size == 0)
        {
@@ -99,7 +98,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
          return;
        }
       else
-       retarray->base_addr = xmalloc (alloc_size);
+       retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
     }
   else
     {
index 9d515d4..a807e71 100644 (file)
@@ -79,7 +79,7 @@ internal_pack_'rtype_ccode` ('rtype` * source)
     return source->base_addr;
 
   /* Allocate storage for the destination.  */
-  destptr = ('rtype_name` *)xmalloc (ssize * sizeof ('rtype_name`));
+  destptr = xmallocarray (ssize, sizeof ('rtype_name`));
   dest = destptr;
   src = source->base_addr;
   stride0 = stride[0];
index 937daa8..e5f43e2 100644 (file)
@@ -125,7 +125,7 @@ matmul_'rtype_code` ('rtype` * const restrict retarray,
         }
 
       retarray->base_addr
-       = xmalloc (sizeof ('rtype_name`) * size0 ((array_t *) retarray));
+       = xmallocarray (size0 ((array_t *) retarray), sizeof ('rtype_name`));
       retarray->offset = 0;
     }
     else if (unlikely (compile_options.bounds_check))
index 25bdc75..4be37d5 100644 (file)
@@ -89,7 +89,7 @@ matmul_'rtype_code` ('rtype` * const restrict retarray,
         }
           
       retarray->base_addr
-       = xmalloc (sizeof ('rtype_name`) * size0 ((array_t *) retarray));
+       = xmallocarray (size0 ((array_t *) retarray), sizeof ('rtype_name`));
       retarray->offset = 0;
     }
     else if (unlikely (compile_options.bounds_check))
index 8495de4..a5517d0 100644 (file)
@@ -168,8 +168,8 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array,
 
          ret->offset = 0;
 
-         /* xmalloc allocates a single byte for zero size.  */
-         ret->base_addr = xmalloc (sizeof ('rtype_name`) * total);
+         /* xmallocarray allocates a single byte for zero size.  */
+         ret->base_addr = xmallocarray (total, sizeof ('rtype_name`));
 
          if (total == 0)
            return;
index 943f3e9..6341b6e 100644 (file)
@@ -115,11 +115,11 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret,
       ret->offset = 0;
 
       if (unlikely (rs < 1))
-        alloc_size = 1;
+        alloc_size = 0;
       else
-        alloc_size = rs * sizeof ('rtype_name`);
+        alloc_size = rs;
 
-      ret->base_addr = xmalloc (alloc_size);
+      ret->base_addr = xmallocarray (alloc_size, sizeof ('rtype_name`));
       ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
     }
 
index 85dd233..9d02c6c 100644 (file)
@@ -50,7 +50,7 @@ shape_'rtype_kind` ('rtype` * const restrict ret,
     {
       GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1);
       ret->offset = 0;
-      ret->base_addr = xmalloc (sizeof ('rtype_name`) * rank);
+      ret->base_addr = xmallocarray (rank, sizeof ('rtype_name`));
     }
 
   stride = GFC_DESCRIPTOR_STRIDE(ret,0);
index 82ae240..62cfd81 100644 (file)
@@ -102,8 +102,8 @@ spread_'rtype_code` ('rtype` *ret, const 'rtype` *source,
        }
       ret->offset = 0;
 
-      /* xmalloc allocates a single byte for zero size.  */
-      ret->base_addr = xmalloc (rs * sizeof('rtype_name`));
+      /* xmallocarray allocates a single byte for zero size.  */
+      ret->base_addr = xmallocarray (rs, sizeof('rtype_name`));
       if (rs <= 0)
         return;
     }
@@ -245,7 +245,7 @@ spread_scalar_'rtype_code` ('rtype` *ret, const 'rtype_name` *source,
 
   if (ret->base_addr == NULL)
     {
-      ret->base_addr = xmalloc (ncopies * sizeof ('rtype_name`));
+      ret->base_addr = xmallocarray (ncopies, sizeof ('rtype_name`));
       ret->offset = 0;
       GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
     }
index da4f782..6d9f476 100644 (file)
@@ -61,7 +61,8 @@ transpose_'rtype_code` ('rtype` * const restrict ret,
       GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
                        GFC_DESCRIPTOR_EXTENT(source, 1));
 
-      ret->base_addr = xmalloc (sizeof ('rtype_name`) * size0 ((array_t *) ret));
+      ret->base_addr = xmallocarray (size0 ((array_t *) ret), 
+                                     sizeof ('rtype_name`));
       ret->offset = 0;
     } else if (unlikely (compile_options.bounds_check))
     {
index 4382ac4..e945446 100644 (file)
@@ -100,7 +100,7 @@ unpack0_'rtype_code` ('rtype` *ret, const 'rtype` *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof ('rtype_name`));
+      ret->base_addr = xmallocarray (rs, sizeof ('rtype_name`));
     }
   else
     {
@@ -245,7 +245,7 @@ unpack1_'rtype_code` ('rtype` *ret, const 'rtype` *vector,
          rs *= extent[n];
        }
       ret->offset = 0;
-      ret->base_addr = xmalloc (rs * sizeof ('rtype_name`));
+      ret->base_addr = xmallocarray (rs, sizeof ('rtype_name`));
     }
   else
     {
index aa81991..c3cd1c2 100644 (file)
@@ -44,7 +44,7 @@ convert_char1_to_char4 (gfc_char4_t **dst, gfc_charlen_type len,
   gfc_charlen_type i, l;
 
   l = len > 0 ? len : 0;
-  *dst = xmalloc ((l + 1) * sizeof (gfc_char4_t));
+  *dst = xmallocarray ((l + 1), sizeof (gfc_char4_t));
 
   for (i = 0; i < l; i++)
     (*dst)[i] = src[i];
@@ -60,7 +60,7 @@ convert_char4_to_char1 (unsigned char **dst, gfc_charlen_type len,
   gfc_charlen_type i, l;
 
   l = len > 0 ? len : 0;
-  *dst = xmalloc ((l + 1) * sizeof (unsigned char));
+  *dst = xmalloc (l + 1);
 
   for (i = 0; i < l; i++)
     (*dst)[i] = src[i];
index 0c0e930..1095f44 100644 (file)
@@ -837,7 +837,7 @@ void init_unformatted (variable * v)
     }
   else
     {
-      elist = xmalloc (unit_count * sizeof (exception_t));
+      elist = xmallocarray (unit_count, sizeof (exception_t));
       do_count = 0;
       p = val;
       do_parse ();
index 1b8c558..aab155d 100644 (file)
@@ -180,7 +180,7 @@ internal_pack (gfc_array_char * source)
     return source->base_addr;
 
    /* Allocate storage for the destination.  */
-  destptr = xmalloc (ssize * size);
+  destptr = xmallocarray (ssize, size);
   dest = (char *)destptr;
   src = source->base_addr;
   stride0 = stride[0] * size;
index efeea86..c1e7358 100644 (file)
@@ -25,6 +25,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 #include "libgfortran.h"
 #include <stdlib.h>
+#include <errno.h>
+
+#ifndef SIZE_MAX
+#define SIZE_MAX ((size_t)-1)
+#endif
 
 
 void *
@@ -44,12 +49,34 @@ xmalloc (size_t n)
 }
 
 
+void *
+xmallocarray (size_t nmemb, size_t size)
+{
+  void *p;
+
+  if (!nmemb || !size)
+    size = nmemb = 1;
+  else if (nmemb > SIZE_MAX / size)
+    {
+      errno = ENOMEM;
+      os_error ("Integer overflow in xmallocarray");
+    }
+
+  p = malloc (nmemb * size);
+
+  if (!p)
+    os_error ("Memory allocation failed in xmallocarray");
+
+  return p;
+}
+
+
 /* calloc wrapper that aborts on error.  */
 
 void *
 xcalloc (size_t nmemb, size_t size)
 {
-  if (nmemb * size == 0)
+  if (!nmemb || !size)
     nmemb = size = 1;
 
   void *p = calloc (nmemb, size);
index e97b850..a3e0424 100644 (file)
@@ -7,6 +7,9 @@
 /* Implement runtime.Caller.  */
 
 #include <stdint.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
 
 #include "backtrace.h"
 
@@ -99,6 +102,7 @@ __go_get_backtrace_state ()
   if (back_state == NULL)
     {
       const char *filename;
+      struct stat s;
 
       filename = (const char *) runtime_progname ();
 
@@ -108,6 +112,14 @@ __go_get_backtrace_state ()
       if (__builtin_strchr (filename, '/') == NULL)
        filename = NULL;
 
+      /* If the file is small, then it's not the real executable.
+        This is specifically to deal with Docker, which uses a bogus
+        argv[0] (http://gcc.gnu.org/PR61895).  It would be nice to
+        have a better check for whether this file is the real
+        executable.  */
+      if (stat (filename, &s) < 0 || s.st_size < 1024)
+       filename = NULL;
+
       back_state = backtrace_create_state (filename, 1, error_callback, NULL);
     }
   runtime_unlock (&back_state_lock);
index f84950d..d9d5db7 100644 (file)
@@ -1,3 +1,44 @@
+2014-08-04  Jakub Jelinek  <jakub@redhat.com>
+
+       * task.c (GOMP_taskgroup_end): If taskgroup->num_children
+       is not zero, but taskgroup->children is NULL and there are
+       any task->children, schedule those instead of waiting.
+       * testsuite/libgomp.c/depend-6.c: New test.
+       * testsuite/libgomp.c/depend-7.c: New test.
+       * testsuite/libgomp.c/depend-8.c: New test.
+       * testsuite/libgomp.c/depend-9.c: New test.
+       * testsuite/libgomp.c/depend-10.c: New test.
+
+2014-08-01  Jakub Jelinek  <jakub@redhat.com>
+
+       * libgomp.h (struct gomp_task_depend_entry): Add redundant_out field.
+       (struct gomp_taskwait): New type.
+       (struct gomp_task): Add taskwait and parent_depends_on, remove
+       in_taskwait and taskwait_sem fields.
+       (gomp_finish_task): Don't destroy taskwait_sem.
+       * task.c (gomp_init_task): Don't init in_taskwait, instead init
+       taskwait and parent_depends_on.
+       (GOMP_task): For if (0) tasks with depend clause that depend on
+       earlier tasks don't defer them, instead call
+       gomp_task_maybe_wait_for_dependencies to wait for the dependencies.
+       Initialize redundant_out field, for redundant out entries just
+       move them at the end of linked list instead of removing them
+       completely, and set redundant_out flag instead of redundant.
+       (gomp_task_run_pre): Update last_parent_depends_on if scheduling
+       that task.
+       (gomp_task_run_post_handle_dependers): If parent is in
+       gomp_task_maybe_wait_for_dependencies and newly runnable task
+       is not parent_depends_on, queue it in parent->children linked
+       list after all runnable tasks with parent_depends_on set.
+       Adjust for addition of taskwait indirection.
+       (gomp_task_run_post_remove_parent): If parent is in
+       gomp_task_maybe_wait_for_dependencies and task to be removed
+       is parent_depends_on, decrement n_depend and if needed awake
+       parent.  Adjust for addition of taskwait indirection.
+       (GOMP_taskwait): Adjust for addition of taskwait indirection.
+       (gomp_task_maybe_wait_for_dependencies): New function.
+       * testsuite/libgomp.c/depend-5.c: New test.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index bcd5b34..a1482cc 100644 (file)
@@ -274,6 +274,7 @@ struct gomp_task_depend_entry
   struct gomp_task *task;
   bool is_in;
   bool redundant;
+  bool redundant_out;
 };
 
 struct gomp_dependers_vec
@@ -283,6 +284,17 @@ struct gomp_dependers_vec
   struct gomp_task *elem[];
 };
 
+/* Used when in GOMP_taskwait or in gomp_task_maybe_wait_for_dependencies.  */
+
+struct gomp_taskwait
+{
+  bool in_taskwait;
+  bool in_depend_wait;
+  size_t n_depend;
+  struct gomp_task *last_parent_depends_on;
+  gomp_sem_t taskwait_sem;
+};
+
 /* This structure describes a "task" to be run by a thread.  */
 
 struct gomp_task
@@ -298,17 +310,17 @@ struct gomp_task
   struct gomp_taskgroup *taskgroup;
   struct gomp_dependers_vec *dependers;
   struct htab *depend_hash;
+  struct gomp_taskwait *taskwait;
   size_t depend_count;
   size_t num_dependees;
   struct gomp_task_icv icv;
   void (*fn) (void *);
   void *fn_data;
   enum gomp_task_kind kind;
-  bool in_taskwait;
   bool in_tied_task;
   bool final_task;
   bool copy_ctors_done;
-  gomp_sem_t taskwait_sem;
+  bool parent_depends_on;
   struct gomp_task_depend_entry depend[];
 };
 
@@ -582,7 +594,6 @@ gomp_finish_task (struct gomp_task *task)
 {
   if (__builtin_expect (task->depend_hash != NULL, 0))
     free (task->depend_hash);
-  gomp_sem_destroy (&task->taskwait_sem);
 }
 
 /* team.c */
index be2df3f..7d3233c 100644 (file)
@@ -66,16 +66,16 @@ gomp_init_task (struct gomp_task *task, struct gomp_task *parent_task,
   task->parent = parent_task;
   task->icv = *prev_icv;
   task->kind = GOMP_TASK_IMPLICIT;
-  task->in_taskwait = false;
+  task->taskwait = NULL;
   task->in_tied_task = false;
   task->final_task = false;
   task->copy_ctors_done = false;
+  task->parent_depends_on = false;
   task->children = NULL;
   task->taskgroup = NULL;
   task->dependers = NULL;
   task->depend_hash = NULL;
   task->depend_count = 0;
-  gomp_sem_init (&task->taskwait_sem, 0);
 }
 
 /* Clean up a task, after completing it.  */
@@ -104,6 +104,8 @@ gomp_clear_parent (struct gomp_task *children)
     while (task != children);
 }
 
+static void gomp_task_maybe_wait_for_dependencies (void **depend);
+
 /* Called when encountering an explicit task directive.  If IF_CLAUSE is
    false, then we must not delay in executing the task.  If UNTIED is true,
    then the task may be executed by any member of the team.  */
@@ -141,35 +143,12 @@ GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
 
       /* If there are depend clauses and earlier deferred sibling tasks
         with depend clauses, check if there isn't a dependency.  If there
-        is, fall through to the deferred task handling, as we can't
-        schedule such tasks right away.  There is no need to handle
+        is, we need to wait for them.  There is no need to handle
         depend clauses for non-deferred tasks other than this, because
         the parent task is suspended until the child task finishes and thus
         it can't start further child tasks.  */
       if ((flags & 8) && thr->task && thr->task->depend_hash)
-       {
-         struct gomp_task *parent = thr->task;
-         struct gomp_task_depend_entry elem, *ent = NULL;
-         size_t ndepend = (uintptr_t) depend[0];
-         size_t nout = (uintptr_t) depend[1];
-         size_t i;
-         gomp_mutex_lock (&team->task_lock);
-         for (i = 0; i < ndepend; i++)
-           {
-             elem.addr = depend[i + 2];
-             ent = htab_find (parent->depend_hash, &elem);
-             for (; ent; ent = ent->next)
-               if (i >= nout && ent->is_in)
-                 continue;
-               else
-                 break;
-             if (ent)
-               break;
-           }
-         gomp_mutex_unlock (&team->task_lock);
-         if (ent)
-           goto defer;
-       }
+       gomp_task_maybe_wait_for_dependencies (depend);
 
       gomp_init_task (&task, thr->task, gomp_icv (false));
       task.kind = GOMP_TASK_IFFALSE;
@@ -209,7 +188,6 @@ GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
     }
   else
     {
-     defer:;
       struct gomp_task *task;
       struct gomp_task *parent = thr->task;
       struct gomp_taskgroup *taskgroup = parent->taskgroup;
@@ -275,11 +253,12 @@ GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
              task->depend[i].task = task;
              task->depend[i].is_in = i >= nout;
              task->depend[i].redundant = false;
+             task->depend[i].redundant_out = false;
 
              hash_entry_type *slot
                = htab_find_slot (&parent->depend_hash, &task->depend[i],
                                  INSERT);
-             hash_entry_type out = NULL;
+             hash_entry_type out = NULL, last = NULL;
              if (*slot)
                {
                  /* If multiple depends on the same task are the
@@ -294,6 +273,11 @@ GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
                    }
                  for (ent = *slot; ent; ent = ent->next)
                    {
+                     if (ent->redundant_out)
+                       break;
+
+                     last = ent;
+
                      /* depend(in:...) doesn't depend on earlier
                         depend(in:...).  */
                      if (i >= nout && ent->is_in)
@@ -341,21 +325,31 @@ GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
              *slot = &task->depend[i];
 
              /* There is no need to store more than one depend({,in}out:)
-                task per address in the hash table chain, because each out
+                task per address in the hash table chain for the purpose
+                of creation of deferred tasks, because each out
                 depends on all earlier outs, thus it is enough to record
                 just the last depend({,in}out:).  For depend(in:), we need
                 to keep all of the previous ones not terminated yet, because
                 a later depend({,in}out:) might need to depend on all of
                 them.  So, if the new task's clause is depend({,in}out:),
                 we know there is at most one other depend({,in}out:) clause
-                in the list (out) and to maintain the invariant we now
-                need to remove it from the list.  */
+                in the list (out).  For non-deferred tasks we want to see
+                all outs, so they are moved to the end of the chain,
+                after first redundant_out entry all following entries
+                should be redundant_out.  */
              if (!task->depend[i].is_in && out)
                {
-                 if (out->next)
-                   out->next->prev = out->prev;
-                 out->prev->next = out->next;
-                 out->redundant = true;
+                 if (out != last)
+                   {
+                     out->next->prev = out->prev;
+                     out->prev->next = out->next;
+                     out->next = last->next;
+                     out->prev = last;
+                     last->next = out;
+                     if (out->next)
+                       out->next->prev = out;
+                   }
+                 out->redundant_out = true;
                }
            }
          if (task->num_dependees)
@@ -421,8 +415,20 @@ static inline bool
 gomp_task_run_pre (struct gomp_task *child_task, struct gomp_task *parent,
                   struct gomp_taskgroup *taskgroup, struct gomp_team *team)
 {
-  if (parent && parent->children == child_task)
-    parent->children = child_task->next_child;
+  if (parent)
+    {
+      if (parent->children == child_task)
+       parent->children = child_task->next_child;
+      if (__builtin_expect (child_task->parent_depends_on, 0)
+         && parent->taskwait->last_parent_depends_on == child_task)
+       {
+         if (child_task->prev_child->kind == GOMP_TASK_WAITING
+             && child_task->prev_child->parent_depends_on)
+           parent->taskwait->last_parent_depends_on = child_task->prev_child;
+         else
+           parent->taskwait->last_parent_depends_on = NULL;
+       }
+    }
   if (taskgroup && taskgroup->children == child_task)
     taskgroup->children = child_task->next_taskgroup;
   child_task->prev_queue->next_queue = child_task->next_queue;
@@ -489,8 +495,23 @@ gomp_task_run_post_handle_dependers (struct gomp_task *child_task,
        {
          if (parent->children)
            {
-             task->next_child = parent->children;
-             task->prev_child = parent->children->prev_child;
+             /* If parent is in gomp_task_maybe_wait_for_dependencies
+                and it doesn't need to wait for this task, put it after
+                all ready to run tasks it needs to wait for.  */
+             if (parent->taskwait && parent->taskwait->last_parent_depends_on
+                 && !task->parent_depends_on)
+               {
+                 struct gomp_task *last_parent_depends_on
+                   = parent->taskwait->last_parent_depends_on;
+                 task->next_child = last_parent_depends_on->next_child;
+                 task->prev_child = last_parent_depends_on;
+               }
+             else
+               {
+                 task->next_child = parent->children;
+                 task->prev_child = parent->children->prev_child;
+                 parent->children = task;
+               }
              task->next_child->prev_child = task;
              task->prev_child->next_child = task;
            }
@@ -498,12 +519,23 @@ gomp_task_run_post_handle_dependers (struct gomp_task *child_task,
            {
              task->next_child = task;
              task->prev_child = task;
+             parent->children = task;
            }
-         parent->children = task;
-         if (parent->in_taskwait)
+         if (parent->taskwait)
            {
-             parent->in_taskwait = false;
-             gomp_sem_post (&parent->taskwait_sem);
+             if (parent->taskwait->in_taskwait)
+               {
+                 parent->taskwait->in_taskwait = false;
+                 gomp_sem_post (&parent->taskwait->taskwait_sem);
+               }
+             else if (parent->taskwait->in_depend_wait)
+               {
+                 parent->taskwait->in_depend_wait = false;
+                 gomp_sem_post (&parent->taskwait->taskwait_sem);
+               }
+             if (parent->taskwait->last_parent_depends_on == NULL
+                 && task->parent_depends_on)
+               parent->taskwait->last_parent_depends_on = task;
            }
        }
       if (taskgroup)
@@ -575,6 +607,13 @@ gomp_task_run_post_remove_parent (struct gomp_task *child_task)
   struct gomp_task *parent = child_task->parent;
   if (parent == NULL)
     return;
+  if (__builtin_expect (child_task->parent_depends_on, 0)
+      && --parent->taskwait->n_depend == 0
+      && parent->taskwait->in_depend_wait)
+    {
+      parent->taskwait->in_depend_wait = false;
+      gomp_sem_post (&parent->taskwait->taskwait_sem);
+    }
   child_task->prev_child->next_child = child_task->next_child;
   child_task->next_child->prev_child = child_task->prev_child;
   if (parent->children != child_task)
@@ -589,10 +628,10 @@ gomp_task_run_post_remove_parent (struct gomp_task *child_task)
         written by child_task->fn above is flushed
         before the NULL is written.  */
       __atomic_store_n (&parent->children, NULL, MEMMODEL_RELEASE);
-      if (parent->in_taskwait)
+      if (parent->taskwait && parent->taskwait->in_taskwait)
        {
-         parent->in_taskwait = false;
-         gomp_sem_post (&parent->taskwait_sem);
+         parent->taskwait->in_taskwait = false;
+         gomp_sem_post (&parent->taskwait->taskwait_sem);
        }
     }
 }
@@ -736,6 +775,7 @@ GOMP_taskwait (void)
   struct gomp_task *task = thr->task;
   struct gomp_task *child_task = NULL;
   struct gomp_task *to_free = NULL;
+  struct gomp_taskwait taskwait;
   int do_wake = 0;
 
   /* The acquire barrier on load of task->children here synchronizes
@@ -748,18 +788,194 @@ GOMP_taskwait (void)
       || __atomic_load_n (&task->children, MEMMODEL_ACQUIRE) == NULL)
     return;
 
+  memset (&taskwait, 0, sizeof (taskwait));
   gomp_mutex_lock (&team->task_lock);
   while (1)
     {
       bool cancelled = false;
       if (task->children == NULL)
        {
+         bool destroy_taskwait = task->taskwait != NULL;
+         task->taskwait = NULL;
          gomp_mutex_unlock (&team->task_lock);
          if (to_free)
            {
              gomp_finish_task (to_free);
              free (to_free);
            }
+         if (destroy_taskwait)
+           gomp_sem_destroy (&taskwait.taskwait_sem);
+         return;
+       }
+      if (task->children->kind == GOMP_TASK_WAITING)
+       {
+         child_task = task->children;
+         cancelled
+           = gomp_task_run_pre (child_task, task, child_task->taskgroup,
+                                team);
+         if (__builtin_expect (cancelled, 0))
+           {
+             if (to_free)
+               {
+                 gomp_finish_task (to_free);
+                 free (to_free);
+                 to_free = NULL;
+               }
+             goto finish_cancelled;
+           }
+       }
+      else
+       {
+         /* All tasks we are waiting for are already running
+            in other threads.  Wait for them.  */
+         if (task->taskwait == NULL)
+           {
+             taskwait.in_depend_wait = false;
+             gomp_sem_init (&taskwait.taskwait_sem, 0);
+             task->taskwait = &taskwait;
+           }
+         taskwait.in_taskwait = true;
+       }
+      gomp_mutex_unlock (&team->task_lock);
+      if (do_wake)
+       {
+         gomp_team_barrier_wake (&team->barrier, do_wake);
+         do_wake = 0;
+       }
+      if (to_free)
+       {
+         gomp_finish_task (to_free);
+         free (to_free);
+         to_free = NULL;
+       }
+      if (child_task)
+       {
+         thr->task = child_task;
+         child_task->fn (child_task->fn_data);
+         thr->task = task;
+       }
+      else
+       gomp_sem_wait (&taskwait.taskwait_sem);
+      gomp_mutex_lock (&team->task_lock);
+      if (child_task)
+       {
+        finish_cancelled:;
+         size_t new_tasks
+           = gomp_task_run_post_handle_depend (child_task, team);
+         child_task->prev_child->next_child = child_task->next_child;
+         child_task->next_child->prev_child = child_task->prev_child;
+         if (task->children == child_task)
+           {
+             if (child_task->next_child != child_task)
+               task->children = child_task->next_child;
+             else
+               task->children = NULL;
+           }
+         gomp_clear_parent (child_task->children);
+         gomp_task_run_post_remove_taskgroup (child_task);
+         to_free = child_task;
+         child_task = NULL;
+         team->task_count--;
+         if (new_tasks > 1)
+           {
+             do_wake = team->nthreads - team->task_running_count
+                       - !task->in_tied_task;
+             if (do_wake > new_tasks)
+               do_wake = new_tasks;
+           }
+       }
+    }
+}
+
+/* This is like GOMP_taskwait, but we only wait for tasks that the
+   upcoming task depends on.  */
+
+static void
+gomp_task_maybe_wait_for_dependencies (void **depend)
+{
+  struct gomp_thread *thr = gomp_thread ();
+  struct gomp_task *task = thr->task;
+  struct gomp_team *team = thr->ts.team;
+  struct gomp_task_depend_entry elem, *ent = NULL;
+  struct gomp_taskwait taskwait;
+  struct gomp_task *last_parent_depends_on = NULL;
+  size_t ndepend = (uintptr_t) depend[0];
+  size_t nout = (uintptr_t) depend[1];
+  size_t i;
+  size_t num_awaited = 0;
+  struct gomp_task *child_task = NULL;
+  struct gomp_task *to_free = NULL;
+  int do_wake = 0;
+
+  gomp_mutex_lock (&team->task_lock);
+  for (i = 0; i < ndepend; i++)
+    {
+      elem.addr = depend[i + 2];
+      ent = htab_find (task->depend_hash, &elem);
+      for (; ent; ent = ent->next)
+       if (i >= nout && ent->is_in)
+         continue;
+       else
+         {
+           struct gomp_task *tsk = ent->task;
+           if (!tsk->parent_depends_on)
+             {
+               tsk->parent_depends_on = true;
+               ++num_awaited;
+               if (tsk->num_dependees == 0 && tsk->kind == GOMP_TASK_WAITING)
+                 {
+                   /* If a task we need to wait for is not already
+                      running and is ready to be scheduled, move it
+                      to front, so that we run it as soon as possible.  */
+                   if (last_parent_depends_on)
+                     {
+                       tsk->prev_child->next_child = tsk->next_child;
+                       tsk->next_child->prev_child = tsk->prev_child;
+                       tsk->prev_child = last_parent_depends_on;
+                       tsk->next_child = last_parent_depends_on->next_child;
+                       tsk->prev_child->next_child = tsk;
+                       tsk->next_child->prev_child = tsk;
+                     }
+                   else if (tsk != task->children)
+                     {
+                       tsk->prev_child->next_child = tsk->next_child;
+                       tsk->next_child->prev_child = tsk->prev_child;
+                       tsk->prev_child = task->children;
+                       tsk->next_child = task->children->next_child;
+                       task->children = tsk;
+                       tsk->prev_child->next_child = tsk;
+                       tsk->next_child->prev_child = tsk;
+                     }
+                   last_parent_depends_on = tsk;
+                 }
+             }
+         }
+    }
+  if (num_awaited == 0)
+    {
+      gomp_mutex_unlock (&team->task_lock);
+      return;
+    }
+
+  memset (&taskwait, 0, sizeof (taskwait));
+  taskwait.n_depend = num_awaited;
+  taskwait.last_parent_depends_on = last_parent_depends_on;
+  gomp_sem_init (&taskwait.taskwait_sem, 0);
+  task->taskwait = &taskwait;
+
+  while (1)
+    {
+      bool cancelled = false;
+      if (taskwait.n_depend == 0)
+       {
+         task->taskwait = NULL;
+         gomp_mutex_unlock (&team->task_lock);
+         if (to_free)
+           {
+             gomp_finish_task (to_free);
+             free (to_free);
+           }
+         gomp_sem_destroy (&taskwait.taskwait_sem);
          return;
        }
       if (task->children->kind == GOMP_TASK_WAITING)
@@ -782,7 +998,7 @@ GOMP_taskwait (void)
       else
        /* All tasks we are waiting for are already running
           in other threads.  Wait for them.  */
-       task->in_taskwait = true;
+       taskwait.in_depend_wait = true;
       gomp_mutex_unlock (&team->task_lock);
       if (do_wake)
        {
@@ -802,13 +1018,15 @@ GOMP_taskwait (void)
          thr->task = task;
        }
       else
-       gomp_sem_wait (&task->taskwait_sem);
+       gomp_sem_wait (&taskwait.taskwait_sem);
       gomp_mutex_lock (&team->task_lock);
       if (child_task)
        {
         finish_cancelled:;
          size_t new_tasks
            = gomp_task_run_post_handle_depend (child_task, team);
+         if (child_task->parent_depends_on)
+           --taskwait.n_depend;
          child_task->prev_child->next_child = child_task->next_child;
          child_task->next_child->prev_child = child_task->prev_child;
          if (task->children == child_task)
@@ -897,18 +1115,26 @@ GOMP_taskgroup_end (void)
       if (taskgroup->children == NULL)
        {
          if (taskgroup->num_children)
-           goto do_wait;
-         gomp_mutex_unlock (&team->task_lock);
-         if (to_free)
            {
-             gomp_finish_task (to_free);
-             free (to_free);
+             if (task->children == NULL)
+               goto do_wait;
+             child_task = task->children;
+            }
+          else
+           {
+             gomp_mutex_unlock (&team->task_lock);
+             if (to_free)
+               {
+                 gomp_finish_task (to_free);
+                 free (to_free);
+               }
+             goto finish;
            }
-         goto finish;
        }
-      if (taskgroup->children->kind == GOMP_TASK_WAITING)
+      else
+       child_task = taskgroup->children;
+      if (child_task->kind == GOMP_TASK_WAITING)
        {
-         child_task = taskgroup->children;
          cancelled
            = gomp_task_run_pre (child_task, child_task->parent, taskgroup,
                                 team);
@@ -925,6 +1151,7 @@ GOMP_taskgroup_end (void)
        }
       else
        {
+         child_task = NULL;
         do_wait:
          /* All tasks we are waiting for are already running
             in other threads.  Wait for them.  */
@@ -956,20 +1183,9 @@ GOMP_taskgroup_end (void)
         finish_cancelled:;
          size_t new_tasks
            = gomp_task_run_post_handle_depend (child_task, team);
-         child_task->prev_taskgroup->next_taskgroup
-           = child_task->next_taskgroup;
-         child_task->next_taskgroup->prev_taskgroup
-           = child_task->prev_taskgroup;
-         --taskgroup->num_children;
-         if (taskgroup->children == child_task)
-           {
-             if (child_task->next_taskgroup != child_task)
-               taskgroup->children = child_task->next_taskgroup;
-             else
-               taskgroup->children = NULL;
-           }
          gomp_task_run_post_remove_parent (child_task);
          gomp_clear_parent (child_task->children);
+         gomp_task_run_post_remove_taskgroup (child_task);
          to_free = child_task;
          child_task = NULL;
          team->task_count--;
diff --git a/libgomp/testsuite/libgomp.c/depend-10.c b/libgomp/testsuite/libgomp.c/depend-10.c
new file mode 100644 (file)
index 0000000..2137bf9
--- /dev/null
@@ -0,0 +1,3 @@
+/* { dg-set-target-env-var OMP_NUM_THREADS "1" } */
+
+#include "depend-5.c"
diff --git a/libgomp/testsuite/libgomp.c/depend-5.c b/libgomp/testsuite/libgomp.c/depend-5.c
new file mode 100644 (file)
index 0000000..192c6dd
--- /dev/null
@@ -0,0 +1,98 @@
+#include <stdlib.h>
+
+__attribute__((noinline, noclone)) void
+f1 (int ifval)
+{
+  int x = 1, y = 2, z = 3;
+  #pragma omp parallel
+  #pragma omp single
+  {
+    #pragma omp task shared (x) depend(out: x)
+    x = 2;
+    #pragma omp task shared (x) depend(inout: x)
+    {
+      if (x != 2)
+       abort ();
+      x = 3;
+    }
+    #pragma omp task shared (x) depend(inout: x)
+    {
+      if (x != 3)
+       abort ();
+      x = 4;
+    }
+    #pragma omp task shared (z) depend(in: z)
+    if (z != 3)
+      abort ();
+    #pragma omp task shared (z) depend(in: z)
+    if (z != 3)
+      abort ();
+    #pragma omp task shared (z) depend(in: z)
+    if (z != 3)
+      abort ();
+    #pragma omp task shared (z) depend(in: z)
+    if (z != 3)
+      abort ();
+    #pragma omp task shared (z) depend(in: z)
+    if (z != 3)
+      abort ();
+    #pragma omp task shared (z) depend(in: z)
+    if (z != 3)
+      abort ();
+    #pragma omp task shared (y) depend(in: y)
+    if (y != 2)
+      abort ();
+    #pragma omp task shared (y) depend(in: y)
+    if (y != 2)
+      abort ();
+    #pragma omp task shared (y) depend(in: y)
+    if (y != 2)
+      abort ();
+    #pragma omp task shared (y) depend(in: y)
+    if (y != 2)
+      abort ();
+    #pragma omp task if (ifval) shared (x, y) depend(in: x) depend(inout: y)
+    {
+      if (x != 4 || y != 2)
+       abort ();
+      y = 3;
+    }
+    if (ifval == 0)
+      {
+       /* The above if (0) task should have waited till all
+          the tasks with x and y dependencies finish.  */
+       if (x != 4 || y != 3)
+         abort ();
+       x = 5;
+       y = 4;
+      }
+    #pragma omp task shared (z) depend(inout: z)
+    {
+      if (z != 3)
+       abort ();
+      z = 4;
+    }
+    #pragma omp task shared (z) depend(inout: z)
+    {
+      if (z != 4)
+       abort ();
+      z = 5;
+    }
+    #pragma omp taskwait
+    if (x != (ifval ? 4 : 5) || y != (ifval ? 3 : 4) || z != 5)
+      abort ();
+    #pragma omp task if (ifval) shared (x, y) depend(in: x) depend(inout: y)
+    {
+      if (x != (ifval ? 4 : 5) || y != (ifval ? 3 : 4))
+       abort ();
+    }
+  }
+}
+
+int
+main ()
+{
+  f1 (0);
+  f1 (1);
+  return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/depend-6.c b/libgomp/testsuite/libgomp.c/depend-6.c
new file mode 100644 (file)
index 0000000..d30e6e9
--- /dev/null
@@ -0,0 +1,3 @@
+/* { dg-set-target-env-var OMP_NUM_THREADS "1" } */
+
+#include "depend-1.c"
diff --git a/libgomp/testsuite/libgomp.c/depend-7.c b/libgomp/testsuite/libgomp.c/depend-7.c
new file mode 100644 (file)
index 0000000..bd4a3f9
--- /dev/null
@@ -0,0 +1,3 @@
+/* { dg-set-target-env-var OMP_NUM_THREADS "1" } */
+
+#include "depend-2.c"
diff --git a/libgomp/testsuite/libgomp.c/depend-8.c b/libgomp/testsuite/libgomp.c/depend-8.c
new file mode 100644 (file)
index 0000000..4dcce67
--- /dev/null
@@ -0,0 +1,3 @@
+/* { dg-set-target-env-var OMP_NUM_THREADS "1" } */
+
+#include "depend-3.c"
diff --git a/libgomp/testsuite/libgomp.c/depend-9.c b/libgomp/testsuite/libgomp.c/depend-9.c
new file mode 100644 (file)
index 0000000..a52c47a
--- /dev/null
@@ -0,0 +1,3 @@
+/* { dg-set-target-env-var OMP_NUM_THREADS "1" } */
+
+#include "depend-4.c"
index 11e9042..02afa89 100644 (file)
@@ -1,3 +1,9 @@
+2014-07-24  Richard Henderson  <rth@redhat.com>
+
+       * config/aarch64/sjlj.S: New file.
+       * config/aarch64/target.h: New file.
+       * configure.tgt: Enable aarch64.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index c0be646..9d7969b 100644 (file)
@@ -1,3 +1,16 @@
+2014-07-28  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       PR libobjc/61920
+       * encoding.c (rs6000_special_adjust_field_align_p): Use definition
+       that matches the 4.9 branch ABI.
+
+2014-07-27  Alan Modra  <amodra@gmail.com>
+           Matthias Klose  <doko@ubuntu.com>
+
+       PR libobjc/61920
+
+       * encoding.c: Define rs6000_special_adjust_field_align_p.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index 7ecc812..c476f22 100644 (file)
@@ -192,6 +192,8 @@ _darwin_rs6000_special_round_type_align (const char *struc, int comp, int spec)
    ? MAX (MAX (COMPUTED, SPECIFIED), 64)                               \
    : MAX (COMPUTED, SPECIFIED));})
 
+#define rs6000_special_adjust_field_align_p(FIELD, COMPUTED) \
+ (TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE)
 
 /* Skip a variable name, enclosed in quotes (").  */
 static inline
index a742a72..e708a48 100644 (file)
@@ -1,3 +1,108 @@
+2014-08-09  François Dumont  <fdumont@gcc.gnu.org>
+
+       PR libstdc++/61667
+       * include/bits/hashtable.h (_Hashtable<>::__rehash_policy): Use
+       _M_need_rehash to initialize the rehash policy and check if a rehash is
+       needed.
+       * testsuite/23_containers/unordered_map/modifiers/61667.cc: New.
+
+2014-08-04  Jonathan Wakely  <jwakely@redhat.com>
+
+       Backported from mainline
+       2014-07-29  Jonathan Wakely  <jwakely@redhat.com>
+
+       PR libstdc++/61946
+       * include/ext/rope (rope::rope(char_producer<_CharT>*, size_t, bool,
+       const allocator_type&)): Pass non-const allocator to
+       _S_new_RopeFunction.
+       * testsuite/ext/rope/61946.cc: New.
+
+2014-08-04  Zifei Tong  <zifeitong@gmail.com>
+
+       * libsupc++/atexit_thread.cc (HAVE___CXA_THREAD_ATEXIT_IMPL): Add
+       _GLIBCXX_ prefix to macro.
+
+2014-08-04  Samuel Bronson  <naesten@gmail.com>
+
+       Backport r212453 from trunk
+       2014-07-11  Samuel Bronson  <naesten@gmail.com>
+                   Matthias Klose  <doko@ubuntu.com>
+
+       PR libstdc++/58962
+       * python/libstdcxx/v6/printers.py: Port to Python 2+3
+       (imap): New compat function.
+       (izip): Likewise.
+       (Iterator): New mixin to allow writing iterators in Python 3 style
+       regardless of which version we're running on.
+       [Python3] (long) New compat alias for "int".
+       * testsuite/lib/gdb-test.exp: Port to Python 2+3 (print syntax)
+
+       Backport r210625 from trunk
+       2014-05-19  Jonathan Wakely  <jwakely@redhat.com>
+
+       * python/libstdcxx/v6/printers.py: Use Python3 raise syntax.
+
+2014-08-04  Jonathan Wakely  <jwakely@redhat.com>
+
+       Backported from mainline
+       2014-06-10  Jonathan Wakely  <jwakely@redhat.com>
+
+       PR libstdc++/61390
+       * include/ext/pb_ds/detail/bin_search_tree_/traits.hpp
+       (bin_search_tree_traits): Do not redeclare template-parameters.
+       * testsuite/util/testsuite_iterators.h (test_container): Likewise.
+
+       Backported from mainline
+       2014-06-02  Jonathan Wakely  <jwakely@redhat.com>
+
+       * include/std/condition_variable (condition_variable_any::_Unlock): Do
+       not swallow __forced_unwind.
+       * include/std/future (__future_base::_Task_setter): Likewise.
+       (__future_base::_Async_state_impl): Turn __forced_unwind into broken
+       promise and rethrow.
+       * include/std/mutex (try_lock): Likewise.
+       * testsuite/30_threads/async/forced_unwind.cc: New.
+       * testsuite/30_threads/packaged_task/forced_unwind.cc: New.
+
+       Backported from mainline
+       2014-06-01  Jonathan Wakely  <jwakely@redhat.com>
+
+       PR libstdc++/61374
+       * include/experimental/string_view (operator basic_string): Correct
+       order of arguments.
+       (to_string): Replace with member function.
+       Add inline specifiers. Remove unused header. Remove _S_empty_rep and
+       allow _M_str to be null.
+       * testsuite/experimental/string_view/cons/char/1.cc: Adjust to new
+       default constructor semantics.
+       * testsuite/experimental/string_view/cons/wchar_t/1.cc: Likewise.
+       * testsuite/experimental/string_view/operations/copy/char/1.cc: Fix
+       copyright dates. Remove unused header.
+       * testsuite/experimental/string_view/operations/copy/wchar_t/1.cc:
+       Likewise.
+       * testsuite/experimental/string_view/operations/data/char/1.cc:
+       Fix copyright dates. Adjust to new default constructor semantics.
+       * testsuite/experimental/string_view/operations/data/wchar_t/1.cc:
+       Likewise.
+       * testsuite/experimental/string_view/operations/to_string/1.cc: New.
+
+       Backported from mainline
+       2014-04-15  Jonathan Wakely  <jwakely@redhat.com>
+
+       * include/bits/atomic_base.h (__atomic_base<_PTp*>::_M_type_size): Add
+       const to constexpr member functions.
+
+2014-07-29  Ed Smith-Rowland  <3dw4rd@verizon.net>
+
+       PR libstdc++/60037 - SIGFPE in std::generate_canonical<unsigned int...>
+       * include/bits/random.h (_Adaptor): static_assert for non floating-point
+       result type.
+       * include/bits/random.tcc (generate_canonical): Ditto.
+       * include/ext/random.tcc (hypergeometric_distribution::operator()):
+       Use double as a rng result type.
+       * testsuite/26_numerics/random/pr60037-neg.cc: New.
+       * testsuite/ext/random/hypergeometric_distribution/pr60037.cc: New.
+
 2014-07-16  Release Manager
 
        * GCC 4.9.1 released.
index 242459a..1fc0ebb 100644 (file)
@@ -675,10 +675,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       // Factored out to facilitate explicit specialization.
       constexpr ptrdiff_t
-      _M_type_size(ptrdiff_t __d) { return __d * sizeof(_PTp); }
+      _M_type_size(ptrdiff_t __d) const { return __d * sizeof(_PTp); }
 
       constexpr ptrdiff_t
-      _M_type_size(ptrdiff_t __d) volatile { return __d * sizeof(_PTp); }
+      _M_type_size(ptrdiff_t __d) const volatile { return __d * sizeof(_PTp); }
 
     public:
       __atomic_base() noexcept = default;
index 9b6394c..588e69c 100644 (file)
@@ -1281,10 +1281,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
               _H1, _H2, _Hash, _RehashPolicy, _Traits>::
     __rehash_policy(const _RehashPolicy& __pol)
     {
-      size_type __n_bkt = __pol._M_bkt_for_elements(_M_element_count);
-      __n_bkt = __pol._M_next_bkt(__n_bkt);
-      if (__n_bkt != _M_bucket_count)
-       _M_rehash(__n_bkt, _M_rehash_policy._M_state());
+      auto __do_rehash =
+       __pol._M_need_rehash(_M_bucket_count, _M_element_count, 0);
+      if (__do_rehash.first)
+       _M_rehash(__do_rehash.second, _M_rehash_policy._M_state());
       _M_rehash_policy = __pol;
     }
 
index edfd797..b34dbe6 100644 (file)
@@ -164,6 +164,8 @@ _GLIBCXX_END_NAMESPACE_VERSION
     template<typename _Engine, typename _DInputType>
       struct _Adaptor
       {
+       static_assert(std::is_floating_point<_DInputType>::value,
+                     "template argument not a floating point type");
 
       public:
        _Adaptor(_Engine& __g)
index 0eda287..8849ee9 100644 (file)
@@ -3463,6 +3463,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     _RealType
     generate_canonical(_UniformRandomNumberGenerator& __urng)
     {
+      static_assert(std::is_floating_point<_RealType>::value,
+                   "template argument not a floating point type");
+
       const size_t __b
        = std::min(static_cast<size_t>(std::numeric_limits<_RealType>::digits),
                    __bits);
index bebeb6b..e66039e 100644 (file)
@@ -39,7 +39,6 @@
 # include <bits/c++14_warning.h>
 #else
 
-#include <debug/debug.h>
 #include <string>
 #include <limits>
 
@@ -66,18 +65,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    *    _CharT*    _M_str
    *    size_t     _M_len
    *  @endcode
-   *
-   *  A basic_string_view represents an empty string with a static constexpr
-   *  length one string:
-   *
-   *  @code
-   *    static constexpr value_type _S_empty_str[1]{0};
-   *  @endcode
    */
-  template<typename _CharT, typename _Traits = char_traits<_CharT>>
+  template<typename _CharT, typename _Traits = std::char_traits<_CharT>>
     class basic_string_view
     {
-
     public:
 
       // types
@@ -99,7 +90,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       constexpr
       basic_string_view() noexcept
-      : _M_len{0}, _M_str{_S_empty_str}
+      : _M_len{0}, _M_str{nullptr}
       { }
 
       constexpr basic_string_view(const basic_string_view&) noexcept = default;
@@ -112,12 +103,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       constexpr basic_string_view(const _CharT* __str)
       : _M_len{__str == nullptr ? 0 : traits_type::length(__str)},
-       _M_str{__str == nullptr ? _S_empty_str : __str}
+       _M_str{__str}
       { }
 
       constexpr basic_string_view(const _CharT* __str, size_type __len)
-      : _M_len{__str == nullptr ? 0 :__len},
-        _M_str{__str == nullptr ? _S_empty_str : __str}
+      : _M_len{__len},
+        _M_str{__str}
       { }
 
       basic_string_view&
@@ -143,19 +134,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       const_reverse_iterator
       rbegin() const noexcept
-      { return std::reverse_iterator<const_iterator>(this->end()); }
+      { return const_reverse_iterator(this->end()); }
 
       const_reverse_iterator
       rend() const noexcept
-      { return std::reverse_iterator<const_iterator>(this->begin()); }
+      { return const_reverse_iterator(this->begin()); }
 
       const_reverse_iterator
       crbegin() const noexcept
-      { return std::reverse_iterator<const_iterator>(this->end()); }
+      { return const_reverse_iterator(this->end()); }
 
       const_reverse_iterator
       crend() const noexcept
-      { return std::reverse_iterator<const_iterator>(this->begin()); }
+      { return const_reverse_iterator(this->begin()); }
 
       // [string.view.capacity], capacity
 
@@ -169,8 +160,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       constexpr size_type
       max_size() const noexcept
-      { return ((npos - sizeof(size_type) - sizeof(void*))
-               / sizeof(value_type) / 4); }
+      {
+       return (npos - sizeof(size_type) - sizeof(void*))
+               / sizeof(value_type) / 4;
+      }
 
       constexpr bool
       empty() const noexcept
@@ -195,7 +188,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
                                             "(which is %zu) >= this->size() "
                                             "(which is %zu)"),
                                         __pos, this->size()),
-               _S_empty_str[0]);
+               *this->_M_str);
       }
 
       constexpr const _CharT&
@@ -219,11 +212,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       { return this->_M_str; }
 
       // [string.view.modifiers], modifiers:
+
       void
       clear() noexcept
       {
        this->_M_len = 0;
-       this->_M_str = _S_empty_str;
+       this->_M_str = nullptr;
       }
 
       void
@@ -251,8 +245,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       template<typename _Allocator>
         explicit operator basic_string<_CharT, _Traits, _Allocator>() const
         {
-         return basic_string<_CharT, _Traits, _Allocator>
-                                       (this->_M_len, this->_M_str);
+         return { this->_M_str, this->_M_len };
+       }
+
+      template<typename _Allocator = std::allocator<_CharT>>
+       basic_string<_CharT, _Traits, _Allocator>
+       to_string(const _Allocator& __alloc = _Allocator()) const
+       {
+         return { this->_M_str, this->_M_len, __alloc };
        }
 
       size_type
@@ -431,8 +431,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
             : static_cast<int>(difference_type{__n1 - __n2});
       }
 
-      static constexpr value_type _S_empty_str[1]{};
-
       size_t       _M_len;
       const _CharT* _M_str;
     };
@@ -456,131 +454,119 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   }
 
   template<typename _CharT, typename _Traits>
-    bool
+    inline bool
     operator==(basic_string_view<_CharT, _Traits> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) == 0; }
 
   template<typename _CharT, typename _Traits>
-    bool
+    inline bool
     operator==(basic_string_view<_CharT, _Traits> __x,
                __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
     { return __x.compare(__y) == 0; }
 
   template<typename _CharT, typename _Traits>
-    bool
+    inline bool
     operator==(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) == 0; }
 
   template<typename _CharT, typename _Traits>
-    bool
+    inline bool
     operator!=(basic_string_view<_CharT, _Traits> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return !(__x == __y); }
 
   template<typename _CharT, typename _Traits>
-    bool
+    inline bool
     operator!=(basic_string_view<_CharT, _Traits> __x,
                __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
     { return !(__x == __y); }
 
   template<typename _CharT, typename _Traits>
-    bool
+    inline bool
     operator!=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return !(__x == __y); }
 
   template<typename _CharT, typename _Traits>
-    bool
+    inline bool
     operator< (basic_string_view<_CharT, _Traits> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) < 0; }
 
   template<typename _CharT, typename _Traits>
-    bool
+    inline bool
     operator< (basic_string_view<_CharT, _Traits> __x,
                __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
     { return __x.compare(__y) < 0; }
 
   template<typename _CharT, typename _Traits>
-    bool
+    inline bool
     operator< (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) < 0; }
 
   template<typename _CharT, typename _Traits>
-    bool
+    inline bool
     operator> (basic_string_view<_CharT, _Traits> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) > 0; }
 
   template<typename _CharT, typename _Traits>
-    bool
+    inline bool
     operator> (basic_string_view<_CharT, _Traits> __x,
                __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
     { return __x.compare(__y) > 0; }
 
   template<typename _CharT, typename _Traits>
-    bool
+    inline bool
     operator> (__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) > 0; }
 
   template<typename _CharT, typename _Traits>
-    bool
+    inline bool
     operator<=(basic_string_view<_CharT, _Traits> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) <= 0; }
 
   template<typename _CharT, typename _Traits>
-    bool
+    inline bool
     operator<=(basic_string_view<_CharT, _Traits> __x,
                __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
     { return __x.compare(__y) <= 0; }
 
   template<typename _CharT, typename _Traits>
-    bool
+    inline bool
     operator<=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) <= 0; }
 
   template<typename _CharT, typename _Traits>
-    bool
+    inline bool
     operator>=(basic_string_view<_CharT, _Traits> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) >= 0; }
 
   template<typename _CharT, typename _Traits>
-    bool
+    inline bool
     operator>=(basic_string_view<_CharT, _Traits> __x,
                __detail::__idt<basic_string_view<_CharT, _Traits>> __y) noexcept
     { return __x.compare(__y) >= 0; }
 
   template<typename _CharT, typename _Traits>
-    bool
+    inline bool
     operator>=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
                basic_string_view<_CharT, _Traits> __y) noexcept
     { return __x.compare(__y) >= 0; }
 
-  // [string.view.comparison], sufficient additional overloads of comparison functions
-
-  // [string.view.nonmem], other non-member basic_string_view functions
-  template<typename _CharT, typename _Traits = char_traits<_CharT>,
-           typename _Allocator = allocator<_CharT>>
-    basic_string<_CharT, _Traits, _Allocator>
-    to_string(basic_string_view<_CharT, _Traits> __str,
-             const _Allocator& __alloc = _Allocator())
-    {
-      return basic_string<_CharT, _Traits, _Allocator>
-                       (__str.begin(), __str.end(), __alloc);
-    }
-
+  // [string.view.io], Inserters and extractors
   template<typename _CharT, typename _Traits>
-    basic_ostream<_CharT, _Traits>&
-      operator<<(basic_ostream<_CharT, _Traits>& __os,
-                 basic_string_view<_CharT,_Traits> __str)
-      { return __ostream_insert(__os, __str.data(), __str.size()); }
+    inline basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os,
+              basic_string_view<_CharT,_Traits> __str)
+    { return __ostream_insert(__os, __str.data(), __str.size()); }
 
 
   // basic_string_view typedef names
index 1af3a4d..4456266 100644 (file)
@@ -47,10 +47,6 @@ namespace experimental
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   template<typename _CharT, typename _Traits>
-    constexpr _CharT
-    basic_string_view<_CharT, _Traits>::_S_empty_str[1];
-
-  template<typename _CharT, typename _Traits>
     typename basic_string_view<_CharT, _Traits>::size_type
     basic_string_view<_CharT, _Traits>::
     find(const _CharT* __str, size_type __pos, size_type __n) const noexcept
index d97b432..7ada365 100644 (file)
@@ -55,7 +55,7 @@ namespace __gnu_pbds
             class Cmp_Fn,
             template<typename Node_CItr,
                      class Node_Itr,
-                     class Cmp_Fn,
+                     class _Cmp_Fn,
                      typename _Alloc>
             class Node_Update,
             class Node,
@@ -161,7 +161,7 @@ namespace __gnu_pbds
             class Cmp_Fn,
             template<typename Node_CItr,
                      class Node_Itr,
-                     class Cmp_Fn,
+                     class _Cmp_Fn,
                      typename _Alloc>
             class Node_Update,
             class Node,
index dd7a14a..fec7f86 100644 (file)
@@ -1314,7 +1314,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       operator()(_UniformRandomNumberGenerator& __urng,
                 const param_type& __param)
       {
-       std::__detail::_Adaptor<_UniformRandomNumberGenerator, result_type>
+       std::__detail::_Adaptor<_UniformRandomNumberGenerator, double>
          __aurng(__urng);
 
        result_type __a = __param.successful_size();
index df3d4bb..147b335 100644 (file)
@@ -1544,7 +1544,7 @@ protected:
       typedef typename _Base::allocator_type allocator_type;
       using _Base::_M_tree_ptr;
       using _Base::get_allocator;
-      using _Base::_M_get_allocator;      
+      using _Base::_M_get_allocator;
       typedef __GC_CONST _CharT* _Cstrptr;
       
       static _CharT _S_empty_c_str[1];
@@ -1876,8 +1876,9 @@ protected:
           const allocator_type& __a = allocator_type())
       : _Base(__a)
       {
-       this->_M_tree_ptr = (0 == __len) ?
-         0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a);
+       this->_M_tree_ptr = (0 == __len)
+         ? 0
+         : _S_new_RopeFunction(__fn, __len, __delete_fn, _M_get_allocator());
       }
 
       rope(const rope& __x, const allocator_type& __a = allocator_type())
index fc111dd..921cb83 100644 (file)
@@ -189,7 +189,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        ~_Unlock() noexcept(false)
        {
          if (uncaught_exception())
-           __try { _M_lock.lock(); } __catch(...) { }
+           {
+             __try
+             { _M_lock.lock(); }
+             __catch(const __cxxabiv1::__forced_unwind&)
+             { __throw_exception_again; }
+             __catch(...)
+             { }
+           }
          else
            _M_lock.lock();
        }
index 998e90a..d446b9d 100644 (file)
@@ -1240,6 +1240,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          {
            _M_result->_M_set(_M_fn());
          }
+       __catch(const __cxxabiv1::__forced_unwind&)
+         {
+           __throw_exception_again; // will cause broken_promise
+         }
        __catch(...)
          {
            _M_result->_M_error = current_exception();
@@ -1259,6 +1263,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          {
            _M_fn();
          }
+       __catch(const __cxxabiv1::__forced_unwind&)
+         {
+           __throw_exception_again; // will cause broken_promise
+         }
        __catch(...)
          {
            _M_result->_M_error = current_exception();
@@ -1519,7 +1527,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       : _M_result(new _Result<_Res>()), _M_fn(std::move(__fn))
       {
        _M_thread = std::thread{ [this] {
-         _M_set_result(_S_task_setter(_M_result, _M_fn));
+           __try
+             {
+               _M_set_result(_S_task_setter(_M_result, _M_fn));
+             }
+           __catch (const __cxxabiv1::__forced_unwind&)
+             {
+               // make the shared state ready on thread cancellation
+               if (static_cast<bool>(_M_result))
+                 this->_M_break_promise(std::move(_M_result));
+               __throw_exception_again;
+             }
         } };
       }
 
index 0b481d6..8e9dd27 100644 (file)
@@ -44,6 +44,7 @@
 #include <bits/functexcept.h>
 #include <bits/gthr.h>
 #include <bits/move.h> // for std::swap
+#include <bits/cxxabi_forced.h>
 
 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
 
@@ -649,6 +650,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       auto __locks = std::tie(__l1, __l2, __l3...);
       __try
       { __try_lock_impl<0>::__do_try_lock(__locks, __idx); }
+      __catch(const __cxxabiv1::__forced_unwind&)
+      { __throw_exception_again; }
       __catch(...)
       { }
       return __idx;
index db20200..dff08e9 100644 (file)
@@ -26,7 +26,7 @@
 #include <new>
 #include "bits/gthr.h"
 
-#if HAVE___CXA_THREAD_ATEXIT_IMPL
+#if _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
 
 extern "C" int __cxa_thread_atexit_impl (void (*func) (void *),
                                         void *arg, void *d);
@@ -38,7 +38,7 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *),
   return __cxa_thread_atexit_impl (dtor, obj, dso_handle);
 }
 
-#else /* HAVE___CXA_THREAD_ATEXIT_IMPL */
+#else /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
 
 namespace {
   // One element in a singly-linked stack of cleanups.
@@ -142,4 +142,4 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), void *obj, void */*dso_ha
   return 0;
 }
 
-#endif /* HAVE___CXA_THREAD_ATEXIT_IMPL */
+#endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */
index 1f1f860..1fa08fb 100644 (file)
@@ -1,4 +1,4 @@
-# Pretty-printers for libstc++.
+# Pretty-printers for libstdc++.
 
 # Copyright (C) 2008-2014 Free Software Foundation, Inc.
 
 import gdb
 import itertools
 import re
+import sys
+
+### Python 2 + Python 3 compatibility code
+
+# Resources about compatibility:
+#
+#  * <http://pythonhosted.org/six/>: Documentation of the "six" module
+
+# FIXME: The handling of e.g. std::basic_string (at least on char)
+# probably needs updating to work with Python 3's new string rules.
+#
+# In particular, Python 3 has a separate type (called byte) for
+# bytestrings, and a special b"" syntax for the byte literals; the old
+# str() type has been redefined to always store Unicode text.
+#
+# We probably can't do much about this until this GDB PR is addressed:
+# <https://sourceware.org/bugzilla/show_bug.cgi?id=17138>
+
+if sys.version_info[0] > 2:
+    ### Python 3 stuff
+    Iterator = object
+    # Python 3 folds these into the normal functions.
+    imap = map
+    izip = zip
+    # Also, int subsumes long
+    long = int
+else:
+    ### Python 2 stuff
+    class Iterator:
+        """Compatibility mixin for iterators
+
+        Instead of writing next() methods for iterators, write
+        __next__() methods and use this mixin to make them work in
+        Python 2 as well as Python 3.
+
+        Idea stolen from the "six" documentation:
+        <http://pythonhosted.org/six/#six.Iterator>
+        """
+
+        def next(self):
+            return self.__next__()
+
+    # In Python 2, we still need these from itertools
+    from itertools import imap, izip
 
 # Try to use the new-style pretty-printing if available.
 _use_gdb_pp = True
@@ -51,7 +95,7 @@ def find_type(orig, name):
         # anything fancier here.
         field = typ.fields()[0]
         if not field.is_base_class:
-            raise ValueError, "Cannot find type %s::%s" % (str(orig), name)
+            raise ValueError("Cannot find type %s::%s" % (str(orig), name))
         typ = field.type
 
 class SharedPointerPrinter:
@@ -87,7 +131,7 @@ class UniquePointerPrinter:
 class StdListPrinter:
     "Print a std::list"
 
-    class _iterator:
+    class _iterator(Iterator):
         def __init__(self, nodetype, head):
             self.nodetype = nodetype
             self.base = head['_M_next']
@@ -97,7 +141,7 @@ class StdListPrinter:
         def __iter__(self):
             return self
 
-        def next(self):
+        def __next__(self):
             if self.base == self.head:
                 raise StopIteration
             elt = self.base.cast(self.nodetype).dereference()
@@ -135,7 +179,7 @@ class StdListIteratorPrinter:
 class StdSlistPrinter:
     "Print a __gnu_cxx::slist"
 
-    class _iterator:
+    class _iterator(Iterator):
         def __init__(self, nodetype, head):
             self.nodetype = nodetype
             self.base = head['_M_head']['_M_next']
@@ -144,7 +188,7 @@ class StdSlistPrinter:
         def __iter__(self):
             return self
 
-        def next(self):
+        def __next__(self):
             if self.base == 0:
                 raise StopIteration
             elt = self.base.cast(self.nodetype).dereference()
@@ -180,7 +224,7 @@ class StdSlistIteratorPrinter:
 class StdVectorPrinter:
     "Print a std::vector"
 
-    class _iterator:
+    class _iterator(Iterator):
         def __init__ (self, start, finish, bitvec):
             self.bitvec = bitvec
             if bitvec:
@@ -198,7 +242,7 @@ class StdVectorPrinter:
         def __iter__(self):
             return self
 
-        def next(self):
+        def __next__(self):
             count = self.count
             self.count = self.count + 1
             if self.bitvec:
@@ -265,7 +309,7 @@ class StdVectorIteratorPrinter:
 class StdTuplePrinter:
     "Print a std::tuple"
 
-    class _iterator:
+    class _iterator(Iterator):
         def __init__ (self, head):
             self.head = head
 
@@ -276,20 +320,20 @@ class StdTuplePrinter:
                 # Set the actual head to the first pair.
                 self.head  = self.head.cast (nodes[0].type)
             elif len (nodes) != 0:
-                raise ValueError, "Top of tuple tree does not consist of a single node."
+                raise ValueError("Top of tuple tree does not consist of a single node.")
             self.count = 0
 
         def __iter__ (self):
             return self
 
-        def next (self):
+        def __next__ (self):
             nodes = self.head.type.fields ()
             # Check for further recursions in the inheritance tree.
             if len (nodes) == 0:
                 raise StopIteration
             # Check that this iteration has an expected structure.
             if len (nodes) != 2:
-                raise ValueError, "Cannot parse more than 2 nodes in a tuple tree."
+                raise ValueError("Cannot parse more than 2 nodes in a tuple tree.")
 
             # - Left node is the next recursion parent.
             # - Right node is the actual class contained in the tuple.
@@ -341,7 +385,7 @@ class StdStackOrQueuePrinter:
             return self.visualizer.display_hint ()
         return None
 
-class RbtreeIterator:
+class RbtreeIterator(Iterator):
     def __init__(self, rbtree):
         self.size = rbtree['_M_t']['_M_impl']['_M_node_count']
         self.node = rbtree['_M_t']['_M_impl']['_M_header']['_M_left']
@@ -353,7 +397,7 @@ class RbtreeIterator:
     def __len__(self):
         return int (self.size)
 
-    def next(self):
+    def __next__(self):
         if self.count == self.size:
             raise StopIteration
         result = self.node
@@ -389,7 +433,7 @@ def get_value_from_Rb_tree_node(node):
             return p.dereference()
     except:
         pass
-    raise ValueError, "Unsupported implementation for %s" % str(node.type)
+    raise ValueError("Unsupported implementation for %s" % str(node.type))
 
 # This is a pretty printer for std::_Rb_tree_iterator (which is
 # std::map::iterator), and has nothing to do with the RbtreeIterator
@@ -422,7 +466,7 @@ class StdMapPrinter:
     "Print a std::map or std::multimap"
 
     # Turn an RbtreeIterator into a pretty-print iterator.
-    class _iter:
+    class _iter(Iterator):
         def __init__(self, rbiter, type):
             self.rbiter = rbiter
             self.count = 0
@@ -431,9 +475,9 @@ class StdMapPrinter:
         def __iter__(self):
             return self
 
-        def next(self):
+        def __next__(self):
             if self.count % 2 == 0:
-                n = self.rbiter.next()
+                n = next(self.rbiter)
                 n = n.cast(self.type).dereference()
                 n = get_value_from_Rb_tree_node(n)
                 self.pair = n
@@ -465,7 +509,7 @@ class StdSetPrinter:
     "Print a std::set or std::multiset"
 
     # Turn an RbtreeIterator into a pretty-print iterator.
-    class _iter:
+    class _iter(Iterator):
         def __init__(self, rbiter, type):
             self.rbiter = rbiter
             self.count = 0
@@ -474,8 +518,8 @@ class StdSetPrinter:
         def __iter__(self):
             return self
 
-        def next(self):
-            item = self.rbiter.next()
+        def __next__(self):
+            item = next(self.rbiter)
             item = item.cast(self.type).dereference()
             item = get_value_from_Rb_tree_node(item)
             # FIXME: this is weird ... what to do?
@@ -541,7 +585,7 @@ class StdBitsetPrinter:
 class StdDequePrinter:
     "Print a std::deque"
 
-    class _iter:
+    class _iter(Iterator):
         def __init__(self, node, start, end, last, buffer_size):
             self.node = node
             self.p = start
@@ -553,7 +597,7 @@ class StdDequePrinter:
         def __iter__(self):
             return self
 
-        def next(self):
+        def __next__(self):
             if self.p == self.last:
                 raise StopIteration
 
@@ -638,7 +682,7 @@ class StdStringPrinter:
     def display_hint (self):
         return 'string'
 
-class Tr1HashtableIterator:
+class Tr1HashtableIterator(Iterator):
     def __init__ (self, hash):
         self.buckets = hash['_M_buckets']
         self.bucket = 0
@@ -654,7 +698,7 @@ class Tr1HashtableIterator:
     def __iter__ (self):
         return self
 
-    def next (self):
+    def __next__ (self):
         if self.node == 0:
             raise StopIteration
         node = self.node.cast(self.node_type)
@@ -669,7 +713,7 @@ class Tr1HashtableIterator:
                 self.bucket = self.bucket + 1
         return result
 
-class StdHashtableIterator:
+class StdHashtableIterator(Iterator):
     def __init__(self, hash):
         self.node = hash['_M_before_begin']['_M_nxt']
         self.node_type = find_type(hash.type, '__node_type').pointer()
@@ -677,7 +721,7 @@ class StdHashtableIterator:
     def __iter__(self):
         return self
 
-    def next(self):
+    def __next__(self):
         if self.node == 0:
             raise StopIteration
         elt = self.node.cast(self.node_type).dereference()
@@ -706,10 +750,10 @@ class Tr1UnorderedSetPrinter:
         return '[%d]' % i
 
     def children (self):
-        counter = itertools.imap (self.format_count, itertools.count())
+        counter = imap (self.format_count, itertools.count())
         if self.typename.startswith('std::tr1'):
-            return itertools.izip (counter, Tr1HashtableIterator (self.hashtable()))
-        return itertools.izip (counter, StdHashtableIterator (self.hashtable()))
+            return izip (counter, Tr1HashtableIterator (self.hashtable()))
+        return izip (counter, StdHashtableIterator (self.hashtable()))
 
 class Tr1UnorderedMapPrinter:
     "Print a tr1::unordered_map"
@@ -741,15 +785,15 @@ class Tr1UnorderedMapPrinter:
         return '[%d]' % i
 
     def children (self):
-        counter = itertools.imap (self.format_count, itertools.count())
+        counter = imap (self.format_count, itertools.count())
         # Map over the hash table and flatten the result.
         if self.typename.startswith('std::tr1'):
-            data = self.flatten (itertools.imap (self.format_one, Tr1HashtableIterator (self.hashtable())))
+            data = self.flatten (imap (self.format_one, Tr1HashtableIterator (self.hashtable())))
             # Zip the two iterators together.
-            return itertools.izip (counter, data)
-        data = self.flatten (itertools.imap (self.format_one, StdHashtableIterator (self.hashtable())))
+            return izip (counter, data)
+        data = self.flatten (imap (self.format_one, StdHashtableIterator (self.hashtable())))
         # Zip the two iterators together.
-        return itertools.izip (counter, data)
+        return izip (counter, data)
         
 
     def display_hint (self):
@@ -758,7 +802,7 @@ class Tr1UnorderedMapPrinter:
 class StdForwardListPrinter:
     "Print a std::forward_list"
 
-    class _iterator:
+    class _iterator(Iterator):
         def __init__(self, nodetype, head):
             self.nodetype = nodetype
             self.base = head['_M_next']
@@ -767,7 +811,7 @@ class StdForwardListPrinter:
         def __iter__(self):
             return self
 
-        def next(self):
+        def __next__(self):
             if self.base == 0:
                 raise StopIteration
             elt = self.base.cast(self.nodetype).dereference()
@@ -827,7 +871,7 @@ class Printer(object):
         # A small sanity check.
         # FIXME
         if not self.compiled_rx.match(name + '<>'):
-            raise ValueError, 'libstdc++ programming error: "%s" does not match' % name
+            raise ValueError('libstdc++ programming error: "%s" does not match' % name)
         printer = RxPrinter(name, function)
         self.subprinters.append(printer)
         self.lookup[name] = printer
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/61667.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/61667.cc
new file mode 100644 (file)
index 0000000..cb4ad8e
--- /dev/null
@@ -0,0 +1,44 @@
+// { dg-options "-std=gnu++11" }
+
+// Copyright (C) 2011-2014 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_map>
+#include <testsuite_hooks.h>
+
+bool test __attribute__((unused)) = true;
+
+void test01()
+{
+  std::unordered_map<int, int> um(20);
+
+  std::size_t bkt_count = um.bucket_count();
+
+  um.max_load_factor(um.max_load_factor());
+
+  VERIFY( um.bucket_count() >= bkt_count );
+
+  um.max_load_factor(um.max_load_factor() * 2.f);
+
+  VERIFY( um.bucket_count() >= bkt_count );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc b/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc
new file mode 100644 (file)
index 0000000..11d5539
--- /dev/null
@@ -0,0 +1,15 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++11" }
+
+#include <random>
+
+std::mt19937 urng;
+
+std::__detail::_Adaptor<std::mt19937, unsigned long> aurng(urng);
+
+auto x = std::generate_canonical<std::size_t,
+                       std::numeric_limits<std::size_t>::digits>(urng);
+
+// { dg-error "static assertion failed: template argument not a floating point type" "" { target *-*-* } 167 }
+
+// { dg-error "static assertion failed: template argument not a floating point type" "" { target *-*-* } 3466 }
diff --git a/libstdc++-v3/testsuite/30_threads/async/forced_unwind.cc b/libstdc++-v3/testsuite/30_threads/async/forced_unwind.cc
new file mode 100644 (file)
index 0000000..7b0a492
--- /dev/null
@@ -0,0 +1,45 @@
+// { dg-do run { target *-*-linux* *-*-gnu* } }
+// { dg-options " -std=gnu++11 -pthread" { target *-*-linux* *-*-gnu* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+// { dg-require-atomic-builtins "" }
+
+// Copyright (C) 2014 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Test (non-standard) handling of __forced_unwind exception.
+
+#include <future>
+#include <stdexcept>
+#include <pthread.h>
+#include <testsuite_hooks.h>
+
+void f() { pthread_exit(nullptr); }
+
+int main()
+{
+  auto fut = std::async(std::launch::async, f);
+  try
+  {
+    fut.get();
+    throw std::logic_error("Unreachable");
+  }
+  catch (const std::future_error& e)
+  {
+    VERIFY( e.code() == std::future_errc::broken_promise );
+  }
+}
diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/forced_unwind.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/forced_unwind.cc
new file mode 100644 (file)
index 0000000..235ab17
--- /dev/null
@@ -0,0 +1,48 @@
+// { dg-do run { target *-*-linux* *-*-gnu* } }
+// { dg-options " -std=gnu++11 -pthread" { target *-*-linux* *-*-gnu* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+// { dg-require-atomic-builtins "" }
+
+// Copyright (C) 2014 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Test (non-standard) handling of __forced_unwind exception.
+
+#include <future>
+#include <stdexcept>
+#include <pthread.h>
+#include <testsuite_hooks.h>
+
+void f() { pthread_exit(nullptr); }
+
+int main()
+{
+  std::packaged_task<void()> p(f);
+  auto fut = p.get_future();
+  std::thread t(std::move(p));
+  try
+  {
+    fut.get();
+    throw std::logic_error("Unreachable");
+  }
+  catch (const std::future_error& e)
+  {
+    VERIFY( e.code() == std::future_errc::broken_promise );
+  }
+  t.join();
+}
index c879cc7..a443b0a 100644 (file)
@@ -33,7 +33,7 @@ test01()
   // basic_string_view()
   const std::experimental::string_view str00{};
   VERIFY( str00.length() == 0 );
-  VERIFY( str00.data() != nullptr );
+  VERIFY( str00.data() == nullptr );
 
   // basic_string_view(const char*)
   const char str_lit01[] = "rodeo beach, marin";
@@ -54,11 +54,6 @@ test01()
   VERIFY( str05.length() == len_lit01 );
   VERIFY( str05.data() == str_lit01 );
 
-  //  basic_string_view(const char* s, std::size_t l)
-  std::experimental::string_view str06{nullptr, len_lit01};
-  VERIFY( str06.length() == 0 );
-  VERIFY( str06.data() != nullptr );
-
   // basic_string_view(basic_string& s)
   std::string istr07(10, 'z');
   std::experimental::string_view str07{istr07};
index 12db72f..9ba9b84 100644 (file)
@@ -33,7 +33,7 @@ test01()
   // basic_string_view()
   const std::experimental::wstring_view str00{};
   VERIFY( str00.length() == 0 );
-  VERIFY( str00.data() != nullptr );
+  VERIFY( str00.data() == nullptr );
 
   // basic_string_view(const char*)
   const wchar_t str_lit01[] = L"rodeo beach, marin";
@@ -54,11 +54,6 @@ test01()
   VERIFY( str05.length() == len_lit01 );
   VERIFY( str05.data() == str_lit01 );
 
-  //  basic_string_view(const wchar_t* s, std::size_t l)
-  std::experimental::wstring_view str06{nullptr, len_lit01};
-  VERIFY( str06.length() == 0 );
-  VERIFY( str06.data() != nullptr );
-
   // basic_string_view(basic_string& s)
   std::wstring istr07(10, L'z');
   std::experimental::wstring_view str07{istr07};
index 25b2af1..d0f3e8d 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-options "-std=gnu++1y" }
 
-// Copyright (C) 2013 Free Software Foundation, Inc.
+// Copyright (C) 2013-2014 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
@@ -20,7 +20,6 @@
 // basic_string_view::copy
 
 #include <experimental/string_view>
-#include <stdexcept>
 #include <testsuite_hooks.h>
 
 bool
index 0348e1f..bf3f14b 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-options "-std=gnu++1y" }
 
-// Copyright (C) 2013 Free Software Foundation, Inc.
+// Copyright (C) 2013-2014 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
@@ -20,7 +20,6 @@
 // basic_string_view::copy
 
 #include <experimental/string_view>
-#include <stdexcept>
 #include <testsuite_hooks.h>
 
 bool
index be75de9..a344926 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-options "-std=gnu++1y" }
 
-// Copyright (C) 2013 Free Software Foundation, Inc.
+// Copyright (C) 2013-2014 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
@@ -29,10 +29,9 @@ test01()
 
   std::experimental::string_view empty;
 
-  // data() for size == 0 is non-NULL.
   VERIFY( empty.size() == 0 );
   const std::experimental::string_view::value_type* p = empty.data();
-  VERIFY( p );
+  VERIFY( p == nullptr );
 
   return 0;
 }
index 5e00b00..41d2d14 100644 (file)
@@ -1,6 +1,6 @@
 // { dg-options "-std=gnu++1y" }
 
-// Copyright (C) 2013 Free Software Foundation, Inc.
+// Copyright (C) 2013-2014 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
@@ -29,10 +29,9 @@ test01()
 
   std::experimental::wstring_view empty;
 
-  // data() for size == 0 is non-NULL.
   VERIFY( empty.size() == 0 );
   const std::experimental::wstring_view::value_type* p = empty.data();
-  VERIFY( p );
+  VERIFY( p == nullptr );
 
   return 0;
 }
diff --git a/libstdc++-v3/testsuite/experimental/string_view/operations/to_string/1.cc b/libstdc++-v3/testsuite/experimental/string_view/operations/to_string/1.cc
new file mode 100644 (file)
index 0000000..c0a5734
--- /dev/null
@@ -0,0 +1,53 @@
+// { dg-options "-std=gnu++1y" }
+
+// Copyright (C) 2014 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// basic_string_view::to_string
+
+#include <experimental/string_view>
+#include <algorithm>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+bool
+test01()
+{
+  bool test [[gnu::unused]] = true;
+
+  const char str_lit[] = "123456789A";
+  const std::experimental::string_view sv(str_lit);
+  char buffer[4] = { 0 };
+
+  auto s1 = sv.to_string();
+  VERIFY( s1 == str_lit );
+  using test_alloc = __gnu_test::tracker_allocator<char>;
+  auto s2 = sv.to_string( test_alloc{} );
+  static_assert( std::is_same<decltype(s2)::allocator_type, test_alloc>::value,
+                 "to_string() uses custom allocator" );
+  VERIFY( std::equal(s1.begin(), s1.end(), s2.begin(), s2.end()) );
+  auto s3 = static_cast<std::string>(sv);
+  VERIFY( s3 == s1 );
+
+  return test;
+}
+
+int
+main()
+{
+  test01();
+}
diff --git a/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/pr60037.cc b/libstdc++-v3/testsuite/ext/random/hypergeometric_distribution/pr60037.cc
new file mode 100644 (file)
index 0000000..d3088a6
--- /dev/null
@@ -0,0 +1,23 @@
+// { dg-options "-std=gnu++11 -O0" }
+// { dg-require-cstdint "" }
+// { dg-require-cmath "" }
+
+#include <ext/random>
+#include <functional>
+
+void
+hyperplot(unsigned int N, unsigned int K, unsigned int n)
+{
+  std::mt19937 re; // the default engine
+  __gnu_cxx::hypergeometric_distribution<> hd(N, K, n);
+  auto gen = std::bind(hd, re);
+  gen();
+}
+
+int
+main()
+{
+  hyperplot(15, 3, 2);
+  hyperplot(500, 50, 30);
+  hyperplot(100, 20, 5);
+}
diff --git a/libstdc++-v3/testsuite/ext/rope/61946.cc b/libstdc++-v3/testsuite/ext/rope/61946.cc
new file mode 100644 (file)
index 0000000..ba73b48
--- /dev/null
@@ -0,0 +1,31 @@
+// Copyright (C) 2014 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do compile }
+
+#include <ext/rope>
+
+struct empty_char_prod : __gnu_cxx::char_producer<char>
+{
+  virtual void operator()(size_t, size_t, char*) {}
+};
+
+int main ()
+{
+  empty_char_prod* ecp = new empty_char_prod;
+  __gnu_cxx::crope excrope( ecp, 10L, true );
+}
index 1a72a44..2169f26 100644 (file)
@@ -91,7 +91,7 @@ proc gdb-test { marker {selector {}} } {
        }
     }
 
-    set do_whatis_tests [gdb_batch_check "python print gdb.type_printers" \
+    set do_whatis_tests [gdb_batch_check "python print(gdb.type_printers)" \
                           "\\\[\\\]"]
     if {!$do_whatis_tests} {
        send_log "skipping 'whatis' tests - gdb too old"
@@ -252,6 +252,6 @@ proc gdb_batch_check {command pattern} {
 # but not earlier versions.
 # Return 1 if the version is ok, 0 otherwise.
 proc gdb_version_check {} {
-    return [gdb_batch_check "python print gdb.lookup_global_symbol" \
+    return [gdb_batch_check "python print(gdb.lookup_global_symbol)" \
              "<built-in function lookup_global_symbol>"]
 }
index c690581..6cf18b4 100644 (file)
@@ -518,7 +518,7 @@ namespace __gnu_test
    * It takes two pointers representing a range and presents them as 
    * a container of iterators.
    */
-  template <class T, template<class T> class ItType>
+  template <class T, template<class TT> class ItType>
   struct test_container
   {
     typename ItType<T>::ContainerType bounds;