diff options
author | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-17 19:31:06 +0000 |
---|---|---|
committer | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-17 19:31:06 +0000 |
commit | 8e882a1674e70cdea3bf8630a7613fe2bf12e52d (patch) | |
tree | 3580b7403687d7d146efbcceecee9d57deff3d8f /libgfortran | |
parent | fade5ce98b583fa416ba84b4cc3cad12af227f57 (diff) | |
parent | 634a5ad7fc8a4498978609c4e523b29658affa22 (diff) | |
download | gcc-8e882a1674e70cdea3bf8630a7613fe2bf12e52d.tar.gz |
2014-06-17 Tobias Burnus <burnus@net-b.de>
* Merge from the trunk to r211744.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/fortran-dev@211745 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
333 files changed, 1658 insertions, 1901 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 9d753296445..34f36a1fa64 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,62 @@ +2014-06-17 Janne Blomqvist <jb@gcc.gnu.org> + + * 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-06-15 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + PR libfortran/60468 + * configure.ac: Include <math.h> when checking for fp_except_t + and fp_rnd_t types. + * configure: Regenerate. + 2014-06-08 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/56981 @@ -327,406 +386,7 @@ 2014-01-02 Richard Sandiford <rdsandiford@googlemail.com> Update copyright years - -2013-12-18 Steven G. Kargl <kargl@gcc.gnu.org> - - * io/read.c (read_f): Convert assert to runtime error. - -2013-12-17 Andreas Tobler <andreast@gcc.gnu.org> - - * io/unix.c (tempfile_open): Only use the needed flag O_CLOEXEC. - -2013-12-16 Jerry DeLisle <jvdelisle@gcc.gnu> - - PR libfortran/59419 - * io/file_pos.c (st_rewind): Do proper return after - generate_error. - * io/open.c (edit_modes): Move action code inside block that - checks for library ok. (new_unit): Do cleanup after error. - (st_open): Do proper return after error. - * io/transfer.c (data_transfer_init): Likewise. - -2013-12-11 Tobias Burnus <burnus@net-b.de> - - * config/fpu-387.h (sigill_hdlr, get_fpu_rounding_mode): Emit SSE - instructions when __SSE_MATH__ is defined. - -2013-12-06 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> - - * intrinsics/erfc_scaled.c (_M_2_SQRTPI): Define if missing. - -2013-12-01 Uros Bizjak <ubizjak@gmail.com> - - PR libfortran/59313 - * intrinsics/erfc_scaled.c (erfc_scaled_r16): Also provide for - quadruple precision long double variant. - -2013-11-20 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> - - * intrinsics/erfc_scaled.c (erfc_scaled_r16): Don't define if - __float128 is not available. - -2013-11-20 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> - - PR libfortran/49024 - * intrinsics/erfc_scaled.c (erfc_scaled_r16): New function. - * intrinsics/erfc_scaled_inc.c: Do not provide quadruple - precision variant. - -2013-11-18 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> - - PR libfortran/51828 - * intrinsics/unpack_generic.c (unpack_internal): Let the compiler - know that dim > 0 to avoid warnings. - -2013-11-15 Janne Blomqvist <jb@gcc.gnu.org> - Jerry DeLisle <jvdelisle@gcc.gnu.org> - - PR fortran/59108 - * io/unix.c (regular_file): Don't set O_CREAT when opening a file - read-only with unknown status. Mask out O_CREAT when falling back - to opening read-only if ACTION= is not set and read-write fails. - -2013-11-15 Steve Ellcey <sellcey@mips.com> - - * configure.ac: Do not define HAVE_STRTOLD. - * configure: Regenerate. - -2013-11-10 Janne Blomqvist <jb@gcc.gnu.org> - - * configure.ac: Check presence of mkostemp. - * io/unix.c (set_close_on_exec): New function. - (tempfile_open): Use mkostemp and O_CLOEXEC if available, fallback - to calling set_close_on_exec. - (regular_file): Add O_CLOEXEC to flags if defined. - (open_external): Call set_close_on_exec if O_CLOEXEC is not - defined. - * config.h.in: Regenerated. - * configure: Regenerated. - * Makefile.in: Regenerated. - * aclocal.m4: Regenerated. - -2013-10-01 Tobias Burnus <burnus@net-b.de> - - PR fortran/55469 - * io/list_read (parse_repeat, read_integer, read_character, - parse_real, read_real, check_type, list_formatted_read_scalar, - finish_list_read): Call list_free. - -2013-09-20 Alan Modra <amodra@gmail.com> - - * configure: Regenerate. - -2013-07-23 Uros Bizjak <ubizjak@gmail.com> - - * config/fpu-387.h (get_fpu_rounding_mode): Read rounding mode - from SSE mxcsr register on x86_64. - -2013-07-21 OndÅ™ej BÃlka <neleai@seznam.cz> - - * io/transfer.c: Fix comment typos. - -2013-07-21 Tobias Burnus <burnus@net-b.de> - - PR fortran/35862 - * config/fpu-387.h (set_fpu_rounding_mode, - get_fpu_rounding_mode): Add missing _ to fix build. - -2013-07-21 Tobias Burnus <burnus@net-b.de> - Uros Bizjak <ubizjak@gmail.com> - - PR fortran/35862 - * libgfortran.h (set_fpu_rounding_mode, - get_fpu_rounding_mode): New prototypes. - * config/fpu-387.h (set_fpu_rounding_mode, - get_fpu_rounding_mode): New functions. - * config/fpu-aix.h (set_fpu_rounding_mode, - get_fpu_rounding_mode): Ditto. - * config/fpu-generic.h (set_fpu_rounding_mode, - get_fpu_rounding_mode): Ditto. - * config/fpu-glibc.h (set_fpu_rounding_mode, - get_fpu_rounding_mode): Ditto. - * config/fpu-sysv.h (set_fpu_rounding_mode, - get_fpu_rounding_mode): Ditto. - * configure.ac: Check for fp_rnd and fp_rnd_t. - * io/io.h (enum unit_round): Use GFC_FPE_* for the value. - * io/read.c (convert_real): Set FP ronding mode. - * Makefile.in: Regenerate. - * aclocal.m4: Regenerate. - * config.h.in: Regenerate. - * configure: Regenerate. - -2013-06-24 Tobias Burnus <burnus@net-b.de> - - * configure.ac: Check for fp_except and fp_except_t. - * config/fpu-sysv.h: Conditionally use either type. - * configure: Regenerate. - * config.h.in: Regenerate. - -2013-06-21 Eric Botcazou <ebotcazou@adacore.com> - - * config/fpu-sysv.h (get_fpu_except_flags): Fix typo. - -2013-06-20 Uros Bizjak <ubizjak@gmail.com> - - * config/fpu-387.h (_FPU_MASK_ALL): New. - (_FPU_EX_ALL): Ditto. - (set_fpu): Use fstcw to store x87 FPU control word. Use fnclex to - clear stalled exception flags. Correctly clear stalled SSE - exception flags. Simplify code. - (get_fpu_except_flags): Simplify code. - -2013-06-20 Tobias Burnus <burnus@net-b.de> - - PR fortran/57633 - * io/list_read.c (next_char, eat_separator): Don't set EOL for \r. - -2013-06-19 Uros Bizjak <ubizjak@gmail.com> - - * config/fpu-387.h: Use __asm__ and __volatile__ consistently. - (get_fpu_except_flags): Initialize result. - -2013-06-17 Tobias Burnus <burnus@net-b.de> - - * libgfortran.h (compile_options_t) Add fpe_summary. - (get_fpu_except_flags): New prototype. - * runtime/compile_options.c (set_options, init_compile_options): - Handle fpe_summary. - * runtime/stop.c (report_exception): New function. - (stop_numeric, stop_numeric_f08, stop_string, error_stop_string, - error_stop_numeric): Call it. - * config/fpu-387.h (get_fpu_except_flags): New function. - * config/fpu-aix.h (get_fpu_except_flags): New function. - * config/fpu-generic.h (get_fpu_except_flags): New function. - * config/fpu-glibc.h (get_fpu_except_flags): New function. - * config/fpu-sysv.h (get_fpu_except_flags): New function. - * configure.ac: Check for fpxcp.h. - * configure: Regenerate. - * config.h.in: Regenerate. - -2013-06-01 Tobias Burnus <burnus@net-b.de> - - PR fortran/57496 - * io/write_float.def (ISFINITE2Q, ISFINITE2, ISFINITE2L, ISFINITE, - SIGNBIT2Q, SIGNBIT2, SIGNBIT2L, SIGNBIT, ISNAN2Q, ISNAN2, ISNAN2L, - ISNAN): New macros. - (output_float_FMT_G_,WRITE_FLOAT): Use them. - -2013-05-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> - - * acinclude.m4 (libgfor_cv_have_as_needed): Check for -z ignore, too. - * configure: Regenerate. - -2013-05-05 David Edelsohn <dje.gcc@gmail.com> - - * caf/libcaf.h (_gfortran_caf_critical): Add a prototype. - (_gfortran_caf_end_critical): Same. - -2013-05-04 David Edelsohn <dje.gcc@gmail.com> - - * runtime/environ.c: Include unistd.h. - * runtime/pause.c: Test HAVE_UNISTD_H. - * runtime/stop.c: Same. - * io/open.c: Same. - * io/unix.c: Same. - * io/read.c (si_max): Protect declaration of value. - -2013-04-29 Janne Blomqvist <jb@gcc.gnu.org> - - * intrinsics/system_clock (gf_gettime_mono): Use variable - resolution for fractional seconds argument. - (system_clock_4): Simplify, update for gf_gettime_mono change. - (system_clock_8): Likewise. - -2013-04-29 Janne Blomqvist <jb@gcc.gnu.org> - - PR fortran/56981 - * io/transfer.c (next_record_w_unf): First fix head marker, then - write tail. - (next_record): Call flush_if_unbuffered. - * io/unix.c (struct unix_stream): Add field unbuffered. - (flush_if_unbuffered): New function. - (fd_to_stream): New argument. - (open_external): Fix fd_to_stream call. - (input_stream): Likewise. - (output_stream): Likewise. - (error_stream): Likewise. - * io/unix.h (flush_if_unbuffered): New prototype. - -2013-04-28 Janne Blomqvist <jb@gcc.gnu.org> - - * intrinsics/system_clock.c (system_clock_4): Fix sign error in - Windows version. - -2013-04-15 Tobias Burnus <burnus@net-b.de> - - * list_read.c (finish_separator): Initialize variable. - -2013-04-15 Janne Blomqvist <jb@gcc.gnu.org> - - PR fortran/56919 - * intrinsics/time_1.h: Check __CYGWIN__ in addition to - __MINGW32__. - * intrinsics/system_clock.c (GF_CLOCK_MONOTONIC): Check - _POSIX_MONOTONIC_CLOCK as well. - (system_clock_4): Use GetTickCount on Windows. - (system_clock_8): Use QueryPerformanceCounter and - QueryPerformanceCounterFrequency on Windows. - -2013-04-04 Tobias Burnus <burnus@net-b.de> - - PR fortran/56810 - * io/list_read.c (check_type): Fix kind checking for COMPLEX. - -2013-04-01 Jerry DeLisle <jvdelisle@gcc.gnu.org> - - PR libfortran/56660 - * io/list_read.c (nml_read_obj): Do not reset the read error flag - inside nml_read_obj. If the read error flag is found set just exit. - Fix some whitespace on comments. - (nml_read_obj_data): Reset the read error flag before the first call - to nml_read_object. - -2013-03-31 Jerry DeLisle <jvdelisle@gcc.gnu.org> - - PR libfortran/56786 - * io/list_read.c (nml_parse_qualifier): Remove spurious next_char call - when checking for EOF. Use error return mechanism when EOF detected. - Do not return false unless parse_err_msg and parse_err_msg_size have - been set. Use hit_eof. - (nml_get_obj_data): Likewise use the correct error mechanism. - * io/transfer.c (hit_eof): Do not set AFTER_ENDFILE if in namelist - mode. - -2013-03-29 Tobias Burnus <burnus@net-b.de> - - PR fortran/56737 - * io/format.c (parse_format_list): Also cache FMT_STRING. - (parse_format): Update call. - -2013-03-29 Tobias Burnus <burnus@net-b.de> - - PR fortran/56737 - * io/format.c (parse_format): With caching, copy - dtp->format string. - (save_parsed_format): Use dtp->format directy without - copying. - -2013-03-29 Tobias Burnus <burnus@net-b.de> - - PR fortran/56735 - * io/list_read.c (nml_query): Only abort when - an error occured. - (namelist_read): Add goto instead of falling through. - -2013-03-25 Tilo Schwarz <tilo@tilo-schwarz.de> - - PR libfortran/52512 - * io/list_read.c (nml_parse_qualifier): To check for a derived type - don't use the namelist head element type but the current element type. - (nml_get_obj_data): Add current namelist element type to - nml_parse_qualifier call. - -2013-03-24 Tobias Burnus <burnus@net-b.de> - - PR fortran/56696 - * io/list_read.c (read_real): Fix EOF diagnostic. - -2013-03-20 Tilo Schwarz <tilo@tilo-schwarz.de> - - PR libfortran/51825 - * io/list_read.c (nml_read_obj): Don't end the component loop on a - nested derived type, but continue with the next loop iteration. - (nml_get_obj_data): Don't move the first_nl pointer further in the - list if a qualifier was found. - -2013-03-20 Tilo Schwarz <tilo@tilo-schwarz.de> - - PR libfortran/48618 - * io/open.c (st_open): Raise error for unit number < 0 only if - unit number does not exist already. - -2013-03-19 Janne Blomqvist <jb@gcc.gnu.org> - - * libgfortran.h: Include stdbool.h. - (enum try): Remove. - (notify_std): Change return type to bool. - * intrinsics/chmod.c: Don't include stdbool.h. - * intrinsics/execute_command_line.c: Likewise. - * io/format.c: Likewise. - * io/list_read.c (nml_parse_qualifier): Change return type to bool. - (nml_read_obj): Likewise. - (nml_get_obj_data): Likewise. - * io/transfer.c (read_block_form): Fix comment. - (write_buf): Change return type to bool. - * io/write.c: Don't include stdbool.h. - * io/write_float.def (output_float): Change return type to bool. - (output_float_FMT_G_ ## x): Change type of result variable. - * runtime/error.c (notify_std): Change return type to bool. - -2013-03-11 Tobias Burnus <burnus@net-b.de> - - * io/transfer.c (read_block_direct): Correct condition. - * intrinsics/execute_command_line.c (execute_command_line): - Remove dead code for the HAVE_FORK case. - -2013-02-21 Janne Blomqvist <jb@gcc.gnu.org> - - PR libfortran/30162 - * io/open.c (test_endfile): Call stell only if size != 0. - * io/unix.c (raw_tell): Revert r194679. - (raw_size): Return size field only for regular files, otherwise 0. - -2013-02-19 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> - - PR target/56347 - * acinclude.m4 (LIBGFOR_CHECK_FOR_BROKEN_POWF): Remove check for - broken powf. - * configure.ac (LIBGFOR_CHECK_FOR_BROKEN_POWF): Likewise. - * intrinsics/c99_functions.c: Likewise. - * configure: Rebuilt. - * config.h.in: Rebuilt. - -2013-02-06 Janus Weil <janus@gcc.gnu.org> - - PR fortran/55978 - * runtime/in_pack_generic.c (internal_pack): Return if base_addr is - NULL. - -2013-01-23 Janne Blomqvist <jb@gcc.gnu.org> - - * io/file_pos.c (unformatted_backspace): Use __builtin_bswapXX - instead of reverse_memcpy. - * io/io.h (reverse_memcpy): Remove prototype. - * io/transfer.c (reverse_memcpy): Make static, move towards - beginning of file. - (bswap_array): New function. - (unformatted_read): Use bswap_array to byte swap the data - in-place. - (unformatted_write): Use a larger temp buffer and bswap_array. - (us_read): Use __builtin_bswapXX instead of reverse_memcpy. - (write_us_marker): Likewise. - -2013-01-14 Richard Sandiford <rdsandiford@googlemail.com> - - Update copyright years. - -2013-01-06 Tobias Burnus <burnus@net-b.de> - - PR fortran/54678 - * intrinsics/env.c (get_environment_variable_i8): Don't use - uninitialized variable. - -2013-01-02 Jerry DeLisle <jvdelisle@gcc.gnu.org> - - PR libfortran/55818 - * io/list_read.c (read_real): Do not call hit_eof when EOF can be - treated as a value separator. - (parse_real): Likewise. - (read_logical): Likewise. - (read_character): Likewise. - (read_complex): Likewise. - +^L Copyright (C) 2013-2014 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, diff --git a/libgfortran/ChangeLog-2013 b/libgfortran/ChangeLog-2013 new file mode 100644 index 00000000000..d0c2c5d78ed --- /dev/null +++ b/libgfortran/ChangeLog-2013 @@ -0,0 +1,404 @@ +2013-12-18 Steven G. Kargl <kargl@gcc.gnu.org> + + * io/read.c (read_f): Convert assert to runtime error. + +2013-12-17 Andreas Tobler <andreast@gcc.gnu.org> + + * io/unix.c (tempfile_open): Only use the needed flag O_CLOEXEC. + +2013-12-16 Jerry DeLisle <jvdelisle@gcc.gnu> + + PR libfortran/59419 + * io/file_pos.c (st_rewind): Do proper return after + generate_error. + * io/open.c (edit_modes): Move action code inside block that + checks for library ok. (new_unit): Do cleanup after error. + (st_open): Do proper return after error. + * io/transfer.c (data_transfer_init): Likewise. + +2013-12-11 Tobias Burnus <burnus@net-b.de> + + * config/fpu-387.h (sigill_hdlr, get_fpu_rounding_mode): Emit SSE + instructions when __SSE_MATH__ is defined. + +2013-12-06 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * intrinsics/erfc_scaled.c (_M_2_SQRTPI): Define if missing. + +2013-12-01 Uros Bizjak <ubizjak@gmail.com> + + PR libfortran/59313 + * intrinsics/erfc_scaled.c (erfc_scaled_r16): Also provide for + quadruple precision long double variant. + +2013-11-20 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + * intrinsics/erfc_scaled.c (erfc_scaled_r16): Don't define if + __float128 is not available. + +2013-11-20 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + PR libfortran/49024 + * intrinsics/erfc_scaled.c (erfc_scaled_r16): New function. + * intrinsics/erfc_scaled_inc.c: Do not provide quadruple + precision variant. + +2013-11-18 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + PR libfortran/51828 + * intrinsics/unpack_generic.c (unpack_internal): Let the compiler + know that dim > 0 to avoid warnings. + +2013-11-15 Janne Blomqvist <jb@gcc.gnu.org> + Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR fortran/59108 + * io/unix.c (regular_file): Don't set O_CREAT when opening a file + read-only with unknown status. Mask out O_CREAT when falling back + to opening read-only if ACTION= is not set and read-write fails. + +2013-11-15 Steve Ellcey <sellcey@mips.com> + + * configure.ac: Do not define HAVE_STRTOLD. + * configure: Regenerate. + +2013-11-10 Janne Blomqvist <jb@gcc.gnu.org> + + * configure.ac: Check presence of mkostemp. + * io/unix.c (set_close_on_exec): New function. + (tempfile_open): Use mkostemp and O_CLOEXEC if available, fallback + to calling set_close_on_exec. + (regular_file): Add O_CLOEXEC to flags if defined. + (open_external): Call set_close_on_exec if O_CLOEXEC is not + defined. + * config.h.in: Regenerated. + * configure: Regenerated. + * Makefile.in: Regenerated. + * aclocal.m4: Regenerated. + +2013-10-01 Tobias Burnus <burnus@net-b.de> + + PR fortran/55469 + * io/list_read (parse_repeat, read_integer, read_character, + parse_real, read_real, check_type, list_formatted_read_scalar, + finish_list_read): Call list_free. + +2013-09-20 Alan Modra <amodra@gmail.com> + + * configure: Regenerate. + +2013-07-23 Uros Bizjak <ubizjak@gmail.com> + + * config/fpu-387.h (get_fpu_rounding_mode): Read rounding mode + from SSE mxcsr register on x86_64. + +2013-07-21 OndÅ™ej BÃlka <neleai@seznam.cz> + + * io/transfer.c: Fix comment typos. + +2013-07-21 Tobias Burnus <burnus@net-b.de> + + PR fortran/35862 + * config/fpu-387.h (set_fpu_rounding_mode, + get_fpu_rounding_mode): Add missing _ to fix build. + +2013-07-21 Tobias Burnus <burnus@net-b.de> + Uros Bizjak <ubizjak@gmail.com> + + PR fortran/35862 + * libgfortran.h (set_fpu_rounding_mode, + get_fpu_rounding_mode): New prototypes. + * config/fpu-387.h (set_fpu_rounding_mode, + get_fpu_rounding_mode): New functions. + * config/fpu-aix.h (set_fpu_rounding_mode, + get_fpu_rounding_mode): Ditto. + * config/fpu-generic.h (set_fpu_rounding_mode, + get_fpu_rounding_mode): Ditto. + * config/fpu-glibc.h (set_fpu_rounding_mode, + get_fpu_rounding_mode): Ditto. + * config/fpu-sysv.h (set_fpu_rounding_mode, + get_fpu_rounding_mode): Ditto. + * configure.ac: Check for fp_rnd and fp_rnd_t. + * io/io.h (enum unit_round): Use GFC_FPE_* for the value. + * io/read.c (convert_real): Set FP ronding mode. + * Makefile.in: Regenerate. + * aclocal.m4: Regenerate. + * config.h.in: Regenerate. + * configure: Regenerate. + +2013-06-24 Tobias Burnus <burnus@net-b.de> + + * configure.ac: Check for fp_except and fp_except_t. + * config/fpu-sysv.h: Conditionally use either type. + * configure: Regenerate. + * config.h.in: Regenerate. + +2013-06-21 Eric Botcazou <ebotcazou@adacore.com> + + * config/fpu-sysv.h (get_fpu_except_flags): Fix typo. + +2013-06-20 Uros Bizjak <ubizjak@gmail.com> + + * config/fpu-387.h (_FPU_MASK_ALL): New. + (_FPU_EX_ALL): Ditto. + (set_fpu): Use fstcw to store x87 FPU control word. Use fnclex to + clear stalled exception flags. Correctly clear stalled SSE + exception flags. Simplify code. + (get_fpu_except_flags): Simplify code. + +2013-06-20 Tobias Burnus <burnus@net-b.de> + + PR fortran/57633 + * io/list_read.c (next_char, eat_separator): Don't set EOL for \r. + +2013-06-19 Uros Bizjak <ubizjak@gmail.com> + + * config/fpu-387.h: Use __asm__ and __volatile__ consistently. + (get_fpu_except_flags): Initialize result. + +2013-06-17 Tobias Burnus <burnus@net-b.de> + + * libgfortran.h (compile_options_t) Add fpe_summary. + (get_fpu_except_flags): New prototype. + * runtime/compile_options.c (set_options, init_compile_options): + Handle fpe_summary. + * runtime/stop.c (report_exception): New function. + (stop_numeric, stop_numeric_f08, stop_string, error_stop_string, + error_stop_numeric): Call it. + * config/fpu-387.h (get_fpu_except_flags): New function. + * config/fpu-aix.h (get_fpu_except_flags): New function. + * config/fpu-generic.h (get_fpu_except_flags): New function. + * config/fpu-glibc.h (get_fpu_except_flags): New function. + * config/fpu-sysv.h (get_fpu_except_flags): New function. + * configure.ac: Check for fpxcp.h. + * configure: Regenerate. + * config.h.in: Regenerate. + +2013-06-01 Tobias Burnus <burnus@net-b.de> + + PR fortran/57496 + * io/write_float.def (ISFINITE2Q, ISFINITE2, ISFINITE2L, ISFINITE, + SIGNBIT2Q, SIGNBIT2, SIGNBIT2L, SIGNBIT, ISNAN2Q, ISNAN2, ISNAN2L, + ISNAN): New macros. + (output_float_FMT_G_,WRITE_FLOAT): Use them. + +2013-05-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * acinclude.m4 (libgfor_cv_have_as_needed): Check for -z ignore, too. + * configure: Regenerate. + +2013-05-05 David Edelsohn <dje.gcc@gmail.com> + + * caf/libcaf.h (_gfortran_caf_critical): Add a prototype. + (_gfortran_caf_end_critical): Same. + +2013-05-04 David Edelsohn <dje.gcc@gmail.com> + + * runtime/environ.c: Include unistd.h. + * runtime/pause.c: Test HAVE_UNISTD_H. + * runtime/stop.c: Same. + * io/open.c: Same. + * io/unix.c: Same. + * io/read.c (si_max): Protect declaration of value. + +2013-04-29 Janne Blomqvist <jb@gcc.gnu.org> + + * intrinsics/system_clock (gf_gettime_mono): Use variable + resolution for fractional seconds argument. + (system_clock_4): Simplify, update for gf_gettime_mono change. + (system_clock_8): Likewise. + +2013-04-29 Janne Blomqvist <jb@gcc.gnu.org> + + PR fortran/56981 + * io/transfer.c (next_record_w_unf): First fix head marker, then + write tail. + (next_record): Call flush_if_unbuffered. + * io/unix.c (struct unix_stream): Add field unbuffered. + (flush_if_unbuffered): New function. + (fd_to_stream): New argument. + (open_external): Fix fd_to_stream call. + (input_stream): Likewise. + (output_stream): Likewise. + (error_stream): Likewise. + * io/unix.h (flush_if_unbuffered): New prototype. + +2013-04-28 Janne Blomqvist <jb@gcc.gnu.org> + + * intrinsics/system_clock.c (system_clock_4): Fix sign error in + Windows version. + +2013-04-15 Tobias Burnus <burnus@net-b.de> + + * list_read.c (finish_separator): Initialize variable. + +2013-04-15 Janne Blomqvist <jb@gcc.gnu.org> + + PR fortran/56919 + * intrinsics/time_1.h: Check __CYGWIN__ in addition to + __MINGW32__. + * intrinsics/system_clock.c (GF_CLOCK_MONOTONIC): Check + _POSIX_MONOTONIC_CLOCK as well. + (system_clock_4): Use GetTickCount on Windows. + (system_clock_8): Use QueryPerformanceCounter and + QueryPerformanceCounterFrequency on Windows. + +2013-04-04 Tobias Burnus <burnus@net-b.de> + + PR fortran/56810 + * io/list_read.c (check_type): Fix kind checking for COMPLEX. + +2013-04-01 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libfortran/56660 + * io/list_read.c (nml_read_obj): Do not reset the read error flag + inside nml_read_obj. If the read error flag is found set just exit. + Fix some whitespace on comments. + (nml_read_obj_data): Reset the read error flag before the first call + to nml_read_object. + +2013-03-31 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libfortran/56786 + * io/list_read.c (nml_parse_qualifier): Remove spurious next_char call + when checking for EOF. Use error return mechanism when EOF detected. + Do not return false unless parse_err_msg and parse_err_msg_size have + been set. Use hit_eof. + (nml_get_obj_data): Likewise use the correct error mechanism. + * io/transfer.c (hit_eof): Do not set AFTER_ENDFILE if in namelist + mode. + +2013-03-29 Tobias Burnus <burnus@net-b.de> + + PR fortran/56737 + * io/format.c (parse_format_list): Also cache FMT_STRING. + (parse_format): Update call. + +2013-03-29 Tobias Burnus <burnus@net-b.de> + + PR fortran/56737 + * io/format.c (parse_format): With caching, copy + dtp->format string. + (save_parsed_format): Use dtp->format directy without + copying. + +2013-03-29 Tobias Burnus <burnus@net-b.de> + + PR fortran/56735 + * io/list_read.c (nml_query): Only abort when + an error occured. + (namelist_read): Add goto instead of falling through. + +2013-03-25 Tilo Schwarz <tilo@tilo-schwarz.de> + + PR libfortran/52512 + * io/list_read.c (nml_parse_qualifier): To check for a derived type + don't use the namelist head element type but the current element type. + (nml_get_obj_data): Add current namelist element type to + nml_parse_qualifier call. + +2013-03-24 Tobias Burnus <burnus@net-b.de> + + PR fortran/56696 + * io/list_read.c (read_real): Fix EOF diagnostic. + +2013-03-20 Tilo Schwarz <tilo@tilo-schwarz.de> + + PR libfortran/51825 + * io/list_read.c (nml_read_obj): Don't end the component loop on a + nested derived type, but continue with the next loop iteration. + (nml_get_obj_data): Don't move the first_nl pointer further in the + list if a qualifier was found. + +2013-03-20 Tilo Schwarz <tilo@tilo-schwarz.de> + + PR libfortran/48618 + * io/open.c (st_open): Raise error for unit number < 0 only if + unit number does not exist already. + +2013-03-19 Janne Blomqvist <jb@gcc.gnu.org> + + * libgfortran.h: Include stdbool.h. + (enum try): Remove. + (notify_std): Change return type to bool. + * intrinsics/chmod.c: Don't include stdbool.h. + * intrinsics/execute_command_line.c: Likewise. + * io/format.c: Likewise. + * io/list_read.c (nml_parse_qualifier): Change return type to bool. + (nml_read_obj): Likewise. + (nml_get_obj_data): Likewise. + * io/transfer.c (read_block_form): Fix comment. + (write_buf): Change return type to bool. + * io/write.c: Don't include stdbool.h. + * io/write_float.def (output_float): Change return type to bool. + (output_float_FMT_G_ ## x): Change type of result variable. + * runtime/error.c (notify_std): Change return type to bool. + +2013-03-11 Tobias Burnus <burnus@net-b.de> + + * io/transfer.c (read_block_direct): Correct condition. + * intrinsics/execute_command_line.c (execute_command_line): + Remove dead code for the HAVE_FORK case. + +2013-02-21 Janne Blomqvist <jb@gcc.gnu.org> + + PR libfortran/30162 + * io/open.c (test_endfile): Call stell only if size != 0. + * io/unix.c (raw_tell): Revert r194679. + (raw_size): Return size field only for regular files, otherwise 0. + +2013-02-19 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + PR target/56347 + * acinclude.m4 (LIBGFOR_CHECK_FOR_BROKEN_POWF): Remove check for + broken powf. + * configure.ac (LIBGFOR_CHECK_FOR_BROKEN_POWF): Likewise. + * intrinsics/c99_functions.c: Likewise. + * configure: Rebuilt. + * config.h.in: Rebuilt. + +2013-02-06 Janus Weil <janus@gcc.gnu.org> + + PR fortran/55978 + * runtime/in_pack_generic.c (internal_pack): Return if base_addr is + NULL. + +2013-01-23 Janne Blomqvist <jb@gcc.gnu.org> + + * io/file_pos.c (unformatted_backspace): Use __builtin_bswapXX + instead of reverse_memcpy. + * io/io.h (reverse_memcpy): Remove prototype. + * io/transfer.c (reverse_memcpy): Make static, move towards + beginning of file. + (bswap_array): New function. + (unformatted_read): Use bswap_array to byte swap the data + in-place. + (unformatted_write): Use a larger temp buffer and bswap_array. + (us_read): Use __builtin_bswapXX instead of reverse_memcpy. + (write_us_marker): Likewise. + +2013-01-14 Richard Sandiford <rdsandiford@googlemail.com> + + Update copyright years. + +2013-01-06 Tobias Burnus <burnus@net-b.de> + + PR fortran/54678 + * intrinsics/env.c (get_environment_variable_i8): Don't use + uninitialized variable. + +2013-01-02 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libfortran/55818 + * io/list_read.c (read_real): Do not call hit_eof when EOF can be + treated as a value separator. + (parse_real): Likewise. + (read_logical): Likewise. + (read_character): Likewise. + (read_complex): Likewise. + +Copyright (C) 2013-2014 Free Software Foundation, Inc. + +Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. diff --git a/libgfortran/configure b/libgfortran/configure index 9841ebc0ae3..05ab1683e02 100755 --- a/libgfortran/configure +++ b/libgfortran/configure @@ -26042,7 +26042,10 @@ $as_echo "#define HAVE_FPSETMASK 1" >>confdefs.h fi -ac_fn_c_check_type "$LINENO" "fp_except" "ac_cv_type_fp_except" "#include <ieeefp.h> +ac_fn_c_check_type "$LINENO" "fp_except" "ac_cv_type_fp_except" " +#include <ieeefp.h> +#include <math.h> + " if test "x$ac_cv_type_fp_except" = x""yes; then : @@ -26052,7 +26055,10 @@ _ACEOF fi -ac_fn_c_check_type "$LINENO" "fp_except_t" "ac_cv_type_fp_except_t" "#include <ieeefp.h> +ac_fn_c_check_type "$LINENO" "fp_except_t" "ac_cv_type_fp_except_t" " +#include <ieeefp.h> +#include <math.h> + " if test "x$ac_cv_type_fp_except_t" = x""yes; then : @@ -26063,7 +26069,10 @@ _ACEOF fi -ac_fn_c_check_type "$LINENO" "fp_rnd" "ac_cv_type_fp_rnd" "#include <ieeefp.h> +ac_fn_c_check_type "$LINENO" "fp_rnd" "ac_cv_type_fp_rnd" " +#include <ieeefp.h> +#include <math.h> + " if test "x$ac_cv_type_fp_rnd" = x""yes; then : @@ -26073,7 +26082,10 @@ _ACEOF fi -ac_fn_c_check_type "$LINENO" "fp_rnd_t" "ac_cv_type_fp_rnd_t" "#include <ieeefp.h> +ac_fn_c_check_type "$LINENO" "fp_rnd_t" "ac_cv_type_fp_rnd_t" " +#include <ieeefp.h> +#include <math.h> + " if test "x$ac_cv_type_fp_rnd_t" = x""yes; then : diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac index ab4c497e5f3..57e26ce9e48 100644 --- a/libgfortran/configure.ac +++ b/libgfortran/configure.ac @@ -521,8 +521,14 @@ fi # Check for SysV fpsetmask LIBGFOR_CHECK_FPSETMASK -AC_CHECK_TYPES([fp_except,fp_except_t], [], [], [[#include <ieeefp.h>]]) -AC_CHECK_TYPES([fp_rnd,fp_rnd_t], [], [], [[#include <ieeefp.h>]]) +AC_CHECK_TYPES([fp_except,fp_except_t], [], [], [[ +#include <ieeefp.h> +#include <math.h> +]]) +AC_CHECK_TYPES([fp_rnd,fp_rnd_t], [], [], [[ +#include <ieeefp.h> +#include <math.h> +]]) # Check for AIX fp_trap and fp_enable AC_CHECK_FUNC([fp_trap],[have_fp_trap=yes AC_DEFINE([HAVE_FP_TRAP],[1],[fp_trap is present])]) diff --git a/libgfortran/generated/all_l1.c b/libgfortran/generated/all_l1.c index 5f23e6e22bc..76e11b79ff6 100644 --- a/libgfortran/generated/all_l1.c +++ b/libgfortran/generated/all_l1.c @@ -101,8 +101,7 @@ all_l1 (gfc_array_l1 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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 { diff --git a/libgfortran/generated/all_l16.c b/libgfortran/generated/all_l16.c index 41e849b9e0a..85085224235 100644 --- a/libgfortran/generated/all_l16.c +++ b/libgfortran/generated/all_l16.c @@ -101,8 +101,7 @@ all_l16 (gfc_array_l16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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 { diff --git a/libgfortran/generated/all_l2.c b/libgfortran/generated/all_l2.c index a7308fd1dd6..763a25db0d3 100644 --- a/libgfortran/generated/all_l2.c +++ b/libgfortran/generated/all_l2.c @@ -101,8 +101,7 @@ all_l2 (gfc_array_l2 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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 { diff --git a/libgfortran/generated/all_l4.c b/libgfortran/generated/all_l4.c index ea4f0471e03..699f81afb6e 100644 --- a/libgfortran/generated/all_l4.c +++ b/libgfortran/generated/all_l4.c @@ -101,8 +101,7 @@ all_l4 (gfc_array_l4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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 { diff --git a/libgfortran/generated/all_l8.c b/libgfortran/generated/all_l8.c index 617fb2d13f6..6710767f0fc 100644 --- a/libgfortran/generated/all_l8.c +++ b/libgfortran/generated/all_l8.c @@ -101,8 +101,7 @@ all_l8 (gfc_array_l8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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 { diff --git a/libgfortran/generated/any_l1.c b/libgfortran/generated/any_l1.c index c822b44d249..783f762b171 100644 --- a/libgfortran/generated/any_l1.c +++ b/libgfortran/generated/any_l1.c @@ -101,8 +101,7 @@ any_l1 (gfc_array_l1 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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 { diff --git a/libgfortran/generated/any_l16.c b/libgfortran/generated/any_l16.c index 1e76d745c78..eb84fc3d950 100644 --- a/libgfortran/generated/any_l16.c +++ b/libgfortran/generated/any_l16.c @@ -101,8 +101,7 @@ any_l16 (gfc_array_l16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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 { diff --git a/libgfortran/generated/any_l2.c b/libgfortran/generated/any_l2.c index bc68eae222b..a5c34959796 100644 --- a/libgfortran/generated/any_l2.c +++ b/libgfortran/generated/any_l2.c @@ -101,8 +101,7 @@ any_l2 (gfc_array_l2 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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 { diff --git a/libgfortran/generated/any_l4.c b/libgfortran/generated/any_l4.c index dfd6dc25186..129fe997d6b 100644 --- a/libgfortran/generated/any_l4.c +++ b/libgfortran/generated/any_l4.c @@ -101,8 +101,7 @@ any_l4 (gfc_array_l4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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 { diff --git a/libgfortran/generated/any_l8.c b/libgfortran/generated/any_l8.c index f5661e0b716..b358aba5b0e 100644 --- a/libgfortran/generated/any_l8.c +++ b/libgfortran/generated/any_l8.c @@ -101,8 +101,7 @@ any_l8 (gfc_array_l8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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 { diff --git a/libgfortran/generated/bessel_r10.c b/libgfortran/generated/bessel_r10.c index 8eb08cca8fd..cd55e1fdbd9 100644 --- a/libgfortran/generated/bessel_r10.c +++ b/libgfortran/generated/bessel_r10.c @@ -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, sizeof (GFC_REAL_10)); - 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, sizeof (GFC_REAL_10)); - ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_10)); ret->offset = 0; } diff --git a/libgfortran/generated/bessel_r16.c b/libgfortran/generated/bessel_r16.c index da7710a003f..aff3cd211b0 100644 --- a/libgfortran/generated/bessel_r16.c +++ b/libgfortran/generated/bessel_r16.c @@ -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, sizeof (GFC_REAL_16)); - 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, sizeof (GFC_REAL_16)); - ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_16)); ret->offset = 0; } diff --git a/libgfortran/generated/bessel_r4.c b/libgfortran/generated/bessel_r4.c index b9ca4933484..186280aa66c 100644 --- a/libgfortran/generated/bessel_r4.c +++ b/libgfortran/generated/bessel_r4.c @@ -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, sizeof (GFC_REAL_4)); - 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, sizeof (GFC_REAL_4)); - ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_4)); ret->offset = 0; } diff --git a/libgfortran/generated/bessel_r8.c b/libgfortran/generated/bessel_r8.c index ff751630b02..ecc23d68c62 100644 --- a/libgfortran/generated/bessel_r8.c +++ b/libgfortran/generated/bessel_r8.c @@ -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, sizeof (GFC_REAL_8)); - 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, sizeof (GFC_REAL_8)); - ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_8)); ret->offset = 0; } diff --git a/libgfortran/generated/count_16_l.c b/libgfortran/generated/count_16_l.c index 12d01b7ddb8..8557c058870 100644 --- a/libgfortran/generated/count_16_l.c +++ b/libgfortran/generated/count_16_l.c @@ -101,8 +101,7 @@ count_16_l (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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 { diff --git a/libgfortran/generated/count_1_l.c b/libgfortran/generated/count_1_l.c index 6f8df444d1d..21024c13888 100644 --- a/libgfortran/generated/count_1_l.c +++ b/libgfortran/generated/count_1_l.c @@ -101,8 +101,7 @@ count_1_l (gfc_array_i1 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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 { diff --git a/libgfortran/generated/count_2_l.c b/libgfortran/generated/count_2_l.c index f74458723bc..2b3babb961c 100644 --- a/libgfortran/generated/count_2_l.c +++ b/libgfortran/generated/count_2_l.c @@ -101,8 +101,7 @@ count_2_l (gfc_array_i2 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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 { diff --git a/libgfortran/generated/count_4_l.c b/libgfortran/generated/count_4_l.c index 9a2f98e110e..4c902e98332 100644 --- a/libgfortran/generated/count_4_l.c +++ b/libgfortran/generated/count_4_l.c @@ -101,8 +101,7 @@ count_4_l (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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 { diff --git a/libgfortran/generated/count_8_l.c b/libgfortran/generated/count_8_l.c index 329e3635b4f..83e1c5ee51c 100644 --- a/libgfortran/generated/count_8_l.c +++ b/libgfortran/generated/count_8_l.c @@ -101,8 +101,7 @@ count_8_l (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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 { diff --git a/libgfortran/generated/cshift1_16.c b/libgfortran/generated/cshift1_16.c index 86a4c76bb25..6ea2c6595ef 100644 --- a/libgfortran/generated/cshift1_16.c +++ b/libgfortran/generated/cshift1_16.c @@ -81,7 +81,7 @@ cshift1 (gfc_array_char * const restrict ret, int i; index_type sm, ext; - ret->base_addr = xmalloc (size * arraysize); + ret->base_addr = xmallocarray (arraysize, size); ret->elem_len = array->elem_len; ret->type = array->type; ret->offset = 0; diff --git a/libgfortran/generated/cshift1_4.c b/libgfortran/generated/cshift1_4.c index 003674e00c3..4793e58f183 100644 --- a/libgfortran/generated/cshift1_4.c +++ b/libgfortran/generated/cshift1_4.c @@ -81,7 +81,7 @@ cshift1 (gfc_array_char * const restrict ret, int i; index_type sm, ext; - ret->base_addr = xmalloc (size * arraysize); + ret->base_addr = xmallocarray (arraysize, size); ret->elem_len = array->elem_len; ret->type = array->type; ret->offset = 0; diff --git a/libgfortran/generated/cshift1_8.c b/libgfortran/generated/cshift1_8.c index c76a4d7ed85..9be7415b628 100644 --- a/libgfortran/generated/cshift1_8.c +++ b/libgfortran/generated/cshift1_8.c @@ -81,7 +81,7 @@ cshift1 (gfc_array_char * const restrict ret, int i; index_type sm, ext; - ret->base_addr = xmalloc (size * arraysize); + ret->base_addr = xmallocarray (arraysize, size); ret->elem_len = array->elem_len; ret->type = array->type; ret->offset = 0; diff --git a/libgfortran/generated/eoshift1_16.c b/libgfortran/generated/eoshift1_16.c index 8b098fb0629..06a3682035c 100644 --- a/libgfortran/generated/eoshift1_16.c +++ b/libgfortran/generated/eoshift1_16.c @@ -106,8 +106,8 @@ eoshift1 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET (ret->dim[i], 0, ext, sm); } - /* 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)) diff --git a/libgfortran/generated/eoshift1_4.c b/libgfortran/generated/eoshift1_4.c index 7c61a185884..7b0b4929aa7 100644 --- a/libgfortran/generated/eoshift1_4.c +++ b/libgfortran/generated/eoshift1_4.c @@ -106,8 +106,8 @@ eoshift1 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET (ret->dim[i], 0, ext, sm); } - /* 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)) diff --git a/libgfortran/generated/eoshift1_8.c b/libgfortran/generated/eoshift1_8.c index 449e0c2bd72..368a463a19b 100644 --- a/libgfortran/generated/eoshift1_8.c +++ b/libgfortran/generated/eoshift1_8.c @@ -106,8 +106,8 @@ eoshift1 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET (ret->dim[i], 0, ext, sm); } - /* 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)) diff --git a/libgfortran/generated/eoshift3_16.c b/libgfortran/generated/eoshift3_16.c index cb46ff36629..c494cea7c20 100644 --- a/libgfortran/generated/eoshift3_16.c +++ b/libgfortran/generated/eoshift3_16.c @@ -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->elem_len = array->elem_len; ret->type = array->type; ret->offset = 0; @@ -108,8 +108,8 @@ eoshift3 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET (ret->dim[i], 0, ext, sm); } - /* 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)) diff --git a/libgfortran/generated/eoshift3_4.c b/libgfortran/generated/eoshift3_4.c index f080258c8c1..7d00e36f61a 100644 --- a/libgfortran/generated/eoshift3_4.c +++ b/libgfortran/generated/eoshift3_4.c @@ -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->elem_len = array->elem_len; ret->type = array->type; ret->offset = 0; @@ -108,8 +108,8 @@ eoshift3 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET (ret->dim[i], 0, ext, sm); } - /* 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)) diff --git a/libgfortran/generated/eoshift3_8.c b/libgfortran/generated/eoshift3_8.c index 8c7cb5217b1..3657ea2d589 100644 --- a/libgfortran/generated/eoshift3_8.c +++ b/libgfortran/generated/eoshift3_8.c @@ -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->elem_len = array->elem_len; ret->type = array->type; ret->offset = 0; @@ -108,8 +108,8 @@ eoshift3 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET (ret->dim[i], 0, ext, sm); } - /* 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)) diff --git a/libgfortran/generated/iall_i1.c b/libgfortran/generated/iall_i1.c index ab3b35bd0a9..0e4c6f5dc46 100644 --- a/libgfortran/generated/iall_i1.c +++ b/libgfortran/generated/iall_i1.c @@ -98,10 +98,9 @@ iall_i1 (gfc_array_i1 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ miall_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ siall_i1 (gfc_array_i1 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/iall_i16.c b/libgfortran/generated/iall_i16.c index 656b5049173..33f3764b46f 100644 --- a/libgfortran/generated/iall_i16.c +++ b/libgfortran/generated/iall_i16.c @@ -98,10 +98,9 @@ iall_i16 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ miall_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ siall_i16 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/iall_i2.c b/libgfortran/generated/iall_i2.c index 8df1bd081b8..52dc1da37e5 100644 --- a/libgfortran/generated/iall_i2.c +++ b/libgfortran/generated/iall_i2.c @@ -98,10 +98,9 @@ iall_i2 (gfc_array_i2 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ miall_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ siall_i2 (gfc_array_i2 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/iall_i4.c b/libgfortran/generated/iall_i4.c index a4288c09a06..bca8e950ebb 100644 --- a/libgfortran/generated/iall_i4.c +++ b/libgfortran/generated/iall_i4.c @@ -98,10 +98,9 @@ iall_i4 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ miall_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ siall_i4 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/iall_i8.c b/libgfortran/generated/iall_i8.c index e0b454a4b90..d0cf056302a 100644 --- a/libgfortran/generated/iall_i8.c +++ b/libgfortran/generated/iall_i8.c @@ -98,10 +98,9 @@ iall_i8 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ miall_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ siall_i8 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/iany_i1.c b/libgfortran/generated/iany_i1.c index 3288ea27e0c..0a2fcd9d79f 100644 --- a/libgfortran/generated/iany_i1.c +++ b/libgfortran/generated/iany_i1.c @@ -98,10 +98,9 @@ iany_i1 (gfc_array_i1 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ miany_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ siany_i1 (gfc_array_i1 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/iany_i16.c b/libgfortran/generated/iany_i16.c index 64601905f6f..fc61c2104c3 100644 --- a/libgfortran/generated/iany_i16.c +++ b/libgfortran/generated/iany_i16.c @@ -98,10 +98,9 @@ iany_i16 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ miany_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ siany_i16 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/iany_i2.c b/libgfortran/generated/iany_i2.c index 5dee561a8bb..a58c458d6c1 100644 --- a/libgfortran/generated/iany_i2.c +++ b/libgfortran/generated/iany_i2.c @@ -98,10 +98,9 @@ iany_i2 (gfc_array_i2 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ miany_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ siany_i2 (gfc_array_i2 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/iany_i4.c b/libgfortran/generated/iany_i4.c index 25d02901c3e..7f081878907 100644 --- a/libgfortran/generated/iany_i4.c +++ b/libgfortran/generated/iany_i4.c @@ -98,10 +98,9 @@ iany_i4 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ miany_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ siany_i4 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/iany_i8.c b/libgfortran/generated/iany_i8.c index 39018015114..ca3dea818a8 100644 --- a/libgfortran/generated/iany_i8.c +++ b/libgfortran/generated/iany_i8.c @@ -98,10 +98,9 @@ iany_i8 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ miany_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ siany_i8 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/in_pack_c10.c b/libgfortran/generated/in_pack_c10.c index 4e2d585cb4f..ba2656115e7 100644 --- a/libgfortran/generated/in_pack_c10.c +++ b/libgfortran/generated/in_pack_c10.c @@ -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]; diff --git a/libgfortran/generated/in_pack_c16.c b/libgfortran/generated/in_pack_c16.c index febbbce5acc..f2285dcd60e 100644 --- a/libgfortran/generated/in_pack_c16.c +++ b/libgfortran/generated/in_pack_c16.c @@ -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]; diff --git a/libgfortran/generated/in_pack_c4.c b/libgfortran/generated/in_pack_c4.c index d9e04e050a1..116cb6380df 100644 --- a/libgfortran/generated/in_pack_c4.c +++ b/libgfortran/generated/in_pack_c4.c @@ -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]; diff --git a/libgfortran/generated/in_pack_c8.c b/libgfortran/generated/in_pack_c8.c index 496a8c0a400..f56e6bc8328 100644 --- a/libgfortran/generated/in_pack_c8.c +++ b/libgfortran/generated/in_pack_c8.c @@ -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]; diff --git a/libgfortran/generated/in_pack_i1.c b/libgfortran/generated/in_pack_i1.c index 0abb92fe60f..1a185ce6eef 100644 --- a/libgfortran/generated/in_pack_i1.c +++ b/libgfortran/generated/in_pack_i1.c @@ -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]; diff --git a/libgfortran/generated/in_pack_i16.c b/libgfortran/generated/in_pack_i16.c index ea66ec38f29..b4537aa71e4 100644 --- a/libgfortran/generated/in_pack_i16.c +++ b/libgfortran/generated/in_pack_i16.c @@ -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]; diff --git a/libgfortran/generated/in_pack_i2.c b/libgfortran/generated/in_pack_i2.c index 6ac7845ad52..99bc9814a34 100644 --- a/libgfortran/generated/in_pack_i2.c +++ b/libgfortran/generated/in_pack_i2.c @@ -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]; diff --git a/libgfortran/generated/in_pack_i4.c b/libgfortran/generated/in_pack_i4.c index b2779d5e2d8..f8a3a9694ac 100644 --- a/libgfortran/generated/in_pack_i4.c +++ b/libgfortran/generated/in_pack_i4.c @@ -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]; diff --git a/libgfortran/generated/in_pack_i8.c b/libgfortran/generated/in_pack_i8.c index 6aec3660beb..7c3a927cad4 100644 --- a/libgfortran/generated/in_pack_i8.c +++ b/libgfortran/generated/in_pack_i8.c @@ -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]; diff --git a/libgfortran/generated/in_pack_r10.c b/libgfortran/generated/in_pack_r10.c index f924639f546..01b9a83b35b 100644 --- a/libgfortran/generated/in_pack_r10.c +++ b/libgfortran/generated/in_pack_r10.c @@ -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]; diff --git a/libgfortran/generated/in_pack_r16.c b/libgfortran/generated/in_pack_r16.c index 108690d7ff6..9f4d68b556a 100644 --- a/libgfortran/generated/in_pack_r16.c +++ b/libgfortran/generated/in_pack_r16.c @@ -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]; diff --git a/libgfortran/generated/in_pack_r4.c b/libgfortran/generated/in_pack_r4.c index 0affbf2d015..316a644477e 100644 --- a/libgfortran/generated/in_pack_r4.c +++ b/libgfortran/generated/in_pack_r4.c @@ -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]; diff --git a/libgfortran/generated/in_pack_r8.c b/libgfortran/generated/in_pack_r8.c index b408a4810c0..be5a761e4af 100644 --- a/libgfortran/generated/in_pack_r8.c +++ b/libgfortran/generated/in_pack_r8.c @@ -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]; diff --git a/libgfortran/generated/iparity_i1.c b/libgfortran/generated/iparity_i1.c index f39ecc4f241..9c96e07e2f2 100644 --- a/libgfortran/generated/iparity_i1.c +++ b/libgfortran/generated/iparity_i1.c @@ -98,10 +98,9 @@ iparity_i1 (gfc_array_i1 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ miparity_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ siparity_i1 (gfc_array_i1 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/iparity_i16.c b/libgfortran/generated/iparity_i16.c index 189193c272a..6a17f4990ca 100644 --- a/libgfortran/generated/iparity_i16.c +++ b/libgfortran/generated/iparity_i16.c @@ -98,10 +98,9 @@ iparity_i16 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ miparity_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ siparity_i16 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/iparity_i2.c b/libgfortran/generated/iparity_i2.c index afa85df57b3..7fd85d40869 100644 --- a/libgfortran/generated/iparity_i2.c +++ b/libgfortran/generated/iparity_i2.c @@ -98,10 +98,9 @@ iparity_i2 (gfc_array_i2 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ miparity_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ siparity_i2 (gfc_array_i2 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/iparity_i4.c b/libgfortran/generated/iparity_i4.c index 7f8d3544992..1e03b3cb5d2 100644 --- a/libgfortran/generated/iparity_i4.c +++ b/libgfortran/generated/iparity_i4.c @@ -98,10 +98,9 @@ iparity_i4 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ miparity_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ siparity_i4 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/iparity_i8.c b/libgfortran/generated/iparity_i8.c index f92397468b5..2d7e8407d7e 100644 --- a/libgfortran/generated/iparity_i8.c +++ b/libgfortran/generated/iparity_i8.c @@ -98,10 +98,9 @@ iparity_i8 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ miparity_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ siparity_i8 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/matmul_c10.c b/libgfortran/generated/matmul_c10.c index ad87817fe84..d7af93c88e6 100644 --- a/libgfortran/generated/matmul_c10.c +++ b/libgfortran/generated/matmul_c10.c @@ -125,7 +125,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)) diff --git a/libgfortran/generated/matmul_c16.c b/libgfortran/generated/matmul_c16.c index 43454e4f0da..f94e89e09d5 100644 --- a/libgfortran/generated/matmul_c16.c +++ b/libgfortran/generated/matmul_c16.c @@ -125,7 +125,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)) diff --git a/libgfortran/generated/matmul_c4.c b/libgfortran/generated/matmul_c4.c index 3b51153e825..5192e0822c2 100644 --- a/libgfortran/generated/matmul_c4.c +++ b/libgfortran/generated/matmul_c4.c @@ -125,7 +125,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)) diff --git a/libgfortran/generated/matmul_c8.c b/libgfortran/generated/matmul_c8.c index 9d6712f9e81..93d737fc9d2 100644 --- a/libgfortran/generated/matmul_c8.c +++ b/libgfortran/generated/matmul_c8.c @@ -125,7 +125,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)) diff --git a/libgfortran/generated/matmul_i1.c b/libgfortran/generated/matmul_i1.c index 71204b3a9ee..07c6ffece24 100644 --- a/libgfortran/generated/matmul_i1.c +++ b/libgfortran/generated/matmul_i1.c @@ -125,7 +125,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)) diff --git a/libgfortran/generated/matmul_i16.c b/libgfortran/generated/matmul_i16.c index 1441eb98945..e477d8b5e80 100644 --- a/libgfortran/generated/matmul_i16.c +++ b/libgfortran/generated/matmul_i16.c @@ -125,7 +125,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)) diff --git a/libgfortran/generated/matmul_i2.c b/libgfortran/generated/matmul_i2.c index a655fbf4c13..7b2a5f683f9 100644 --- a/libgfortran/generated/matmul_i2.c +++ b/libgfortran/generated/matmul_i2.c @@ -125,7 +125,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)) diff --git a/libgfortran/generated/matmul_i4.c b/libgfortran/generated/matmul_i4.c index 4513c801037..a650f0ad4f7 100644 --- a/libgfortran/generated/matmul_i4.c +++ b/libgfortran/generated/matmul_i4.c @@ -125,7 +125,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)) diff --git a/libgfortran/generated/matmul_i8.c b/libgfortran/generated/matmul_i8.c index 5019a68f4ef..c7efc77f15d 100644 --- a/libgfortran/generated/matmul_i8.c +++ b/libgfortran/generated/matmul_i8.c @@ -125,7 +125,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)) diff --git a/libgfortran/generated/matmul_l16.c b/libgfortran/generated/matmul_l16.c index 20c3bdfcbbd..1e016587d03 100644 --- a/libgfortran/generated/matmul_l16.c +++ b/libgfortran/generated/matmul_l16.c @@ -89,7 +89,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)) diff --git a/libgfortran/generated/matmul_l4.c b/libgfortran/generated/matmul_l4.c index e17ea56c603..2b3d870acc4 100644 --- a/libgfortran/generated/matmul_l4.c +++ b/libgfortran/generated/matmul_l4.c @@ -89,7 +89,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)) diff --git a/libgfortran/generated/matmul_l8.c b/libgfortran/generated/matmul_l8.c index 5866fb4f1eb..bff2852166b 100644 --- a/libgfortran/generated/matmul_l8.c +++ b/libgfortran/generated/matmul_l8.c @@ -89,7 +89,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)) diff --git a/libgfortran/generated/matmul_r10.c b/libgfortran/generated/matmul_r10.c index 41c01fcc54f..9959f6a9977 100644 --- a/libgfortran/generated/matmul_r10.c +++ b/libgfortran/generated/matmul_r10.c @@ -125,7 +125,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)) diff --git a/libgfortran/generated/matmul_r16.c b/libgfortran/generated/matmul_r16.c index f5f6b925b0f..bc43ca21291 100644 --- a/libgfortran/generated/matmul_r16.c +++ b/libgfortran/generated/matmul_r16.c @@ -125,7 +125,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)) diff --git a/libgfortran/generated/matmul_r4.c b/libgfortran/generated/matmul_r4.c index 2aa632f4fd4..8fd3849b726 100644 --- a/libgfortran/generated/matmul_r4.c +++ b/libgfortran/generated/matmul_r4.c @@ -125,7 +125,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)) diff --git a/libgfortran/generated/matmul_r8.c b/libgfortran/generated/matmul_r8.c index dc11452bfc8..ca7adb309aa 100644 --- a/libgfortran/generated/matmul_r8.c +++ b/libgfortran/generated/matmul_r8.c @@ -125,7 +125,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)) diff --git a/libgfortran/generated/maxloc0_16_i1.c b/libgfortran/generated/maxloc0_16_i1.c index 7599e2f01d2..792f59fb683 100644 --- a/libgfortran/generated/maxloc0_16_i1.c +++ b/libgfortran/generated/maxloc0_16_i1.c @@ -59,7 +59,7 @@ maxloc0_16_i1 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -201,7 +201,7 @@ mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -368,7 +368,7 @@ smaxloc0_16_i1 (gfc_array_i16 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_16)); 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)) { diff --git a/libgfortran/generated/maxloc0_16_i16.c b/libgfortran/generated/maxloc0_16_i16.c index 7db5d770f37..6e35ac7c6f0 100644 --- a/libgfortran/generated/maxloc0_16_i16.c +++ b/libgfortran/generated/maxloc0_16_i16.c @@ -59,7 +59,7 @@ maxloc0_16_i16 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -201,7 +201,7 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -368,7 +368,7 @@ smaxloc0_16_i16 (gfc_array_i16 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_16)); 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)) { diff --git a/libgfortran/generated/maxloc0_16_i2.c b/libgfortran/generated/maxloc0_16_i2.c index 60842b0b575..eaeeab93f58 100644 --- a/libgfortran/generated/maxloc0_16_i2.c +++ b/libgfortran/generated/maxloc0_16_i2.c @@ -59,7 +59,7 @@ maxloc0_16_i2 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -201,7 +201,7 @@ mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -368,7 +368,7 @@ smaxloc0_16_i2 (gfc_array_i16 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_16)); 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)) { diff --git a/libgfortran/generated/maxloc0_16_i4.c b/libgfortran/generated/maxloc0_16_i4.c index bde420802c8..5d8acb0e72b 100644 --- a/libgfortran/generated/maxloc0_16_i4.c +++ b/libgfortran/generated/maxloc0_16_i4.c @@ -59,7 +59,7 @@ maxloc0_16_i4 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -201,7 +201,7 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -368,7 +368,7 @@ smaxloc0_16_i4 (gfc_array_i16 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_16)); 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)) { diff --git a/libgfortran/generated/maxloc0_16_i8.c b/libgfortran/generated/maxloc0_16_i8.c index 5f11d70d997..cd315741ffd 100644 --- a/libgfortran/generated/maxloc0_16_i8.c +++ b/libgfortran/generated/maxloc0_16_i8.c @@ -59,7 +59,7 @@ maxloc0_16_i8 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -201,7 +201,7 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -368,7 +368,7 @@ smaxloc0_16_i8 (gfc_array_i16 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_16)); 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)) { diff --git a/libgfortran/generated/maxloc0_16_r10.c b/libgfortran/generated/maxloc0_16_r10.c index 87de7a7febb..089e751dc8a 100644 --- a/libgfortran/generated/maxloc0_16_r10.c +++ b/libgfortran/generated/maxloc0_16_r10.c @@ -59,7 +59,7 @@ maxloc0_16_r10 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -201,7 +201,7 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -368,7 +368,7 @@ smaxloc0_16_r10 (gfc_array_i16 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_16)); 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)) { diff --git a/libgfortran/generated/maxloc0_16_r16.c b/libgfortran/generated/maxloc0_16_r16.c index e643280a852..1c423e7847b 100644 --- a/libgfortran/generated/maxloc0_16_r16.c +++ b/libgfortran/generated/maxloc0_16_r16.c @@ -59,7 +59,7 @@ maxloc0_16_r16 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -201,7 +201,7 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -368,7 +368,7 @@ smaxloc0_16_r16 (gfc_array_i16 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_16)); 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)) { diff --git a/libgfortran/generated/maxloc0_16_r4.c b/libgfortran/generated/maxloc0_16_r4.c index fb0b69d03d9..28ae3829f95 100644 --- a/libgfortran/generated/maxloc0_16_r4.c +++ b/libgfortran/generated/maxloc0_16_r4.c @@ -59,7 +59,7 @@ maxloc0_16_r4 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -201,7 +201,7 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -368,7 +368,7 @@ smaxloc0_16_r4 (gfc_array_i16 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_16)); 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)) { diff --git a/libgfortran/generated/maxloc0_16_r8.c b/libgfortran/generated/maxloc0_16_r8.c index 96956c4d75d..0f17f337882 100644 --- a/libgfortran/generated/maxloc0_16_r8.c +++ b/libgfortran/generated/maxloc0_16_r8.c @@ -59,7 +59,7 @@ maxloc0_16_r8 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -201,7 +201,7 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -368,7 +368,7 @@ smaxloc0_16_r8 (gfc_array_i16 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_16)); 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)) { diff --git a/libgfortran/generated/maxloc0_4_i1.c b/libgfortran/generated/maxloc0_4_i1.c index 4a388d82db2..63f8564d8f3 100644 --- a/libgfortran/generated/maxloc0_4_i1.c +++ b/libgfortran/generated/maxloc0_4_i1.c @@ -59,7 +59,7 @@ maxloc0_4_i1 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -201,7 +201,7 @@ mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -368,7 +368,7 @@ smaxloc0_4_i1 (gfc_array_i4 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_4)); 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)) { diff --git a/libgfortran/generated/maxloc0_4_i16.c b/libgfortran/generated/maxloc0_4_i16.c index 3039dda689f..053fd05fb34 100644 --- a/libgfortran/generated/maxloc0_4_i16.c +++ b/libgfortran/generated/maxloc0_4_i16.c @@ -59,7 +59,7 @@ maxloc0_4_i16 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -201,7 +201,7 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -368,7 +368,7 @@ smaxloc0_4_i16 (gfc_array_i4 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_4)); 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)) { diff --git a/libgfortran/generated/maxloc0_4_i2.c b/libgfortran/generated/maxloc0_4_i2.c index 3ea64f62071..e0ee681f04d 100644 --- a/libgfortran/generated/maxloc0_4_i2.c +++ b/libgfortran/generated/maxloc0_4_i2.c @@ -59,7 +59,7 @@ maxloc0_4_i2 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -201,7 +201,7 @@ mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -368,7 +368,7 @@ smaxloc0_4_i2 (gfc_array_i4 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_4)); 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)) { diff --git a/libgfortran/generated/maxloc0_4_i4.c b/libgfortran/generated/maxloc0_4_i4.c index c1d163762f2..ad793633f9b 100644 --- a/libgfortran/generated/maxloc0_4_i4.c +++ b/libgfortran/generated/maxloc0_4_i4.c @@ -59,7 +59,7 @@ maxloc0_4_i4 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -201,7 +201,7 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -368,7 +368,7 @@ smaxloc0_4_i4 (gfc_array_i4 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_4)); 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)) { diff --git a/libgfortran/generated/maxloc0_4_i8.c b/libgfortran/generated/maxloc0_4_i8.c index 2d14ddfeb87..335ad26f815 100644 --- a/libgfortran/generated/maxloc0_4_i8.c +++ b/libgfortran/generated/maxloc0_4_i8.c @@ -59,7 +59,7 @@ maxloc0_4_i8 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -201,7 +201,7 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -368,7 +368,7 @@ smaxloc0_4_i8 (gfc_array_i4 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_4)); 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)) { diff --git a/libgfortran/generated/maxloc0_4_r10.c b/libgfortran/generated/maxloc0_4_r10.c index baf3cb52d34..54701204074 100644 --- a/libgfortran/generated/maxloc0_4_r10.c +++ b/libgfortran/generated/maxloc0_4_r10.c @@ -59,7 +59,7 @@ maxloc0_4_r10 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -201,7 +201,7 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -368,7 +368,7 @@ smaxloc0_4_r10 (gfc_array_i4 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_4)); 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)) { diff --git a/libgfortran/generated/maxloc0_4_r16.c b/libgfortran/generated/maxloc0_4_r16.c index 22867a597ef..60352e19f17 100644 --- a/libgfortran/generated/maxloc0_4_r16.c +++ b/libgfortran/generated/maxloc0_4_r16.c @@ -59,7 +59,7 @@ maxloc0_4_r16 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -201,7 +201,7 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -368,7 +368,7 @@ smaxloc0_4_r16 (gfc_array_i4 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_4)); 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)) { diff --git a/libgfortran/generated/maxloc0_4_r4.c b/libgfortran/generated/maxloc0_4_r4.c index be7be4bbc8b..af9f83bb909 100644 --- a/libgfortran/generated/maxloc0_4_r4.c +++ b/libgfortran/generated/maxloc0_4_r4.c @@ -59,7 +59,7 @@ maxloc0_4_r4 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -201,7 +201,7 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -368,7 +368,7 @@ smaxloc0_4_r4 (gfc_array_i4 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_4)); 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)) { diff --git a/libgfortran/generated/maxloc0_4_r8.c b/libgfortran/generated/maxloc0_4_r8.c index 077cc6c820c..2c70d47f440 100644 --- a/libgfortran/generated/maxloc0_4_r8.c +++ b/libgfortran/generated/maxloc0_4_r8.c @@ -59,7 +59,7 @@ maxloc0_4_r8 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -201,7 +201,7 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -368,7 +368,7 @@ smaxloc0_4_r8 (gfc_array_i4 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_4)); 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)) { diff --git a/libgfortran/generated/maxloc0_8_i1.c b/libgfortran/generated/maxloc0_8_i1.c index 20872b34026..341fadb8b16 100644 --- a/libgfortran/generated/maxloc0_8_i1.c +++ b/libgfortran/generated/maxloc0_8_i1.c @@ -59,7 +59,7 @@ maxloc0_8_i1 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -201,7 +201,7 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -368,7 +368,7 @@ smaxloc0_8_i1 (gfc_array_i8 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_8)); 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)) { diff --git a/libgfortran/generated/maxloc0_8_i16.c b/libgfortran/generated/maxloc0_8_i16.c index 979ea2caeb4..5d4d978b64c 100644 --- a/libgfortran/generated/maxloc0_8_i16.c +++ b/libgfortran/generated/maxloc0_8_i16.c @@ -59,7 +59,7 @@ maxloc0_8_i16 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -201,7 +201,7 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -368,7 +368,7 @@ smaxloc0_8_i16 (gfc_array_i8 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_8)); 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)) { diff --git a/libgfortran/generated/maxloc0_8_i2.c b/libgfortran/generated/maxloc0_8_i2.c index 903015c2b21..1a19a1fd1db 100644 --- a/libgfortran/generated/maxloc0_8_i2.c +++ b/libgfortran/generated/maxloc0_8_i2.c @@ -59,7 +59,7 @@ maxloc0_8_i2 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -201,7 +201,7 @@ mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -368,7 +368,7 @@ smaxloc0_8_i2 (gfc_array_i8 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_8)); 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)) { diff --git a/libgfortran/generated/maxloc0_8_i4.c b/libgfortran/generated/maxloc0_8_i4.c index 7ad04f2f2ad..d3745aa8b6e 100644 --- a/libgfortran/generated/maxloc0_8_i4.c +++ b/libgfortran/generated/maxloc0_8_i4.c @@ -59,7 +59,7 @@ maxloc0_8_i4 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -201,7 +201,7 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -368,7 +368,7 @@ smaxloc0_8_i4 (gfc_array_i8 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_8)); 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)) { diff --git a/libgfortran/generated/maxloc0_8_i8.c b/libgfortran/generated/maxloc0_8_i8.c index 2b6bde7208a..4ac8ff5fc5c 100644 --- a/libgfortran/generated/maxloc0_8_i8.c +++ b/libgfortran/generated/maxloc0_8_i8.c @@ -59,7 +59,7 @@ maxloc0_8_i8 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -201,7 +201,7 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -368,7 +368,7 @@ smaxloc0_8_i8 (gfc_array_i8 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_8)); 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)) { diff --git a/libgfortran/generated/maxloc0_8_r10.c b/libgfortran/generated/maxloc0_8_r10.c index c8fc79213af..8bd4d257182 100644 --- a/libgfortran/generated/maxloc0_8_r10.c +++ b/libgfortran/generated/maxloc0_8_r10.c @@ -59,7 +59,7 @@ maxloc0_8_r10 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -201,7 +201,7 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -368,7 +368,7 @@ smaxloc0_8_r10 (gfc_array_i8 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_8)); 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)) { diff --git a/libgfortran/generated/maxloc0_8_r16.c b/libgfortran/generated/maxloc0_8_r16.c index 2a0d979814c..33068477d23 100644 --- a/libgfortran/generated/maxloc0_8_r16.c +++ b/libgfortran/generated/maxloc0_8_r16.c @@ -59,7 +59,7 @@ maxloc0_8_r16 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -201,7 +201,7 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -368,7 +368,7 @@ smaxloc0_8_r16 (gfc_array_i8 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_8)); 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)) { diff --git a/libgfortran/generated/maxloc0_8_r4.c b/libgfortran/generated/maxloc0_8_r4.c index 58887484d3c..7abef9f34a9 100644 --- a/libgfortran/generated/maxloc0_8_r4.c +++ b/libgfortran/generated/maxloc0_8_r4.c @@ -59,7 +59,7 @@ maxloc0_8_r4 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -201,7 +201,7 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -368,7 +368,7 @@ smaxloc0_8_r4 (gfc_array_i8 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_8)); 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)) { diff --git a/libgfortran/generated/maxloc0_8_r8.c b/libgfortran/generated/maxloc0_8_r8.c index e67cd6f5a59..9d163d6ddaa 100644 --- a/libgfortran/generated/maxloc0_8_r8.c +++ b/libgfortran/generated/maxloc0_8_r8.c @@ -59,7 +59,7 @@ maxloc0_8_r8 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -201,7 +201,7 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -368,7 +368,7 @@ smaxloc0_8_r8 (gfc_array_i8 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_8)); 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)) { diff --git a/libgfortran/generated/maxloc1_16_i1.c b/libgfortran/generated/maxloc1_16_i1.c index 029a794ce4b..4bae2d2e0db 100644 --- a/libgfortran/generated/maxloc1_16_i1.c +++ b/libgfortran/generated/maxloc1_16_i1.c @@ -99,10 +99,9 @@ maxloc1_16_i1 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_16_i16.c b/libgfortran/generated/maxloc1_16_i16.c index ec5fb65667d..03d3198c7f9 100644 --- a/libgfortran/generated/maxloc1_16_i16.c +++ b/libgfortran/generated/maxloc1_16_i16.c @@ -99,10 +99,9 @@ maxloc1_16_i16 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_16_i2.c b/libgfortran/generated/maxloc1_16_i2.c index 59b0532e9f7..d2acb3775a5 100644 --- a/libgfortran/generated/maxloc1_16_i2.c +++ b/libgfortran/generated/maxloc1_16_i2.c @@ -99,10 +99,9 @@ maxloc1_16_i2 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_16_i4.c b/libgfortran/generated/maxloc1_16_i4.c index d5e9dca83cb..cd1650135ec 100644 --- a/libgfortran/generated/maxloc1_16_i4.c +++ b/libgfortran/generated/maxloc1_16_i4.c @@ -99,10 +99,9 @@ maxloc1_16_i4 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_16_i8.c b/libgfortran/generated/maxloc1_16_i8.c index 52a86d2489c..0584bf38bba 100644 --- a/libgfortran/generated/maxloc1_16_i8.c +++ b/libgfortran/generated/maxloc1_16_i8.c @@ -99,10 +99,9 @@ maxloc1_16_i8 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_16_r10.c b/libgfortran/generated/maxloc1_16_r10.c index 61a005c6406..3c01efb2d6f 100644 --- a/libgfortran/generated/maxloc1_16_r10.c +++ b/libgfortran/generated/maxloc1_16_r10.c @@ -99,10 +99,9 @@ maxloc1_16_r10 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_16_r16.c b/libgfortran/generated/maxloc1_16_r16.c index 0b53c4211c2..18fee74173d 100644 --- a/libgfortran/generated/maxloc1_16_r16.c +++ b/libgfortran/generated/maxloc1_16_r16.c @@ -99,10 +99,9 @@ maxloc1_16_r16 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_16_r4.c b/libgfortran/generated/maxloc1_16_r4.c index d4aadc3a5e7..c268600c67b 100644 --- a/libgfortran/generated/maxloc1_16_r4.c +++ b/libgfortran/generated/maxloc1_16_r4.c @@ -99,10 +99,9 @@ maxloc1_16_r4 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_16_r8.c b/libgfortran/generated/maxloc1_16_r8.c index e5dda0b1884..b3d5141b64f 100644 --- a/libgfortran/generated/maxloc1_16_r8.c +++ b/libgfortran/generated/maxloc1_16_r8.c @@ -99,10 +99,9 @@ maxloc1_16_r8 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_4_i1.c b/libgfortran/generated/maxloc1_4_i1.c index 6a6a02c40a4..678181b7e3e 100644 --- a/libgfortran/generated/maxloc1_4_i1.c +++ b/libgfortran/generated/maxloc1_4_i1.c @@ -99,10 +99,9 @@ maxloc1_4_i1 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_4_i16.c b/libgfortran/generated/maxloc1_4_i16.c index b7c7d1950e3..4f468836fc1 100644 --- a/libgfortran/generated/maxloc1_4_i16.c +++ b/libgfortran/generated/maxloc1_4_i16.c @@ -99,10 +99,9 @@ maxloc1_4_i16 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_4_i2.c b/libgfortran/generated/maxloc1_4_i2.c index d0f66c07964..89df835d7a3 100644 --- a/libgfortran/generated/maxloc1_4_i2.c +++ b/libgfortran/generated/maxloc1_4_i2.c @@ -99,10 +99,9 @@ maxloc1_4_i2 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_4_i4.c b/libgfortran/generated/maxloc1_4_i4.c index 3be68aee24a..86cb7ea74c1 100644 --- a/libgfortran/generated/maxloc1_4_i4.c +++ b/libgfortran/generated/maxloc1_4_i4.c @@ -99,10 +99,9 @@ maxloc1_4_i4 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_4_i8.c b/libgfortran/generated/maxloc1_4_i8.c index 549dc416019..76d5aec2c58 100644 --- a/libgfortran/generated/maxloc1_4_i8.c +++ b/libgfortran/generated/maxloc1_4_i8.c @@ -99,10 +99,9 @@ maxloc1_4_i8 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_4_r10.c b/libgfortran/generated/maxloc1_4_r10.c index ee0fb311bcb..6322e19aaf8 100644 --- a/libgfortran/generated/maxloc1_4_r10.c +++ b/libgfortran/generated/maxloc1_4_r10.c @@ -99,10 +99,9 @@ maxloc1_4_r10 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_4_r16.c b/libgfortran/generated/maxloc1_4_r16.c index 5a36f6be97e..f2779e49cfe 100644 --- a/libgfortran/generated/maxloc1_4_r16.c +++ b/libgfortran/generated/maxloc1_4_r16.c @@ -99,10 +99,9 @@ maxloc1_4_r16 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_4_r4.c b/libgfortran/generated/maxloc1_4_r4.c index 675a4e7a977..b5ea02dfedf 100644 --- a/libgfortran/generated/maxloc1_4_r4.c +++ b/libgfortran/generated/maxloc1_4_r4.c @@ -99,10 +99,9 @@ maxloc1_4_r4 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_4_r8.c b/libgfortran/generated/maxloc1_4_r8.c index b7f1c3f8d83..0cb7db50d1d 100644 --- a/libgfortran/generated/maxloc1_4_r8.c +++ b/libgfortran/generated/maxloc1_4_r8.c @@ -99,10 +99,9 @@ maxloc1_4_r8 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_8_i1.c b/libgfortran/generated/maxloc1_8_i1.c index 9932ed6fd06..4d0827a0d77 100644 --- a/libgfortran/generated/maxloc1_8_i1.c +++ b/libgfortran/generated/maxloc1_8_i1.c @@ -99,10 +99,9 @@ maxloc1_8_i1 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_8_i16.c b/libgfortran/generated/maxloc1_8_i16.c index 9a8a6563594..3f7c2edfedc 100644 --- a/libgfortran/generated/maxloc1_8_i16.c +++ b/libgfortran/generated/maxloc1_8_i16.c @@ -99,10 +99,9 @@ maxloc1_8_i16 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_8_i2.c b/libgfortran/generated/maxloc1_8_i2.c index a2d4ab99c5a..3be4387b8b3 100644 --- a/libgfortran/generated/maxloc1_8_i2.c +++ b/libgfortran/generated/maxloc1_8_i2.c @@ -99,10 +99,9 @@ maxloc1_8_i2 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_8_i4.c b/libgfortran/generated/maxloc1_8_i4.c index c4f7a3f4f25..4adf1280979 100644 --- a/libgfortran/generated/maxloc1_8_i4.c +++ b/libgfortran/generated/maxloc1_8_i4.c @@ -99,10 +99,9 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_8_i8.c b/libgfortran/generated/maxloc1_8_i8.c index a63c5327c3a..37f5609fc0c 100644 --- a/libgfortran/generated/maxloc1_8_i8.c +++ b/libgfortran/generated/maxloc1_8_i8.c @@ -99,10 +99,9 @@ maxloc1_8_i8 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_8_r10.c b/libgfortran/generated/maxloc1_8_r10.c index de2ae4b5336..ec8040e23bf 100644 --- a/libgfortran/generated/maxloc1_8_r10.c +++ b/libgfortran/generated/maxloc1_8_r10.c @@ -99,10 +99,9 @@ maxloc1_8_r10 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_8_r16.c b/libgfortran/generated/maxloc1_8_r16.c index 916e87d71e7..c5e85b1f499 100644 --- a/libgfortran/generated/maxloc1_8_r16.c +++ b/libgfortran/generated/maxloc1_8_r16.c @@ -99,10 +99,9 @@ maxloc1_8_r16 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_8_r4.c b/libgfortran/generated/maxloc1_8_r4.c index b25cef7ef51..ad0fa1dd566 100644 --- a/libgfortran/generated/maxloc1_8_r4.c +++ b/libgfortran/generated/maxloc1_8_r4.c @@ -99,10 +99,9 @@ maxloc1_8_r4 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxloc1_8_r8.c b/libgfortran/generated/maxloc1_8_r8.c index 3034d079602..5b9ecf7b691 100644 --- a/libgfortran/generated/maxloc1_8_r8.c +++ b/libgfortran/generated/maxloc1_8_r8.c @@ -99,10 +99,9 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ smaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/maxval_i1.c b/libgfortran/generated/maxval_i1.c index 1daeae810ac..708a6b4cd7b 100644 --- a/libgfortran/generated/maxval_i1.c +++ b/libgfortran/generated/maxval_i1.c @@ -98,10 +98,9 @@ maxval_i1 (gfc_array_i1 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -287,8 +286,7 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -301,7 +299,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 @@ -474,8 +472,7 @@ smaxval_i1 (gfc_array_i1 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -484,7 +481,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 { diff --git a/libgfortran/generated/maxval_i16.c b/libgfortran/generated/maxval_i16.c index a87bc89ead5..803949c151f 100644 --- a/libgfortran/generated/maxval_i16.c +++ b/libgfortran/generated/maxval_i16.c @@ -98,10 +98,9 @@ maxval_i16 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -287,8 +286,7 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -301,7 +299,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 @@ -474,8 +472,7 @@ smaxval_i16 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -484,7 +481,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 { diff --git a/libgfortran/generated/maxval_i2.c b/libgfortran/generated/maxval_i2.c index bcc2b64b25b..e77ab736b1f 100644 --- a/libgfortran/generated/maxval_i2.c +++ b/libgfortran/generated/maxval_i2.c @@ -98,10 +98,9 @@ maxval_i2 (gfc_array_i2 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -287,8 +286,7 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -301,7 +299,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 @@ -474,8 +472,7 @@ smaxval_i2 (gfc_array_i2 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -484,7 +481,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 { diff --git a/libgfortran/generated/maxval_i4.c b/libgfortran/generated/maxval_i4.c index 8a6b8f3e83a..29a8c793de9 100644 --- a/libgfortran/generated/maxval_i4.c +++ b/libgfortran/generated/maxval_i4.c @@ -98,10 +98,9 @@ maxval_i4 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -287,8 +286,7 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -301,7 +299,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 @@ -474,8 +472,7 @@ smaxval_i4 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -484,7 +481,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 { diff --git a/libgfortran/generated/maxval_i8.c b/libgfortran/generated/maxval_i8.c index b8ea6c5f4f7..11de2b01db0 100644 --- a/libgfortran/generated/maxval_i8.c +++ b/libgfortran/generated/maxval_i8.c @@ -98,10 +98,9 @@ maxval_i8 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -287,8 +286,7 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -301,7 +299,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 @@ -474,8 +472,7 @@ smaxval_i8 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -484,7 +481,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 { diff --git a/libgfortran/generated/maxval_r10.c b/libgfortran/generated/maxval_r10.c index 066fb54b9fb..0571233f958 100644 --- a/libgfortran/generated/maxval_r10.c +++ b/libgfortran/generated/maxval_r10.c @@ -98,10 +98,9 @@ maxval_r10 (gfc_array_r10 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -287,8 +286,7 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -301,7 +299,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 @@ -474,8 +472,7 @@ smaxval_r10 (gfc_array_r10 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -484,7 +481,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 { diff --git a/libgfortran/generated/maxval_r16.c b/libgfortran/generated/maxval_r16.c index c80cd93a5e3..aef3064eae9 100644 --- a/libgfortran/generated/maxval_r16.c +++ b/libgfortran/generated/maxval_r16.c @@ -98,10 +98,9 @@ maxval_r16 (gfc_array_r16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -287,8 +286,7 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -301,7 +299,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 @@ -474,8 +472,7 @@ smaxval_r16 (gfc_array_r16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -484,7 +481,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 { diff --git a/libgfortran/generated/maxval_r4.c b/libgfortran/generated/maxval_r4.c index a7350f165c5..d82e44bc6f9 100644 --- a/libgfortran/generated/maxval_r4.c +++ b/libgfortran/generated/maxval_r4.c @@ -98,10 +98,9 @@ maxval_r4 (gfc_array_r4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -287,8 +286,7 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -301,7 +299,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 @@ -474,8 +472,7 @@ smaxval_r4 (gfc_array_r4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -484,7 +481,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 { diff --git a/libgfortran/generated/maxval_r8.c b/libgfortran/generated/maxval_r8.c index c596783eaf1..070f87b281a 100644 --- a/libgfortran/generated/maxval_r8.c +++ b/libgfortran/generated/maxval_r8.c @@ -98,10 +98,9 @@ maxval_r8 (gfc_array_r8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -287,8 +286,7 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -301,7 +299,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 @@ -474,8 +472,7 @@ smaxval_r8 (gfc_array_r8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -484,7 +481,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 { diff --git a/libgfortran/generated/minloc0_16_i1.c b/libgfortran/generated/minloc0_16_i1.c index a34ced672ef..d74b3f7d60b 100644 --- a/libgfortran/generated/minloc0_16_i1.c +++ b/libgfortran/generated/minloc0_16_i1.c @@ -59,7 +59,7 @@ minloc0_16_i1 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -201,7 +201,7 @@ mminloc0_16_i1 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -368,7 +368,7 @@ sminloc0_16_i1 (gfc_array_i16 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_16)); 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)) { diff --git a/libgfortran/generated/minloc0_16_i16.c b/libgfortran/generated/minloc0_16_i16.c index 7c31c9326ff..5ae2f39bf92 100644 --- a/libgfortran/generated/minloc0_16_i16.c +++ b/libgfortran/generated/minloc0_16_i16.c @@ -59,7 +59,7 @@ minloc0_16_i16 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -201,7 +201,7 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -368,7 +368,7 @@ sminloc0_16_i16 (gfc_array_i16 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_16)); 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)) { diff --git a/libgfortran/generated/minloc0_16_i2.c b/libgfortran/generated/minloc0_16_i2.c index e085b918739..8e9df536c36 100644 --- a/libgfortran/generated/minloc0_16_i2.c +++ b/libgfortran/generated/minloc0_16_i2.c @@ -59,7 +59,7 @@ minloc0_16_i2 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -201,7 +201,7 @@ mminloc0_16_i2 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -368,7 +368,7 @@ sminloc0_16_i2 (gfc_array_i16 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_16)); 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)) { diff --git a/libgfortran/generated/minloc0_16_i4.c b/libgfortran/generated/minloc0_16_i4.c index 0b2e14c51c4..d626e812399 100644 --- a/libgfortran/generated/minloc0_16_i4.c +++ b/libgfortran/generated/minloc0_16_i4.c @@ -59,7 +59,7 @@ minloc0_16_i4 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -201,7 +201,7 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -368,7 +368,7 @@ sminloc0_16_i4 (gfc_array_i16 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_16)); 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)) { diff --git a/libgfortran/generated/minloc0_16_i8.c b/libgfortran/generated/minloc0_16_i8.c index e6c30fe9bc2..bf611b6b3c2 100644 --- a/libgfortran/generated/minloc0_16_i8.c +++ b/libgfortran/generated/minloc0_16_i8.c @@ -59,7 +59,7 @@ minloc0_16_i8 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -201,7 +201,7 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -368,7 +368,7 @@ sminloc0_16_i8 (gfc_array_i16 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_16)); 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)) { diff --git a/libgfortran/generated/minloc0_16_r10.c b/libgfortran/generated/minloc0_16_r10.c index f88cd72095b..fa6bc79aa84 100644 --- a/libgfortran/generated/minloc0_16_r10.c +++ b/libgfortran/generated/minloc0_16_r10.c @@ -59,7 +59,7 @@ minloc0_16_r10 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -201,7 +201,7 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -368,7 +368,7 @@ sminloc0_16_r10 (gfc_array_i16 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_16)); 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)) { diff --git a/libgfortran/generated/minloc0_16_r16.c b/libgfortran/generated/minloc0_16_r16.c index 36b90fb490e..b1ae2e1d1ec 100644 --- a/libgfortran/generated/minloc0_16_r16.c +++ b/libgfortran/generated/minloc0_16_r16.c @@ -59,7 +59,7 @@ minloc0_16_r16 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -201,7 +201,7 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -368,7 +368,7 @@ sminloc0_16_r16 (gfc_array_i16 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_16)); 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)) { diff --git a/libgfortran/generated/minloc0_16_r4.c b/libgfortran/generated/minloc0_16_r4.c index 373cdc526ac..0cbe3382531 100644 --- a/libgfortran/generated/minloc0_16_r4.c +++ b/libgfortran/generated/minloc0_16_r4.c @@ -59,7 +59,7 @@ minloc0_16_r4 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -201,7 +201,7 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -368,7 +368,7 @@ sminloc0_16_r4 (gfc_array_i16 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_16)); 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)) { diff --git a/libgfortran/generated/minloc0_16_r8.c b/libgfortran/generated/minloc0_16_r8.c index b52873302c4..40f33c3af20 100644 --- a/libgfortran/generated/minloc0_16_r8.c +++ b/libgfortran/generated/minloc0_16_r8.c @@ -59,7 +59,7 @@ minloc0_16_r8 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -201,7 +201,7 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -368,7 +368,7 @@ sminloc0_16_r8 (gfc_array_i16 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_16)); 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)) { diff --git a/libgfortran/generated/minloc0_4_i1.c b/libgfortran/generated/minloc0_4_i1.c index 5ff676379af..6e88e0077fc 100644 --- a/libgfortran/generated/minloc0_4_i1.c +++ b/libgfortran/generated/minloc0_4_i1.c @@ -59,7 +59,7 @@ minloc0_4_i1 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -201,7 +201,7 @@ mminloc0_4_i1 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -368,7 +368,7 @@ sminloc0_4_i1 (gfc_array_i4 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_4)); 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)) { diff --git a/libgfortran/generated/minloc0_4_i16.c b/libgfortran/generated/minloc0_4_i16.c index 653aa48be9f..62399930b3b 100644 --- a/libgfortran/generated/minloc0_4_i16.c +++ b/libgfortran/generated/minloc0_4_i16.c @@ -59,7 +59,7 @@ minloc0_4_i16 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -201,7 +201,7 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -368,7 +368,7 @@ sminloc0_4_i16 (gfc_array_i4 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_4)); 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)) { diff --git a/libgfortran/generated/minloc0_4_i2.c b/libgfortran/generated/minloc0_4_i2.c index 42d0431fbd4..9f9ec121fbb 100644 --- a/libgfortran/generated/minloc0_4_i2.c +++ b/libgfortran/generated/minloc0_4_i2.c @@ -59,7 +59,7 @@ minloc0_4_i2 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -201,7 +201,7 @@ mminloc0_4_i2 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -368,7 +368,7 @@ sminloc0_4_i2 (gfc_array_i4 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_4)); 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)) { diff --git a/libgfortran/generated/minloc0_4_i4.c b/libgfortran/generated/minloc0_4_i4.c index 6f983af4339..05cdab8929d 100644 --- a/libgfortran/generated/minloc0_4_i4.c +++ b/libgfortran/generated/minloc0_4_i4.c @@ -59,7 +59,7 @@ minloc0_4_i4 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -201,7 +201,7 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -368,7 +368,7 @@ sminloc0_4_i4 (gfc_array_i4 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_4)); 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)) { diff --git a/libgfortran/generated/minloc0_4_i8.c b/libgfortran/generated/minloc0_4_i8.c index 51875aacb75..b8602cad787 100644 --- a/libgfortran/generated/minloc0_4_i8.c +++ b/libgfortran/generated/minloc0_4_i8.c @@ -59,7 +59,7 @@ minloc0_4_i8 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -201,7 +201,7 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -368,7 +368,7 @@ sminloc0_4_i8 (gfc_array_i4 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_4)); 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)) { diff --git a/libgfortran/generated/minloc0_4_r10.c b/libgfortran/generated/minloc0_4_r10.c index 31c7fa722ee..b30bb8633f0 100644 --- a/libgfortran/generated/minloc0_4_r10.c +++ b/libgfortran/generated/minloc0_4_r10.c @@ -59,7 +59,7 @@ minloc0_4_r10 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -201,7 +201,7 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -368,7 +368,7 @@ sminloc0_4_r10 (gfc_array_i4 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_4)); 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)) { diff --git a/libgfortran/generated/minloc0_4_r16.c b/libgfortran/generated/minloc0_4_r16.c index 826c0687301..721d39cdca9 100644 --- a/libgfortran/generated/minloc0_4_r16.c +++ b/libgfortran/generated/minloc0_4_r16.c @@ -59,7 +59,7 @@ minloc0_4_r16 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -201,7 +201,7 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -368,7 +368,7 @@ sminloc0_4_r16 (gfc_array_i4 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_4)); 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)) { diff --git a/libgfortran/generated/minloc0_4_r4.c b/libgfortran/generated/minloc0_4_r4.c index 05631387e83..2babc439f01 100644 --- a/libgfortran/generated/minloc0_4_r4.c +++ b/libgfortran/generated/minloc0_4_r4.c @@ -59,7 +59,7 @@ minloc0_4_r4 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -201,7 +201,7 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -368,7 +368,7 @@ sminloc0_4_r4 (gfc_array_i4 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_4)); 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)) { diff --git a/libgfortran/generated/minloc0_4_r8.c b/libgfortran/generated/minloc0_4_r8.c index d3400301f60..ff8ff5f6cf0 100644 --- a/libgfortran/generated/minloc0_4_r8.c +++ b/libgfortran/generated/minloc0_4_r8.c @@ -59,7 +59,7 @@ minloc0_4_r8 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -201,7 +201,7 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -368,7 +368,7 @@ sminloc0_4_r8 (gfc_array_i4 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_4)); 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)) { diff --git a/libgfortran/generated/minloc0_8_i1.c b/libgfortran/generated/minloc0_8_i1.c index 13f5b80503e..3c8700e4204 100644 --- a/libgfortran/generated/minloc0_8_i1.c +++ b/libgfortran/generated/minloc0_8_i1.c @@ -59,7 +59,7 @@ minloc0_8_i1 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -201,7 +201,7 @@ mminloc0_8_i1 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -368,7 +368,7 @@ sminloc0_8_i1 (gfc_array_i8 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_8)); 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)) { diff --git a/libgfortran/generated/minloc0_8_i16.c b/libgfortran/generated/minloc0_8_i16.c index d494c677bd6..945ec4c9c8f 100644 --- a/libgfortran/generated/minloc0_8_i16.c +++ b/libgfortran/generated/minloc0_8_i16.c @@ -59,7 +59,7 @@ minloc0_8_i16 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -201,7 +201,7 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -368,7 +368,7 @@ sminloc0_8_i16 (gfc_array_i8 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_8)); 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)) { diff --git a/libgfortran/generated/minloc0_8_i2.c b/libgfortran/generated/minloc0_8_i2.c index 1da598a97e0..2511b339af3 100644 --- a/libgfortran/generated/minloc0_8_i2.c +++ b/libgfortran/generated/minloc0_8_i2.c @@ -59,7 +59,7 @@ minloc0_8_i2 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -201,7 +201,7 @@ mminloc0_8_i2 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -368,7 +368,7 @@ sminloc0_8_i2 (gfc_array_i8 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_8)); 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)) { diff --git a/libgfortran/generated/minloc0_8_i4.c b/libgfortran/generated/minloc0_8_i4.c index c5ed118b8cd..58fe1023518 100644 --- a/libgfortran/generated/minloc0_8_i4.c +++ b/libgfortran/generated/minloc0_8_i4.c @@ -59,7 +59,7 @@ minloc0_8_i4 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -201,7 +201,7 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -368,7 +368,7 @@ sminloc0_8_i4 (gfc_array_i8 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_8)); 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)) { diff --git a/libgfortran/generated/minloc0_8_i8.c b/libgfortran/generated/minloc0_8_i8.c index 4cec8e2ea06..f1bc31e2e29 100644 --- a/libgfortran/generated/minloc0_8_i8.c +++ b/libgfortran/generated/minloc0_8_i8.c @@ -59,7 +59,7 @@ minloc0_8_i8 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -201,7 +201,7 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -368,7 +368,7 @@ sminloc0_8_i8 (gfc_array_i8 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_8)); 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)) { diff --git a/libgfortran/generated/minloc0_8_r10.c b/libgfortran/generated/minloc0_8_r10.c index 9f576509e01..e2bf5273b7a 100644 --- a/libgfortran/generated/minloc0_8_r10.c +++ b/libgfortran/generated/minloc0_8_r10.c @@ -59,7 +59,7 @@ minloc0_8_r10 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -201,7 +201,7 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -368,7 +368,7 @@ sminloc0_8_r10 (gfc_array_i8 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_8)); 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)) { diff --git a/libgfortran/generated/minloc0_8_r16.c b/libgfortran/generated/minloc0_8_r16.c index 12efc36e40f..dbe35d08cad 100644 --- a/libgfortran/generated/minloc0_8_r16.c +++ b/libgfortran/generated/minloc0_8_r16.c @@ -59,7 +59,7 @@ minloc0_8_r16 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -201,7 +201,7 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -368,7 +368,7 @@ sminloc0_8_r16 (gfc_array_i8 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_8)); 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)) { diff --git a/libgfortran/generated/minloc0_8_r4.c b/libgfortran/generated/minloc0_8_r4.c index 8ff779f3b72..2db1a110fb3 100644 --- a/libgfortran/generated/minloc0_8_r4.c +++ b/libgfortran/generated/minloc0_8_r4.c @@ -59,7 +59,7 @@ minloc0_8_r4 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -201,7 +201,7 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -368,7 +368,7 @@ sminloc0_8_r4 (gfc_array_i8 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_8)); 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)) { diff --git a/libgfortran/generated/minloc0_8_r8.c b/libgfortran/generated/minloc0_8_r8.c index aad978ad7c4..2a492c6f1b8 100644 --- a/libgfortran/generated/minloc0_8_r8.c +++ b/libgfortran/generated/minloc0_8_r8.c @@ -59,7 +59,7 @@ minloc0_8_r8 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -201,7 +201,7 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -368,7 +368,7 @@ sminloc0_8_r8 (gfc_array_i8 * const restrict retarray, { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (GFC_INTEGER_8)); 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)) { diff --git a/libgfortran/generated/minloc1_16_i1.c b/libgfortran/generated/minloc1_16_i1.c index 7f05bae4a35..a9ef738c4f7 100644 --- a/libgfortran/generated/minloc1_16_i1.c +++ b/libgfortran/generated/minloc1_16_i1.c @@ -99,10 +99,9 @@ minloc1_16_i1 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_16_i1 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_16_i16.c b/libgfortran/generated/minloc1_16_i16.c index 4172c62d790..f4b422aea62 100644 --- a/libgfortran/generated/minloc1_16_i16.c +++ b/libgfortran/generated/minloc1_16_i16.c @@ -99,10 +99,9 @@ minloc1_16_i16 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_16_i16 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_16_i2.c b/libgfortran/generated/minloc1_16_i2.c index dd80c0060b6..a035ef35ef2 100644 --- a/libgfortran/generated/minloc1_16_i2.c +++ b/libgfortran/generated/minloc1_16_i2.c @@ -99,10 +99,9 @@ minloc1_16_i2 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_16_i2 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_16_i4.c b/libgfortran/generated/minloc1_16_i4.c index 9104a4f095e..71140968e5b 100644 --- a/libgfortran/generated/minloc1_16_i4.c +++ b/libgfortran/generated/minloc1_16_i4.c @@ -99,10 +99,9 @@ minloc1_16_i4 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_16_i4 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_16_i8.c b/libgfortran/generated/minloc1_16_i8.c index d7d220c25f0..a9a1f0a571e 100644 --- a/libgfortran/generated/minloc1_16_i8.c +++ b/libgfortran/generated/minloc1_16_i8.c @@ -99,10 +99,9 @@ minloc1_16_i8 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_16_i8 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_16_r10.c b/libgfortran/generated/minloc1_16_r10.c index 94c271d81cc..95f6b9263a8 100644 --- a/libgfortran/generated/minloc1_16_r10.c +++ b/libgfortran/generated/minloc1_16_r10.c @@ -99,10 +99,9 @@ minloc1_16_r10 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_16_r10 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_16_r16.c b/libgfortran/generated/minloc1_16_r16.c index 9292f1addf5..26f7f4cfd65 100644 --- a/libgfortran/generated/minloc1_16_r16.c +++ b/libgfortran/generated/minloc1_16_r16.c @@ -99,10 +99,9 @@ minloc1_16_r16 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_16_r16 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_16_r4.c b/libgfortran/generated/minloc1_16_r4.c index 6a928fd01fd..81149b6e4b9 100644 --- a/libgfortran/generated/minloc1_16_r4.c +++ b/libgfortran/generated/minloc1_16_r4.c @@ -99,10 +99,9 @@ minloc1_16_r4 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_16_r4 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_16_r8.c b/libgfortran/generated/minloc1_16_r8.c index 858ed975999..3404c2493a9 100644 --- a/libgfortran/generated/minloc1_16_r8.c +++ b/libgfortran/generated/minloc1_16_r8.c @@ -99,10 +99,9 @@ minloc1_16_r8 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_16_r8 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_4_i1.c b/libgfortran/generated/minloc1_4_i1.c index 024668e8f15..b71337b6745 100644 --- a/libgfortran/generated/minloc1_4_i1.c +++ b/libgfortran/generated/minloc1_4_i1.c @@ -99,10 +99,9 @@ minloc1_4_i1 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_4_i1 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_4_i16.c b/libgfortran/generated/minloc1_4_i16.c index f721e419bbf..1fb9219ff34 100644 --- a/libgfortran/generated/minloc1_4_i16.c +++ b/libgfortran/generated/minloc1_4_i16.c @@ -99,10 +99,9 @@ minloc1_4_i16 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_4_i16 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_4_i2.c b/libgfortran/generated/minloc1_4_i2.c index e0e8a9eccf0..e61bf95ab5f 100644 --- a/libgfortran/generated/minloc1_4_i2.c +++ b/libgfortran/generated/minloc1_4_i2.c @@ -99,10 +99,9 @@ minloc1_4_i2 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_4_i2 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_4_i4.c b/libgfortran/generated/minloc1_4_i4.c index 303c7128100..64cf2daa98a 100644 --- a/libgfortran/generated/minloc1_4_i4.c +++ b/libgfortran/generated/minloc1_4_i4.c @@ -99,10 +99,9 @@ minloc1_4_i4 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_4_i4 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_4_i8.c b/libgfortran/generated/minloc1_4_i8.c index e6bbc3851e5..ab74930c337 100644 --- a/libgfortran/generated/minloc1_4_i8.c +++ b/libgfortran/generated/minloc1_4_i8.c @@ -99,10 +99,9 @@ minloc1_4_i8 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_4_i8 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_4_r10.c b/libgfortran/generated/minloc1_4_r10.c index adb55fc53b5..fd0b874a90b 100644 --- a/libgfortran/generated/minloc1_4_r10.c +++ b/libgfortran/generated/minloc1_4_r10.c @@ -99,10 +99,9 @@ minloc1_4_r10 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_4_r10 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_4_r16.c b/libgfortran/generated/minloc1_4_r16.c index 840da057346..186f18b993f 100644 --- a/libgfortran/generated/minloc1_4_r16.c +++ b/libgfortran/generated/minloc1_4_r16.c @@ -99,10 +99,9 @@ minloc1_4_r16 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_4_r16 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_4_r4.c b/libgfortran/generated/minloc1_4_r4.c index b32fd1e102e..939692473ed 100644 --- a/libgfortran/generated/minloc1_4_r4.c +++ b/libgfortran/generated/minloc1_4_r4.c @@ -99,10 +99,9 @@ minloc1_4_r4 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_4_r4 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_4_r8.c b/libgfortran/generated/minloc1_4_r8.c index a4c44ee8527..dce1851b005 100644 --- a/libgfortran/generated/minloc1_4_r8.c +++ b/libgfortran/generated/minloc1_4_r8.c @@ -99,10 +99,9 @@ minloc1_4_r8 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_4_r8 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_8_i1.c b/libgfortran/generated/minloc1_8_i1.c index 9968a5e514b..0c43c925c35 100644 --- a/libgfortran/generated/minloc1_8_i1.c +++ b/libgfortran/generated/minloc1_8_i1.c @@ -99,10 +99,9 @@ minloc1_8_i1 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_8_i1 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_8_i16.c b/libgfortran/generated/minloc1_8_i16.c index ad401954bf6..f0d218134cb 100644 --- a/libgfortran/generated/minloc1_8_i16.c +++ b/libgfortran/generated/minloc1_8_i16.c @@ -99,10 +99,9 @@ minloc1_8_i16 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_8_i16 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_8_i2.c b/libgfortran/generated/minloc1_8_i2.c index d35843c632d..fe5ffd876ec 100644 --- a/libgfortran/generated/minloc1_8_i2.c +++ b/libgfortran/generated/minloc1_8_i2.c @@ -99,10 +99,9 @@ minloc1_8_i2 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_8_i2 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_8_i4.c b/libgfortran/generated/minloc1_8_i4.c index d49715bffe6..30097d0b307 100644 --- a/libgfortran/generated/minloc1_8_i4.c +++ b/libgfortran/generated/minloc1_8_i4.c @@ -99,10 +99,9 @@ minloc1_8_i4 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_8_i4 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_8_i8.c b/libgfortran/generated/minloc1_8_i8.c index 3ae55851f95..76e4c11df2a 100644 --- a/libgfortran/generated/minloc1_8_i8.c +++ b/libgfortran/generated/minloc1_8_i8.c @@ -99,10 +99,9 @@ minloc1_8_i8 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_8_i8 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_8_r10.c b/libgfortran/generated/minloc1_8_r10.c index 374cdabec88..df42b81cd5f 100644 --- a/libgfortran/generated/minloc1_8_r10.c +++ b/libgfortran/generated/minloc1_8_r10.c @@ -99,10 +99,9 @@ minloc1_8_r10 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_8_r10 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_8_r16.c b/libgfortran/generated/minloc1_8_r16.c index 0fd75d04213..d10725402c0 100644 --- a/libgfortran/generated/minloc1_8_r16.c +++ b/libgfortran/generated/minloc1_8_r16.c @@ -99,10 +99,9 @@ minloc1_8_r16 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_8_r16 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_8_r4.c b/libgfortran/generated/minloc1_8_r4.c index 515e66f4be7..77450ac6b52 100644 --- a/libgfortran/generated/minloc1_8_r4.c +++ b/libgfortran/generated/minloc1_8_r4.c @@ -99,10 +99,9 @@ minloc1_8_r4 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_8_r4 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minloc1_8_r8.c b/libgfortran/generated/minloc1_8_r8.c index 5da6fb6449c..ce72c0de849 100644 --- a/libgfortran/generated/minloc1_8_r8.c +++ b/libgfortran/generated/minloc1_8_r8.c @@ -99,10 +99,9 @@ minloc1_8_r8 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -295,8 +294,7 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -309,7 +307,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 @@ -487,8 +485,7 @@ sminloc1_8_r8 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -497,7 +494,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 { diff --git a/libgfortran/generated/minval_i1.c b/libgfortran/generated/minval_i1.c index 327b51da069..723aa549de0 100644 --- a/libgfortran/generated/minval_i1.c +++ b/libgfortran/generated/minval_i1.c @@ -98,10 +98,9 @@ minval_i1 (gfc_array_i1 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -287,8 +286,7 @@ mminval_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -301,7 +299,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 @@ -474,8 +472,7 @@ sminval_i1 (gfc_array_i1 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -484,7 +481,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 { diff --git a/libgfortran/generated/minval_i16.c b/libgfortran/generated/minval_i16.c index 846498526fb..2679fc86945 100644 --- a/libgfortran/generated/minval_i16.c +++ b/libgfortran/generated/minval_i16.c @@ -98,10 +98,9 @@ minval_i16 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -287,8 +286,7 @@ mminval_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -301,7 +299,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 @@ -474,8 +472,7 @@ sminval_i16 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -484,7 +481,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 { diff --git a/libgfortran/generated/minval_i2.c b/libgfortran/generated/minval_i2.c index 3dbb4a50767..b18c4331b91 100644 --- a/libgfortran/generated/minval_i2.c +++ b/libgfortran/generated/minval_i2.c @@ -98,10 +98,9 @@ minval_i2 (gfc_array_i2 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -287,8 +286,7 @@ mminval_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -301,7 +299,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 @@ -474,8 +472,7 @@ sminval_i2 (gfc_array_i2 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -484,7 +481,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 { diff --git a/libgfortran/generated/minval_i4.c b/libgfortran/generated/minval_i4.c index f0b56f5cba5..adebe0c26cd 100644 --- a/libgfortran/generated/minval_i4.c +++ b/libgfortran/generated/minval_i4.c @@ -98,10 +98,9 @@ minval_i4 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -287,8 +286,7 @@ mminval_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -301,7 +299,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 @@ -474,8 +472,7 @@ sminval_i4 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -484,7 +481,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 { diff --git a/libgfortran/generated/minval_i8.c b/libgfortran/generated/minval_i8.c index 57d1cae1963..764d4649f41 100644 --- a/libgfortran/generated/minval_i8.c +++ b/libgfortran/generated/minval_i8.c @@ -98,10 +98,9 @@ minval_i8 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -287,8 +286,7 @@ mminval_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -301,7 +299,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 @@ -474,8 +472,7 @@ sminval_i8 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -484,7 +481,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 { diff --git a/libgfortran/generated/minval_r10.c b/libgfortran/generated/minval_r10.c index f91a77354df..091919be105 100644 --- a/libgfortran/generated/minval_r10.c +++ b/libgfortran/generated/minval_r10.c @@ -98,10 +98,9 @@ minval_r10 (gfc_array_r10 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -287,8 +286,7 @@ mminval_r10 (gfc_array_r10 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -301,7 +299,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 @@ -474,8 +472,7 @@ sminval_r10 (gfc_array_r10 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -484,7 +481,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 { diff --git a/libgfortran/generated/minval_r16.c b/libgfortran/generated/minval_r16.c index 9791f4a5ba2..0f270d55701 100644 --- a/libgfortran/generated/minval_r16.c +++ b/libgfortran/generated/minval_r16.c @@ -98,10 +98,9 @@ minval_r16 (gfc_array_r16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -287,8 +286,7 @@ mminval_r16 (gfc_array_r16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -301,7 +299,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 @@ -474,8 +472,7 @@ sminval_r16 (gfc_array_r16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -484,7 +481,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 { diff --git a/libgfortran/generated/minval_r4.c b/libgfortran/generated/minval_r4.c index b7ec6585ff5..8e7068348db 100644 --- a/libgfortran/generated/minval_r4.c +++ b/libgfortran/generated/minval_r4.c @@ -98,10 +98,9 @@ minval_r4 (gfc_array_r4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -287,8 +286,7 @@ mminval_r4 (gfc_array_r4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -301,7 +299,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 @@ -474,8 +472,7 @@ sminval_r4 (gfc_array_r4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -484,7 +481,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 { diff --git a/libgfortran/generated/minval_r8.c b/libgfortran/generated/minval_r8.c index f2160bfba02..99523caad2f 100644 --- a/libgfortran/generated/minval_r8.c +++ b/libgfortran/generated/minval_r8.c @@ -98,10 +98,9 @@ minval_r8 (gfc_array_r8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -287,8 +286,7 @@ mminval_r8 (gfc_array_r8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -301,7 +299,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 @@ -474,8 +472,7 @@ sminval_r8 (gfc_array_r8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -484,7 +481,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 { diff --git a/libgfortran/generated/norm2_r10.c b/libgfortran/generated/norm2_r10.c index 32845671e36..d414e6dadea 100644 --- a/libgfortran/generated/norm2_r10.c +++ b/libgfortran/generated/norm2_r10.c @@ -102,10 +102,9 @@ norm2_r10 (gfc_array_r10 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ diff --git a/libgfortran/generated/norm2_r16.c b/libgfortran/generated/norm2_r16.c index 395ffb14012..da4445a35d2 100644 --- a/libgfortran/generated/norm2_r16.c +++ b/libgfortran/generated/norm2_r16.c @@ -106,10 +106,9 @@ norm2_r16 (gfc_array_r16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ diff --git a/libgfortran/generated/norm2_r4.c b/libgfortran/generated/norm2_r4.c index 493068e7cb8..5e7a2b9382b 100644 --- a/libgfortran/generated/norm2_r4.c +++ b/libgfortran/generated/norm2_r4.c @@ -102,10 +102,9 @@ norm2_r4 (gfc_array_r4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ diff --git a/libgfortran/generated/norm2_r8.c b/libgfortran/generated/norm2_r8.c index 9eededdf726..f96f8a45ac5 100644 --- a/libgfortran/generated/norm2_r8.c +++ b/libgfortran/generated/norm2_r8.c @@ -102,10 +102,9 @@ norm2_r8 (gfc_array_r8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ diff --git a/libgfortran/generated/pack_c10.c b/libgfortran/generated/pack_c10.c index 53f7b5d8015..28ecabf8cd0 100644 --- a/libgfortran/generated/pack_c10.c +++ b/libgfortran/generated/pack_c10.c @@ -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; diff --git a/libgfortran/generated/pack_c16.c b/libgfortran/generated/pack_c16.c index 5ca18035cf5..05e0fc3525e 100644 --- a/libgfortran/generated/pack_c16.c +++ b/libgfortran/generated/pack_c16.c @@ -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; diff --git a/libgfortran/generated/pack_c4.c b/libgfortran/generated/pack_c4.c index df561b657a4..39695ada844 100644 --- a/libgfortran/generated/pack_c4.c +++ b/libgfortran/generated/pack_c4.c @@ -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; diff --git a/libgfortran/generated/pack_c8.c b/libgfortran/generated/pack_c8.c index 2ce7e2e0bba..f3478e7ce8e 100644 --- a/libgfortran/generated/pack_c8.c +++ b/libgfortran/generated/pack_c8.c @@ -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; diff --git a/libgfortran/generated/pack_i1.c b/libgfortran/generated/pack_i1.c index 4893d4a1b33..e87ef18730d 100644 --- a/libgfortran/generated/pack_i1.c +++ b/libgfortran/generated/pack_i1.c @@ -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; diff --git a/libgfortran/generated/pack_i16.c b/libgfortran/generated/pack_i16.c index 94bf7688306..d57d303ccd8 100644 --- a/libgfortran/generated/pack_i16.c +++ b/libgfortran/generated/pack_i16.c @@ -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; diff --git a/libgfortran/generated/pack_i2.c b/libgfortran/generated/pack_i2.c index e15f4cd7dcd..4059e21c9a4 100644 --- a/libgfortran/generated/pack_i2.c +++ b/libgfortran/generated/pack_i2.c @@ -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; diff --git a/libgfortran/generated/pack_i4.c b/libgfortran/generated/pack_i4.c index 808badb00fe..190095e8fbe 100644 --- a/libgfortran/generated/pack_i4.c +++ b/libgfortran/generated/pack_i4.c @@ -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; diff --git a/libgfortran/generated/pack_i8.c b/libgfortran/generated/pack_i8.c index 4297be155f2..a9d2f9d11e7 100644 --- a/libgfortran/generated/pack_i8.c +++ b/libgfortran/generated/pack_i8.c @@ -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; diff --git a/libgfortran/generated/pack_r10.c b/libgfortran/generated/pack_r10.c index 9c9d57c1489..e89c5298962 100644 --- a/libgfortran/generated/pack_r10.c +++ b/libgfortran/generated/pack_r10.c @@ -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; diff --git a/libgfortran/generated/pack_r16.c b/libgfortran/generated/pack_r16.c index 9bc76910a0f..4b3e7561526 100644 --- a/libgfortran/generated/pack_r16.c +++ b/libgfortran/generated/pack_r16.c @@ -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; diff --git a/libgfortran/generated/pack_r4.c b/libgfortran/generated/pack_r4.c index 6cf3d608e24..14e7914f68e 100644 --- a/libgfortran/generated/pack_r4.c +++ b/libgfortran/generated/pack_r4.c @@ -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; diff --git a/libgfortran/generated/pack_r8.c b/libgfortran/generated/pack_r8.c index 623c31c6c9f..07e29f7c5b1 100644 --- a/libgfortran/generated/pack_r8.c +++ b/libgfortran/generated/pack_r8.c @@ -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; diff --git a/libgfortran/generated/parity_l1.c b/libgfortran/generated/parity_l1.c index d9f0bfbc7f7..615a744b0d1 100644 --- a/libgfortran/generated/parity_l1.c +++ b/libgfortran/generated/parity_l1.c @@ -99,10 +99,9 @@ parity_l1 (gfc_array_l1 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ diff --git a/libgfortran/generated/parity_l16.c b/libgfortran/generated/parity_l16.c index 2c5dec8a5ce..dd7d69a830c 100644 --- a/libgfortran/generated/parity_l16.c +++ b/libgfortran/generated/parity_l16.c @@ -99,10 +99,9 @@ parity_l16 (gfc_array_l16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ diff --git a/libgfortran/generated/parity_l2.c b/libgfortran/generated/parity_l2.c index ec1786d82fe..7a64c1891e4 100644 --- a/libgfortran/generated/parity_l2.c +++ b/libgfortran/generated/parity_l2.c @@ -99,10 +99,9 @@ parity_l2 (gfc_array_l2 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ diff --git a/libgfortran/generated/parity_l4.c b/libgfortran/generated/parity_l4.c index 1604bbcc373..11e0bbf67be 100644 --- a/libgfortran/generated/parity_l4.c +++ b/libgfortran/generated/parity_l4.c @@ -99,10 +99,9 @@ parity_l4 (gfc_array_l4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ diff --git a/libgfortran/generated/parity_l8.c b/libgfortran/generated/parity_l8.c index a3a4152126d..ac131918caf 100644 --- a/libgfortran/generated/parity_l8.c +++ b/libgfortran/generated/parity_l8.c @@ -99,10 +99,9 @@ parity_l8 (gfc_array_l8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ diff --git a/libgfortran/generated/product_c10.c b/libgfortran/generated/product_c10.c index feaba8ab546..5607dbe75cf 100644 --- a/libgfortran/generated/product_c10.c +++ b/libgfortran/generated/product_c10.c @@ -98,10 +98,9 @@ product_c10 (gfc_array_c10 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ sproduct_c10 (gfc_array_c10 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/product_c16.c b/libgfortran/generated/product_c16.c index 338ce75d36e..c0c972cc295 100644 --- a/libgfortran/generated/product_c16.c +++ b/libgfortran/generated/product_c16.c @@ -98,10 +98,9 @@ product_c16 (gfc_array_c16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ sproduct_c16 (gfc_array_c16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/product_c4.c b/libgfortran/generated/product_c4.c index 86fa19a38ad..b61635dd463 100644 --- a/libgfortran/generated/product_c4.c +++ b/libgfortran/generated/product_c4.c @@ -98,10 +98,9 @@ product_c4 (gfc_array_c4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ sproduct_c4 (gfc_array_c4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/product_c8.c b/libgfortran/generated/product_c8.c index ab043e2ec75..09d23b9be0e 100644 --- a/libgfortran/generated/product_c8.c +++ b/libgfortran/generated/product_c8.c @@ -98,10 +98,9 @@ product_c8 (gfc_array_c8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ sproduct_c8 (gfc_array_c8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/product_i1.c b/libgfortran/generated/product_i1.c index 8dbc761d466..23192cbea79 100644 --- a/libgfortran/generated/product_i1.c +++ b/libgfortran/generated/product_i1.c @@ -98,10 +98,9 @@ product_i1 (gfc_array_i1 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ sproduct_i1 (gfc_array_i1 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/product_i16.c b/libgfortran/generated/product_i16.c index 3499c70ac6f..56320078ffc 100644 --- a/libgfortran/generated/product_i16.c +++ b/libgfortran/generated/product_i16.c @@ -98,10 +98,9 @@ product_i16 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ sproduct_i16 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/product_i2.c b/libgfortran/generated/product_i2.c index 16a547cb4c1..a0b8129a320 100644 --- a/libgfortran/generated/product_i2.c +++ b/libgfortran/generated/product_i2.c @@ -98,10 +98,9 @@ product_i2 (gfc_array_i2 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ sproduct_i2 (gfc_array_i2 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/product_i4.c b/libgfortran/generated/product_i4.c index b78a96f11cb..84f0d5c503f 100644 --- a/libgfortran/generated/product_i4.c +++ b/libgfortran/generated/product_i4.c @@ -98,10 +98,9 @@ product_i4 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ sproduct_i4 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/product_i8.c b/libgfortran/generated/product_i8.c index 7c5641727fa..b381eda82ab 100644 --- a/libgfortran/generated/product_i8.c +++ b/libgfortran/generated/product_i8.c @@ -98,10 +98,9 @@ product_i8 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ sproduct_i8 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/product_r10.c b/libgfortran/generated/product_r10.c index c504714185b..65229926f6e 100644 --- a/libgfortran/generated/product_r10.c +++ b/libgfortran/generated/product_r10.c @@ -98,10 +98,9 @@ product_r10 (gfc_array_r10 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ sproduct_r10 (gfc_array_r10 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/product_r16.c b/libgfortran/generated/product_r16.c index 0a95f5ab425..13891a0fccc 100644 --- a/libgfortran/generated/product_r16.c +++ b/libgfortran/generated/product_r16.c @@ -98,10 +98,9 @@ product_r16 (gfc_array_r16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ sproduct_r16 (gfc_array_r16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/product_r4.c b/libgfortran/generated/product_r4.c index d6e8740ebdd..5d9a573f01c 100644 --- a/libgfortran/generated/product_r4.c +++ b/libgfortran/generated/product_r4.c @@ -98,10 +98,9 @@ product_r4 (gfc_array_r4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ sproduct_r4 (gfc_array_r4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/product_r8.c b/libgfortran/generated/product_r8.c index 956fce70016..cdc3a5e9fc2 100644 --- a/libgfortran/generated/product_r8.c +++ b/libgfortran/generated/product_r8.c @@ -98,10 +98,9 @@ product_r8 (gfc_array_r8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ sproduct_r8 (gfc_array_r8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/reshape_c10.c b/libgfortran/generated/reshape_c10.c index 026c71b7e0f..45914ab8b4e 100644 --- a/libgfortran/generated/reshape_c10.c +++ b/libgfortran/generated/reshape_c10.c @@ -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; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); ret->elem_len = source->elem_len; ret->type = source->type; } diff --git a/libgfortran/generated/reshape_c16.c b/libgfortran/generated/reshape_c16.c index 518b2663811..517c672aab3 100644 --- a/libgfortran/generated/reshape_c16.c +++ b/libgfortran/generated/reshape_c16.c @@ -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; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); ret->elem_len = source->elem_len; ret->type = source->type; } diff --git a/libgfortran/generated/reshape_c4.c b/libgfortran/generated/reshape_c4.c index 352b0de164d..81f0e539d10 100644 --- a/libgfortran/generated/reshape_c4.c +++ b/libgfortran/generated/reshape_c4.c @@ -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; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); ret->elem_len = source->elem_len; ret->type = source->type; } diff --git a/libgfortran/generated/reshape_c8.c b/libgfortran/generated/reshape_c8.c index 9a2e180b64b..d91dcae432b 100644 --- a/libgfortran/generated/reshape_c8.c +++ b/libgfortran/generated/reshape_c8.c @@ -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; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); ret->elem_len = source->elem_len; ret->type = source->type; } diff --git a/libgfortran/generated/reshape_i16.c b/libgfortran/generated/reshape_i16.c index d7c3457c83f..b43a841b7c9 100644 --- a/libgfortran/generated/reshape_i16.c +++ b/libgfortran/generated/reshape_i16.c @@ -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; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); ret->elem_len = source->elem_len; ret->type = source->type; } diff --git a/libgfortran/generated/reshape_i4.c b/libgfortran/generated/reshape_i4.c index 8d26e1847d2..01f5b34b1e3 100644 --- a/libgfortran/generated/reshape_i4.c +++ b/libgfortran/generated/reshape_i4.c @@ -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; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); ret->elem_len = source->elem_len; ret->type = source->type; } diff --git a/libgfortran/generated/reshape_i8.c b/libgfortran/generated/reshape_i8.c index c91eee0eb94..63ecd497926 100644 --- a/libgfortran/generated/reshape_i8.c +++ b/libgfortran/generated/reshape_i8.c @@ -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; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); ret->elem_len = source->elem_len; ret->type = source->type; } diff --git a/libgfortran/generated/reshape_r10.c b/libgfortran/generated/reshape_r10.c index c3e750d2bf7..2f1a552c50c 100644 --- a/libgfortran/generated/reshape_r10.c +++ b/libgfortran/generated/reshape_r10.c @@ -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; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); ret->elem_len = source->elem_len; ret->type = source->type; } diff --git a/libgfortran/generated/reshape_r16.c b/libgfortran/generated/reshape_r16.c index 30454a6e6c1..31d8a0756c7 100644 --- a/libgfortran/generated/reshape_r16.c +++ b/libgfortran/generated/reshape_r16.c @@ -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; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); ret->elem_len = source->elem_len; ret->type = source->type; } diff --git a/libgfortran/generated/reshape_r4.c b/libgfortran/generated/reshape_r4.c index 225e941a0ff..8db329ba870 100644 --- a/libgfortran/generated/reshape_r4.c +++ b/libgfortran/generated/reshape_r4.c @@ -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; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); ret->elem_len = source->elem_len; ret->type = source->type; } diff --git a/libgfortran/generated/reshape_r8.c b/libgfortran/generated/reshape_r8.c index ebbbcbea56d..33b476830d7 100644 --- a/libgfortran/generated/reshape_r8.c +++ b/libgfortran/generated/reshape_r8.c @@ -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; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); ret->elem_len = source->elem_len; ret->type = source->type; } diff --git a/libgfortran/generated/shape_i16.c b/libgfortran/generated/shape_i16.c index a73b9b533b7..ccf3484fdb6 100644 --- a/libgfortran/generated/shape_i16.c +++ b/libgfortran/generated/shape_i16.c @@ -49,7 +49,7 @@ shape_16 (gfc_array_i16 * const restrict ret, { GFC_DIMENSION_SET(ret->dim[0], 0, rank, sizeof (GFC_INTEGER_16)); 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_TYPEKNOWN(ret,0); diff --git a/libgfortran/generated/shape_i4.c b/libgfortran/generated/shape_i4.c index b53f353d66c..1af330c7a1a 100644 --- a/libgfortran/generated/shape_i4.c +++ b/libgfortran/generated/shape_i4.c @@ -49,7 +49,7 @@ shape_4 (gfc_array_i4 * const restrict ret, { GFC_DIMENSION_SET(ret->dim[0], 0, rank, sizeof (GFC_INTEGER_4)); 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_TYPEKNOWN(ret,0); diff --git a/libgfortran/generated/shape_i8.c b/libgfortran/generated/shape_i8.c index 7b4dac61d9e..bec047d2e73 100644 --- a/libgfortran/generated/shape_i8.c +++ b/libgfortran/generated/shape_i8.c @@ -49,7 +49,7 @@ shape_8 (gfc_array_i8 * const restrict ret, { GFC_DIMENSION_SET(ret->dim[0], 0, rank, sizeof (GFC_INTEGER_8)); 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_TYPEKNOWN(ret,0); diff --git a/libgfortran/generated/spread_c10.c b/libgfortran/generated/spread_c10.c index 40c37f67c8f..ce9940ac14d 100644 --- a/libgfortran/generated/spread_c10.c +++ b/libgfortran/generated/spread_c10.c @@ -102,8 +102,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; } @@ -245,7 +245,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, sizeof (GFC_COMPLEX_10)); } diff --git a/libgfortran/generated/spread_c16.c b/libgfortran/generated/spread_c16.c index a8f344be752..4ed122ff25f 100644 --- a/libgfortran/generated/spread_c16.c +++ b/libgfortran/generated/spread_c16.c @@ -102,8 +102,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; } @@ -245,7 +245,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, sizeof (GFC_COMPLEX_16)); } diff --git a/libgfortran/generated/spread_c4.c b/libgfortran/generated/spread_c4.c index 38a6a75e68d..67a672a17a8 100644 --- a/libgfortran/generated/spread_c4.c +++ b/libgfortran/generated/spread_c4.c @@ -102,8 +102,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; } @@ -245,7 +245,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, sizeof (GFC_COMPLEX_4)); } diff --git a/libgfortran/generated/spread_c8.c b/libgfortran/generated/spread_c8.c index 17e1cd563b4..b01627e53be 100644 --- a/libgfortran/generated/spread_c8.c +++ b/libgfortran/generated/spread_c8.c @@ -102,8 +102,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; } @@ -245,7 +245,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, sizeof (GFC_COMPLEX_8)); } diff --git a/libgfortran/generated/spread_i1.c b/libgfortran/generated/spread_i1.c index 74375977fc3..875b8864eea 100644 --- a/libgfortran/generated/spread_i1.c +++ b/libgfortran/generated/spread_i1.c @@ -102,8 +102,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; } @@ -245,7 +245,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, sizeof (GFC_INTEGER_1)); } diff --git a/libgfortran/generated/spread_i16.c b/libgfortran/generated/spread_i16.c index 3be8937ce88..3690ceb2a4f 100644 --- a/libgfortran/generated/spread_i16.c +++ b/libgfortran/generated/spread_i16.c @@ -102,8 +102,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; } @@ -245,7 +245,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, sizeof (GFC_INTEGER_16)); } diff --git a/libgfortran/generated/spread_i2.c b/libgfortran/generated/spread_i2.c index 55288a40226..3f2f9ecbb30 100644 --- a/libgfortran/generated/spread_i2.c +++ b/libgfortran/generated/spread_i2.c @@ -102,8 +102,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; } @@ -245,7 +245,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, sizeof (GFC_INTEGER_2)); } diff --git a/libgfortran/generated/spread_i4.c b/libgfortran/generated/spread_i4.c index ea7e18d655e..92655d50b16 100644 --- a/libgfortran/generated/spread_i4.c +++ b/libgfortran/generated/spread_i4.c @@ -102,8 +102,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; } @@ -245,7 +245,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, sizeof (GFC_INTEGER_4)); } diff --git a/libgfortran/generated/spread_i8.c b/libgfortran/generated/spread_i8.c index 0b2e1a0bf8b..30f10d967f4 100644 --- a/libgfortran/generated/spread_i8.c +++ b/libgfortran/generated/spread_i8.c @@ -102,8 +102,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; } @@ -245,7 +245,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, sizeof (GFC_INTEGER_8)); } diff --git a/libgfortran/generated/spread_r10.c b/libgfortran/generated/spread_r10.c index 98cfd2022c8..8f59d131a5e 100644 --- a/libgfortran/generated/spread_r10.c +++ b/libgfortran/generated/spread_r10.c @@ -102,8 +102,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; } @@ -245,7 +245,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, sizeof (GFC_REAL_10)); } diff --git a/libgfortran/generated/spread_r16.c b/libgfortran/generated/spread_r16.c index a30dcdda42c..4a1a35e0f24 100644 --- a/libgfortran/generated/spread_r16.c +++ b/libgfortran/generated/spread_r16.c @@ -102,8 +102,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; } @@ -245,7 +245,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, sizeof (GFC_REAL_16)); } diff --git a/libgfortran/generated/spread_r4.c b/libgfortran/generated/spread_r4.c index faa619e882b..a3f9b48a693 100644 --- a/libgfortran/generated/spread_r4.c +++ b/libgfortran/generated/spread_r4.c @@ -102,8 +102,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; } @@ -245,7 +245,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, sizeof (GFC_REAL_4)); } diff --git a/libgfortran/generated/spread_r8.c b/libgfortran/generated/spread_r8.c index ece719cd56e..754bc40d2fc 100644 --- a/libgfortran/generated/spread_r8.c +++ b/libgfortran/generated/spread_r8.c @@ -102,8 +102,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; } @@ -245,7 +245,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, sizeof (GFC_REAL_8)); } diff --git a/libgfortran/generated/sum_c10.c b/libgfortran/generated/sum_c10.c index 46fa5539b8f..cebcc78b451 100644 --- a/libgfortran/generated/sum_c10.c +++ b/libgfortran/generated/sum_c10.c @@ -98,10 +98,9 @@ sum_c10 (gfc_array_c10 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ msum_c10 (gfc_array_c10 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ ssum_c10 (gfc_array_c10 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/sum_c16.c b/libgfortran/generated/sum_c16.c index 2c16e279fde..b913d926c33 100644 --- a/libgfortran/generated/sum_c16.c +++ b/libgfortran/generated/sum_c16.c @@ -98,10 +98,9 @@ sum_c16 (gfc_array_c16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ msum_c16 (gfc_array_c16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ ssum_c16 (gfc_array_c16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/sum_c4.c b/libgfortran/generated/sum_c4.c index 9ba84b5a56d..2e2eac0dd2b 100644 --- a/libgfortran/generated/sum_c4.c +++ b/libgfortran/generated/sum_c4.c @@ -98,10 +98,9 @@ sum_c4 (gfc_array_c4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ msum_c4 (gfc_array_c4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ ssum_c4 (gfc_array_c4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/sum_c8.c b/libgfortran/generated/sum_c8.c index 206467b2e39..150604d7777 100644 --- a/libgfortran/generated/sum_c8.c +++ b/libgfortran/generated/sum_c8.c @@ -98,10 +98,9 @@ sum_c8 (gfc_array_c8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ msum_c8 (gfc_array_c8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ ssum_c8 (gfc_array_c8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/sum_i1.c b/libgfortran/generated/sum_i1.c index dc92164e807..050763281fb 100644 --- a/libgfortran/generated/sum_i1.c +++ b/libgfortran/generated/sum_i1.c @@ -98,10 +98,9 @@ sum_i1 (gfc_array_i1 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ msum_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ ssum_i1 (gfc_array_i1 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/sum_i16.c b/libgfortran/generated/sum_i16.c index 7c70d68a9e9..ea5730edc5a 100644 --- a/libgfortran/generated/sum_i16.c +++ b/libgfortran/generated/sum_i16.c @@ -98,10 +98,9 @@ sum_i16 (gfc_array_i16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ msum_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ ssum_i16 (gfc_array_i16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/sum_i2.c b/libgfortran/generated/sum_i2.c index 060b1c27ead..39f82f003d0 100644 --- a/libgfortran/generated/sum_i2.c +++ b/libgfortran/generated/sum_i2.c @@ -98,10 +98,9 @@ sum_i2 (gfc_array_i2 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ msum_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ ssum_i2 (gfc_array_i2 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/sum_i4.c b/libgfortran/generated/sum_i4.c index 7551b2afc20..dc195f8da19 100644 --- a/libgfortran/generated/sum_i4.c +++ b/libgfortran/generated/sum_i4.c @@ -98,10 +98,9 @@ sum_i4 (gfc_array_i4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ msum_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ ssum_i4 (gfc_array_i4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/sum_i8.c b/libgfortran/generated/sum_i8.c index 0f344aea9d7..76e44858dec 100644 --- a/libgfortran/generated/sum_i8.c +++ b/libgfortran/generated/sum_i8.c @@ -98,10 +98,9 @@ sum_i8 (gfc_array_i8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ msum_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ ssum_i8 (gfc_array_i8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/sum_r10.c b/libgfortran/generated/sum_r10.c index 6557d67fa35..7d7d7d088a8 100644 --- a/libgfortran/generated/sum_r10.c +++ b/libgfortran/generated/sum_r10.c @@ -98,10 +98,9 @@ sum_r10 (gfc_array_r10 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ msum_r10 (gfc_array_r10 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ ssum_r10 (gfc_array_r10 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/sum_r16.c b/libgfortran/generated/sum_r16.c index d0c826b448b..1e591481d4e 100644 --- a/libgfortran/generated/sum_r16.c +++ b/libgfortran/generated/sum_r16.c @@ -98,10 +98,9 @@ sum_r16 (gfc_array_r16 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ msum_r16 (gfc_array_r16 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ ssum_r16 (gfc_array_r16 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/sum_r4.c b/libgfortran/generated/sum_r4.c index 8c700f184ae..f601117a739 100644 --- a/libgfortran/generated/sum_r4.c +++ b/libgfortran/generated/sum_r4.c @@ -98,10 +98,9 @@ sum_r4 (gfc_array_r4 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ msum_r4 (gfc_array_r4 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ ssum_r4 (gfc_array_r4 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/sum_r8.c b/libgfortran/generated/sum_r8.c index a2a6c3c5d53..98b43d1719f 100644 --- a/libgfortran/generated/sum_r8.c +++ b/libgfortran/generated/sum_r8.c @@ -98,10 +98,9 @@ sum_r8 (gfc_array_r8 * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -273,8 +272,7 @@ msum_r8 (gfc_array_r8 * const restrict retarray, } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -287,7 +285,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 @@ -432,8 +430,7 @@ ssum_r8 (gfc_array_r8 * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -442,7 +439,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 { diff --git a/libgfortran/generated/transpose_c10.c b/libgfortran/generated/transpose_c10.c index 2d9c84c9893..e746cef0e96 100644 --- a/libgfortran/generated/transpose_c10.c +++ b/libgfortran/generated/transpose_c10.c @@ -60,7 +60,8 @@ transpose_c10 (gfc_array_c10 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0), GFC_DESCRIPTOR_EXTENT(source, 1)*sizeof (GFC_COMPLEX_10)); - 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)) { diff --git a/libgfortran/generated/transpose_c16.c b/libgfortran/generated/transpose_c16.c index 99f963746aa..bd11080ce32 100644 --- a/libgfortran/generated/transpose_c16.c +++ b/libgfortran/generated/transpose_c16.c @@ -60,7 +60,8 @@ transpose_c16 (gfc_array_c16 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0), GFC_DESCRIPTOR_EXTENT(source, 1)*sizeof (GFC_COMPLEX_16)); - 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)) { diff --git a/libgfortran/generated/transpose_c4.c b/libgfortran/generated/transpose_c4.c index 6722b364914..edd62b3a63f 100644 --- a/libgfortran/generated/transpose_c4.c +++ b/libgfortran/generated/transpose_c4.c @@ -60,7 +60,8 @@ transpose_c4 (gfc_array_c4 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0), GFC_DESCRIPTOR_EXTENT(source, 1)*sizeof (GFC_COMPLEX_4)); - 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)) { diff --git a/libgfortran/generated/transpose_c8.c b/libgfortran/generated/transpose_c8.c index 422c6da41c3..014a9ef3298 100644 --- a/libgfortran/generated/transpose_c8.c +++ b/libgfortran/generated/transpose_c8.c @@ -60,7 +60,8 @@ transpose_c8 (gfc_array_c8 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0), GFC_DESCRIPTOR_EXTENT(source, 1)*sizeof (GFC_COMPLEX_8)); - 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)) { diff --git a/libgfortran/generated/transpose_i16.c b/libgfortran/generated/transpose_i16.c index 7993c20b5ca..76941458a39 100644 --- a/libgfortran/generated/transpose_i16.c +++ b/libgfortran/generated/transpose_i16.c @@ -60,7 +60,8 @@ transpose_i16 (gfc_array_i16 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0), GFC_DESCRIPTOR_EXTENT(source, 1)*sizeof (GFC_INTEGER_16)); - 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)) { diff --git a/libgfortran/generated/transpose_i4.c b/libgfortran/generated/transpose_i4.c index 395586b2bc4..0eb2ea414d2 100644 --- a/libgfortran/generated/transpose_i4.c +++ b/libgfortran/generated/transpose_i4.c @@ -60,7 +60,8 @@ transpose_i4 (gfc_array_i4 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0), GFC_DESCRIPTOR_EXTENT(source, 1)*sizeof (GFC_INTEGER_4)); - 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)) { diff --git a/libgfortran/generated/transpose_i8.c b/libgfortran/generated/transpose_i8.c index c8042723969..7a77e329d9b 100644 --- a/libgfortran/generated/transpose_i8.c +++ b/libgfortran/generated/transpose_i8.c @@ -60,7 +60,8 @@ transpose_i8 (gfc_array_i8 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0), GFC_DESCRIPTOR_EXTENT(source, 1)*sizeof (GFC_INTEGER_8)); - 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)) { diff --git a/libgfortran/generated/transpose_r10.c b/libgfortran/generated/transpose_r10.c index fa44c38d913..b1232984054 100644 --- a/libgfortran/generated/transpose_r10.c +++ b/libgfortran/generated/transpose_r10.c @@ -60,7 +60,8 @@ transpose_r10 (gfc_array_r10 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0), GFC_DESCRIPTOR_EXTENT(source, 1)*sizeof (GFC_REAL_10)); - 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)) { diff --git a/libgfortran/generated/transpose_r16.c b/libgfortran/generated/transpose_r16.c index 88036309090..fb853c2a2c7 100644 --- a/libgfortran/generated/transpose_r16.c +++ b/libgfortran/generated/transpose_r16.c @@ -60,7 +60,8 @@ transpose_r16 (gfc_array_r16 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0), GFC_DESCRIPTOR_EXTENT(source, 1)*sizeof (GFC_REAL_16)); - 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)) { diff --git a/libgfortran/generated/transpose_r4.c b/libgfortran/generated/transpose_r4.c index a7026071748..98bad752bf2 100644 --- a/libgfortran/generated/transpose_r4.c +++ b/libgfortran/generated/transpose_r4.c @@ -60,7 +60,8 @@ transpose_r4 (gfc_array_r4 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0), GFC_DESCRIPTOR_EXTENT(source, 1)*sizeof (GFC_REAL_4)); - 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)) { diff --git a/libgfortran/generated/transpose_r8.c b/libgfortran/generated/transpose_r8.c index bc1ff3d2c85..17926bddab7 100644 --- a/libgfortran/generated/transpose_r8.c +++ b/libgfortran/generated/transpose_r8.c @@ -60,7 +60,8 @@ transpose_r8 (gfc_array_r8 * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0), GFC_DESCRIPTOR_EXTENT(source, 1)*sizeof (GFC_REAL_8)); - 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)) { diff --git a/libgfortran/generated/unpack_c10.c b/libgfortran/generated/unpack_c10.c index 9dc24896691..57a53f1a6f7 100644 --- a/libgfortran/generated/unpack_c10.c +++ b/libgfortran/generated/unpack_c10.c @@ -100,7 +100,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 { @@ -246,7 +246,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 { diff --git a/libgfortran/generated/unpack_c16.c b/libgfortran/generated/unpack_c16.c index e3c465319e5..1e6e1cf7652 100644 --- a/libgfortran/generated/unpack_c16.c +++ b/libgfortran/generated/unpack_c16.c @@ -100,7 +100,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 { @@ -246,7 +246,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 { diff --git a/libgfortran/generated/unpack_c4.c b/libgfortran/generated/unpack_c4.c index c8f47ec322a..4bfe5f750ee 100644 --- a/libgfortran/generated/unpack_c4.c +++ b/libgfortran/generated/unpack_c4.c @@ -100,7 +100,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 { @@ -246,7 +246,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 { diff --git a/libgfortran/generated/unpack_c8.c b/libgfortran/generated/unpack_c8.c index 694ce7bd117..4800498767e 100644 --- a/libgfortran/generated/unpack_c8.c +++ b/libgfortran/generated/unpack_c8.c @@ -100,7 +100,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 { @@ -246,7 +246,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 { diff --git a/libgfortran/generated/unpack_i1.c b/libgfortran/generated/unpack_i1.c index ed473b30e36..51101e0ddf0 100644 --- a/libgfortran/generated/unpack_i1.c +++ b/libgfortran/generated/unpack_i1.c @@ -100,7 +100,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 { @@ -246,7 +246,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 { diff --git a/libgfortran/generated/unpack_i16.c b/libgfortran/generated/unpack_i16.c index 01140f467d1..feaed3dec65 100644 --- a/libgfortran/generated/unpack_i16.c +++ b/libgfortran/generated/unpack_i16.c @@ -100,7 +100,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 { @@ -246,7 +246,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 { diff --git a/libgfortran/generated/unpack_i2.c b/libgfortran/generated/unpack_i2.c index 55364d5a523..45e0aa0cb55 100644 --- a/libgfortran/generated/unpack_i2.c +++ b/libgfortran/generated/unpack_i2.c @@ -100,7 +100,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 { @@ -246,7 +246,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 { diff --git a/libgfortran/generated/unpack_i4.c b/libgfortran/generated/unpack_i4.c index b872b50cd45..c58287ae037 100644 --- a/libgfortran/generated/unpack_i4.c +++ b/libgfortran/generated/unpack_i4.c @@ -100,7 +100,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 { @@ -246,7 +246,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 { diff --git a/libgfortran/generated/unpack_i8.c b/libgfortran/generated/unpack_i8.c index 5baf10ea533..3c1c1afe695 100644 --- a/libgfortran/generated/unpack_i8.c +++ b/libgfortran/generated/unpack_i8.c @@ -100,7 +100,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 { @@ -246,7 +246,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 { diff --git a/libgfortran/generated/unpack_r10.c b/libgfortran/generated/unpack_r10.c index 781990d5f77..e2737a625f3 100644 --- a/libgfortran/generated/unpack_r10.c +++ b/libgfortran/generated/unpack_r10.c @@ -100,7 +100,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 { @@ -246,7 +246,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 { diff --git a/libgfortran/generated/unpack_r16.c b/libgfortran/generated/unpack_r16.c index 5a7ca6f3f04..8ce95c800a5 100644 --- a/libgfortran/generated/unpack_r16.c +++ b/libgfortran/generated/unpack_r16.c @@ -100,7 +100,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 { @@ -246,7 +246,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 { diff --git a/libgfortran/generated/unpack_r4.c b/libgfortran/generated/unpack_r4.c index 22e0a09ace4..2e977ad466c 100644 --- a/libgfortran/generated/unpack_r4.c +++ b/libgfortran/generated/unpack_r4.c @@ -100,7 +100,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 { @@ -246,7 +246,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 { diff --git a/libgfortran/generated/unpack_r8.c b/libgfortran/generated/unpack_r8.c index dcff04bb941..249f6654e49 100644 --- a/libgfortran/generated/unpack_r8.c +++ b/libgfortran/generated/unpack_r8.c @@ -100,7 +100,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 { @@ -246,7 +246,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 { diff --git a/libgfortran/intrinsics/cshift0.c b/libgfortran/intrinsics/cshift0.c index c56f9ad717b..ea4c269bcb0 100644 --- a/libgfortran/intrinsics/cshift0.c +++ b/libgfortran/intrinsics/cshift0.c @@ -80,8 +80,8 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array, GFC_DIMENSION_SET (ret->dim[i], 0, ext, sm); } - /* 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)) { diff --git a/libgfortran/intrinsics/eoshift0.c b/libgfortran/intrinsics/eoshift0.c index 43729e9c623..f9da1ea77bc 100644 --- a/libgfortran/intrinsics/eoshift0.c +++ b/libgfortran/intrinsics/eoshift0.c @@ -87,8 +87,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)) { diff --git a/libgfortran/intrinsics/eoshift2.c b/libgfortran/intrinsics/eoshift2.c index 6d3df419828..8630dfcb805 100644 --- a/libgfortran/intrinsics/eoshift2.c +++ b/libgfortran/intrinsics/eoshift2.c @@ -79,8 +79,8 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array, ret->elem_len = array->elem_len; ret->type = array->type; - /* 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++) { diff --git a/libgfortran/intrinsics/pack_generic.c b/libgfortran/intrinsics/pack_generic.c index 87937a2c5e2..00f98eae682 100644 --- a/libgfortran/intrinsics/pack_generic.c +++ b/libgfortran/intrinsics/pack_generic.c @@ -154,8 +154,8 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array, GFC_DIMENSION_SET (ret->dim[0], 0, total, size); 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. */ @@ -515,7 +515,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; diff --git a/libgfortran/intrinsics/reshape_generic.c b/libgfortran/intrinsics/reshape_generic.c index 45c28310270..3c8cbab0a23 100644 --- a/libgfortran/intrinsics/reshape_generic.c +++ b/libgfortran/intrinsics/reshape_generic.c @@ -100,11 +100,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; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, size); ret->elem_len = source->elem_len; ret->type = source->type; } diff --git a/libgfortran/intrinsics/spread_generic.c b/libgfortran/intrinsics/spread_generic.c index 931abd6dfa4..7e56fd5edf3 100644 --- a/libgfortran/intrinsics/spread_generic.c +++ b/libgfortran/intrinsics/spread_generic.c @@ -246,7 +246,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, size); } diff --git a/libgfortran/intrinsics/string_intrinsics_inc.c b/libgfortran/intrinsics/string_intrinsics_inc.c index 84182af18b5..5c50366f35e 100644 --- a/libgfortran/intrinsics/string_intrinsics_inc.c +++ b/libgfortran/intrinsics/string_intrinsics_inc.c @@ -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; diff --git a/libgfortran/intrinsics/transpose_generic.c b/libgfortran/intrinsics/transpose_generic.c index 2acf04a76d7..a8dcfc325ab 100644 --- a/libgfortran/intrinsics/transpose_generic.c +++ b/libgfortran/intrinsics/transpose_generic.c @@ -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), GFC_DESCRIPTOR_EXTENT(source, 1) * size); - 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)) diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index 3a3c3cf9c5e..c94ed13004b 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -2615,7 +2615,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) diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index ea16c09a933..d577bbc11d2 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -3793,9 +3793,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 { diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c index a406c9e8be9..22b315a4fd3 100644 --- a/libgfortran/io/unit.c +++ b/libgfortran/io/unit.c @@ -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); diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index ac51d3cb9b3..4a939add742 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -1849,7 +1849,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); @@ -1878,7 +1878,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); diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index 5d6ddf62d58..f058d99daf6 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -711,6 +711,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); diff --git a/libgfortran/m4/bessel.m4 b/libgfortran/m4/bessel.m4 index 9880b9e93c9..9f2c6f835b5 100644 --- a/libgfortran/m4/bessel.m4 +++ b/libgfortran/m4/bessel.m4 @@ -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, sizeof ('rtype_name`)); - 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, sizeof ('rtype_name`)); - ret->base_addr = xmalloc (sizeof ('rtype_name`) * size); + ret->base_addr = xmallocarray (size, sizeof ('rtype_name`)); ret->offset = 0; } diff --git a/libgfortran/m4/cshift1.m4 b/libgfortran/m4/cshift1.m4 index 3a3899e77e4..d2245eb42ff 100644 --- a/libgfortran/m4/cshift1.m4 +++ b/libgfortran/m4/cshift1.m4 @@ -82,7 +82,7 @@ cshift1 (gfc_array_char * const restrict ret, int i; index_type sm, ext; - ret->base_addr = xmalloc (size * arraysize); + ret->base_addr = xmallocarray (arraysize, size); ret->elem_len = array->elem_len; ret->type = array->type; ret->offset = 0; diff --git a/libgfortran/m4/eoshift1.m4 b/libgfortran/m4/eoshift1.m4 index 4c3111ffb66..166a85629e4 100644 --- a/libgfortran/m4/eoshift1.m4 +++ b/libgfortran/m4/eoshift1.m4 @@ -107,8 +107,8 @@ eoshift1 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET (ret->dim[i], 0, ext, sm); } - /* 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)) diff --git a/libgfortran/m4/eoshift3.m4 b/libgfortran/m4/eoshift3.m4 index d8b61cd5ab0..32413207633 100644 --- a/libgfortran/m4/eoshift3.m4 +++ b/libgfortran/m4/eoshift3.m4 @@ -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->elem_len = array->elem_len; ret->type = array->type; ret->offset = 0; @@ -109,8 +109,8 @@ eoshift3 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET (ret->dim[i], 0, ext, sm); } - /* 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)) diff --git a/libgfortran/m4/iforeach.m4 b/libgfortran/m4/iforeach.m4 index 444a51cbba7..41bddafd797 100644 --- a/libgfortran/m4/iforeach.m4 +++ b/libgfortran/m4/iforeach.m4 @@ -31,7 +31,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (rtype_name) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (rtype_name)); } else { @@ -135,7 +135,7 @@ void retarray->elem_len = retarray->elem_len; retarray->type = retarray->type; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (rtype_name) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (rtype_name)); } else { @@ -265,7 +265,7 @@ void { GFC_DIMENSION_SET (retarray->dim[0], 0, rank, sizeof (rtype_name)); 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)) { diff --git a/libgfortran/m4/ifunction.m4 b/libgfortran/m4/ifunction.m4 index 979ed8dbed5..53d091b0f46 100644 --- a/libgfortran/m4/ifunction.m4 +++ b/libgfortran/m4/ifunction.m4 @@ -86,10 +86,9 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, retarray->elem_len = array->elem_len; retarray->type = array->type; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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. */ @@ -261,8 +260,7 @@ void } - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; retarray->offset = 0; retarray->elem_len = array->elem_len; @@ -275,7 +273,7 @@ void return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name)); } else @@ -419,8 +417,7 @@ void retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -429,7 +426,7 @@ void return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name)); } else { diff --git a/libgfortran/m4/ifunction_logical.m4 b/libgfortran/m4/ifunction_logical.m4 index 84f1f846483..e8509bbc86c 100644 --- a/libgfortran/m4/ifunction_logical.m4 +++ b/libgfortran/m4/ifunction_logical.m4 @@ -89,8 +89,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, retarray->type = array->type; retarray->offset = 0; - alloc_size = GFC_DESCRIPTOR_SM (retarray, rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_SM (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 { diff --git a/libgfortran/m4/in_pack.m4 b/libgfortran/m4/in_pack.m4 index 02ff6fcedcf..49d8d2392da 100644 --- a/libgfortran/m4/in_pack.m4 +++ b/libgfortran/m4/in_pack.m4 @@ -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]; diff --git a/libgfortran/m4/matmul.m4 b/libgfortran/m4/matmul.m4 index 886f5bc87a0..56b35e9a4bb 100644 --- a/libgfortran/m4/matmul.m4 +++ b/libgfortran/m4/matmul.m4 @@ -126,7 +126,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)) diff --git a/libgfortran/m4/matmull.m4 b/libgfortran/m4/matmull.m4 index 02f33fcf288..17959b61314 100644 --- a/libgfortran/m4/matmull.m4 +++ b/libgfortran/m4/matmull.m4 @@ -90,7 +90,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)) diff --git a/libgfortran/m4/pack.m4 b/libgfortran/m4/pack.m4 index 9c8204bce1b..ac27b29012f 100644 --- a/libgfortran/m4/pack.m4 +++ b/libgfortran/m4/pack.m4 @@ -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; diff --git a/libgfortran/m4/reshape.m4 b/libgfortran/m4/reshape.m4 index fc1129ada83..4061f75602a 100644 --- a/libgfortran/m4/reshape.m4 +++ b/libgfortran/m4/reshape.m4 @@ -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; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof ('rtype_name`)); ret->elem_len = source->elem_len; ret->type = source->type; } diff --git a/libgfortran/m4/shape.m4 b/libgfortran/m4/shape.m4 index 23dcbc21a2e..a449fefb4d0 100644 --- a/libgfortran/m4/shape.m4 +++ b/libgfortran/m4/shape.m4 @@ -50,7 +50,7 @@ shape_'rtype_kind` ('rtype` * const restrict ret, { GFC_DIMENSION_SET(ret->dim[0], 0, rank, sizeof ('rtype_name`)); ret->offset = 0; - ret->base_addr = xmalloc (sizeof ('rtype_name`) * rank); + ret->base_addr = xmallocarray (rank, sizeof ('rtype_name`)); } stride = GFC_DESCRIPTOR_STRIDE_TYPEKNOWN(ret,0); diff --git a/libgfortran/m4/spread.m4 b/libgfortran/m4/spread.m4 index 376daebed1b..6e635525dc7 100644 --- a/libgfortran/m4/spread.m4 +++ b/libgfortran/m4/spread.m4 @@ -103,8 +103,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; } @@ -246,7 +246,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, sizeof ('rtype_name`)); } diff --git a/libgfortran/m4/transpose.m4 b/libgfortran/m4/transpose.m4 index dd9ed7e0fe7..fe7b0447be0 100644 --- a/libgfortran/m4/transpose.m4 +++ b/libgfortran/m4/transpose.m4 @@ -61,7 +61,8 @@ transpose_'rtype_code` ('rtype` * const restrict ret, GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0), GFC_DESCRIPTOR_EXTENT(source, 1)*sizeof ('rtype_name`)); - 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)) { diff --git a/libgfortran/m4/unpack.m4 b/libgfortran/m4/unpack.m4 index 29f186c261e..8d12fc93a0c 100644 --- a/libgfortran/m4/unpack.m4 +++ b/libgfortran/m4/unpack.m4 @@ -101,7 +101,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 { @@ -247,7 +247,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 { diff --git a/libgfortran/runtime/convert_char.c b/libgfortran/runtime/convert_char.c index aa819912a13..c3cd1c28c16 100644 --- a/libgfortran/runtime/convert_char.c +++ b/libgfortran/runtime/convert_char.c @@ -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]; diff --git a/libgfortran/runtime/environ.c b/libgfortran/runtime/environ.c index 0c0e9308fb4..1095f443a5f 100644 --- a/libgfortran/runtime/environ.c +++ b/libgfortran/runtime/environ.c @@ -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 (); diff --git a/libgfortran/runtime/memory.c b/libgfortran/runtime/memory.c index b18b50532c7..501d870b83c 100644 --- a/libgfortran/runtime/memory.c +++ b/libgfortran/runtime/memory.c @@ -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); |