gcc/libgfortran/m4/iforeach.m4

282 lines
7.4 KiB
Plaintext
Raw Normal View History

dnl Support macro file for intrinsic functions.
dnl Contains the generic sections of the array functions.
dnl This file is part of the GNU Fortran 95 Runtime Library (libgfortran)
re PR libfortran/19280 (Inconsistent licensing of libgfortran) 2005-01-12 Toon Moene <toon@moene.indiv.nluug.nl> PR libfortran/19280 c99_protos.h: License changed to GPL+exception. libgfortran.h: Ditto. intrinsics/abort.c: Ditto. intrinsics/args.c: Ditto. intrinsics/associated.c: Ditto. intrinsics/bessel.c: Ditto. intrinsics/c99_functions.c: Ditto. intrinsics/cpu_time.c: Ditto. intrinsics/cshift0.c: Ditto. intrinsics/date_and_time.c: Ditto. intrinsics/env.c: Ditto. intrinsics/eoshift0.c: Ditto. intrinsics/eoshift2.c: Ditto. intrinsics/erf.c: Ditto. intrinsics/etime.c: Ditto. intrinsics/exit.c: Ditto. intrinsics/flush.c: Ditto. intrinsics/fnum.c: Ditto. intrinsics/getXid.c: Ditto. intrinsics/getcwd.c: Ditto. intrinsics/ishftc.c: Ditto. intrinsics/mvbits.c: Ditto. intrinsics/pack_generic.c: Ditto. intrinsics/rand.c: Ditto. intrinsics/random.c: Ditto. intrinsics/reshape_generic.c: Ditto. intrinsics/reshape_packed.c: Ditto. intrinsics/size.c: Ditto. intrinsics/spread_generic.c: Ditto. intrinsics/stat.c: Ditto. intrinsics/string_intrinsics.c: Ditto. intrinsics/system.c: Ditto. intrinsics/system_clock.c: Ditto. intrinsics/transpose_generic.c: Ditto. intrinsics/umask.c: Ditto. intrinsics/unlink.c: Ditto. intrinsics/unpack_generic.c: Ditto. io/backspace.c: Ditto. io/close.c: Ditto. io/endfile.c: Ditto. io/format.c: Ditto. io/inquire.c: Ditto. io/io.h: Ditto. io/list_read.c: Ditto. io/lock.c: Ditto. io/open.c: Ditto. io/read.c: Ditto. io/rewind.c: Ditto. io/transfer.c: Ditto. io/unit.c: Ditto. io/unix.c: Ditto. io/write.c: Ditto. m4/all.m4: Ditto. m4/any.m4: Ditto. m4/cexp.m4: Ditto. m4/chyp.m4: Ditto. m4/count.m4: Ditto. m4/cshift1.m4: Ditto. m4/ctrig.m4: Ditto. m4/dotprod.m4: Ditto. m4/dotprodc.m4: Ditto. m4/dotprodl.m4: Ditto. m4/eoshift1.m4: Ditto. m4/eoshift3.m4: Ditto. m4/exponent.m4: Ditto. m4/fraction.m4: Ditto. m4/head.m4: Ditto. m4/iforeach.m4: Ditto. m4/ifunction.m4: Ditto. m4/in_pack.m4: Ditto. m4/in_unpack.m4: Ditto. m4/iparm.m4: Ditto. m4/matmul.m4: Ditto. m4/matmull.m4: Ditto. m4/maxloc0.m4: Ditto. m4/maxloc1.m4: Ditto. m4/maxval.m4: Ditto. m4/minloc0.m4: Ditto. m4/minloc1.m4: Ditto. m4/minval.m4: Ditto. m4/mtype.m4: Ditto. m4/nearest.m4: Ditto. m4/pow.m4: Ditto. m4/product.m4: Ditto. m4/reshape.m4: Ditto. m4/set_exponent.m4: Ditto. m4/shape.m4: Ditto. m4/specific.m4: Ditto. m4/specific2.m4: Ditto. m4/sum.m4: Ditto. m4/transpose.m4: Ditto. m4/types.m4: Ditto. runtime/environ.c: Ditto. runtime/error.c: Ditto. runtime/in_pack_generic.c: Ditto. runtime/in_unpack_generic.c: Ditto. runtime/main.c: Ditto. runtime/memory.c: Ditto. runtime/normalize.c: Ditto. runtime/pause.c: Ditto. runtime/select.c: Ditto. runtime/stop.c: Ditto. runtime/string.c: Ditto. generated/_abs_c4.f90: Regenerated. generated/_abs_c8.f90: Regenerated. generated/_abs_i4.f90: Regenerated. generated/_abs_i8.f90: Regenerated. generated/_abs_r4.f90: Regenerated. generated/_abs_r8.f90: Regenerated. generated/_acos_r4.f90: Regenerated. generated/_acos_r8.f90: Regenerated. generated/_aint_r4.f90: Regenerated. generated/_aint_r8.f90: Regenerated. generated/_anint_r4.f90: Regenerated. generated/_anint_r8.f90: Regenerated. generated/_asin_r4.f90: Regenerated. generated/_asin_r8.f90: Regenerated. generated/_atan2_r4.f90: Regenerated. generated/_atan2_r8.f90: Regenerated. generated/_atan_r4.f90: Regenerated. generated/_atan_r8.f90: Regenerated. generated/_conjg_c4.f90: Regenerated. generated/_conjg_c8.f90: Regenerated. generated/_cos_c4.f90: Regenerated. generated/_cos_c8.f90: Regenerated. generated/_cos_r4.f90: Regenerated. generated/_cos_r8.f90: Regenerated. generated/_cosh_r4.f90: Regenerated. generated/_cosh_r8.f90: Regenerated. generated/_dim_i4.f90: Regenerated. generated/_dim_i8.f90: Regenerated. generated/_dim_r4.f90: Regenerated. generated/_dim_r8.f90: Regenerated. generated/_exp_c4.f90: Regenerated. generated/_exp_c8.f90: Regenerated. generated/_exp_r4.f90: Regenerated. generated/_exp_r8.f90: Regenerated. generated/_log10_r4.f90: Regenerated. generated/_log10_r8.f90: Regenerated. generated/_log_c4.f90: Regenerated. generated/_log_c8.f90: Regenerated. generated/_log_r4.f90: Regenerated. generated/_log_r8.f90: Regenerated. generated/_mod_i4.f90: Regenerated. generated/_mod_i8.f90: Regenerated. generated/_mod_r4.f90: Regenerated. generated/_mod_r8.f90: Regenerated. generated/_sign_i4.f90: Regenerated. generated/_sign_i8.f90: Regenerated. generated/_sign_r4.f90: Regenerated. generated/_sign_r8.f90: Regenerated. generated/_sin_c4.f90: Regenerated. generated/_sin_c8.f90: Regenerated. generated/_sin_r4.f90: Regenerated. generated/_sin_r8.f90: Regenerated. generated/_sinh_r4.f90: Regenerated. generated/_sinh_r8.f90: Regenerated. generated/_sqrt_c4.f90: Regenerated. generated/_sqrt_c8.f90: Regenerated. generated/_sqrt_r4.f90: Regenerated. generated/_sqrt_r8.f90: Regenerated. generated/_tan_r4.f90: Regenerated. generated/_tan_r8.f90: Regenerated. generated/_tanh_r4.f90: Regenerated. generated/_tanh_r8.f90: Regenerated. generated/all_l4.c: Regenerated. generated/all_l8.c: Regenerated. generated/any_l4.c: Regenerated. generated/any_l8.c: Regenerated. generated/count_4_l4.c: Regenerated. generated/count_4_l8.c: Regenerated. generated/count_8_l4.c: Regenerated. generated/count_8_l8.c: Regenerated. generated/cshift1_4.c: Regenerated. generated/cshift1_8.c: Regenerated. generated/dotprod_c4.c: Regenerated. generated/dotprod_c8.c: Regenerated. generated/dotprod_i4.c: Regenerated. generated/dotprod_i8.c: Regenerated. generated/dotprod_l4.c: Regenerated. generated/dotprod_l8.c: Regenerated. generated/dotprod_r4.c: Regenerated. generated/dotprod_r8.c: Regenerated. generated/eoshift1_4.c: Regenerated. generated/eoshift1_8.c: Regenerated. generated/eoshift3_4.c: Regenerated. generated/eoshift3_8.c: Regenerated. generated/exp_c4.c: Regenerated. generated/exp_c8.c: Regenerated. generated/exponent_r4.c: Regenerated. generated/exponent_r8.c: Regenerated. generated/fraction_r4.c: Regenerated. generated/fraction_r8.c: Regenerated. generated/hyp_c4.c: Regenerated. generated/hyp_c8.c: Regenerated. generated/in_pack_i4.c: Regenerated. generated/in_pack_i8.c: Regenerated. generated/in_unpack_i4.c: Regenerated. generated/in_unpack_i8.c: Regenerated. generated/matmul_c4.c: Regenerated. generated/matmul_c8.c: Regenerated. generated/matmul_i4.c: Regenerated. generated/matmul_i8.c: Regenerated. generated/matmul_l4.c: Regenerated. generated/matmul_l8.c: Regenerated. generated/matmul_r4.c: Regenerated. generated/matmul_r8.c: Regenerated. generated/maxloc0_4_i4.c: Regenerated. generated/maxloc0_4_i8.c: Regenerated. generated/maxloc0_4_r4.c: Regenerated. generated/maxloc0_4_r8.c: Regenerated. generated/maxloc0_8_i4.c: Regenerated. generated/maxloc0_8_i8.c: Regenerated. generated/maxloc0_8_r4.c: Regenerated. generated/maxloc0_8_r8.c: Regenerated. generated/maxloc1_4_i4.c: Regenerated. generated/maxloc1_4_i8.c: Regenerated. generated/maxloc1_4_r4.c: Regenerated. generated/maxloc1_4_r8.c: Regenerated. generated/maxloc1_8_i4.c: Regenerated. generated/maxloc1_8_i8.c: Regenerated. generated/maxloc1_8_r4.c: Regenerated. generated/maxloc1_8_r8.c: Regenerated. generated/maxval_i4.c: Regenerated. generated/maxval_i8.c: Regenerated. generated/maxval_r4.c: Regenerated. generated/maxval_r8.c: Regenerated. generated/minloc0_4_i4.c: Regenerated. generated/minloc0_4_i8.c: Regenerated. generated/minloc0_4_r4.c: Regenerated. generated/minloc0_4_r8.c: Regenerated. generated/minloc0_8_i4.c: Regenerated. generated/minloc0_8_i8.c: Regenerated. generated/minloc0_8_r4.c: Regenerated. generated/minloc0_8_r8.c: Regenerated. generated/minloc1_4_i4.c: Regenerated. generated/minloc1_4_i8.c: Regenerated. generated/minloc1_4_r4.c: Regenerated. generated/minloc1_4_r8.c: Regenerated. generated/minloc1_8_i4.c: Regenerated. generated/minloc1_8_i8.c: Regenerated. generated/minloc1_8_r4.c: Regenerated. generated/minloc1_8_r8.c: Regenerated. generated/minval_i4.c: Regenerated. generated/minval_i8.c: Regenerated. generated/minval_r4.c: Regenerated. generated/minval_r8.c: Regenerated. generated/nearest_r4.c: Regenerated. generated/nearest_r8.c: Regenerated. generated/pow_c4_i4.c: Regenerated. generated/pow_c4_i8.c: Regenerated. generated/pow_c8_i4.c: Regenerated. generated/pow_c8_i8.c: Regenerated. generated/pow_i4_i4.c: Regenerated. generated/pow_i4_i8.c: Regenerated. generated/pow_i8_i4.c: Regenerated. generated/pow_i8_i8.c: Regenerated. generated/pow_r4_i4.c: Regenerated. generated/pow_r4_i8.c: Regenerated. generated/pow_r8_i4.c: Regenerated. generated/pow_r8_i8.c: Regenerated. generated/product_c4.c: Regenerated. generated/product_c8.c: Regenerated. generated/product_i4.c: Regenerated. generated/product_i8.c: Regenerated. generated/product_r4.c: Regenerated. generated/product_r8.c: Regenerated. generated/reshape_i4.c: Regenerated. generated/reshape_i8.c: Regenerated. generated/set_exponent_r4.c: Regenerated. generated/set_exponent_r8.c: Regenerated. generated/shape_i4.c: Regenerated. generated/shape_i8.c: Regenerated. generated/sum_c4.c: Regenerated. generated/sum_c8.c: Regenerated. generated/sum_i4.c: Regenerated. generated/sum_i8.c: Regenerated. generated/sum_r4.c: Regenerated. generated/sum_r8.c: Regenerated. generated/transpose_i4.c: Regenerated. generated/transpose_i8.c: Regenerated. generated/trig_c4.c: Regenerated. generated/trig_c8.c: Regenerated. From-SVN: r93235
2005-01-12 22:27:33 +01:00
dnl Distributed under the GNU GPL with exception. See COPYING for details.
define(START_FOREACH_FUNCTION,
acinclude.m4 (LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY): New. * acinclude.m4 (LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY): New. (LIBGFOR_CHECK_ATTRIBUTE_DLLEXPORT): New. (LIBGFOR_CHECK_ATTRIBUTE_ALIAS): New. * configure.ac: Use them. * configure, config.h.in, aclocal.m4: Rebuild. * libgfortran.h (prefix): Remove. (PREFIX, IPREFIX): New. (sym_rename, sym_rename1, sym_rename2): New. (internal_proto, export_proto, export_proto_np): New. (iexport_proto, iexport): New. (iexport_data_proto, iexport_data): New. * intrinsics/abort.c, intrinsics/args.c, intrinsics/associated.c, intrinsics/cpu_time.c, intrinsics/cshift0.c, intrinsics/date_and_time.c, intrinsics/env.c, intrinsics/eoshift0.c, intrinsics/eoshift2.c, intrinsics/etime.c, intrinsics/exit.c, intrinsics/flush.c, intrinsics/fnum.c, intrinsics/getXid.c, intrinsics/getcwd.c, intrinsics/ishftc.c, intrinsics/mvbits.c, intrinsics/pack_generic.c, intrinsics/rand.c, intrinsics/random.c, intrinsics/reshape_generic.c, intrinsics/size.c, intrinsics/spread_generic.c, intrinsics/stat.c, intrinsics/string_intrinsics.c, intrinsics/system.c, intrinsics/system_clock.c, intrinsics/transpose_generic.c, intrinsics/umask.c, intrinsics/unlink.c, intrinsics/unpack_generic.c, io/backspace.c, io/close.c, io/endfile.c, io/inquire.c, io/io.h, io/open.c, io/rewind.c, io/transfer.c, libgfortran.h, m4/cshift1.m4, m4/dotprod.m4, m4/dotprodc.m4, m4/dotprodl.m4, m4/eoshift1.m4, m4/eoshift3.m4, m4/exponent.m4, m4/fraction.m4, m4/iforeach.m4, m4/ifunction.m4, m4/matmul.m4, m4/matmull.m4, m4/nearest.m4, m4/pow.m4, m4/reshape.m4, m4/set_exponent.m4, m4/shape.m4, m4/transpose.m4, runtime/environ.c, runtime/error.c, runtime/in_pack_generic.c, runtime/in_unpack_generic.c, runtime/main.c, runtime/memory.c, runtime/pause.c, runtime/select.c, runtime/stop.c: Use them to mark symbols internal or external. * generated/*: Rebuild. From-SVN: r92045
2004-12-12 09:59:05 +01:00
`
extern void name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
atype * const restrict array);
export_proto(name`'rtype_qual`_'atype_code);
acinclude.m4 (LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY): New. * acinclude.m4 (LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY): New. (LIBGFOR_CHECK_ATTRIBUTE_DLLEXPORT): New. (LIBGFOR_CHECK_ATTRIBUTE_ALIAS): New. * configure.ac: Use them. * configure, config.h.in, aclocal.m4: Rebuild. * libgfortran.h (prefix): Remove. (PREFIX, IPREFIX): New. (sym_rename, sym_rename1, sym_rename2): New. (internal_proto, export_proto, export_proto_np): New. (iexport_proto, iexport): New. (iexport_data_proto, iexport_data): New. * intrinsics/abort.c, intrinsics/args.c, intrinsics/associated.c, intrinsics/cpu_time.c, intrinsics/cshift0.c, intrinsics/date_and_time.c, intrinsics/env.c, intrinsics/eoshift0.c, intrinsics/eoshift2.c, intrinsics/etime.c, intrinsics/exit.c, intrinsics/flush.c, intrinsics/fnum.c, intrinsics/getXid.c, intrinsics/getcwd.c, intrinsics/ishftc.c, intrinsics/mvbits.c, intrinsics/pack_generic.c, intrinsics/rand.c, intrinsics/random.c, intrinsics/reshape_generic.c, intrinsics/size.c, intrinsics/spread_generic.c, intrinsics/stat.c, intrinsics/string_intrinsics.c, intrinsics/system.c, intrinsics/system_clock.c, intrinsics/transpose_generic.c, intrinsics/umask.c, intrinsics/unlink.c, intrinsics/unpack_generic.c, io/backspace.c, io/close.c, io/endfile.c, io/inquire.c, io/io.h, io/open.c, io/rewind.c, io/transfer.c, libgfortran.h, m4/cshift1.m4, m4/dotprod.m4, m4/dotprodc.m4, m4/dotprodl.m4, m4/eoshift1.m4, m4/eoshift3.m4, m4/exponent.m4, m4/fraction.m4, m4/iforeach.m4, m4/ifunction.m4, m4/matmul.m4, m4/matmull.m4, m4/nearest.m4, m4/pow.m4, m4/reshape.m4, m4/set_exponent.m4, m4/shape.m4, m4/transpose.m4, runtime/environ.c, runtime/error.c, runtime/in_pack_generic.c, runtime/in_unpack_generic.c, runtime/main.c, runtime/memory.c, runtime/pause.c, runtime/select.c, runtime/stop.c: Use them to mark symbols internal or external. * generated/*: Rebuild. From-SVN: r92045
2004-12-12 09:59:05 +01:00
void
name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
atype * const restrict array)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
index_type sstride[GFC_MAX_DIMENSIONS];
index_type dstride;
const atype_name *base;
rtype_name *dest;
index_type rank;
index_type n;
rank = GFC_DESCRIPTOR_RANK (array);
re PR libfortran/19106 ([4.0 only] segfault in executable for print *,sum(a,dim=2,mask=a>0)) 2005-04-09 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/19106 PR libfortran/19014 * m4/ifunction.m4 (name`'rtype_qual`_'atype_code): ditto. If retarray->data is NULL (i.e. the front end does not know the rank and dimenson of the array), fill in its properties and allocate memory. Change the assertions about rank and dimension of retarray into runtime errors and only check them for retarray->data != NULL. Do the same for correcting the stride from 0 to 1 in retarray. (`m'name`'rtype_qual`_'atype_code): Likewise. * m4/iforeach.m4 (name`'rtype_qual`_'atype_code): Likewise. Change assertion about rank of array to runtime error. (`m'name`'rtype_qual`_'atype_code): Likewise. * generated/all_l4.c: Regenerated. * generated/all_l8.c: Regenerated. * generated/any_l4.c: Regenerated. * generated/any_l8.c: Regenerated. * generated/count_4_l4.c: Regenerated. * generated/count_4_l8.c: Regenerated. * generated/count_8_l4.c: Regenerated. * generated/count_8_l8.c: Regenerated. * generated/maxloc0_4_i4.c: Regenerated. * generated/maxloc0_4_i8.c: Regenerated. * generated/maxloc0_4_r4.c: Regenerated. * generated/maxloc0_4_r8.c: Regenerated. * generated/maxloc0_8_i4.c: Regenerated. * generated/maxloc0_8_i8.c: Regenerated. * generated/maxloc0_8_r4.c: Regenerated. * generated/maxloc0_8_r8.c: Regenerated. * generated/maxloc1_4_i4.c: Regenerated. * generated/maxloc1_4_i8.c: Regenerated. * generated/maxloc1_4_r4.c: Regenerated. * generated/maxloc1_4_r8.c: Regenerated. * generated/maxloc1_8_i4.c: Regenerated. * generated/maxloc1_8_i8.c: Regenerated. * generated/maxloc1_8_r4.c: Regenerated. * generated/maxloc1_8_r8.c: Regenerated. * generated/maxval_i4.c: Regenerated. * generated/maxval_i8.c: Regenerated. * generated/maxval_r4.c: Regenerated. * generated/maxval_r8.c: Regenerated. * generated/minloc0_4_i4.c: Regenerated. * generated/minloc0_4_i8.c: Regenerated. * generated/minloc0_4_r4.c: Regenerated. * generated/minloc0_4_r8.c: Regenerated. * generated/minloc0_8_i4.c: Regenerated. * generated/minloc0_8_i8.c: Regenerated. * generated/minloc0_8_r4.c: Regenerated. * generated/minloc0_8_r8.c: Regenerated. * generated/minloc1_4_i4.c: Regenerated. * generated/minloc1_4_i8.c: Regenerated. * generated/minloc1_4_r4.c: Regenerated. * generated/minloc1_4_r8.c: Regenerated. * generated/minloc1_8_i4.c: Regenerated. * generated/minloc1_8_i8.c: Regenerated. * generated/minloc1_8_r4.c: Regenerated. * generated/minloc1_8_r8.c: Regenerated. * generated/minval_i4.c: Regenerated. * generated/minval_i8.c: Regenerated. * generated/minval_r4.c: Regenerated. * generated/minval_r8.c: Regenerated. * generated/product_c4.c: Regenerated. * generated/product_c8.c: Regenerated. * generated/product_i4.c: Regenerated. * generated/product_i8.c: Regenerated. * generated/product_r4.c: Regenerated. * generated/product_r8.c: Regenerated. * generated/sum_c4.c: Regenerated. * generated/sum_c8.c: Regenerated. * generated/sum_i4.c: Regenerated. * generated/sum_i8.c: Regenerated. * generated/sum_r4.c: Regenerated. * generated/sum_r8.c: Regenerated. 2005-04-09 Thomas Koenig <Thomas.Koenig@online.de> * gfortran.fortran-torture/execute/intrinsic_anyall.f90: Added test for callee-allocated arrays with write statements. * gfortran.fortran-torture/execute/intrinsic_count.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_mmloc.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_mmval.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_product.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_sum.f90: Likewise. From-SVN: r97929
2005-04-09 23:38:47 +02:00
if (rank <= 0)
runtime_error ("Rank of array needs to be > 0");
if (retarray->data == NULL)
{
retarray->dim[0].lbound = 0;
retarray->dim[0].ubound = rank-1;
retarray->dim[0].stride = 1;
retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
libgfortran.h (GFC_ARRAY_DESCRIPTOR): Replace 'type *base' by 'size_t offset'. * libgfortran.h (GFC_ARRAY_DESCRIPTOR): Replace 'type *base' by 'size_t offset'. * intrinsics/cshift0.c, intrinsics/eoshift0.c, intrinsics/eoshift2.c,intrinsics/pack_generic.c, intrinsics/reshape_generic.c, intrinsics/spread_generic.c, intrinsics/transpose_generic.c, intrinsics/unpack_generic, m4/cshift1.m4, m4/eoshift1.m4, m4/eoshift3.m4, m4/iforeach.m4, m4/ifunction.m4, m4/matmul.m4, m4/matmull.m4, m4/reshape.m4, m4,transpose.m4: Set renamed field 'offset' to zero instead of 'base'. * generated/all_l4.c, generated/all_l8.c, generated/any_l4.c, generated/any_l8.c, generated/count_4_l4.c, generated/count_4_l8.c, generated/count_8_l4.c, generated/count_8_l8.c, generated/chift1_4.c, generated/cshift1_8.c, generated/eoshift1_4.c, generated/eoshift1_8.c, generated/eoshift3_4.c, generated/eoshift3_8.c, generated/matmul_c4.c, generated/matmul_c8.c, generated/matmul_i4.c, matmul_i8.c, generated/matmul_l4.c, generated/matmul_l8.c, generated/matmul_r4.c, generated/matmul_r8.c, generated/maxloc0_4_i4.c, generated/maxloc0_4_i8.c, generated/maxloc0_4_r4.c, generated/maxloc0_4_r8.c, generated/maxloc0_8_i4.c, generated/maxloc0_8_i8.c, generated/maxloc0_8_r4.c, generated/maxloc0_8_r8.c, generated/maxloc1_4_i4.c, generated/maxloc1_4_i8.c, generated/maxloc1_4_r4.c, generated/maxloc1_4_r8.c, generated/maxloc1_8_i4.c, generated/maxloc1_8_i8.c, generated/maxloc1_8_r4.c, generated/maxloc1_8_r8.c, generated/maxval_i4.c, generated/maxval_i8.c, generated/maxval_r4.c, generated/maxval_r8.c, generated/minloc0_4_i4.c, generated/minloc0_4_i8.c, generated/minloc0_4_r4.c, generated/minloc0_4_r8.c, generated/minloc0_8_i4.c, generated/minloc0_8_i8.c, generated/minloc0_8_r4.c, generated/minloc0_8_r8.c, generated/minloc1_4_i4.c, generated/minloc1_4_i8.c, generated/minloc1_4_r4.c, generated/minloc1_4_r8.c, generated/minloc1_8_i4.c, generated/minloc1_8_i8.c, generated/minloc1_8_r4.c, generated/minloc1_8_r8.c, generated/minval_i4.c, generated/minval_i8.c, generated/minval_r4.c, generated/minval_r8.c, generated/product_c4.c, generated/product_c8.c, generated/product_i4.c, generated/product_i8.c, generated/product_r4.c, generated/product_r8.c, generated/reshape_c4.c, generated/reshape_c8.c, generated/reshape_i4.c, generated/reshape_i8.c, generated/sum_c4.c, generated/sum_c8.c, generated/sum_i4.c, generated/sum_i8.c, generated/sum_r4.c, generated/sum_r8.c, generated/transpose_c4.c, generated/transpose_c8.c, generated/transpose_i4.c, generated/transpose_i8.c: Regenerate: From-SVN: r101739
2005-07-08 00:08:06 +02:00
retarray->offset = 0;
re PR libfortran/19106 ([4.0 only] segfault in executable for print *,sum(a,dim=2,mask=a>0)) 2005-04-09 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/19106 PR libfortran/19014 * m4/ifunction.m4 (name`'rtype_qual`_'atype_code): ditto. If retarray->data is NULL (i.e. the front end does not know the rank and dimenson of the array), fill in its properties and allocate memory. Change the assertions about rank and dimension of retarray into runtime errors and only check them for retarray->data != NULL. Do the same for correcting the stride from 0 to 1 in retarray. (`m'name`'rtype_qual`_'atype_code): Likewise. * m4/iforeach.m4 (name`'rtype_qual`_'atype_code): Likewise. Change assertion about rank of array to runtime error. (`m'name`'rtype_qual`_'atype_code): Likewise. * generated/all_l4.c: Regenerated. * generated/all_l8.c: Regenerated. * generated/any_l4.c: Regenerated. * generated/any_l8.c: Regenerated. * generated/count_4_l4.c: Regenerated. * generated/count_4_l8.c: Regenerated. * generated/count_8_l4.c: Regenerated. * generated/count_8_l8.c: Regenerated. * generated/maxloc0_4_i4.c: Regenerated. * generated/maxloc0_4_i8.c: Regenerated. * generated/maxloc0_4_r4.c: Regenerated. * generated/maxloc0_4_r8.c: Regenerated. * generated/maxloc0_8_i4.c: Regenerated. * generated/maxloc0_8_i8.c: Regenerated. * generated/maxloc0_8_r4.c: Regenerated. * generated/maxloc0_8_r8.c: Regenerated. * generated/maxloc1_4_i4.c: Regenerated. * generated/maxloc1_4_i8.c: Regenerated. * generated/maxloc1_4_r4.c: Regenerated. * generated/maxloc1_4_r8.c: Regenerated. * generated/maxloc1_8_i4.c: Regenerated. * generated/maxloc1_8_i8.c: Regenerated. * generated/maxloc1_8_r4.c: Regenerated. * generated/maxloc1_8_r8.c: Regenerated. * generated/maxval_i4.c: Regenerated. * generated/maxval_i8.c: Regenerated. * generated/maxval_r4.c: Regenerated. * generated/maxval_r8.c: Regenerated. * generated/minloc0_4_i4.c: Regenerated. * generated/minloc0_4_i8.c: Regenerated. * generated/minloc0_4_r4.c: Regenerated. * generated/minloc0_4_r8.c: Regenerated. * generated/minloc0_8_i4.c: Regenerated. * generated/minloc0_8_i8.c: Regenerated. * generated/minloc0_8_r4.c: Regenerated. * generated/minloc0_8_r8.c: Regenerated. * generated/minloc1_4_i4.c: Regenerated. * generated/minloc1_4_i8.c: Regenerated. * generated/minloc1_4_r4.c: Regenerated. * generated/minloc1_4_r8.c: Regenerated. * generated/minloc1_8_i4.c: Regenerated. * generated/minloc1_8_i8.c: Regenerated. * generated/minloc1_8_r4.c: Regenerated. * generated/minloc1_8_r8.c: Regenerated. * generated/minval_i4.c: Regenerated. * generated/minval_i8.c: Regenerated. * generated/minval_r4.c: Regenerated. * generated/minval_r8.c: Regenerated. * generated/product_c4.c: Regenerated. * generated/product_c8.c: Regenerated. * generated/product_i4.c: Regenerated. * generated/product_i8.c: Regenerated. * generated/product_r4.c: Regenerated. * generated/product_r8.c: Regenerated. * generated/sum_c4.c: Regenerated. * generated/sum_c8.c: Regenerated. * generated/sum_i4.c: Regenerated. * generated/sum_i8.c: Regenerated. * generated/sum_r4.c: Regenerated. * generated/sum_r8.c: Regenerated. 2005-04-09 Thomas Koenig <Thomas.Koenig@online.de> * gfortran.fortran-torture/execute/intrinsic_anyall.f90: Added test for callee-allocated arrays with write statements. * gfortran.fortran-torture/execute/intrinsic_count.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_mmloc.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_mmval.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_product.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_sum.f90: Likewise. From-SVN: r97929
2005-04-09 23:38:47 +02:00
retarray->data = internal_malloc_size (sizeof (rtype_name) * rank);
}
else
{
if (GFC_DESCRIPTOR_RANK (retarray) != 1)
runtime_error ("rank of return array does not equal 1");
if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
runtime_error ("dimension of return array incorrect");
}
re PR libfortran/19106 ([4.0 only] segfault in executable for print *,sum(a,dim=2,mask=a>0)) 2005-04-13 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/19106 * m4/iforeach.c (name`'rtype_qual`_'atype_code): Add TODO that setting correct strides is a front end job. (`m'name`'rtype_qual`_'atype_code): Likewise. If mask has a lowest stride of 0, adjust to 1. * m4/ifunction.c (name`'rtype_qual`_'atype_code): Add TODO that setting correct strides is a front end job. (`m'name`'rtype_qual`_'atype_code): Likewise. If mask has a lowest stride of 0, adjust to 1. * maxloc0_4_i4.c: Regenerated * maxloc0_4_i8.c: Regenerated * maxloc0_4_r4.c: Regenerated * maxloc0_4_r8.c: Regenerated * maxloc0_8_i4.c: Regenerated * maxloc0_8_i8.c: Regenerated * maxloc0_8_r4.c: Regenerated * maxloc0_8_r8.c: Regenerated * maxloc1_4_i4.c: Regenerated * maxloc1_4_i8.c: Regenerated * maxloc1_4_r4.c: Regenerated * maxloc1_4_r8.c: Regenerated * maxloc1_8_i4.c: Regenerated * maxloc1_8_i8.c: Regenerated * maxloc1_8_r4.c: Regenerated * maxloc1_8_r8.c: Regenerated * maxval_i4.c: Regenerated * maxval_i8.c: Regenerated * maxval_r4.c: Regenerated * maxval_r8.c: Regenerated * minloc0_4_i4.c: Regenerated * minloc0_4_i8.c: Regenerated * minloc0_4_r4.c: Regenerated * minloc0_4_r8.c: Regenerated * minloc0_8_i4.c: Regenerated * minloc0_8_i8.c: Regenerated * minloc0_8_r4.c: Regenerated * minloc0_8_r8.c: Regenerated * minloc1_4_i4.c: Regenerated * minloc1_4_i8.c: Regenerated * minloc1_4_r4.c: Regenerated * minloc1_4_r8.c: Regenerated * minloc1_8_i4.c: Regenerated * minloc1_8_i8.c: Regenerated * minloc1_8_r4.c: Regenerated * minloc1_8_r8.c: Regenerated * minval_i4.c: Regenerated * minval_i8.c: Regenerated * minval_r4.c: Regenerated * minval_r8.c: Regenerated * product_c4.c: Regenerated * product_c8.c: Regenerated * product_i4.c: Regenerated * product_i8.c: Regenerated * product_r4.c: Regenerated * product_r8.c: Regenerated * sum_c4.c: Regenerated * sum_c8.c: Regenerated * sum_i4.c: Regenerated * sum_i8.c: Regenerated * sum_r4.c: Regenerated * sum_r8.c: Regenerated 2005-04-13 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/19016 * gfortran.fortran-torture/execute/intrinsic_mmloc.f90: Add tests with mask generated by expression. * gfortran.fortran-torture/execute/intrinsic_mmval.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_product.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_sum.f90: Likewise. From-SVN: r98052
2005-04-13 00:57:10 +02:00
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
{
/* Set the return value. */
for (n = 0; n < rank; n++)
dest[n * dstride] = 0;
return;
}
}
base = array->data;
/* Initialize the return value. */
for (n = 0; n < rank; n++)
dest[n * dstride] = 0;
{
')dnl
define(START_FOREACH_BLOCK,
` while (base)
{
{
/* Implementation start. */
')dnl
define(FINISH_FOREACH_FUNCTION,
` /* Implementation end. */
}
/* Advance to the next element. */
count[0]++;
base += sstride[0];
n = 0;
while (count[n] == extent[n])
{
/* When we get to the end of a dimension, reset it and increment
the next dimension. */
count[n] = 0;
/* We could precalculate these products, but this is a less
frequently used path so probably not worth it. */
base -= sstride[n] * extent[n];
n++;
if (n == rank)
{
/* Break out of the loop. */
base = NULL;
break;
}
else
{
count[n]++;
base += sstride[n];
}
}
}
}
}')dnl
define(START_MASKED_FOREACH_FUNCTION,
acinclude.m4 (LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY): New. * acinclude.m4 (LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY): New. (LIBGFOR_CHECK_ATTRIBUTE_DLLEXPORT): New. (LIBGFOR_CHECK_ATTRIBUTE_ALIAS): New. * configure.ac: Use them. * configure, config.h.in, aclocal.m4: Rebuild. * libgfortran.h (prefix): Remove. (PREFIX, IPREFIX): New. (sym_rename, sym_rename1, sym_rename2): New. (internal_proto, export_proto, export_proto_np): New. (iexport_proto, iexport): New. (iexport_data_proto, iexport_data): New. * intrinsics/abort.c, intrinsics/args.c, intrinsics/associated.c, intrinsics/cpu_time.c, intrinsics/cshift0.c, intrinsics/date_and_time.c, intrinsics/env.c, intrinsics/eoshift0.c, intrinsics/eoshift2.c, intrinsics/etime.c, intrinsics/exit.c, intrinsics/flush.c, intrinsics/fnum.c, intrinsics/getXid.c, intrinsics/getcwd.c, intrinsics/ishftc.c, intrinsics/mvbits.c, intrinsics/pack_generic.c, intrinsics/rand.c, intrinsics/random.c, intrinsics/reshape_generic.c, intrinsics/size.c, intrinsics/spread_generic.c, intrinsics/stat.c, intrinsics/string_intrinsics.c, intrinsics/system.c, intrinsics/system_clock.c, intrinsics/transpose_generic.c, intrinsics/umask.c, intrinsics/unlink.c, intrinsics/unpack_generic.c, io/backspace.c, io/close.c, io/endfile.c, io/inquire.c, io/io.h, io/open.c, io/rewind.c, io/transfer.c, libgfortran.h, m4/cshift1.m4, m4/dotprod.m4, m4/dotprodc.m4, m4/dotprodl.m4, m4/eoshift1.m4, m4/eoshift3.m4, m4/exponent.m4, m4/fraction.m4, m4/iforeach.m4, m4/ifunction.m4, m4/matmul.m4, m4/matmull.m4, m4/nearest.m4, m4/pow.m4, m4/reshape.m4, m4/set_exponent.m4, m4/shape.m4, m4/transpose.m4, runtime/environ.c, runtime/error.c, runtime/in_pack_generic.c, runtime/in_unpack_generic.c, runtime/main.c, runtime/memory.c, runtime/pause.c, runtime/select.c, runtime/stop.c: Use them to mark symbols internal or external. * generated/*: Rebuild. From-SVN: r92045
2004-12-12 09:59:05 +01:00
`
extern void `m'name`'rtype_qual`_'atype_code (rtype * const restrict,
atype * const restrict, gfc_array_l4 * const restrict);
export_proto(`m'name`'rtype_qual`_'atype_code);
acinclude.m4 (LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY): New. * acinclude.m4 (LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY): New. (LIBGFOR_CHECK_ATTRIBUTE_DLLEXPORT): New. (LIBGFOR_CHECK_ATTRIBUTE_ALIAS): New. * configure.ac: Use them. * configure, config.h.in, aclocal.m4: Rebuild. * libgfortran.h (prefix): Remove. (PREFIX, IPREFIX): New. (sym_rename, sym_rename1, sym_rename2): New. (internal_proto, export_proto, export_proto_np): New. (iexport_proto, iexport): New. (iexport_data_proto, iexport_data): New. * intrinsics/abort.c, intrinsics/args.c, intrinsics/associated.c, intrinsics/cpu_time.c, intrinsics/cshift0.c, intrinsics/date_and_time.c, intrinsics/env.c, intrinsics/eoshift0.c, intrinsics/eoshift2.c, intrinsics/etime.c, intrinsics/exit.c, intrinsics/flush.c, intrinsics/fnum.c, intrinsics/getXid.c, intrinsics/getcwd.c, intrinsics/ishftc.c, intrinsics/mvbits.c, intrinsics/pack_generic.c, intrinsics/rand.c, intrinsics/random.c, intrinsics/reshape_generic.c, intrinsics/size.c, intrinsics/spread_generic.c, intrinsics/stat.c, intrinsics/string_intrinsics.c, intrinsics/system.c, intrinsics/system_clock.c, intrinsics/transpose_generic.c, intrinsics/umask.c, intrinsics/unlink.c, intrinsics/unpack_generic.c, io/backspace.c, io/close.c, io/endfile.c, io/inquire.c, io/io.h, io/open.c, io/rewind.c, io/transfer.c, libgfortran.h, m4/cshift1.m4, m4/dotprod.m4, m4/dotprodc.m4, m4/dotprodl.m4, m4/eoshift1.m4, m4/eoshift3.m4, m4/exponent.m4, m4/fraction.m4, m4/iforeach.m4, m4/ifunction.m4, m4/matmul.m4, m4/matmull.m4, m4/nearest.m4, m4/pow.m4, m4/reshape.m4, m4/set_exponent.m4, m4/shape.m4, m4/transpose.m4, runtime/environ.c, runtime/error.c, runtime/in_pack_generic.c, runtime/in_unpack_generic.c, runtime/main.c, runtime/memory.c, runtime/pause.c, runtime/select.c, runtime/stop.c: Use them to mark symbols internal or external. * generated/*: Rebuild. From-SVN: r92045
2004-12-12 09:59:05 +01:00
void
`m'name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
atype * const restrict array,
gfc_array_l4 * const restrict mask)
{
index_type count[GFC_MAX_DIMENSIONS];
index_type extent[GFC_MAX_DIMENSIONS];
index_type sstride[GFC_MAX_DIMENSIONS];
index_type mstride[GFC_MAX_DIMENSIONS];
index_type dstride;
rtype_name *dest;
const atype_name *base;
GFC_LOGICAL_4 *mbase;
int rank;
index_type n;
rank = GFC_DESCRIPTOR_RANK (array);
re PR libfortran/19106 ([4.0 only] segfault in executable for print *,sum(a,dim=2,mask=a>0)) 2005-04-09 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/19106 PR libfortran/19014 * m4/ifunction.m4 (name`'rtype_qual`_'atype_code): ditto. If retarray->data is NULL (i.e. the front end does not know the rank and dimenson of the array), fill in its properties and allocate memory. Change the assertions about rank and dimension of retarray into runtime errors and only check them for retarray->data != NULL. Do the same for correcting the stride from 0 to 1 in retarray. (`m'name`'rtype_qual`_'atype_code): Likewise. * m4/iforeach.m4 (name`'rtype_qual`_'atype_code): Likewise. Change assertion about rank of array to runtime error. (`m'name`'rtype_qual`_'atype_code): Likewise. * generated/all_l4.c: Regenerated. * generated/all_l8.c: Regenerated. * generated/any_l4.c: Regenerated. * generated/any_l8.c: Regenerated. * generated/count_4_l4.c: Regenerated. * generated/count_4_l8.c: Regenerated. * generated/count_8_l4.c: Regenerated. * generated/count_8_l8.c: Regenerated. * generated/maxloc0_4_i4.c: Regenerated. * generated/maxloc0_4_i8.c: Regenerated. * generated/maxloc0_4_r4.c: Regenerated. * generated/maxloc0_4_r8.c: Regenerated. * generated/maxloc0_8_i4.c: Regenerated. * generated/maxloc0_8_i8.c: Regenerated. * generated/maxloc0_8_r4.c: Regenerated. * generated/maxloc0_8_r8.c: Regenerated. * generated/maxloc1_4_i4.c: Regenerated. * generated/maxloc1_4_i8.c: Regenerated. * generated/maxloc1_4_r4.c: Regenerated. * generated/maxloc1_4_r8.c: Regenerated. * generated/maxloc1_8_i4.c: Regenerated. * generated/maxloc1_8_i8.c: Regenerated. * generated/maxloc1_8_r4.c: Regenerated. * generated/maxloc1_8_r8.c: Regenerated. * generated/maxval_i4.c: Regenerated. * generated/maxval_i8.c: Regenerated. * generated/maxval_r4.c: Regenerated. * generated/maxval_r8.c: Regenerated. * generated/minloc0_4_i4.c: Regenerated. * generated/minloc0_4_i8.c: Regenerated. * generated/minloc0_4_r4.c: Regenerated. * generated/minloc0_4_r8.c: Regenerated. * generated/minloc0_8_i4.c: Regenerated. * generated/minloc0_8_i8.c: Regenerated. * generated/minloc0_8_r4.c: Regenerated. * generated/minloc0_8_r8.c: Regenerated. * generated/minloc1_4_i4.c: Regenerated. * generated/minloc1_4_i8.c: Regenerated. * generated/minloc1_4_r4.c: Regenerated. * generated/minloc1_4_r8.c: Regenerated. * generated/minloc1_8_i4.c: Regenerated. * generated/minloc1_8_i8.c: Regenerated. * generated/minloc1_8_r4.c: Regenerated. * generated/minloc1_8_r8.c: Regenerated. * generated/minval_i4.c: Regenerated. * generated/minval_i8.c: Regenerated. * generated/minval_r4.c: Regenerated. * generated/minval_r8.c: Regenerated. * generated/product_c4.c: Regenerated. * generated/product_c8.c: Regenerated. * generated/product_i4.c: Regenerated. * generated/product_i8.c: Regenerated. * generated/product_r4.c: Regenerated. * generated/product_r8.c: Regenerated. * generated/sum_c4.c: Regenerated. * generated/sum_c8.c: Regenerated. * generated/sum_i4.c: Regenerated. * generated/sum_i8.c: Regenerated. * generated/sum_r4.c: Regenerated. * generated/sum_r8.c: Regenerated. 2005-04-09 Thomas Koenig <Thomas.Koenig@online.de> * gfortran.fortran-torture/execute/intrinsic_anyall.f90: Added test for callee-allocated arrays with write statements. * gfortran.fortran-torture/execute/intrinsic_count.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_mmloc.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_mmval.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_product.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_sum.f90: Likewise. From-SVN: r97929
2005-04-09 23:38:47 +02:00
if (rank <= 0)
runtime_error ("Rank of array needs to be > 0");
if (retarray->data == NULL)
{
retarray->dim[0].lbound = 0;
retarray->dim[0].ubound = rank-1;
retarray->dim[0].stride = 1;
retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
libgfortran.h (GFC_ARRAY_DESCRIPTOR): Replace 'type *base' by 'size_t offset'. * libgfortran.h (GFC_ARRAY_DESCRIPTOR): Replace 'type *base' by 'size_t offset'. * intrinsics/cshift0.c, intrinsics/eoshift0.c, intrinsics/eoshift2.c,intrinsics/pack_generic.c, intrinsics/reshape_generic.c, intrinsics/spread_generic.c, intrinsics/transpose_generic.c, intrinsics/unpack_generic, m4/cshift1.m4, m4/eoshift1.m4, m4/eoshift3.m4, m4/iforeach.m4, m4/ifunction.m4, m4/matmul.m4, m4/matmull.m4, m4/reshape.m4, m4,transpose.m4: Set renamed field 'offset' to zero instead of 'base'. * generated/all_l4.c, generated/all_l8.c, generated/any_l4.c, generated/any_l8.c, generated/count_4_l4.c, generated/count_4_l8.c, generated/count_8_l4.c, generated/count_8_l8.c, generated/chift1_4.c, generated/cshift1_8.c, generated/eoshift1_4.c, generated/eoshift1_8.c, generated/eoshift3_4.c, generated/eoshift3_8.c, generated/matmul_c4.c, generated/matmul_c8.c, generated/matmul_i4.c, matmul_i8.c, generated/matmul_l4.c, generated/matmul_l8.c, generated/matmul_r4.c, generated/matmul_r8.c, generated/maxloc0_4_i4.c, generated/maxloc0_4_i8.c, generated/maxloc0_4_r4.c, generated/maxloc0_4_r8.c, generated/maxloc0_8_i4.c, generated/maxloc0_8_i8.c, generated/maxloc0_8_r4.c, generated/maxloc0_8_r8.c, generated/maxloc1_4_i4.c, generated/maxloc1_4_i8.c, generated/maxloc1_4_r4.c, generated/maxloc1_4_r8.c, generated/maxloc1_8_i4.c, generated/maxloc1_8_i8.c, generated/maxloc1_8_r4.c, generated/maxloc1_8_r8.c, generated/maxval_i4.c, generated/maxval_i8.c, generated/maxval_r4.c, generated/maxval_r8.c, generated/minloc0_4_i4.c, generated/minloc0_4_i8.c, generated/minloc0_4_r4.c, generated/minloc0_4_r8.c, generated/minloc0_8_i4.c, generated/minloc0_8_i8.c, generated/minloc0_8_r4.c, generated/minloc0_8_r8.c, generated/minloc1_4_i4.c, generated/minloc1_4_i8.c, generated/minloc1_4_r4.c, generated/minloc1_4_r8.c, generated/minloc1_8_i4.c, generated/minloc1_8_i8.c, generated/minloc1_8_r4.c, generated/minloc1_8_r8.c, generated/minval_i4.c, generated/minval_i8.c, generated/minval_r4.c, generated/minval_r8.c, generated/product_c4.c, generated/product_c8.c, generated/product_i4.c, generated/product_i8.c, generated/product_r4.c, generated/product_r8.c, generated/reshape_c4.c, generated/reshape_c8.c, generated/reshape_i4.c, generated/reshape_i8.c, generated/sum_c4.c, generated/sum_c8.c, generated/sum_i4.c, generated/sum_i8.c, generated/sum_r4.c, generated/sum_r8.c, generated/transpose_c4.c, generated/transpose_c8.c, generated/transpose_i4.c, generated/transpose_i8.c: Regenerate: From-SVN: r101739
2005-07-08 00:08:06 +02:00
retarray->offset = 0;
re PR libfortran/19106 ([4.0 only] segfault in executable for print *,sum(a,dim=2,mask=a>0)) 2005-04-09 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/19106 PR libfortran/19014 * m4/ifunction.m4 (name`'rtype_qual`_'atype_code): ditto. If retarray->data is NULL (i.e. the front end does not know the rank and dimenson of the array), fill in its properties and allocate memory. Change the assertions about rank and dimension of retarray into runtime errors and only check them for retarray->data != NULL. Do the same for correcting the stride from 0 to 1 in retarray. (`m'name`'rtype_qual`_'atype_code): Likewise. * m4/iforeach.m4 (name`'rtype_qual`_'atype_code): Likewise. Change assertion about rank of array to runtime error. (`m'name`'rtype_qual`_'atype_code): Likewise. * generated/all_l4.c: Regenerated. * generated/all_l8.c: Regenerated. * generated/any_l4.c: Regenerated. * generated/any_l8.c: Regenerated. * generated/count_4_l4.c: Regenerated. * generated/count_4_l8.c: Regenerated. * generated/count_8_l4.c: Regenerated. * generated/count_8_l8.c: Regenerated. * generated/maxloc0_4_i4.c: Regenerated. * generated/maxloc0_4_i8.c: Regenerated. * generated/maxloc0_4_r4.c: Regenerated. * generated/maxloc0_4_r8.c: Regenerated. * generated/maxloc0_8_i4.c: Regenerated. * generated/maxloc0_8_i8.c: Regenerated. * generated/maxloc0_8_r4.c: Regenerated. * generated/maxloc0_8_r8.c: Regenerated. * generated/maxloc1_4_i4.c: Regenerated. * generated/maxloc1_4_i8.c: Regenerated. * generated/maxloc1_4_r4.c: Regenerated. * generated/maxloc1_4_r8.c: Regenerated. * generated/maxloc1_8_i4.c: Regenerated. * generated/maxloc1_8_i8.c: Regenerated. * generated/maxloc1_8_r4.c: Regenerated. * generated/maxloc1_8_r8.c: Regenerated. * generated/maxval_i4.c: Regenerated. * generated/maxval_i8.c: Regenerated. * generated/maxval_r4.c: Regenerated. * generated/maxval_r8.c: Regenerated. * generated/minloc0_4_i4.c: Regenerated. * generated/minloc0_4_i8.c: Regenerated. * generated/minloc0_4_r4.c: Regenerated. * generated/minloc0_4_r8.c: Regenerated. * generated/minloc0_8_i4.c: Regenerated. * generated/minloc0_8_i8.c: Regenerated. * generated/minloc0_8_r4.c: Regenerated. * generated/minloc0_8_r8.c: Regenerated. * generated/minloc1_4_i4.c: Regenerated. * generated/minloc1_4_i8.c: Regenerated. * generated/minloc1_4_r4.c: Regenerated. * generated/minloc1_4_r8.c: Regenerated. * generated/minloc1_8_i4.c: Regenerated. * generated/minloc1_8_i8.c: Regenerated. * generated/minloc1_8_r4.c: Regenerated. * generated/minloc1_8_r8.c: Regenerated. * generated/minval_i4.c: Regenerated. * generated/minval_i8.c: Regenerated. * generated/minval_r4.c: Regenerated. * generated/minval_r8.c: Regenerated. * generated/product_c4.c: Regenerated. * generated/product_c8.c: Regenerated. * generated/product_i4.c: Regenerated. * generated/product_i8.c: Regenerated. * generated/product_r4.c: Regenerated. * generated/product_r8.c: Regenerated. * generated/sum_c4.c: Regenerated. * generated/sum_c8.c: Regenerated. * generated/sum_i4.c: Regenerated. * generated/sum_i8.c: Regenerated. * generated/sum_r4.c: Regenerated. * generated/sum_r8.c: Regenerated. 2005-04-09 Thomas Koenig <Thomas.Koenig@online.de> * gfortran.fortran-torture/execute/intrinsic_anyall.f90: Added test for callee-allocated arrays with write statements. * gfortran.fortran-torture/execute/intrinsic_count.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_mmloc.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_mmval.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_product.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_sum.f90: Likewise. From-SVN: r97929
2005-04-09 23:38:47 +02:00
retarray->data = internal_malloc_size (sizeof (rtype_name) * rank);
}
else
{
if (GFC_DESCRIPTOR_RANK (retarray) != 1)
runtime_error ("rank of return array does not equal 1");
if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
runtime_error ("dimension of return array incorrect");
}
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n < rank; n++)
{
sstride[n] = array->dim[n].stride;
mstride[n] = mask->dim[n].stride;
extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
count[n] = 0;
if (extent[n] <= 0)
{
/* Set the return value. */
for (n = 0; n < rank; n++)
dest[n * dstride] = 0;
return;
}
}
base = array->data;
mbase = mask->data;
if (GFC_DESCRIPTOR_SIZE (mask) != 4)
{
/* This allows the same loop to be used for all logical types. */
assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
for (n = 0; n < rank; n++)
mstride[n] <<= 1;
mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
}
/* Initialize the return value. */
for (n = 0; n < rank; n++)
dest[n * dstride] = 0;
{
')dnl
define(START_MASKED_FOREACH_BLOCK, `START_FOREACH_BLOCK')dnl
define(FINISH_MASKED_FOREACH_FUNCTION,
` /* Implementation end. */
}
/* Advance to the next element. */
count[0]++;
base += sstride[0];
mbase += mstride[0];
n = 0;
while (count[n] == extent[n])
{
/* When we get to the end of a dimension, reset it and increment
the next dimension. */
count[n] = 0;
/* We could precalculate these products, but this is a less
frequently used path so probably not worth it. */
base -= sstride[n] * extent[n];
mbase -= mstride[n] * extent[n];
n++;
if (n == rank)
{
/* Break out of the loop. */
base = NULL;
break;
}
else
{
count[n]++;
base += sstride[n];
mbase += mstride[n];
}
}
}
}
}')dnl
define(FOREACH_FUNCTION,
`START_FOREACH_FUNCTION
$1
START_FOREACH_BLOCK
$2
FINISH_FOREACH_FUNCTION')dnl
define(MASKED_FOREACH_FUNCTION,
`START_MASKED_FOREACH_FUNCTION
$1
START_MASKED_FOREACH_BLOCK
$2
FINISH_MASKED_FOREACH_FUNCTION')dnl
re PR fortran/20935 (failed assertion for maxloc(n, mask=.true.)) 2006-03-20 Thomas Koenig <Thomas.Koenig@online.de> PR fortran/20935 * iresolve.c (gfc_resolve_maxloc): If mask is scalar, prefix the function name with an "s". If the mask is scalar or if its kind is smaller than gfc_default_logical_kind, coerce it to default kind. (gfc_resolve_maxval): Likewise. (gfc_resolve_minloc): Likewise. (gfc_resolve_minval): Likewise. (gfc_resolve_product): Likewise. (gfc_resolve_sum): Likewise. 2006-03-20 Thomas Koenig <Thomas.Koenig@online.de> PR fortran/20935 * m4/iforeach.m4: Add SCALAR_FOREACH_FUNCTION macro. * m4/ifunction.m4: Add SCALAR_ARRAY_FUNCTION macro. * m4/minloc0.m4: Use SCALAR_FOREACH_FUNCTION. * m4/minloc1.m4: Use SCALAR_ARRAY_FUNCTION. * m4/maxloc0.m4: Use SCALAR_FOREACH_FUNCTION. * m4/maxloc1.m4: Use SCALAR_ARRAY_FUNCTION. * m4/minval.m4: Likewise. * m4/maxval.m4: Likewise. * m4/product.m4: Likewise. * m4/sum.m4: Likewise. * minloc0_16_i16.c : Regenerated. * minloc0_16_i4.c : Regenerated. * minloc0_16_i8.c : Regenerated. * minloc0_16_r10.c : Regenerated. * minloc0_16_r16.c : Regenerated. * minloc0_16_r4.c : Regenerated. * minloc0_16_r8.c : Regenerated. * minloc0_4_i16.c : Regenerated. * minloc0_4_i4.c : Regenerated. * minloc0_4_i8.c : Regenerated. * minloc0_4_r10.c : Regenerated. * minloc0_4_r16.c : Regenerated. * minloc0_4_r4.c : Regenerated. * minloc0_4_r8.c : Regenerated. * minloc0_8_i16.c : Regenerated. * minloc0_8_i4.c : Regenerated. * minloc0_8_i8.c : Regenerated. * minloc0_8_r10.c : Regenerated. * minloc0_8_r16.c : Regenerated. * minloc0_8_r4.c : Regenerated. * minloc0_8_r8.c : Regenerated. * minloc1_16_i16.c : Regenerated. * minloc1_16_i4.c : Regenerated. * minloc1_16_i8.c : Regenerated. * minloc1_16_r10.c : Regenerated. * minloc1_16_r16.c : Regenerated. * minloc1_16_r4.c : Regenerated. * minloc1_16_r8.c : Regenerated. * minloc1_4_i16.c : Regenerated. * minloc1_4_i4.c : Regenerated. * minloc1_4_i8.c : Regenerated. * minloc1_4_r10.c : Regenerated. * minloc1_4_r16.c : Regenerated. * minloc1_4_r4.c : Regenerated. * minloc1_4_r8.c : Regenerated. * minloc1_8_i16.c : Regenerated. * minloc1_8_i4.c : Regenerated. * minloc1_8_i8.c : Regenerated. * minloc1_8_r10.c : Regenerated. * minloc1_8_r16.c : Regenerated. * minloc1_8_r4.c : Regenerated. * minloc1_8_r8.c : Regenerated. * maxloc0_16_i16.c : Regenerated. * maxloc0_16_i4.c : Regenerated. * maxloc0_16_i8.c : Regenerated. * maxloc0_16_r10.c : Regenerated. * maxloc0_16_r16.c : Regenerated. * maxloc0_16_r4.c : Regenerated. * maxloc0_16_r8.c : Regenerated. * maxloc0_4_i16.c : Regenerated. * maxloc0_4_i4.c : Regenerated. * maxloc0_4_i8.c : Regenerated. * maxloc0_4_r10.c : Regenerated. * maxloc0_4_r16.c : Regenerated. * maxloc0_4_r4.c : Regenerated. * maxloc0_4_r8.c : Regenerated. * maxloc0_8_i16.c : Regenerated. * maxloc0_8_i4.c : Regenerated. * maxloc0_8_i8.c : Regenerated. * maxloc0_8_r10.c : Regenerated. * maxloc0_8_r16.c : Regenerated. * maxloc0_8_r4.c : Regenerated. * maxloc0_8_r8.c : Regenerated. * maxloc1_16_i16.c : Regenerated. * maxloc1_16_i4.c : Regenerated. * maxloc1_16_i8.c : Regenerated. * maxloc1_16_r10.c : Regenerated. * maxloc1_16_r16.c : Regenerated. * maxloc1_16_r4.c : Regenerated. * maxloc1_16_r8.c : Regenerated. * maxloc1_4_i16.c : Regenerated. * maxloc1_4_i4.c : Regenerated. * maxloc1_4_i8.c : Regenerated. * maxloc1_4_r10.c : Regenerated. * maxloc1_4_r16.c : Regenerated. * maxloc1_4_r4.c : Regenerated. * maxloc1_4_r8.c : Regenerated. * maxloc1_8_i16.c : Regenerated. * maxloc1_8_i4.c : Regenerated. * maxloc1_8_i8.c : Regenerated. * maxloc1_8_r10.c : Regenerated. * maxloc1_8_r16.c : Regenerated. * maxloc1_8_r4.c : Regenerated. * maxloc1_8_r8.c : Regenerated. * maxval_i16.c : Regenerated. * maxval_i4.c : Regenerated. * maxval_i8.c : Regenerated. * maxval_r10.c : Regenerated. * maxval_r16.c : Regenerated. * maxval_r4.c : Regenerated. * maxval_r8.c : Regenerated. * minval_i16.c : Regenerated. * minval_i4.c : Regenerated. * minval_i8.c : Regenerated. * minval_r10.c : Regenerated. * minval_r16.c : Regenerated. * minval_r4.c : Regenerated. * minval_r8.c : Regenerated. * sum_c10.c : Regenerated. * sum_c16.c : Regenerated. * sum_c4.c : Regenerated. * sum_c8.c : Regenerated. * sum_i16.c : Regenerated. * sum_i4.c : Regenerated. * sum_i8.c : Regenerated. * sum_r10.c : Regenerated. * sum_r16.c : Regenerated. * sum_r4.c : Regenerated. * sum_r8.c : Regenerated. * product_c10.c : Regenerated. * product_c16.c : Regenerated. * product_c4.c : Regenerated. * product_c8.c : Regenerated. * product_i16.c : Regenerated. * product_i4.c : Regenerated. * product_i8.c : Regenerated. * product_r10.c : Regenerated. * product_r16.c : Regenerated. * product_r4.c : Regenerated. * product_r8.c : Regenerated. 2006-03-20 Thomas Koenig <Thomas.Koenig@online.de> PR fortran/20935 * gfortran.dg/scalar_mask_2.f90: New test case. From-SVN: r112230
2006-03-20 22:56:00 +01:00
define(SCALAR_FOREACH_FUNCTION,
`
extern void `s'name`'rtype_qual`_'atype_code (rtype * const restrict,
atype * const restrict, GFC_LOGICAL_4 *);
export_proto(`s'name`'rtype_qual`_'atype_code);
void
`s'name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
atype * const restrict array,
GFC_LOGICAL_4 * mask)
{
index_type rank;
index_type dstride;
index_type n;
rtype_name *dest;
if (*mask)
{
name`'rtype_qual`_'atype_code (retarray, array);
return;
}
rank = GFC_DESCRIPTOR_RANK (array);
if (rank <= 0)
runtime_error ("Rank of array needs to be > 0");
if (retarray->data == NULL)
{
retarray->dim[0].lbound = 0;
retarray->dim[0].ubound = rank-1;
retarray->dim[0].stride = 1;
retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
retarray->offset = 0;
retarray->data = internal_malloc_size (sizeof (rtype_name) * rank);
}
else
{
if (GFC_DESCRIPTOR_RANK (retarray) != 1)
runtime_error ("rank of return array does not equal 1");
if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
runtime_error ("dimension of return array incorrect");
}
dstride = retarray->dim[0].stride;
dest = retarray->data;
for (n = 0; n<rank; n++)
dest[n * dstride] = $1 ;
}')dnl