diff options
author | Yvan Roux <yvan.roux@linaro.org> | 2014-08-14 08:22:05 +0000 |
---|---|---|
committer | Yvan Roux <yvan.roux@linaro.org> | 2014-08-14 08:22:05 +0000 |
commit | 43330d510434cbf10623584a13ec032334df4a63 (patch) | |
tree | 5f2122b90e5efd5702c0ab8400df2e54bddf4290 | |
parent | 2748c83560e8b89f387e1f14e34cebaea3609f02 (diff) | |
parent | 59d1582bc6a955ccc20609c04f4e480f9d22ed8d (diff) |
Merge branches/gcc-4_9-branch rev 213802
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/linaro/gcc-4_8-branch@213944 138bc75d-0d04-0410-961f-82ee72b054a4
474 files changed, 4094 insertions, 1882 deletions
diff --git a/ChangeLog b/ChangeLog index 0ed008342a5..510048aab7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-07-26 Uros Bizjak <ubizjak@gmail.com> + + PR target/47230 + * configure.ac (alpha*-*-linux*): Use mh-alpha-linux. + * configure: Regenerate. + 2014-05-22 Release Manager * GCC 4.8.3 released. diff --git a/config/ChangeLog b/config/ChangeLog index 9dbadab9852..a574b073990 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,8 @@ +2014-07-26 Uros Bizjak <ubizjak@gmail.com> + + PR target/47230 + * mh-alpha-linux: New file. + 2014-05-22 Release Manager * GCC 4.8.3 released. diff --git a/config/mh-alpha-linux b/config/mh-alpha-linux new file mode 100644 index 00000000000..9a9244baaa3 --- /dev/null +++ b/config/mh-alpha-linux @@ -0,0 +1,3 @@ +# Prevent GPREL16 relocation truncation +LDFLAGS += -Wl,--no-relax +BOOT_LDFLAGS += -Wl,--no-relax diff --git a/configure b/configure index f16d5065ca6..42dafded654 100755 --- a/configure +++ b/configure @@ -3836,6 +3836,9 @@ fi *-mingw*) host_makefile_frag="config/mh-mingw" ;; + alpha*-*-linux*) + host_makefile_frag="config/mh-alpha-linux" + ;; hppa*-hp-hpux10*) host_makefile_frag="config/mh-pa-hpux10" ;; diff --git a/configure.ac b/configure.ac index d5d609bdef8..fa5d14860f5 100644 --- a/configure.ac +++ b/configure.ac @@ -1156,6 +1156,9 @@ case "${host}" in *-mingw*) host_makefile_frag="config/mh-mingw" ;; + alpha*-*-linux*) + host_makefile_frag="config/mh-alpha-linux" + ;; hppa*-hp-hpux10*) host_makefile_frag="config/mh-pa-hpux10" ;; diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 45259f278cf..4445d0ef76c 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2014-07-07 Richard Biener <rguenther@suse.de> + + * gennews: Use gcc-3.0/index.html. + 2014-05-22 Release Manager * GCC 4.8.3 released. diff --git a/contrib/gennews b/contrib/gennews index 962bef2f362..294e660cff8 100755 --- a/contrib/gennews +++ b/contrib/gennews @@ -37,7 +37,7 @@ files=" gcc-3.3/index.html gcc-3.3/changes.html gcc-3.2/index.html gcc-3.2/changes.html gcc-3.1/index.html gcc-3.1/changes.html - gcc-3.0/gcc-3.0.html gcc-3.0/features.html gcc-3.0/caveats.html + gcc-3.0/index.html gcc-3.0/features.html gcc-3.0/caveats.html gcc-2.95/index.html gcc-2.95/features.html gcc-2.95/caveats.html egcs-1.1/index.html egcs-1.1/features.html egcs-1.1/caveats.html egcs-1.0/index.html egcs-1.0/features.html egcs-1.0/caveats.html" diff --git a/gcc/BASE-VER b/gcc/BASE-VER index f99c6583c35..57c4b30bba1 100644 --- a/gcc/BASE-VER +++ b/gcc/BASE-VER @@ -1 +1 @@ -4.8.3 +4.8.4 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dc50953a3b5..a7f5cbe955a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,363 @@ +2014-08-01 Thomas Preud'homme <thomas.preudhomme@arm.com> + + Backport from mainline + 2014-06-13 Thomas Preud'homme <thomas.preudhomme@arm.com> + + PR tree-optimization/61375 + * tree-ssa-math-opts.c (find_bswap_or_nop_1): Cancel optimization if + symbolic number cannot be represented in an unsigned HOST_WIDE_INT. + (execute_optimize_bswap): Cancel optimization if CHAR_BIT != 8. + +2014-08-01 Richard Biener <rguenther@suse.de> + + PR tree-optimization/61964 + * tree-ssa-tail-merge.c (gimple_operand_equal_value_p): New + function merged from trunk. + (gimple_equal_p): Handle non-SSA LHS solely by structural + equality. + +2014-07-25 Uros Bizjak <ubizjak@gmail.com> + + * config/alpha/elf.h: Define TARGET_UNWIND_TABLES_DEFAULT. + +2014-07-24 Kyle McMartin <kyle@redhat.com> + + * config/aarch64/aarch64-linux.h (TARGET_ASM_FILE_END): Define. + +2014-07-24 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + * config/rs6000/rs6000-protos.h (rs6000_special_adjust_field_align_p): + Add prototype. + * config/rs6000/rs6000.c (rs6000_special_adjust_field_align_p): New + function. Issue -Wpsabi warning if future GCC releases will use + different field alignment rules for this type. + * config/rs6000/sysv4.h (ADJUST_FIELD_ALIGN): Call it. + * config/rs6000/linux64.h (ADJUST_FIELD_ALIGN): Likewise. + * config/rs6000/freebsd64.h (ADJUST_FIELD_ALIGN): Likewise. + +2014-07-24 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + * config/rs6000/rs6000.c (rs6000_function_arg_boundary): Issue + -Wpsabi note when encountering a type where future GCC releases + will apply different alignment requirements. + +2014-07-24 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + * config/rs6000/rs6000.c (rs6000_function_arg): If a float argument + does not fit fully into floating-point registers, and there is still + space in the register parameter area, issue -Wpsabi note that the ABI + will change in a future GCC release. + +2014-07-23 Sebastian Huber <sebastian.huber@embedded-brains.de> + + * config/arm/t-rtems-eabi: Add + mthumb/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard, + mthumb/march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard, + mbig-endian/mthumb/march=armv7-r, and + mbig-endian/mthumb/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard + multilibs. + +2014-07-21 Peter Bergner <bergner@vnet.ibm.com> + + * config/rs6000/sysv4.h (LIBASAN_EARLY_SPEC): Define. + (LIBTSAN_EARLY_SPEC): Likewise. + (STATIC_LIBASAN_LIBS): Likewise. + (STATIC_LIBTSAN_LIBS): Likewise. + +2014-07-19 Eric Botcazou <ebotcazou@adacore.com> + + * toplev.c (output_stack_usage): Adjust the location of the warning. + +2014-07-19 Daniel Cederman <cederman@gaisler.com> + + * config/sparc/sync.md (*membar_storeload_leon3): New insn. + (*membar_storeload): Disable for LEON3. + +2014-07-17 Richard Biener <rguenther@suse.de> + + PR rtl-optimization/61801 + * sched-deps.c (sched_analyze_2): For ASM_OPERANDS and + ASM_INPUT don't set reg_pending_barrier if it appears in a + debug-insn. + +2014-07-16 Jakub Jelinek <jakub@redhat.com> + + * omp-low.c (create_omp_child_function): Don't set DECL_NAMELESS + on the FUNCTION_DECL. + +2014-07-10 Tom G. Christensen <tgc@jupiterrise.com> + + * doc/install.texi: Remove links to defunct package providers for + Solaris. + +2014-07-10 Eric Botcazou <ebotcazou@adacore.com> + + PR middle-end/53590 + * function.c (allocate_struct_function): Revert r188667 change. + +2014-07-04 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/61684 + * tree-ssa-ifcombine.c (recognize_single_bit_test): Make sure + rhs1 of conversion is a SSA_NAME before using SSA_NAME_DEF_STMT on it. + +2014-06-30 Thomas Preud'homme <thomas.preudhomme@arm.com> + + Backport from Mainline + 2014-06-20 Jakub Jelinek <jakub@redhat.com> + 2014-06-11 Thomas Preud'homme <thomas.preudhomme@arm.com> + + PR tree-optimization/61306 + * tree-ssa-math-opts.c (struct symbolic_number): Store type of + expression instead of its size. + (do_shift_rotate): Adapt to change in struct symbolic_number. Return + false to prevent optimization when the result is unpredictable due to + arithmetic right shift of signed type with highest byte is set. + (verify_symbolic_number_p): Adapt to change in struct symbolic_number. + (find_bswap_1): Likewise. Return NULL to prevent optimization when the + result is unpredictable due to sign extension. + (find_bswap): Adapt to change in struct symbolic_number. + +2014-06-27 Uros Bizjak <ubizjak@gmail.com> + + Backport from mainline + 2014-06-26 Uros Bizjak <ubizjak@gmail.com> + + PR target/61586 + * config/alpha/alpha.c (alpha_handle_trap_shadows): Handle BARRIER RTX. + +2014-06-26 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + PR target/61542 + * config/rs6000/vsx.md (vsx_extract_v4sf): Fix bug with element + extraction other than index 3. + +2014-06-24 Jakub Jelinek <jakub@redhat.com> + + PR target/61570 + * config/i386/driver-i386.c (host_detect_local_cpu): For unknown + model family 6 CPU with has_longmode never use a CPU without + 64-bit support. + +2014-06-20 Chung-Lin Tang <cltang@codesourcery.com> + + Backport from mainline + + 2014-06-20 Julian Brown <julian@codesourcery.com> + Chung-Lin Tang <cltang@codesourcery.com> + + * config/arm/arm.c (arm_output_mi_thunk): Fix offset for + TARGET_THUMB1_ONLY. Add comments. + +2014-06-18 Uros Bizjak <ubizjak@gmail.com> + + Backport from mainline + 2014-06-06 Uros Bizjak <ubizjak@gmail.com> + + PR target/61423 + * config/i386/i386.md (*floatunssi<mode>2_i387_with_xmm): New + define_insn_and_split pattern, merged from *floatunssi<mode>2_1 + and corresponding splitters. Zero extend general register + or memory input operand to XMM temporary. Enable for + TARGET_SSE2 and TARGET_INTER_UNIT_MOVES_TO_VEC only. + (floatunssi<mode>2): Update expander predicate. + +2014-06-18 Richard Henderson <rth@redhat.com> + + PR target/61545 + * config/aarch64/aarch64.md (tlsdesc_small): Clobber CC_REGNUM. + +2014-06-17 Nagaraju Mekala <nagaraju.mekala@xilinx.com> + + Revert on gcc-4_8-branch. + * config/microblaze/microblaze.md: Add movsi4_rev insn pattern. + * config/microblaze/predicates.md: Add reg_or_mem_operand predicate. + +2014-06-17 Yufeng Zhang <yufeng.zhang@arm.com> + + Backport from mainline + + PR target/61483 + * config/aarch64/aarch64.c (aarch64_layout_arg): Add new local + variable 'size'; calculate 'size' right in the front; use + 'size' to compute 'nregs' (when 'allocate_ncrn != 0') and + pcum->aapcs_stack_words. + +2014-06-13 Peter Bergner <bergner@vnet.ibm.com> + + Backport from mainline + + 2014-06-13 Peter Bergner <bergner@vnet.ibm.com> + PR target/61415 + * config/rs6000/rs6000-builtin.def (BU_MISC_1): Delete. + (BU_MISC_2): Rename to ... + (BU_LDBL128_2): ... this. + * config/rs6000/rs6000.h (RS6000_BTM_LDBL128): New define. + (RS6000_BTM_COMMON): Add RS6000_BTM_LDBL128. + * config/rs6000/rs6000.c (rs6000_builtin_mask_calculate): Handle + RS6000_BTM_LDBL128. + (rs6000_invalid_builtin): Add long double 128-bit builtin support. + (rs6000_builtin_mask_names): Add RS6000_BTM_LDBL128. + * config/rs6000/rs6000.md (unpacktf_0): Remove define)expand. + (unpacktf_1): Likewise. + * doc/extend.texi (__builtin_longdouble_dw0): Remove documentation. + (__builtin_longdouble_dw1): Likewise. + * doc/sourcebuild.texi (longdouble128): Document. + +2014-06-13 Jason Merrill <jason@redhat.com> + + PR c++/60731 + * common.opt (-fno-gnu-unique): Add. + * config/elfos.h (USE_GNU_UNIQUE_OBJECT): Check it. + +2014-06-12 Georg-Johann Lay <avr@gjlay.de> + + Backport from 2014-05-09 trunk r210272 + + * config/avr/avr-fixed.md (round<mode>3): Use -1U instead of -1 in + unsigned int initializers for regno_in, regno_out. + + Backport from 2014-05-14 trunk r210418 + * config/avr/avr.h (REG_CLASS_CONTENTS): Use unsigned suffix for + shifted values to avoid build warning. + + Backport from 2014-06-12 trunk r211491 + + PR target/61443 + * config/avr/avr.md (push<mode>1): Avoid (subreg(mem)) when + loading from address spaces. + +2014-06-12 Alan Modra <amodra@gmail.com> + + PR target/61300 + * doc/tm.texi.in (INCOMING_REG_PARM_STACK_SPACE): Document. + * doc/tm.texi: Regenerate. + * function.c (INCOMING_REG_PARM_STACK_SPACE): Provide default. + Use throughout in place of REG_PARM_STACK_SPACE. + * config/rs6000/rs6000.c (rs6000_reg_parm_stack_space): Add + "incoming" param. Pass to rs6000_function_parms_need_stack. + (rs6000_function_parms_need_stack): Add "incoming" param, ignore + prototype_p when incoming. Use function decl when incoming + to handle K&R style functions. + * config/rs6000/rs6000.h (REG_PARM_STACK_SPACE): Adjust. + (INCOMING_REG_PARM_STACK_SPACE): Define. + +2014-06-06 Michael Meissner <meissner@linux.vnet.ibm.com> + + Back port from trunk + 2014-06-06 Michael Meissner <meissner@linux.vnet.ibm.com> + + PR target/61431 + * config/rs6000/vsx.md (VSX_LE): Split VSX_D into 2 separate + iterators, VSX_D that handles 64-bit types, and VSX_LE that + handles swapping the two 64-bit double words on little endian + systems. Include V1TImode and optionally TImode in VSX_LE so that + these types are properly swapped. Change all of the insns and + splits that do the 64-bit swaps to use VSX_LE. + (vsx_le_perm_load_<mode>): Likewise. + (vsx_le_perm_store_<mode>): Likewise. + (splitters for little endian memory operations): Likewise. + (vsx_xxpermdi2_le_<mode>): Likewise. + (vsx_lxvd2x2_le_<mode>): Likewise. + (vsx_stxvd2x2_le_<mode>): Likewise. + +2014-06-05 Martin Jambor <mjambor@suse.cz> + + PR ipa/61393 + * ipa-cp.c (determine_versionability): Pretend that tm_clones are + not versionable. + +2014-06-04 Richard Biener <rguenther@suse.de> + + PR tree-optimization/61383 + * tree-ssa-ifcombine.c (bb_no_side_effects_p): Make sure + stmts can't trap. + +2014-06-03 Andrey Belevantsev <abel@ispras.ru> + + Backport from mainline + 2014-05-14 Andrey Belevantsev <abel@ispras.ru> + + PR rtl-optimization/60866 + * sel-sched-ir (sel_init_new_insn): New parameter old_seqno. + Default it to -1. Pass it down to init_simplejump_data. + (init_simplejump_data): New parameter old_seqno. Pass it down + to get_seqno_for_a_jump. + (get_seqno_for_a_jump): New parameter old_seqno. Use it for + initializing new jump seqno as a last resort. Add comment. + (sel_redirect_edge_and_branch): Save old seqno of the conditional + jump and pass it down to sel_init_new_insn. + (sel_redirect_edge_and_branch_force): Likewise. + +2014-06-03 Andrey Belevantsev <abel@ispras.ru> + + Backport from mainline + 2014-05-14 Andrey Belevantsev <abel@ispras.ru> + + PR rtl-optimization/60901 + * config/i386/i386.c (ix86_dependencies_evaluation_hook): Check that + bb predecessor belongs to the same scheduling region. Adjust comment. + +2014-06-03 Uros Bizjak <ubizjak@gmail.com> + + Backport from mainline + 2014-06-02 Uros Bizjak <ubizjak@gmail.com> + + PR target/61239 + * config/i386/i386.c (ix86_expand_vec_perm) [case V32QImode]: Use + GEN_INT (-128) instead of GEN_INT (128) to set MSB of QImode constant. + +2014-05-28 Guozhi Wei <carrot@google.com> + + PR target/61202 + * config/aarch64/arm_neon.h (vqdmulh_n_s16): Change the last operand's + constraint. + (vqdmulhq_n_s16): Likewise. + +2014-05-28 Eric Botcazou <ebotcazou@adacore.com> + + Backport from mainline + 2014-05-27 Eric Botcazou <ebotcazou@adacore.com> + + * double-int.c (div_and_round_double) <ROUND_DIV_EXPR>: Use the proper + predicate to detect a negative quotient. + +2014-05-28 Georg-Johann Lay <avr@gjlay.de> + + PR target/61044 + * doc/extend.texi (Local Labels): Note that label differences are + not supported for AVR. + +2014-05-26 Michael Tautschnig <mt@debian.org> + + PR target/61249 + * doc/extend.texi (X86 Built-in Functions): Fix parameter lists of + __builtin_ia32_vfrczs[sd] and __builtin_ia32_mpsadbw256. + +2014-05-23 Alan Modra <amodra@gmail.com> + + PR target/61231 + * config/rs6000/rs6000.c (mem_operand_gpr): Handle SImode. + * config/rs6000/rs6000.md (extendsidi2_lfiwax, extendsidi2_nocell): + Use "Y" constraint rather than "m". + +2014-05-22 Peter Bergner <bergner@vnet.ibm.com> + + Backport from mainline + 2014-05-22 Peter Bergner <bergner@vnet.ibm.com> + + * config/rs6000/htm.md (ttest): Use correct shift value to get CR0. + +2014-05-22 Richard Earnshaw <rearnsha@arm.com> + + PR target/61208 + * arm.md (arm_cmpdi_unsigned): Fix length calculation for Thumb2. + +2013-05-22 Richard Biener <rguenther@suse.de> + + * BASE-VER: Set to 4.8.4. + * DEV-PHASE: Set to prerelease. + 2014-05-22 Release Manager * GCC 4.8.3 released. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 1967b777fc6..fb37762b343 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20140522 +20140811 diff --git a/gcc/DEV-PHASE b/gcc/DEV-PHASE index e69de29bb2d..373fbc60bb9 100644 --- a/gcc/DEV-PHASE +++ b/gcc/DEV-PHASE @@ -0,0 +1 @@ +prerelease diff --git a/gcc/common.opt b/gcc/common.opt index 14283c1cbac..693f865c093 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -1226,6 +1226,10 @@ fgnu-tm Common Report Var(flag_tm) Enable support for GNU transactional memory +fgnu-unique +Common Report Var(flag_gnu_unique) Init(1) +Use STB_GNU_UNIQUE if supported by the assembler + floop-flatten Common Ignore Does nothing. Preserved for backward compatibility. diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h index 83efad447f1..4e6e23ad508 100644 --- a/gcc/config/aarch64/aarch64-linux.h +++ b/gcc/config/aarch64/aarch64-linux.h @@ -43,4 +43,6 @@ } \ while (0) +#define TARGET_ASM_FILE_END file_end_indicate_exec_stack + #endif /* GCC_AARCH64_LINUX_H */ diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 3589f057f78..9f9570e3edf 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -1364,6 +1364,7 @@ aarch64_layout_arg (cumulative_args_t pcum_v, enum machine_mode mode, CUMULATIVE_ARGS *pcum = get_cumulative_args (pcum_v); int ncrn, nvrn, nregs; bool allocate_ncrn, allocate_nvrn; + HOST_WIDE_INT size; /* We need to do this once per argument. */ if (pcum->aapcs_arg_processed) @@ -1371,6 +1372,11 @@ aarch64_layout_arg (cumulative_args_t pcum_v, enum machine_mode mode, pcum->aapcs_arg_processed = true; + /* Size in bytes, rounded to the nearest multiple of 8 bytes. */ + size + = AARCH64_ROUND_UP (type ? int_size_in_bytes (type) : GET_MODE_SIZE (mode), + UNITS_PER_WORD); + allocate_ncrn = (type) ? !(FLOAT_TYPE_P (type)) : !FLOAT_MODE_P (mode); allocate_nvrn = aarch64_vfp_is_call_candidate (pcum_v, mode, @@ -1421,9 +1427,7 @@ aarch64_layout_arg (cumulative_args_t pcum_v, enum machine_mode mode, } ncrn = pcum->aapcs_ncrn; - nregs = ((type ? int_size_in_bytes (type) : GET_MODE_SIZE (mode)) - + UNITS_PER_WORD - 1) / UNITS_PER_WORD; - + nregs = size / UNITS_PER_WORD; /* C6 - C9. though the sign and zero extension semantics are handled elsewhere. This is the case where the argument fits @@ -1472,13 +1476,12 @@ aarch64_layout_arg (cumulative_args_t pcum_v, enum machine_mode mode, pcum->aapcs_nextncrn = NUM_ARG_REGS; /* The argument is passed on stack; record the needed number of words for - this argument (we can re-use NREGS) and align the total size if - necessary. */ + this argument and align the total size if necessary. */ on_stack: - pcum->aapcs_stack_words = nregs; + pcum->aapcs_stack_words = size / UNITS_PER_WORD; if (aarch64_function_arg_alignment (mode, type) == 16 * BITS_PER_UNIT) pcum->aapcs_stack_size = AARCH64_ROUND_UP (pcum->aapcs_stack_size, - 16 / UNITS_PER_WORD) + 1; + 16 / UNITS_PER_WORD); return; } diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 0bf9009d5b4..bd467e2cac0 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -3438,6 +3438,7 @@ (unspec:DI [(match_operand:DI 0 "aarch64_valid_symref" "S")] UNSPEC_TLSDESC)) (clobber (reg:DI LR_REGNUM)) + (clobber (reg:CC CC_REGNUM)) (clobber (match_scratch:DI 1 "=r"))] "TARGET_TLS_DESC" "adrp\\tx0, %A0\;ldr\\t%1, [x0, #%L0]\;add\\tx0, x0, %L0\;.tlsdesccall\\t%0\;blr\\t%1" diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index 60f23e74e34..d36c16cc7ba 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -12134,7 +12134,7 @@ vqdmulh_n_s16 (int16x4_t a, int16_t b) int16x4_t result; __asm__ ("sqdmulh %0.4h,%1.4h,%2.h[0]" : "=w"(result) - : "w"(a), "w"(b) + : "w"(a), "x"(b) : /* No clobbers */); return result; } @@ -12156,7 +12156,7 @@ vqdmulhq_n_s16 (int16x8_t a, int16_t b) int16x8_t result; __asm__ ("sqdmulh %0.8h,%1.8h,%2.h[0]" : "=w"(result) - : "w"(a), "w"(b) + : "w"(a), "x"(b) : /* No clobbers */); return result; } diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 5bd49f96daa..1fe6eb57f32 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -8658,6 +8658,11 @@ alpha_handle_trap_shadows (void) } break; + case BARRIER: + /* __builtin_unreachable can expand to no code at all, + leaving (barrier) RTXes in the instruction stream. */ + goto close_shadow_notrapb; + case JUMP_INSN: case CALL_INSN: case CODE_LABEL: @@ -8673,6 +8678,7 @@ alpha_handle_trap_shadows (void) n = emit_insn_before (gen_trapb (), i); PUT_MODE (n, TImode); PUT_MODE (i, TImode); + close_shadow_notrapb: trap_pending = 0; shadow.used.i = 0; shadow.used.fp = 0; diff --git a/gcc/config/alpha/elf.h b/gcc/config/alpha/elf.h index ee44105f725..9ed2441da1a 100644 --- a/gcc/config/alpha/elf.h +++ b/gcc/config/alpha/elf.h @@ -126,6 +126,10 @@ do { \ "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" +/* This variable should be set to 'true' if the target ABI requires + unwinding tables even when exceptions are not used. */ +#define TARGET_UNWIND_TABLES_DEFAULT true + /* Select a format to encode pointers in exception handling data. CODE is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is true if the symbol may be affected by dynamic relocations. diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 19c320724d3..d3cf910cc6c 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -25649,9 +25649,13 @@ arm_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, fputs (":\n", file); if (flag_pic) { - /* Output ".word .LTHUNKn-7-.LTHUNKPCn". */ + /* Output ".word .LTHUNKn-[3,7]-.LTHUNKPCn". */ rtx tem = XEXP (DECL_RTL (function), 0); - tem = gen_rtx_PLUS (GET_MODE (tem), tem, GEN_INT (-7)); + /* For TARGET_THUMB1_ONLY the thunk is in Thumb mode, so the PC + pipeline offset is four rather than eight. Adjust the offset + accordingly. */ + tem = plus_constant (GET_MODE (tem), tem, + TARGET_THUMB1_ONLY ? -3 : -7); tem = gen_rtx_MINUS (GET_MODE (tem), tem, gen_rtx_SYMBOL_REF (Pmode, diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index e6fb0e119b5..452fe5f997e 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -8262,8 +8262,8 @@ (define_insn_and_split "*arm_cmpdi_unsigned" [(set (reg:CC_CZ CC_REGNUM) - (compare:CC_CZ (match_operand:DI 0 "s_register_operand" "l,r,r") - (match_operand:DI 1 "arm_di_operand" "Py,r,rDi")))] + (compare:CC_CZ (match_operand:DI 0 "s_register_operand" "l,r,r,r") + (match_operand:DI 1 "arm_di_operand" "Py,r,Di,rDi")))] "TARGET_32BIT" "#" ; "cmp\\t%R0, %R1\;it eq\;cmpeq\\t%Q0, %Q1" @@ -8283,9 +8283,9 @@ operands[1] = gen_lowpart (SImode, operands[1]); } [(set_attr "conds" "set") - (set_attr "enabled_for_depr_it" "yes,yes,no") - (set_attr "arch" "t2,t2,*") - (set_attr "length" "6,6,8") + (set_attr "enabled_for_depr_it" "yes,yes,no,*") + (set_attr "arch" "t2,t2,t2,a") + (set_attr "length" "6,6,10,8") (set_attr "type" "multiple")] ) diff --git a/gcc/config/arm/t-rtems-eabi b/gcc/config/arm/t-rtems-eabi index d81fbf7ec1a..92c4dcb1288 100644 --- a/gcc/config/arm/t-rtems-eabi +++ b/gcc/config/arm/t-rtems-eabi @@ -1,47 +1,167 @@ # Custom RTEMS EABI multilibs -MULTILIB_OPTIONS = mthumb march=armv6-m/march=armv7-a/march=armv7-r/march=armv7-m mfpu=neon mfloat-abi=hard -MULTILIB_DIRNAMES = thumb armv6-m armv7-a armv7-r armv7-m neon hard +MULTILIB_OPTIONS = mbig-endian mthumb march=armv6-m/march=armv7-a/march=armv7-r/march=armv7-m mfpu=neon/mfpu=vfpv3-d16/mfpu=fpv4-sp-d16 mfloat-abi=hard +MULTILIB_DIRNAMES = eb thumb armv6-m armv7-a armv7-r armv7-m neon vfpv3-d16 fpv4-sp-d16 hard # Enumeration of multilibs MULTILIB_EXCEPTIONS = +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=neon/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=neon +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=vfpv3-d16 +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfpu=fpv4-sp-d16 +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv6-m +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=neon/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=neon +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=vfpv3-d16 +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfpu=fpv4-sp-d16 +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-a +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=neon/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=neon +# MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=vfpv3-d16 +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfpu=fpv4-sp-d16 +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r/mfloat-abi=hard +# MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-r +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=neon/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=neon +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=vfpv3-d16 +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfpu=fpv4-sp-d16 +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/march=armv7-m +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=neon/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=neon +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=vfpv3-d16 +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfpu=fpv4-sp-d16 +MULTILIB_EXCEPTIONS += mbig-endian/mthumb/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mthumb +MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=neon/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=neon +MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=vfpv3-d16 +MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfpu=fpv4-sp-d16 +MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/march=armv6-m +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=neon/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=neon +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=vfpv3-d16 +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfpu=fpv4-sp-d16 +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-a +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=neon/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=neon +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=vfpv3-d16 +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfpu=fpv4-sp-d16 +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-r +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=neon/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=neon +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=vfpv3-d16 +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfpu=fpv4-sp-d16 +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/march=armv7-m +MULTILIB_EXCEPTIONS += mbig-endian/mfpu=neon/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mfpu=neon +MULTILIB_EXCEPTIONS += mbig-endian/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mfpu=vfpv3-d16 +MULTILIB_EXCEPTIONS += mbig-endian/mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian/mfpu=fpv4-sp-d16 +MULTILIB_EXCEPTIONS += mbig-endian/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mbig-endian MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=neon/mfloat-abi=hard MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=neon +MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=vfpv3-d16 +MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfpu=fpv4-sp-d16 MULTILIB_EXCEPTIONS += mthumb/march=armv6-m/mfloat-abi=hard # MULTILIB_EXCEPTIONS += mthumb/march=armv6-m # MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=neon/mfloat-abi=hard MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=neon +MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=vfpv3-d16 +MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfpu=fpv4-sp-d16 MULTILIB_EXCEPTIONS += mthumb/march=armv7-a/mfloat-abi=hard # MULTILIB_EXCEPTIONS += mthumb/march=armv7-a MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=neon/mfloat-abi=hard MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=neon +# MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=vfpv3-d16 +MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfpu=fpv4-sp-d16 MULTILIB_EXCEPTIONS += mthumb/march=armv7-r/mfloat-abi=hard # MULTILIB_EXCEPTIONS += mthumb/march=armv7-r MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=neon/mfloat-abi=hard MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=neon +MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=vfpv3-d16 +# MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfpu=fpv4-sp-d16 MULTILIB_EXCEPTIONS += mthumb/march=armv7-m/mfloat-abi=hard # MULTILIB_EXCEPTIONS += mthumb/march=armv7-m MULTILIB_EXCEPTIONS += mthumb/mfpu=neon/mfloat-abi=hard MULTILIB_EXCEPTIONS += mthumb/mfpu=neon +MULTILIB_EXCEPTIONS += mthumb/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mthumb/mfpu=vfpv3-d16 +MULTILIB_EXCEPTIONS += mthumb/mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mthumb/mfpu=fpv4-sp-d16 MULTILIB_EXCEPTIONS += mthumb/mfloat-abi=hard # MULTILIB_EXCEPTIONS += mthumb MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=neon/mfloat-abi=hard MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=neon +MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=vfpv3-d16 +MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += march=armv6-m/mfpu=fpv4-sp-d16 MULTILIB_EXCEPTIONS += march=armv6-m/mfloat-abi=hard MULTILIB_EXCEPTIONS += march=armv6-m MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=neon/mfloat-abi=hard MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=neon +MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=vfpv3-d16 +MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += march=armv7-a/mfpu=fpv4-sp-d16 MULTILIB_EXCEPTIONS += march=armv7-a/mfloat-abi=hard MULTILIB_EXCEPTIONS += march=armv7-a MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=neon/mfloat-abi=hard MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=neon +MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=vfpv3-d16 +MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += march=armv7-r/mfpu=fpv4-sp-d16 MULTILIB_EXCEPTIONS += march=armv7-r/mfloat-abi=hard MULTILIB_EXCEPTIONS += march=armv7-r MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=neon/mfloat-abi=hard MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=neon +MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=vfpv3-d16 +MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += march=armv7-m/mfpu=fpv4-sp-d16 MULTILIB_EXCEPTIONS += march=armv7-m/mfloat-abi=hard MULTILIB_EXCEPTIONS += march=armv7-m MULTILIB_EXCEPTIONS += mfpu=neon/mfloat-abi=hard MULTILIB_EXCEPTIONS += mfpu=neon +MULTILIB_EXCEPTIONS += mfpu=vfpv3-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mfpu=vfpv3-d16 +MULTILIB_EXCEPTIONS += mfpu=fpv4-sp-d16/mfloat-abi=hard +MULTILIB_EXCEPTIONS += mfpu=fpv4-sp-d16 MULTILIB_EXCEPTIONS += mfloat-abi=hard diff --git a/gcc/config/avr/avr-fixed.md b/gcc/config/avr/avr-fixed.md index b2f0b9aa144..5bda9c2fa7a 100644 --- a/gcc/config/avr/avr-fixed.md +++ b/gcc/config/avr/avr-fixed.md @@ -430,8 +430,8 @@ } // Input and output of the libgcc function - const unsigned int regno_in[] = { -1, 22, 22, -1, 18 }; - const unsigned int regno_out[] = { -1, 24, 24, -1, 22 }; + const unsigned int regno_in[] = { -1U, 22, 22, -1U, 18 }; + const unsigned int regno_out[] = { -1U, 24, 24, -1U, 22 }; operands[3] = gen_rtx_REG (<MODE>mode, regno_out[(size_t) GET_MODE_SIZE (<MODE>mode)]); operands[4] = gen_rtx_REG (<MODE>mode, regno_in[(size_t) GET_MODE_SIZE (<MODE>mode)]); diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index f223a6148ee..57e47bf5a52 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -250,18 +250,18 @@ enum reg_class { #define REG_CLASS_CONTENTS { \ {0x00000000,0x00000000}, /* NO_REGS */ \ {0x00000001,0x00000000}, /* R0_REG */ \ - {3 << REG_X,0x00000000}, /* POINTER_X_REGS, r26 - r27 */ \ - {3 << REG_Y,0x00000000}, /* POINTER_Y_REGS, r28 - r29 */ \ - {3 << REG_Z,0x00000000}, /* POINTER_Z_REGS, r30 - r31 */ \ + {3u << REG_X,0x00000000}, /* POINTER_X_REGS, r26 - r27 */ \ + {3u << REG_Y,0x00000000}, /* POINTER_Y_REGS, r28 - r29 */ \ + {3u << REG_Z,0x00000000}, /* POINTER_Z_REGS, r30 - r31 */ \ {0x00000000,0x00000003}, /* STACK_REG, STACK */ \ - {(3 << REG_Y) | (3 << REG_Z), \ + {(3u << REG_Y) | (3u << REG_Z), \ 0x00000000}, /* BASE_POINTER_REGS, r28 - r31 */ \ - {(3 << REG_X) | (3 << REG_Y) | (3 << REG_Z), \ + {(3u << REG_X) | (3u << REG_Y) | (3u << REG_Z), \ 0x00000000}, /* POINTER_REGS, r26 - r31 */ \ - {(3 << REG_X) | (3 << REG_Y) | (3 << REG_Z) | (3 << REG_W), \ + {(3u << REG_X) | (3u << REG_Y) | (3u << REG_Z) | (3u << REG_W), \ 0x00000000}, /* ADDW_REGS, r24 - r31 */ \ {0x00ff0000,0x00000000}, /* SIMPLE_LD_REGS r16 - r23 */ \ - {(3 << REG_X)|(3 << REG_Y)|(3 << REG_Z)|(3 << REG_W)|(0xff << 16), \ + {(3u << REG_X)|(3u << REG_Y)|(3u << REG_Z)|(3u << REG_W)|(0xffu << 16),\ 0x00000000}, /* LD_REGS, r16 - r31 */ \ {0x0000ffff,0x00000000}, /* NO_LD_REGS r0 - r15 */ \ {0xffffffff,0x00000000}, /* GENERAL_REGS, r0 - r31 */ \ diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md index ae2e7651d44..f56008bf436 100644 --- a/gcc/config/avr/avr.md +++ b/gcc/config/avr/avr.md @@ -367,6 +367,15 @@ "" { int i; + + // Avoid (subreg (mem)) for non-generic address spaces below. Because + // of the poor addressing capabilities of these spaces it's better to + // load them in one chunk. And it avoids PR61443. + + if (MEM_P (operands[0]) + && !ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (operands[0]))) + operands[0] = copy_to_mode_reg (<MODE>mode, operands[0]); + for (i = GET_MODE_SIZE (<MODE>mode) - 1; i >= 0; --i) { rtx part = simplify_gen_subreg (QImode, operands[0], <MODE>mode, i); diff --git a/gcc/config/elfos.h b/gcc/config/elfos.h index 438302345cf..43aab7362f3 100644 --- a/gcc/config/elfos.h +++ b/gcc/config/elfos.h @@ -287,7 +287,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see /* Write the extra assembler code needed to declare an object properly. */ #ifdef HAVE_GAS_GNU_UNIQUE_OBJECT -#define USE_GNU_UNIQUE_OBJECT 1 +#define USE_GNU_UNIQUE_OBJECT flag_gnu_unique #else #define USE_GNU_UNIQUE_OBJECT 0 #endif diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c index 148fbc227c1..87b6a1b4ab6 100644 --- a/gcc/config/i386/driver-i386.c +++ b/gcc/config/i386/driver-i386.c @@ -713,6 +713,11 @@ const char *host_detect_local_cpu (int argc, const char **argv) /* Assume Core 2. */ cpu = "core2"; } + else if (has_longmode) + /* Perhaps some emulator? Assume x86-64, otherwise gcc + -march=native would be unusable for 64-bit compilations, + as all the CPUs below are 32-bit only. */ + cpu = "x86-64"; else if (has_sse3) /* It is Core Duo. */ cpu = "pentium-m"; diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index b585fc14ee5..5e84e53fb13 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -20505,7 +20505,7 @@ ix86_expand_vec_perm (rtx operands[]) t1 = gen_reg_rtx (V32QImode); t2 = gen_reg_rtx (V32QImode); t3 = gen_reg_rtx (V32QImode); - vt2 = GEN_INT (128); + vt2 = GEN_INT (-128); for (i = 0; i < 32; i++) vec[i] = vt2; vt = gen_rtx_CONST_VECTOR (V32QImode, gen_rtvec_v (32, vec)); @@ -24640,13 +24640,17 @@ ix86_dependencies_evaluation_hook (rtx head, rtx tail) { edge e; edge_iterator ei; - /* Assume that region is SCC, i.e. all immediate predecessors - of non-head block are in the same region. */ + + /* Regions are SCCs with the exception of selective + scheduling with pipelining of outer blocks enabled. + So also check that immediate predecessors of a non-head + block are in the same region. */ FOR_EACH_EDGE (e, ei, bb->preds) { /* Avoid creating of loop-carried dependencies through - using topological odering in region. */ - if (BLOCK_TO_BB (bb->index) > BLOCK_TO_BB (e->src->index)) + using topological ordering in the region. */ + if (rgn == CONTAINING_RGN (e->src->index) + && BLOCK_TO_BB (bb->index) > BLOCK_TO_BB (e->src->index)) add_dependee_for_func_arg (first_arg, e->src); } } diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 891d4d4f3ed..d5055943f13 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -5339,66 +5339,37 @@ ;; Avoid store forwarding (partial memory) stall penalty by extending ;; SImode value to DImode through XMM register instead of pushing two -;; SImode values to stack. Note that even !TARGET_INTER_UNIT_MOVES -;; targets benefit from this optimization. Also note that fild -;; loads from memory only. +;; SImode values to stack. Also note that fild loads from memory only. -(define_insn "*floatunssi<mode>2_1" - [(set (match_operand:X87MODEF 0 "register_operand" "=f,f") +(define_insn_and_split "*floatunssi<mode>2_i387_with_xmm" + [(set (match_operand:X87MODEF 0 "register_operand" "=f") (unsigned_float:X87MODEF - (match_operand:SI 1 "nonimmediate_operand" "x,m"))) - (clobber (match_operand:DI 2 "memory_operand" "=m,m")) - (clobber (match_scratch:SI 3 "=X,x"))] + (match_operand:SI 1 "nonimmediate_operand" "rm"))) + (clobber (match_scratch:DI 3 "=x")) + (clobber (match_operand:DI 2 "memory_operand" "=m"))] "!TARGET_64BIT && TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode) - && TARGET_SSE" + && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES" "#" - [(set_attr "type" "multi") - (set_attr "mode" "<MODE>")]) - -(define_split - [(set (match_operand:X87MODEF 0 "register_operand") - (unsigned_float:X87MODEF - (match_operand:SI 1 "register_operand"))) - (clobber (match_operand:DI 2 "memory_operand")) - (clobber (match_scratch:SI 3))] - "!TARGET_64BIT - && TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode) - && TARGET_SSE - && reload_completed" - [(set (match_dup 2) (match_dup 1)) - (set (match_dup 0) - (float:X87MODEF (match_dup 2)))] - "operands[1] = simplify_gen_subreg (DImode, operands[1], SImode, 0);") - -(define_split - [(set (match_operand:X87MODEF 0 "register_operand") - (unsigned_float:X87MODEF - (match_operand:SI 1 "memory_operand"))) - (clobber (match_operand:DI 2 "memory_operand")) - (clobber (match_scratch:SI 3))] - "!TARGET_64BIT - && TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode) - && TARGET_SSE - && reload_completed" - [(set (match_dup 2) (match_dup 3)) + "&& reload_completed" + [(set (match_dup 3) (zero_extend:DI (match_dup 1))) + (set (match_dup 2) (match_dup 3)) (set (match_dup 0) (float:X87MODEF (match_dup 2)))] -{ - emit_move_insn (operands[3], operands[1]); - operands[3] = simplify_gen_subreg (DImode, operands[3], SImode, 0); -}) + "" + [(set_attr "type" "multi") + (set_attr "mode" "<MODE>")]) (define_expand "floatunssi<mode>2" [(parallel [(set (match_operand:X87MODEF 0 "register_operand") (unsigned_float:X87MODEF (match_operand:SI 1 "nonimmediate_operand"))) - (clobber (match_dup 2)) - (clobber (match_scratch:SI 3))])] + (clobber (match_scratch:DI 3)) + (clobber (match_dup 2))])] "!TARGET_64BIT && ((TARGET_80387 && X87_ENABLE_FLOAT (<X87MODEF:MODE>mode, DImode) - && TARGET_SSE) + && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES) || (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH))" { if (SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md index f1913b3c1db..7d613f44351 100644 --- a/gcc/config/microblaze/microblaze.md +++ b/gcc/config/microblaze/microblaze.md @@ -1119,18 +1119,6 @@ } ) -;;Load and store reverse -(define_insn "movsi4_rev" - [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Q") - (bswap:SI (match_operand:SF 1 "reg_or_mem_operand" "Q,r")))] - "TARGET_REORDER" - "@ - lwr\t%0,%y1,r0 - swr\t%1,%y0,r0" - [(set_attr "type" "load,store") - (set_attr "mode" "SI") - (set_attr "length" "4,4")]) - ;; 32-bit floating point moves (define_expand "movsf" diff --git a/gcc/config/microblaze/predicates.md b/gcc/config/microblaze/predicates.md index 905d46a9d1f..2c23291a9f7 100644 --- a/gcc/config/microblaze/predicates.md +++ b/gcc/config/microblaze/predicates.md @@ -85,10 +85,6 @@ (ior (match_operand 0 "const_0_operand") (match_operand 0 "register_operand"))) -(define_predicate "reg_or_mem_operand" - (ior (match_operand 0 "memory_operand") - (match_operand 0 "register_operand"))) - ;; Return if the operand is either the PC or a label_ref. (define_special_predicate "pc_or_label_operand" (ior (match_code "pc,label_ref") diff --git a/gcc/config/rs6000/freebsd64.h b/gcc/config/rs6000/freebsd64.h index b764f763dc2..cab1f0094d9 100644 --- a/gcc/config/rs6000/freebsd64.h +++ b/gcc/config/rs6000/freebsd64.h @@ -367,7 +367,7 @@ extern int dot_symbols; /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ #undef ADJUST_FIELD_ALIGN #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ - ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \ + (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED)) \ ? 128 \ : (TARGET_64BIT \ && TARGET_ALIGN_NATURAL == 0 \ diff --git a/gcc/config/rs6000/htm.md b/gcc/config/rs6000/htm.md index e8ec91aef71..1a1e4351e5c 100644 --- a/gcc/config/rs6000/htm.md +++ b/gcc/config/rs6000/htm.md @@ -179,7 +179,7 @@ (const_int 0)] UNSPECV_HTM_TABORTWCI)) (set (subreg:CC (match_dup 2) 0) (match_dup 1)) - (set (match_dup 3) (lshiftrt:SI (match_dup 2) (const_int 24))) + (set (match_dup 3) (lshiftrt:SI (match_dup 2) (const_int 28))) (parallel [(set (match_operand:SI 0 "int_reg_operand" "") (and:SI (match_dup 3) (const_int 15))) (clobber (scratch:CC))])] diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index c598af1124a..1f4e20b03f3 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -246,7 +246,7 @@ extern int dot_symbols; /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ #undef ADJUST_FIELD_ALIGN #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ - ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \ + (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED)) \ ? 128 \ : (TARGET_64BIT \ && TARGET_ALIGN_NATURAL == 0 \ diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def index 92ba2757769..f7eb2714ff6 100644 --- a/gcc/config/rs6000/rs6000-builtin.def +++ b/gcc/config/rs6000/rs6000-builtin.def @@ -622,19 +622,12 @@ | RS6000_BTC_TERNARY), \ CODE_FOR_ ## ICODE) /* ICODE */ -/* Miscellaneous builtins. */ -#define BU_MISC_1(ENUM, NAME, ATTR, ICODE) \ - RS6000_BUILTIN_2 (MISC_BUILTIN_ ## ENUM, /* ENUM */ \ - "__builtin_" NAME, /* NAME */ \ - RS6000_BTM_HARD_FLOAT, /* MASK */ \ - (RS6000_BTC_ ## ATTR /* ATTR */ \ - | RS6000_BTC_UNARY), \ - CODE_FOR_ ## ICODE) /* ICODE */ - -#define BU_MISC_2(ENUM, NAME, ATTR, ICODE) \ +/* 128-bit long double floating point builtins. */ +#define BU_LDBL128_2(ENUM, NAME, ATTR, ICODE) \ RS6000_BUILTIN_2 (MISC_BUILTIN_ ## ENUM, /* ENUM */ \ "__builtin_" NAME, /* NAME */ \ - RS6000_BTM_HARD_FLOAT, /* MASK */ \ + (RS6000_BTM_HARD_FLOAT /* MASK */ \ + | RS6000_BTM_LDBL128), \ (RS6000_BTC_ ## ATTR /* ATTR */ \ | RS6000_BTC_BINARY), \ CODE_FOR_ ## ICODE) /* ICODE */ @@ -1593,10 +1586,8 @@ BU_P8V_MISC_3 (BCDSUB_OV, "bcdsub_ov", CONST, bcdsub_unordered) BU_DFP_MISC_2 (PACK_TD, "pack_dec128", CONST, packtd) BU_DFP_MISC_2 (UNPACK_TD, "unpack_dec128", CONST, unpacktd) -BU_MISC_2 (PACK_TF, "pack_longdouble", CONST, packtf) -BU_MISC_2 (UNPACK_TF, "unpack_longdouble", CONST, unpacktf) -BU_MISC_1 (UNPACK_TF_0, "longdouble_dw0", CONST, unpacktf_0) -BU_MISC_1 (UNPACK_TF_1, "longdouble_dw1", CONST, unpacktf_1) +BU_LDBL128_2 (PACK_TF, "pack_longdouble", CONST, packtf) +BU_LDBL128_2 (UNPACK_TF, "unpack_longdouble", CONST, unpacktf) BU_P7_MISC_2 (PACK_V1TI, "pack_vector_int128", CONST, packv1ti) BU_P7_MISC_2 (UNPACK_V1TI, "unpack_vector_int128", CONST, unpackv1ti) diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index 71d5d0a7301..02d2c3bd727 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -153,6 +153,7 @@ extern void rs6000_split_logical (rtx [], enum rtx_code, bool, bool, bool, rtx); #ifdef TREE_CODE extern unsigned int rs6000_data_alignment (tree, unsigned int, enum data_align); +extern bool rs6000_special_adjust_field_align_p (tree, unsigned int); extern unsigned int rs6000_special_round_type_align (tree, unsigned int, unsigned int); extern unsigned int darwin_rs6000_special_round_type_align (tree, unsigned int, @@ -161,7 +162,7 @@ extern tree altivec_resolve_overloaded_builtin (location_t, tree, void *); extern rtx rs6000_libcall_value (enum machine_mode); extern rtx rs6000_va_arg (tree, tree); extern int function_ok_for_sibcall (tree); -extern int rs6000_reg_parm_stack_space (tree); +extern int rs6000_reg_parm_stack_space (tree, bool); extern void rs6000_elf_declare_function_name (FILE *, const char *, tree); extern bool rs6000_elf_in_small_data_p (const_tree); #ifdef ARGS_SIZE_RTX diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 08308fdf1e1..b40218da009 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -3014,7 +3014,8 @@ rs6000_builtin_mask_calculate (void) | ((TARGET_CRYPTO) ? RS6000_BTM_CRYPTO : 0) | ((TARGET_HTM) ? RS6000_BTM_HTM : 0) | ((TARGET_DFP) ? RS6000_BTM_DFP : 0) - | ((TARGET_HARD_FLOAT) ? RS6000_BTM_HARD_FLOAT : 0)); + | ((TARGET_HARD_FLOAT) ? RS6000_BTM_HARD_FLOAT : 0) + | ((TARGET_LONG_DOUBLE_128) ? RS6000_BTM_LDBL128 : 0)); } /* Override command line options. Mostly we process the processor type and @@ -5861,6 +5862,34 @@ rs6000_data_alignment (tree type, unsigned int align, enum data_align how) return align; } +/* Previous GCC releases forced all vector types to have 16-byte alignment. */ + +bool +rs6000_special_adjust_field_align_p (tree field, unsigned int computed) +{ + if (TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (field)) == VECTOR_TYPE) + { + if (computed != 128) + { + static bool warned; + if (!warned && warn_psabi) + { + warned = true; + inform (input_location, + "the layout of aggregates containing vectors with" + " %d-byte alignment will change in a future GCC release", + computed / BITS_PER_UNIT); + } + } + /* GCC 4.8/4.9 Note: To avoid any ABI change on a release branch, we + keep the special treatment of vector types, but warn if there will + be differences in future GCC releases. */ + return true; + } + + return false; +} + /* AIX increases natural record alignment to doubleword if the first field is an FP double while the FP fields remain word aligned. */ @@ -6109,7 +6138,8 @@ mem_operand_gpr (rtx op, enum machine_mode mode) return false; extra = GET_MODE_SIZE (mode) - UNITS_PER_WORD; - gcc_assert (extra >= 0); + if (extra < 0) + extra = 0; if (GET_CODE (addr) == LO_SUM) /* For lo_sum addresses, we must allow any offset except one that @@ -9198,14 +9228,51 @@ rs6000_function_arg_boundary (enum machine_mode mode, const_tree type) || (type && TREE_CODE (type) == VECTOR_TYPE && int_size_in_bytes (type) >= 16)) return 128; - else if (((TARGET_MACHO && rs6000_darwin64_abi) - || DEFAULT_ABI == ABI_ELFv2 - || (DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm)) - && mode == BLKmode - && type && TYPE_ALIGN (type) > 64) + + /* Aggregate types that need > 8 byte alignment are quadword-aligned + in the parameter area in the ELFv2 ABI, and in the AIX ABI unless + -mcompat-align-parm is used. */ + if (((DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm) + || DEFAULT_ABI == ABI_ELFv2) + && type && TYPE_ALIGN (type) > 64) + { + /* "Aggregate" means any AGGREGATE_TYPE except for single-element + or homogeneous float/vector aggregates here. We already handled + vector aggregates above, but still need to check for float here. */ + bool aggregate_p = (AGGREGATE_TYPE_P (type) + && !SCALAR_FLOAT_MODE_P (elt_mode)); + + /* We used to check for BLKmode instead of the above aggregate type + check. Warn when this results in any difference to the ABI. */ + if (aggregate_p != (mode == BLKmode)) + { + static bool warned; + if (!warned && warn_psabi) + { + warned = true; + inform (input_location, + "the ABI of passing aggregates with %d-byte alignment" + " will change in a future GCC release", + (int) TYPE_ALIGN (type) / BITS_PER_UNIT); + } + } + + /* GCC 4.8/4.9 Note: To avoid any ABI change on a release branch, we + keep using the BLKmode check, but warn if there will be differences + in future GCC releases. */ + if (mode == BLKmode) + return 128; + } + + /* Similar for the Darwin64 ABI. Note that for historical reasons we + implement the "aggregate type" check as a BLKmode check here; this + means certain aggregate types are in fact not aligned. */ + if (TARGET_MACHO && rs6000_darwin64_abi + && mode == BLKmode + && type && TYPE_ALIGN (type) > 64) return 128; - else - return PARM_BOUNDARY; + + return PARM_BOUNDARY; } /* The offset in words to the start of the parameter save area. */ @@ -10243,6 +10310,7 @@ rs6000_function_arg (cumulative_args_t cum_v, enum machine_mode mode, rtx r, off; int i, k = 0; unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3; + int fpr_words; /* Do we also need to pass this argument in the parameter save area? */ @@ -10271,6 +10339,37 @@ rs6000_function_arg (cumulative_args_t cum_v, enum machine_mode mode, rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off); } + /* If there were not enough FPRs to hold the argument, the rest + usually goes into memory. However, if the current position + is still within the register parameter area, a portion may + actually have to go into GPRs. + + Note that it may happen that the portion of the argument + passed in the first "half" of the first GPR was already + passed in the last FPR as well. + + For unnamed arguments, we already set up GPRs to cover the + whole argument in rs6000_psave_function_arg, so there is + nothing further to do at this point. + + GCC 4.8/4.9 Note: This was implemented incorrectly in earlier + GCC releases. To avoid any ABI change on the release branch, + we retain that original implementation here, but warn if we + encounter a case where the ABI will change in the future. */ + fpr_words = (i * GET_MODE_SIZE (elt_mode)) / (TARGET_32BIT ? 4 : 8); + if (i < n_elts && align_words + fpr_words < GP_ARG_NUM_REG + && cum->nargs_prototype > 0) + { + static bool warned; + if (!warned && warn_psabi) + { + warned = true; + inform (input_location, + "the ABI of passing homogeneous float aggregates" + " will change in a future GCC release"); + } + } + return rs6000_finish_function_arg (mode, rvec, k); } else if (align_words < GP_ARG_NUM_REG) @@ -10497,35 +10596,65 @@ rs6000_parm_needs_stack (cumulative_args_t args_so_far, tree type) list, or passes any parameter in memory. */ static bool -rs6000_function_parms_need_stack (tree fun) +rs6000_function_parms_need_stack (tree fun, bool incoming) { - function_args_iterator args_iter; - tree arg_type; + tree fntype, result; CUMULATIVE_ARGS args_so_far_v; cumulative_args_t args_so_far; if (!fun) /* Must be a libcall, all of which only use reg parms. */ return false; + + fntype = fun; if (!TYPE_P (fun)) - fun = TREE_TYPE (fun); + fntype = TREE_TYPE (fun); /* Varargs functions need the parameter save area. */ - if (!prototype_p (fun) || stdarg_p (fun)) + if ((!incoming && !prototype_p (fntype)) || stdarg_p (fntype)) return true; - INIT_CUMULATIVE_INCOMING_ARGS (args_so_far_v, fun, NULL_RTX); + INIT_CUMULATIVE_INCOMING_ARGS (args_so_far_v, fntype, NULL_RTX); args_so_far = pack_cumulative_args (&args_so_far_v); - if (aggregate_value_p (TREE_TYPE (fun), fun)) + /* When incoming, we will have been passed the function decl. + It is necessary to use the decl to handle K&R style functions, + where TYPE_ARG_TYPES may not be available. */ + if (incoming) { - tree type = build_pointer_type (TREE_TYPE (fun)); - rs6000_parm_needs_stack (args_so_far, type); + gcc_assert (DECL_P (fun)); + result = DECL_RESULT (fun); } + else + result = TREE_TYPE (fntype); - FOREACH_FUNCTION_ARGS (fun, arg_type, args_iter) - if (rs6000_parm_needs_stack (args_so_far, arg_type)) - return true; + if (result && aggregate_value_p (result, fntype)) + { + if (!TYPE_P (result)) + result = TREE_TYPE (result); + result = build_pointer_type (result); + rs6000_parm_needs_stack (args_so_far, result); + } + + if (incoming) + { + tree parm; + + for (parm = DECL_ARGUMENTS (fun); + parm && parm != void_list_node; + parm = TREE_CHAIN (parm)) + if (rs6000_parm_needs_stack (args_so_far, TREE_TYPE (parm))) + return true; + } + else + { + function_args_iterator args_iter; + tree arg_type; + + FOREACH_FUNCTION_ARGS (fntype, arg_type, args_iter) + if (rs6000_parm_needs_stack (args_so_far, arg_type)) + return true; + } return false; } @@ -10537,7 +10666,7 @@ rs6000_function_parms_need_stack (tree fun) all parameters in registers. */ int -rs6000_reg_parm_stack_space (tree fun) +rs6000_reg_parm_stack_space (tree fun, bool incoming) { int reg_parm_stack_space; @@ -10555,7 +10684,7 @@ rs6000_reg_parm_stack_space (tree fun) case ABI_ELFv2: /* ??? Recomputing this every time is a bit expensive. Is there a place to cache this information? */ - if (rs6000_function_parms_need_stack (fun)) + if (rs6000_function_parms_need_stack (fun, incoming)) reg_parm_stack_space = TARGET_64BIT ? 64 : 32; else reg_parm_stack_space = 0; @@ -13544,11 +13673,15 @@ rs6000_invalid_builtin (enum rs6000_builtins fncode) else if ((fnmask & (RS6000_BTM_DFP | RS6000_BTM_P8_VECTOR)) == (RS6000_BTM_DFP | RS6000_BTM_P8_VECTOR)) error ("Builtin function %s requires the -mhard-dfp and" - "-mpower8-vector options", name); + " -mpower8-vector options", name); else if ((fnmask & RS6000_BTM_DFP) != 0) error ("Builtin function %s requires the -mhard-dfp option", name); else if ((fnmask & RS6000_BTM_P8_VECTOR) != 0) error ("Builtin function %s requires the -mpower8-vector option", name); + else if ((fnmask & (RS6000_BTM_HARD_FLOAT | RS6000_BTM_LDBL128)) + == (RS6000_BTM_HARD_FLOAT | RS6000_BTM_LDBL128)) + error ("Builtin function %s requires the -mhard-float and" + " -mlong-double-128 options", name); else if ((fnmask & RS6000_BTM_HARD_FLOAT) != 0) error ("Builtin function %s requires the -mhard-float option", name); else @@ -31413,6 +31546,7 @@ static struct rs6000_opt_mask const rs6000_builtin_mask_names[] = { "htm", RS6000_BTM_HTM, false, false }, { "hard-dfp", RS6000_BTM_DFP, false, false }, { "hard-float", RS6000_BTM_HARD_FLOAT, false, false }, + { "long-double-128", RS6000_BTM_LDBL128, false, false }, }; /* Option variables that we want to support inside attribute((target)) and diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index cd9db8fe41d..90a93f71f4a 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -1593,7 +1593,14 @@ extern enum reg_class rs6000_constraints[RS6000_CONSTRAINT_MAX]; /* Define this if stack space is still allocated for a parameter passed in a register. The value is the number of bytes allocated to this area. */ -#define REG_PARM_STACK_SPACE(FNDECL) rs6000_reg_parm_stack_space((FNDECL)) +#define REG_PARM_STACK_SPACE(FNDECL) \ + rs6000_reg_parm_stack_space ((FNDECL), false) + +/* Define this macro if space guaranteed when compiling a function body + is different to space required when making a call, a situation that + can arise with K&R style function definitions. */ +#define INCOMING_REG_PARM_STACK_SPACE(FNDECL) \ + rs6000_reg_parm_stack_space ((FNDECL), true) /* Define this if the above stack space is to be considered part of the space allocated by the caller. */ @@ -2483,8 +2490,8 @@ extern int frame_pointer_needed; #define RS6000_BTC_SAT RS6000_BTC_MISC /* saturate sets VSCR. */ /* Builtin targets. For now, we reuse the masks for those options that are in - target flags, and pick two random bits for SPE and paired which aren't in - target_flags. */ + target flags, and pick three random bits for SPE, paired and ldbl128 which + aren't in target_flags. */ #define RS6000_BTM_ALWAYS 0 /* Always enabled. */ #define RS6000_BTM_ALTIVEC MASK_ALTIVEC /* VMX/altivec vectors. */ #define RS6000_BTM_VSX MASK_VSX /* VSX (vector/scalar). */ @@ -2501,6 +2508,7 @@ extern int frame_pointer_needed; #define RS6000_BTM_CELL MASK_FPRND /* Target is cell powerpc. */ #define RS6000_BTM_DFP MASK_DFP /* Decimal floating point. */ #define RS6000_BTM_HARD_FLOAT MASK_SOFT_FLOAT /* Hardware floating point. */ +#define RS6000_BTM_LDBL128 MASK_MULTIPLE /* 128-bit long double. */ #define RS6000_BTM_COMMON (RS6000_BTM_ALTIVEC \ | RS6000_BTM_VSX \ @@ -2514,7 +2522,8 @@ extern int frame_pointer_needed; | RS6000_BTM_POPCNTD \ | RS6000_BTM_CELL \ | RS6000_BTM_DFP \ - | RS6000_BTM_HARD_FLOAT) + | RS6000_BTM_HARD_FLOAT \ + | RS6000_BTM_LDBL128) /* Define builtin enum index. */ diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index b1354ff606a..bff4cef5fa0 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -737,7 +737,7 @@ (define_insn "*extendsidi2_lfiwax" [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wl,!wu") - (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r,r,Z,Z")))] + (sign_extend:DI (match_operand:SI 1 "lwa_operand" "Y,r,r,Z,Z")))] "TARGET_POWERPC64 && TARGET_LFIWAX" "@ lwa%U1%X1 %0,%1 @@ -760,7 +760,7 @@ (define_insn "*extendsidi2_nocell" [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r") - (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))] + (sign_extend:DI (match_operand:SI 1 "lwa_operand" "Y,r")))] "TARGET_POWERPC64 && rs6000_gen_cell_microcode && !TARGET_LFIWAX" "@ lwa%U1%X1 %0,%1 @@ -15847,26 +15847,6 @@ "" "") -;; The Advance Toolchain 7.0-3 added private builtins: __builtin_longdouble_dw0 -;; and __builtin_longdouble_dw1 to optimize glibc. Add support for these -;; builtins here. - -(define_expand "unpacktf_0" - [(set (match_operand:DF 0 "nonimmediate_operand" "") - (unspec:DF [(match_operand:TF 1 "register_operand" "") - (const_int 0)] - UNSPEC_UNPACK_128BIT))] - "" - "") - -(define_expand "unpacktf_1" - [(set (match_operand:DF 0 "nonimmediate_operand" "") - (unspec:DF [(match_operand:TF 1 "register_operand" "") - (const_int 1)] - UNSPEC_UNPACK_128BIT))] - "" - "") - (define_insn_and_split "unpack<mode>_dm" [(set (match_operand:<FP128_64> 0 "nonimmediate_operand" "=d,m,d,r,m") (unspec:<FP128_64> diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index f6795b0a158..05c90643ce5 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -292,7 +292,7 @@ do { \ /* An expression for the alignment of a structure field FIELD if the alignment computed in the usual way is COMPUTED. */ #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ - ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \ + (rs6000_special_adjust_field_align_p ((FIELD), (COMPUTED)) \ ? 128 : COMPUTED) #undef BIGGEST_FIELD_ALIGNMENT @@ -949,3 +949,27 @@ ncrtn.o%s" #define TARGET_USES_SYSV4_OPT 1 #undef DBX_REGISTER_NUMBER + +/* Link -lasan early on the command line. For -static-libasan, don't link + it for -shared link, the executable should be compiled with -static-libasan + in that case, and for executable link link with --{,no-}whole-archive around + it to force everything into the executable. And similarly for -ltsan. */ +#if defined(HAVE_LD_STATIC_DYNAMIC) +#undef LIBASAN_EARLY_SPEC +#define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \ + "%{static-libasan:%{!shared:" \ + LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \ + LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}" +#undef LIBTSAN_EARLY_SPEC +#define LIBTSAN_EARLY_SPEC "%{static-libtsan:%{!shared:" \ + LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \ + LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}" +#endif + +/* Additional libraries needed by -static-libasan. */ +#undef STATIC_LIBASAN_LIBS +#define STATIC_LIBASAN_LIBS "-ldl -lpthread" + +/* Additional libraries needed by -static-libtsan. */ +#undef STATIC_LIBTSAN_LIBS +#define STATIC_LIBTSAN_LIBS "-ldl -lpthread" diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md index 3694e283ce3..d7839f5f5e1 100644 --- a/gcc/config/rs6000/vsx.md +++ b/gcc/config/rs6000/vsx.md @@ -24,6 +24,13 @@ ;; Iterator for the 2 64-bit vector types (define_mode_iterator VSX_D [V2DF V2DI]) +;; Iterator for the 2 64-bit vector types + 128-bit types that are loaded with +;; lxvd2x to properly handle swapping words on little endian +(define_mode_iterator VSX_LE [V2DF + V2DI + V1TI + (TI "VECTOR_MEM_VSX_P (TImode)")]) + ;; Iterator for the 2 32-bit vector types (define_mode_iterator VSX_W [V4SF V4SI]) @@ -228,8 +235,8 @@ ;; The patterns for LE permuted loads and stores come before the general ;; VSX moves so they match first. (define_insn_and_split "*vsx_le_perm_load_<mode>" - [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa") - (match_operand:VSX_D 1 "memory_operand" "Z"))] + [(set (match_operand:VSX_LE 0 "vsx_register_operand" "=wa") + (match_operand:VSX_LE 1 "memory_operand" "Z"))] "!BYTES_BIG_ENDIAN && TARGET_VSX" "#" "!BYTES_BIG_ENDIAN && TARGET_VSX" @@ -342,16 +349,16 @@ (set_attr "length" "8")]) (define_insn "*vsx_le_perm_store_<mode>" - [(set (match_operand:VSX_D 0 "memory_operand" "=Z") - (match_operand:VSX_D 1 "vsx_register_operand" "+wa"))] + [(set (match_operand:VSX_LE 0 "memory_operand" "=Z") + (match_operand:VSX_LE 1 "vsx_register_operand" "+wa"))] "!BYTES_BIG_ENDIAN && TARGET_VSX" "#" [(set_attr "type" "vecstore") (set_attr "length" "12")]) (define_split - [(set (match_operand:VSX_D 0 "memory_operand" "") - (match_operand:VSX_D 1 "vsx_register_operand" ""))] + [(set (match_operand:VSX_LE 0 "memory_operand" "") + (match_operand:VSX_LE 1 "vsx_register_operand" ""))] "!BYTES_BIG_ENDIAN && TARGET_VSX && !reload_completed" [(set (match_dup 2) (vec_select:<MODE> @@ -369,8 +376,8 @@ ;; The post-reload split requires that we re-permute the source ;; register in case it is still live. (define_split - [(set (match_operand:VSX_D 0 "memory_operand" "") - (match_operand:VSX_D 1 "vsx_register_operand" ""))] + [(set (match_operand:VSX_LE 0 "memory_operand" "") + (match_operand:VSX_LE 1 "vsx_register_operand" ""))] "!BYTES_BIG_ENDIAN && TARGET_VSX && reload_completed" [(set (match_dup 1) (vec_select:<MODE> @@ -1352,9 +1359,9 @@ ;; xxpermdi for little endian loads and stores. We need several of ;; these since the form of the PARALLEL differs by mode. (define_insn "*vsx_xxpermdi2_le_<mode>" - [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa") - (vec_select:VSX_D - (match_operand:VSX_D 1 "vsx_register_operand" "wa") + [(set (match_operand:VSX_LE 0 "vsx_register_operand" "=wa") + (vec_select:VSX_LE + (match_operand:VSX_LE 1 "vsx_register_operand" "wa") (parallel [(const_int 1) (const_int 0)])))] "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)" "xxpermdi %x0,%x1,%x1,2" @@ -1401,9 +1408,9 @@ ;; lxvd2x for little endian loads. We need several of ;; these since the form of the PARALLEL differs by mode. (define_insn "*vsx_lxvd2x2_le_<mode>" - [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa") - (vec_select:VSX_D - (match_operand:VSX_D 1 "memory_operand" "Z") + [(set (match_operand:VSX_LE 0 "vsx_register_operand" "=wa") + (vec_select:VSX_LE + (match_operand:VSX_LE 1 "memory_operand" "Z") (parallel [(const_int 1) (const_int 0)])))] "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)" "lxvd2x %x0,%y1" @@ -1450,9 +1457,9 @@ ;; stxvd2x for little endian stores. We need several of ;; these since the form of the PARALLEL differs by mode. (define_insn "*vsx_stxvd2x2_le_<mode>" - [(set (match_operand:VSX_D 0 "memory_operand" "=Z") - (vec_select:VSX_D - (match_operand:VSX_D 1 "vsx_register_operand" "wa") + [(set (match_operand:VSX_LE 0 "memory_operand" "=Z") + (vec_select:VSX_LE + (match_operand:VSX_LE 1 "vsx_register_operand" "wa") (parallel [(const_int 1) (const_int 0)])))] "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)" "stxvd2x %x1,%y0" @@ -1606,7 +1613,7 @@ { if (GET_CODE (op3) == SCRATCH) op3 = gen_reg_rtx (V4SFmode); - emit_insn (gen_vsx_xxsldwi_v4sf (op3, op1, op1, op2)); + emit_insn (gen_vsx_xxsldwi_v4sf (op3, op1, op1, GEN_INT (ele))); tmp = op3; } emit_insn (gen_vsx_xscvspdp_scalar2 (op0, tmp)); diff --git a/gcc/config/sparc/sync.md b/gcc/config/sparc/sync.md index cf909853b37..7e39b983d6a 100644 --- a/gcc/config/sparc/sync.md +++ b/gcc/config/sparc/sync.md @@ -64,11 +64,19 @@ "stbar" [(set_attr "type" "multi")]) +;; For LEON3, STB has the effect of membar #StoreLoad. +(define_insn "*membar_storeload_leon3" + [(set (match_operand:BLK 0 "" "") + (unspec:BLK [(match_dup 0) (const_int 2)] UNSPEC_MEMBAR))] + "TARGET_LEON3" + "stb\t%%g0, [%%sp-1]" + [(set_attr "type" "store")]) + ;; For V8, LDSTUB has the effect of membar #StoreLoad. (define_insn "*membar_storeload" [(set (match_operand:BLK 0 "" "") (unspec:BLK [(match_dup 0) (const_int 2)] UNSPEC_MEMBAR))] - "TARGET_V8" + "TARGET_V8 && !TARGET_LEON3" "ldstub\t[%%sp-1], %%g0" [(set_attr "type" "multi")]) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c4d2dee85cc..82e61f5f6b7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,67 @@ +2014-08-07 Jason Merrill <jason@redhat.com> + + PR c++/61959 + * semantics.c (cxx_eval_bare_aggregate): Handle POINTER_PLUS_EXPR. + + PR c++/58714 + * tree.c (stabilize_expr): A stabilized prvalue is an xvalue. + +2014-01-27 Jason Merrill <jason@redhat.com> + + PR c++/59823 + Core DR 1138 + * call.c (reference_binding): Pass LOOKUP_NO_TEMP_BIND for + list-initialization. A conversion to rvalue ref that involves + an lvalue-rvalue conversion is bad. + (convert_like_real): Give helpful error message. + +2014-01-29 Jason Merrill <jason@redhat.com> + + PR c++/59956 + * friend.c (do_friend): Pass the TEMPLATE_DECL to add_friend if we + have a friend template in a class template. + * pt.c (tsubst_friend_function): Look through it. + (push_template_decl_real): A friend member template is + primary. + +2014-02-21 Jason Merrill <jason@redhat.com> + + PR c++/60241 + * pt.c (lookup_template_class_1): Update DECL_TEMPLATE_INSTANTIATIONS + of the partial instantiation, not the most general template. + (maybe_process_partial_specialization): Reassign everything on + that list. + +2014-03-05 Jason Merrill <jason@redhat.com> + + PR c++/60361 + * parser.c (cp_parser_template_id): Don't set up a CPP_TEMPLATE_ID + if re-parsing might succeed. + * semantics.c (finish_id_expression): Use of a parameter outside + the function body is a parse error. + +2014-06-30 Jason Merrill <jason@redhat.com> + + PR c++/61647 + * pt.c (type_dependent_expression_p): Check BASELINK_OPTYPE. + + PR c++/61539 + * pt.c (unify_one_argument): Type/expression mismatch just causes + deduction failure. + + PR c++/61500 + * tree.c (lvalue_kind): Handle MEMBER_REF and DOTSTAR_EXPR. + +2014-06-17 Jason Merrill <jason@redhat.com> + + PR c++/60605 + * pt.c (check_default_tmpl_args): Check DECL_LOCAL_FUNCTION_P. + +2014-06-02 Jason Merrill <jason@redhat.com> + + PR c++/61134 + * pt.c (pack_deducible_p): Handle canonicalization. + 2014-05-22 Release Manager * GCC 4.8.3 released. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 51e1d192958..a4deef080ec 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -1464,7 +1464,7 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags, { maybe_warn_cpp0x (CPP0X_INITIALIZER_LISTS); conv = implicit_conversion (to, from, expr, c_cast_p, - flags, complain); + flags|LOOKUP_NO_TEMP_BIND, complain); if (!CLASS_TYPE_P (to) && CONSTRUCTOR_NELTS (expr) == 1) { @@ -1624,9 +1624,9 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags, /* [dcl.init.ref] - Otherwise, the reference shall be to a non-volatile const type. - - Under C++0x, [8.5.3/5 dcl.init.ref] it may also be an rvalue reference */ + Otherwise, the reference shall be an lvalue reference to a + non-volatile const type, or the reference shall be an rvalue + reference. */ if (!CP_TYPE_CONST_NON_VOLATILE_P (to) && !TYPE_REF_IS_RVALUE (rto)) return NULL; @@ -1664,7 +1664,16 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags, /* This reference binding, unlike those above, requires the creation of a temporary. */ conv->need_temporary_p = true; - conv->rvaluedness_matches_p = TYPE_REF_IS_RVALUE (rto); + if (TYPE_REF_IS_RVALUE (rto)) + { + conv->rvaluedness_matches_p = 1; + /* In the second case, if the reference is an rvalue reference and + the second standard conversion sequence of the user-defined + conversion sequence includes an lvalue-to-rvalue conversion, the + program is ill-formed. */ + if (conv->user_conv_p && next_conversion (conv)->kind == ck_rvalue) + conv->bad_p = 1; + } return conv; } @@ -5811,7 +5820,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, && convs->kind != ck_list && convs->kind != ck_ambig && (convs->kind != ck_ref_bind - || convs->user_conv_p) + || (convs->user_conv_p && next_conversion (convs)->bad_p)) && (convs->kind != ck_rvalue || SCALAR_TYPE_P (totype)) && convs->kind != ck_base) @@ -6110,7 +6119,8 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, if (convs->bad_p && !next_conversion (convs)->bad_p) { gcc_assert (TYPE_REF_IS_RVALUE (ref_type) - && real_lvalue_p (expr)); + && (real_lvalue_p (expr) + || next_conversion(convs)->kind == ck_rvalue)); error_at (loc, "cannot bind %qT lvalue to %qT", TREE_TYPE (expr), totype); diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c index 083372849b9..d0fe981ebbb 100644 --- a/gcc/cp/friend.c +++ b/gcc/cp/friend.c @@ -502,7 +502,13 @@ do_friend (tree ctype, tree declarator, tree decl, ? current_template_parms : NULL_TREE); - if (template_member_p && decl && TREE_CODE (decl) == FUNCTION_DECL) + if ((template_member_p + /* Always pull out the TEMPLATE_DECL if we have a friend + template in a class template so that it gets tsubsted + properly later on (59956). tsubst_friend_function knows + how to tell this apart from a member template. */ + || (class_template_depth && friend_depth)) + && decl && TREE_CODE (decl) == FUNCTION_DECL) decl = DECL_TI_TEMPLATE (decl); if (decl) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index c512d69c6a6..affe2df0c47 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -12831,7 +12831,12 @@ cp_parser_template_id (cp_parser *parser, the effort required to do the parse, nor will we issue duplicate error messages about problems during instantiation of the template. */ - if (start_of_id) + if (start_of_id + /* Don't do this if we had a parse error in a declarator; re-parsing + might succeed if a name changes meaning (60361). */ + && !(cp_parser_error_occurred (parser) + && cp_parser_parsing_tentatively (parser) + && parser->in_declarator_p)) { cp_token *token = cp_lexer_token_at (parser->lexer, start_of_id); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 724707b5a0d..c03af2e93e0 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -907,11 +907,13 @@ maybe_process_partial_specialization (tree type) t; t = TREE_CHAIN (t)) { tree inst = TREE_VALUE (t); - if (CLASSTYPE_TEMPLATE_SPECIALIZATION (inst)) + if (CLASSTYPE_TEMPLATE_SPECIALIZATION (inst) + || !COMPLETE_OR_OPEN_TYPE_P (inst)) { /* We already have a full specialization of this partial - instantiation. Reassign it to the new member - specialization template. */ + instantiation, or a full specialization has been + looked up but not instantiated. Reassign it to the + new member specialization template. */ spec_entry elt; spec_entry *entry; void **slot; @@ -930,7 +932,7 @@ maybe_process_partial_specialization (tree type) *entry = elt; *slot = entry; } - else if (COMPLETE_OR_OPEN_TYPE_P (inst)) + else /* But if we've had an implicit instantiation, that's a problem ([temp.expl.spec]/6). */ error ("specialization %qT after instantiation %qT", @@ -4308,7 +4310,8 @@ check_default_tmpl_args (tree decl, tree parms, bool is_primary, in the template-parameter-list of the definition of a member of a class template. */ - if (TREE_CODE (CP_DECL_CONTEXT (decl)) == FUNCTION_DECL) + if (TREE_CODE (CP_DECL_CONTEXT (decl)) == FUNCTION_DECL + || (TREE_CODE (decl) == FUNCTION_DECL && DECL_LOCAL_FUNCTION_P (decl))) /* You can't have a function template declaration in a local scope, nor you can you define a member of a class template in a local scope. */ @@ -4572,7 +4575,8 @@ push_template_decl_real (tree decl, bool is_friend) DECL_CONTEXT (decl) = FROB_CONTEXT (current_namespace); /* See if this is a primary template. */ - if (is_friend && ctx) + if (is_friend && ctx + && uses_template_parms_level (ctx, processing_template_decl)) /* A friend template that specifies a class context, i.e. template <typename T> friend void A<T>::f(); is not primary. */ @@ -7454,7 +7458,7 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context, } /* Let's consider the explicit specialization of a member - of a class template specialization that is implicitely instantiated, + of a class template specialization that is implicitly instantiated, e.g.: template<class T> struct S @@ -7552,9 +7556,9 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context, /* Note this use of the partial instantiation so we can check it later in maybe_process_partial_specialization. */ - DECL_TEMPLATE_INSTANTIATIONS (templ) + DECL_TEMPLATE_INSTANTIATIONS (found) = tree_cons (arglist, t, - DECL_TEMPLATE_INSTANTIATIONS (templ)); + DECL_TEMPLATE_INSTANTIATIONS (found)); if (TREE_CODE (template_type) == ENUMERAL_TYPE && !is_dependent_type) /* Now that the type has been registered on the instantiations @@ -8289,10 +8293,17 @@ tsubst_friend_function (tree decl, tree args) if (COMPLETE_TYPE_P (context)) { + tree fn = new_friend; + /* do_friend adds the TEMPLATE_DECL for any member friend + template even if it isn't a member template, i.e. + template <class T> friend A<T>::f(); + Look through it in that case. */ + if (TREE_CODE (fn) == TEMPLATE_DECL + && !PRIMARY_TEMPLATE_P (fn)) + fn = DECL_TEMPLATE_RESULT (fn); /* Check to see that the declaration is really present, and, possibly obtain an improved declaration. */ - tree fn = check_classfn (context, - new_friend, NULL_TREE); + fn = check_classfn (context, fn, NULL_TREE); if (fn) new_friend = fn; @@ -14934,7 +14945,7 @@ pack_deducible_p (tree parm, tree fn) continue; for (packs = PACK_EXPANSION_PARAMETER_PACKS (type); packs; packs = TREE_CHAIN (packs)) - if (TREE_VALUE (packs) == parm) + if (template_args_equal (TREE_VALUE (packs), parm)) { /* The template parameter pack is used in a function parameter pack. If this is the end of the parameter list, the @@ -15502,8 +15513,9 @@ unify_one_argument (tree tparms, tree targs, tree parm, tree arg, maybe_adjust_types_for_deduction (strict, &parm, &arg, arg_expr); } else - gcc_assert ((TYPE_P (parm) || TREE_CODE (parm) == TEMPLATE_DECL) - == (TYPE_P (arg) || TREE_CODE (arg) == TEMPLATE_DECL)); + if ((TYPE_P (parm) || TREE_CODE (parm) == TEMPLATE_DECL) + != (TYPE_P (arg) || TREE_CODE (arg) == TEMPLATE_DECL)) + return unify_template_argument_mismatch (explain_p, parm, arg); /* For deduction from an init-list we need the actual list. */ if (arg_expr && BRACE_ENCLOSED_INITIALIZER_P (arg_expr)) @@ -20009,7 +20021,12 @@ type_dependent_expression_p (tree expression) return true; if (BASELINK_P (expression)) - expression = BASELINK_FUNCTIONS (expression); + { + if (BASELINK_OPTYPE (expression) + && dependent_type_p (BASELINK_OPTYPE (expression))) + return true; + expression = BASELINK_FUNCTIONS (expression); + } if (TREE_CODE (expression) == TEMPLATE_ID_EXPR) { diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 95186853374..9825dbe6aa4 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -3108,7 +3108,7 @@ finish_id_expression (tree id_expression, && DECL_CONTEXT (decl) == NULL_TREE && !cp_unevaluated_operand) { - error ("use of parameter %qD outside function body", decl); + *error_msg = "use of parameter outside function body"; return error_mark_node; } } @@ -7296,7 +7296,9 @@ cxx_eval_bare_aggregate (const constexpr_call *call, tree t, constructor_elt *inner = base_field_constructor_elt (n, ce->index); inner->value = elt; } - else if (ce->index && TREE_CODE (ce->index) == NOP_EXPR) + else if (ce->index + && (TREE_CODE (ce->index) == NOP_EXPR + || TREE_CODE (ce->index) == POINTER_PLUS_EXPR)) { /* This is an initializer for an empty base; now that we've checked that it's constant, we can ignore it. */ diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index c7502d6207b..a9ff1c16350 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -97,6 +97,16 @@ lvalue_kind (const_tree ref) case IMAGPART_EXPR: return lvalue_kind (TREE_OPERAND (ref, 0)); + case MEMBER_REF: + case DOTSTAR_EXPR: + if (TREE_CODE (ref) == MEMBER_REF) + op1_lvalue_kind = clk_ordinary; + else + op1_lvalue_kind = lvalue_kind (TREE_OPERAND (ref, 0)); + if (TYPE_PTRMEMFUNC_P (TREE_TYPE (TREE_OPERAND (ref, 1)))) + op1_lvalue_kind = clk_none; + return op1_lvalue_kind; + case COMPONENT_REF: op1_lvalue_kind = lvalue_kind (TREE_OPERAND (ref, 0)); /* Look at the member designator. */ @@ -3738,6 +3748,10 @@ stabilize_expr (tree exp, tree* initp) { init_expr = get_target_expr (exp); exp = TARGET_EXPR_SLOT (init_expr); + if (CLASS_TYPE_P (TREE_TYPE (exp))) + exp = move (exp); + else + exp = rvalue (exp); } else { diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 0417306014d..a0b30294434 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -375,6 +375,8 @@ goto *(&&foo + array[i]); This is more friendly to code living in shared libraries, as it reduces the number of dynamic relocations that are needed, and by consequence, allows the data to be read-only. +This alternative with label differences is not supported for the AVR target, +please use the first approach for AVR programs. The @code{&&foo} expressions for the same label might have different values if the containing function is inlined or cloned. If a program @@ -10499,7 +10501,7 @@ used. All of them generate the machine instruction that is part of the name. @smallexample -v32qi __builtin_ia32_mpsadbw256 (v32qi,v32qi,v32qi,int) +v32qi __builtin_ia32_mpsadbw256 (v32qi,v32qi,int) v32qi __builtin_ia32_pabsb256 (v32qi) v16hi __builtin_ia32_pabsw256 (v16hi) v8si __builtin_ia32_pabsd256 (v8si) @@ -10734,8 +10736,8 @@ The following built-in functions are available when @option{-mxop} is used. @smallexample v2df __builtin_ia32_vfrczpd (v2df) v4sf __builtin_ia32_vfrczps (v4sf) -v2df __builtin_ia32_vfrczsd (v2df, v2df) -v4sf __builtin_ia32_vfrczss (v4sf, v4sf) +v2df __builtin_ia32_vfrczsd (v2df) +v4sf __builtin_ia32_vfrczss (v4sf) v4df __builtin_ia32_vfrczpd256 (v4df) v8sf __builtin_ia32_vfrczps256 (v8sf) v2di __builtin_ia32_vpcmov (v2di, v2di, v2di) @@ -11864,8 +11866,6 @@ double __builtin_rsqrt (double); uint64_t __builtin_ppc_get_timebase (); unsigned long __builtin_ppc_mftb (); double __builtin_unpack_longdouble (long double, int); -double __builtin_longdouble_dw0 (long double); -double __builtin_longdouble_dw1 (long double); long double __builtin_pack_longdouble (double, double); @end smallexample diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 1265129988e..672d78365f2 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -2915,12 +2915,6 @@ OpenServer/Unixware}. Solaris 2 (SPARC, Intel): @itemize @item -@uref{http://www.sunfreeware.com/,,Sunfreeware} - -@item -@uref{http://www.blastwave.org/,,Blastwave} - -@item @uref{http://www.opencsw.org/,,OpenCSW} @item diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index e4b122ed000..f9843598a62 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1011,6 +1011,7 @@ See S/390 and zSeries Options. -ffixed-@var{reg} -fexceptions @gol -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol -fasynchronous-unwind-tables @gol +-fno-gnu-unique @gol -finhibit-size-directive -finstrument-functions @gol -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol @@ -20378,6 +20379,20 @@ Generate unwind table in DWARF 2 format, if supported by target machine. The table is exact at each instruction boundary, so it can be used for stack unwinding from asynchronous events (such as debugger or garbage collector). +@item -fno-gnu-unique +@opindex fno-gnu-unique +On systems with recent GNU assembler and C library, the C++ compiler +uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions +of template static data members and static local variables in inline +functions are unique even in the presence of @code{RTLD_LOCAL}; this +is necessary to avoid problems with a library used by two different +@code{RTLD_LOCAL} plugins depending on a definition in one of them and +therefore disagreeing with the other one about the binding of the +symbol. But this causes @code{dlclose} to be ignored for affected +DSOs; if your program relies on reinitialization of a DSO via +@code{dlclose} and @code{dlopen}, you can use +@option{-fno-gnu-unique}. + @item -fpcc-struct-return @opindex fpcc-struct-return Return ``short'' @code{struct} and @code{union} values in memory like diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 9330aae5202..ecbf3f4aa03 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1299,6 +1299,9 @@ Target has 64-bit @code{double}. @item double64plus Target has @code{double} that is 64 bits or longer. +@item longdouble128 +Target has 128-bit @code{long double}. + @item int32plus Target has @code{int} that is at 32 bits or longer. diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 5595532fc7b..dbe3d1278f9 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -3930,6 +3930,13 @@ which. @c above is overfull. not sure what to do. --mew 5feb93 did @c something, not sure if it looks good. --mew 10feb93 +@defmac INCOMING_REG_PARM_STACK_SPACE (@var{fndecl}) +Like @code{REG_PARM_STACK_SPACE}, but for incoming register arguments. +Define this macro if space guaranteed when compiling a function body +is different to space required when making a call, a situation that +can arise with K&R style function definitions. +@end defmac + @defmac OUTGOING_REG_PARM_STACK_SPACE (@var{fntype}) Define this to a nonzero value if it is the responsibility of the caller to allocate the area reserved for arguments passed in registers diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index ef2e4016ee7..5bd515a5d5c 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -3898,6 +3898,13 @@ which. @c above is overfull. not sure what to do. --mew 5feb93 did @c something, not sure if it looks good. --mew 10feb93 +@defmac INCOMING_REG_PARM_STACK_SPACE (@var{fndecl}) +Like @code{REG_PARM_STACK_SPACE}, but for incoming register arguments. +Define this macro if space guaranteed when compiling a function body +is different to space required when making a call, a situation that +can arise with K&R style function definitions. +@end defmac + @defmac OUTGOING_REG_PARM_STACK_SPACE (@var{fntype}) Define this to a nonzero value if it is the responsibility of the caller to allocate the area reserved for arguments passed in registers diff --git a/gcc/double-int.c b/gcc/double-int.c index 918ce2273ec..53a69ad67a7 100644 --- a/gcc/double-int.c +++ b/gcc/double-int.c @@ -616,7 +616,7 @@ div_and_round_double (unsigned code, int uns, == (unsigned HOST_WIDE_INT) htwice) && (labs_den <= ltwice))) { - if (*hquo < 0) + if (quo_neg) /* quo = quo - 1; */ add_double (*lquo, *hquo, (HOST_WIDE_INT) -1, (HOST_WIDE_INT) -1, lquo, hquo); diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 44c59c77b24..22e84cf8dd0 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,45 @@ +2014-08-10 Thomas Koenig <tkoenig@gcc.gnu.org> + + Backport from trunk + PR fortran/61999 + * simplify.c (gfc_simplify_dot_product): Convert types of + vectors before calculating the result. + +2014-07-19 Paul Thomas <pault@gcc.gnu.org> + + Backport from trunk. + PR fortran/61780 + * dependency.c (gfc_dep_resolver): Index the 'reverse' array so + that elements are skipped. This then correctly aligns 'reverse' + with the scalarizer loops. + +2014-07-08 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/61459 + PR fortran/58883 + * trans-expr.c (fcncall_realloc_result): Use the natural type + for the address expression of 'res_desc'. + +2014-07-02 Jakub Jelinek <jakub@redhat.com> + Fritz Reese <Reese-Fritz@zai.com> + + * decl.c (variable_decl): Reject old style initialization + for derived type components. + +2014-06-15 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + Backport from trunk. + PR fortran/45187 + * trans-decl.c (gfc_create_module_variable): Don't create + Cray-pointee decls twice. + +2014-05-26 Janne Blomqvist <jb@gcc.gnu.org> + + Backport from mainline + PR libfortran/61310 + * intrinsics.texi (CTIME): Remove mention of locale-dependent + behavior. + 2014-05-22 Release Manager * GCC 4.8.3 released. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 7dec803a36d..9292418adca 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -1996,6 +1996,13 @@ variable_decl (int elem) if (gfc_notify_std (GFC_STD_GNU, "Old-style " "initialization at %C") == FAILURE) return MATCH_ERROR; + else if (gfc_current_state () == COMP_DERIVED) + { + gfc_error ("Invalid old style initialization for derived type " + "component at %C"); + m = MATCH_ERROR; + goto cleanup; + } return match_old_style_init (name); } diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c index e58bd227bde..3924905f0ef 100644 --- a/gcc/fortran/dependency.c +++ b/gcc/fortran/dependency.c @@ -1779,6 +1779,7 @@ int gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse) { int n; + int m; gfc_dependency fin_dep; gfc_dependency this_dep; @@ -1828,6 +1829,8 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse) break; } + /* Index for the reverse array. */ + m = -1; for (n=0; n < lref->u.ar.dimen; n++) { /* Assume dependency when either of array reference is vector @@ -1862,38 +1865,44 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse) The ability to reverse or not is set by previous conditions in this dimension. If reversal is not activated, the value GFC_DEP_BACKWARD is reset to GFC_DEP_OVERLAP. */ + + /* Get the indexing right for the scalarizing loop. If this + is an element, there is no corresponding loop. */ + if (lref->u.ar.dimen_type[n] != DIMEN_ELEMENT) + m++; + if (rref->u.ar.dimen_type[n] == DIMEN_RANGE && lref->u.ar.dimen_type[n] == DIMEN_RANGE) { /* Set reverse if backward dependence and not inhibited. */ - if (reverse && reverse[n] == GFC_ENABLE_REVERSE) - reverse[n] = (this_dep == GFC_DEP_BACKWARD) ? - GFC_REVERSE_SET : reverse[n]; + if (reverse && reverse[m] == GFC_ENABLE_REVERSE) + reverse[m] = (this_dep == GFC_DEP_BACKWARD) ? + GFC_REVERSE_SET : reverse[m]; /* Set forward if forward dependence and not inhibited. */ - if (reverse && reverse[n] == GFC_ENABLE_REVERSE) - reverse[n] = (this_dep == GFC_DEP_FORWARD) ? - GFC_FORWARD_SET : reverse[n]; + if (reverse && reverse[m] == GFC_ENABLE_REVERSE) + reverse[m] = (this_dep == GFC_DEP_FORWARD) ? + GFC_FORWARD_SET : reverse[m]; /* Flag up overlap if dependence not compatible with the overall state of the expression. */ - if (reverse && reverse[n] == GFC_REVERSE_SET + if (reverse && reverse[m] == GFC_REVERSE_SET && this_dep == GFC_DEP_FORWARD) { - reverse[n] = GFC_INHIBIT_REVERSE; + reverse[m] = GFC_INHIBIT_REVERSE; this_dep = GFC_DEP_OVERLAP; } - else if (reverse && reverse[n] == GFC_FORWARD_SET + else if (reverse && reverse[m] == GFC_FORWARD_SET && this_dep == GFC_DEP_BACKWARD) { - reverse[n] = GFC_INHIBIT_REVERSE; + reverse[m] = GFC_INHIBIT_REVERSE; this_dep = GFC_DEP_OVERLAP; } /* If no intention of reversing or reversing is explicitly inhibited, convert backward dependence to overlap. */ if ((reverse == NULL && this_dep == GFC_DEP_BACKWARD) - || (reverse != NULL && reverse[n] == GFC_INHIBIT_REVERSE)) + || (reverse != NULL && reverse[m] == GFC_INHIBIT_REVERSE)) this_dep = GFC_DEP_OVERLAP; } diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi index 1e31e4fe6d4..a3b80aa779c 100644 --- a/gcc/fortran/intrinsic.texi +++ b/gcc/fortran/intrinsic.texi @@ -3343,10 +3343,8 @@ end program test_cshift @table @asis @item @emph{Description}: @code{CTIME} converts a system time value, such as returned by -@code{TIME8}, to a string. Unless the application has called -@code{setlocale}, the output will be in the default locale, of length -24 and of the form @samp{Sat Aug 19 18:13:14 1995}. In other locales, -a longer string may result. +@code{TIME8}, to a string. The output will be of the form @samp{Sat +Aug 19 18:13:14 1995}. This intrinsic is provided in both subroutine and function forms; however, only one form can be used in any given program unit. diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 7c21f226d99..65c65a300d2 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -1877,13 +1877,22 @@ gfc_simplify_dim (gfc_expr *x, gfc_expr *y) gfc_expr* gfc_simplify_dot_product (gfc_expr *vector_a, gfc_expr *vector_b) { + + gfc_expr temp; + if (!is_constant_array_expr (vector_a) || !is_constant_array_expr (vector_b)) return NULL; gcc_assert (vector_a->rank == 1); gcc_assert (vector_b->rank == 1); - gcc_assert (gfc_compare_types (&vector_a->ts, &vector_b->ts)); + + temp.expr_type = EXPR_OP; + gfc_clear_ts (&temp.ts); + temp.value.op.op = INTRINSIC_NONE; + temp.value.op.op1 = vector_a; + temp.value.op.op2 = vector_b; + gfc_type_convert_binary (&temp, 1); return compute_dot_product (vector_a, 1, 0, vector_b, 1, 0, true); } diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 7d23561872b..b4b0fc536b0 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -4084,8 +4084,8 @@ gfc_create_module_variable (gfc_symbol * sym) } /* Don't generate variables from other modules. Variables from - COMMONs will already have been generated. */ - if (sym->attr.use_assoc || sym->attr.in_common) + COMMONs and Cray pointees will already have been generated. */ + if (sym->attr.use_assoc || sym->attr.in_common || sym->attr.cray_pointee) return; /* Equivalenced variables arrive here after creation. */ diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index d6411b0f5ec..850ed834a58 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -7096,7 +7096,7 @@ fcncall_realloc_result (gfc_se *se, int rank) res_desc = gfc_evaluate_now (desc, &se->pre); gfc_conv_descriptor_data_set (&se->pre, res_desc, null_pointer_node); - se->expr = gfc_build_addr_expr (TREE_TYPE (se->expr), res_desc); + se->expr = gfc_build_addr_expr (NULL_TREE, res_desc); /* Free the lhs after the function call and copy the result data to the lhs descriptor. */ diff --git a/gcc/function.c b/gcc/function.c index bc04dcb9d8d..76baf307984 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -1354,9 +1354,13 @@ static int cfa_offset; #define STACK_POINTER_OFFSET 0 #endif +#if defined (REG_PARM_STACK_SPACE) && !defined (INCOMING_REG_PARM_STACK_SPACE) +#define INCOMING_REG_PARM_STACK_SPACE REG_PARM_STACK_SPACE +#endif + /* If not defined, pick an appropriate default for the offset of dynamically allocated memory depending on the value of ACCUMULATE_OUTGOING_ARGS, - REG_PARM_STACK_SPACE, and OUTGOING_REG_PARM_STACK_SPACE. */ + INCOMING_REG_PARM_STACK_SPACE, and OUTGOING_REG_PARM_STACK_SPACE. */ #ifndef STACK_DYNAMIC_OFFSET @@ -1368,12 +1372,12 @@ static int cfa_offset; `crtl->outgoing_args_size'. Nevertheless, we must allow for it when allocating stack dynamic objects. */ -#if defined(REG_PARM_STACK_SPACE) +#ifdef INCOMING_REG_PARM_STACK_SPACE #define STACK_DYNAMIC_OFFSET(FNDECL) \ ((ACCUMULATE_OUTGOING_ARGS \ ? (crtl->outgoing_args_size \ + (OUTGOING_REG_PARM_STACK_SPACE ((!(FNDECL) ? NULL_TREE : TREE_TYPE (FNDECL))) ? 0 \ - : REG_PARM_STACK_SPACE (FNDECL))) \ + : INCOMING_REG_PARM_STACK_SPACE (FNDECL))) \ : 0) + (STACK_POINTER_OFFSET)) #else #define STACK_DYNAMIC_OFFSET(FNDECL) \ @@ -2211,8 +2215,9 @@ assign_parms_initialize_all (struct assign_parm_data_all *all) #endif all->args_so_far = pack_cumulative_args (&all->args_so_far_v); -#ifdef REG_PARM_STACK_SPACE - all->reg_parm_stack_space = REG_PARM_STACK_SPACE (current_function_decl); +#ifdef INCOMING_REG_PARM_STACK_SPACE + all->reg_parm_stack_space + = INCOMING_REG_PARM_STACK_SPACE (current_function_decl); #endif } @@ -4518,6 +4523,7 @@ allocate_struct_function (tree fndecl, bool abstract_p) /* ??? This could be set on a per-function basis by the front-end but is this worth the hassle? */ cfun->can_throw_non_call_exceptions = flag_non_call_exceptions; + cfun->can_delete_dead_exceptions = flag_delete_dead_exceptions; } } diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index d9d69b3e4aa..bd45575cba6 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -447,6 +447,8 @@ determine_versionability (struct cgraph_node *node) else if (!opt_for_fn (node->symbol.decl, optimize) || !opt_for_fn (node->symbol.decl, flag_ipa_cp)) reason = "non-optimized function"; + else if (node->tm_clone) + reason = "transactional memory clone"; if (reason && dump_file && !node->alias && !node->thunk.thunk_p) fprintf (dump_file, "Function %s/%i is not versionable, reason: %s.\n", diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 95d1168617b..49fadc3a699 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -1586,7 +1586,6 @@ create_omp_child_function (omp_context *ctx, bool task_copy) TREE_STATIC (decl) = 1; TREE_USED (decl) = 1; DECL_ARTIFICIAL (decl) = 1; - DECL_NAMELESS (decl) = 1; DECL_IGNORED_P (decl) = 0; TREE_PUBLIC (decl) = 0; DECL_UNINLINABLE (decl) = 1; diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c index 07857f2d6bf..4ac2542a3af 100644 --- a/gcc/sched-deps.c +++ b/gcc/sched-deps.c @@ -2744,7 +2744,8 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx insn) Consider for instance a volatile asm that changes the fpu rounding mode. An insn should not be moved across this even if it only uses pseudo-regs because it might give an incorrectly rounded result. */ - if (code != ASM_OPERANDS || MEM_VOLATILE_P (x)) + if ((code != ASM_OPERANDS || MEM_VOLATILE_P (x)) + && !DEBUG_INSN_P (insn)) reg_pending_barrier = TRUE_BARRIER; /* For all ASM_OPERANDS, we must traverse the vector of input operands. diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c index 91e91ec37fd..6aa1904f428 100644 --- a/gcc/sel-sched-ir.c +++ b/gcc/sel-sched-ir.c @@ -162,7 +162,7 @@ static void create_initial_data_sets (basic_block); static void free_av_set (basic_block); static void invalidate_av_set (basic_block); static void extend_insn_data (void); -static void sel_init_new_insn (insn_t, int); +static void sel_init_new_insn (insn_t, int, int = -1); static void finish_insns (void); /* Various list functions. */ @@ -4011,9 +4011,10 @@ get_seqno_by_succs (rtx insn) return seqno; } -/* Compute seqno for INSN by its preds or succs. */ +/* Compute seqno for INSN by its preds or succs. Use OLD_SEQNO to compute + seqno in corner cases. */ static int -get_seqno_for_a_jump (insn_t insn) +get_seqno_for_a_jump (insn_t insn, int old_seqno) { int seqno; @@ -4069,8 +4070,16 @@ get_seqno_for_a_jump (insn_t insn) if (seqno < 0) seqno = get_seqno_by_succs (insn); - gcc_assert (seqno >= 0); + if (seqno < 0) + { + /* The only case where this could be here legally is that the only + unscheduled insn was a conditional jump that got removed and turned + into this unconditional one. Initialize from the old seqno + of that jump passed down to here. */ + seqno = old_seqno; + } + gcc_assert (seqno >= 0); return seqno; } @@ -4250,22 +4259,24 @@ init_insn_data (insn_t insn) } /* This is used to initialize spurious jumps generated by - sel_redirect_edge (). */ + sel_redirect_edge (). OLD_SEQNO is used for initializing seqnos + in corner cases within get_seqno_for_a_jump. */ static void -init_simplejump_data (insn_t insn) +init_simplejump_data (insn_t insn, int old_seqno) { init_expr (INSN_EXPR (insn), vinsn_create (insn, false), 0, REG_BR_PROB_BASE, 0, 0, 0, 0, 0, 0, vNULL, true, false, false, false, true); - INSN_SEQNO (insn) = get_seqno_for_a_jump (insn); + INSN_SEQNO (insn) = get_seqno_for_a_jump (insn, old_seqno); init_first_time_insn_data (insn); } /* Perform deferred initialization of insns. This is used to process - a new jump that may be created by redirect_edge. */ -void -sel_init_new_insn (insn_t insn, int flags) + a new jump that may be created by redirect_edge. OLD_SEQNO is used + for initializing simplejumps in init_simplejump_data. */ +static void +sel_init_new_insn (insn_t insn, int flags, int old_seqno) { /* We create data structures for bb when the first insn is emitted in it. */ if (INSN_P (insn) @@ -4292,7 +4303,7 @@ sel_init_new_insn (insn_t insn, int flags) if (flags & INSN_INIT_TODO_SIMPLEJUMP) { extend_insn_data (); - init_simplejump_data (insn); + init_simplejump_data (insn, old_seqno); } gcc_assert (CONTAINING_RGN (BLOCK_NUM (insn)) @@ -5578,14 +5589,14 @@ sel_merge_blocks (basic_block a, basic_block b) } /* A wrapper for redirect_edge_and_branch_force, which also initializes - data structures for possibly created bb and insns. Returns the newly - added bb or NULL, when a bb was not needed. */ + data structures for possibly created bb and insns. */ void sel_redirect_edge_and_branch_force (edge e, basic_block to) { basic_block jump_bb, src, orig_dest = e->dest; int prev_max_uid; rtx jump; + int old_seqno = -1; /* This function is now used only for bookkeeping code creation, where we'll never get the single pred of orig_dest block and thus will not @@ -5594,8 +5605,13 @@ sel_redirect_edge_and_branch_force (edge e, basic_block to) && !single_pred_p (orig_dest)); src = e->src; prev_max_uid = get_max_uid (); - jump_bb = redirect_edge_and_branch_force (e, to); + /* Compute and pass old_seqno down to sel_init_new_insn only for the case + when the conditional jump being redirected may become unconditional. */ + if (any_condjump_p (BB_END (src)) + && INSN_SEQNO (BB_END (src)) >= 0) + old_seqno = INSN_SEQNO (BB_END (src)); + jump_bb = redirect_edge_and_branch_force (e, to); if (jump_bb != NULL) sel_add_bb (jump_bb); @@ -5607,7 +5623,8 @@ sel_redirect_edge_and_branch_force (edge e, basic_block to) jump = find_new_jump (src, jump_bb, prev_max_uid); if (jump) - sel_init_new_insn (jump, INSN_INIT_TODO_LUID | INSN_INIT_TODO_SIMPLEJUMP); + sel_init_new_insn (jump, INSN_INIT_TODO_LUID | INSN_INIT_TODO_SIMPLEJUMP, + old_seqno); set_immediate_dominator (CDI_DOMINATORS, to, recompute_dominator (CDI_DOMINATORS, to)); set_immediate_dominator (CDI_DOMINATORS, orig_dest, @@ -5626,6 +5643,7 @@ sel_redirect_edge_and_branch (edge e, basic_block to) edge redirected; bool recompute_toporder_p = false; bool maybe_unreachable = single_pred_p (orig_dest); + int old_seqno = -1; latch_edge_p = (pipelining_p && current_loop_nest @@ -5634,6 +5652,12 @@ sel_redirect_edge_and_branch (edge e, basic_block to) src = e->src; prev_max_uid = get_max_uid (); + /* Compute and pass old_seqno down to sel_init_new_insn only for the case + when the conditional jump being redirected may become unconditional. */ + if (any_condjump_p (BB_END (src)) + && INSN_SEQNO (BB_END (src)) >= 0) + old_seqno = INSN_SEQNO (BB_END (src)); + redirected = redirect_edge_and_branch (e, to); gcc_assert (redirected && !last_added_blocks.exists ()); @@ -5654,7 +5678,7 @@ sel_redirect_edge_and_branch (edge e, basic_block to) jump = find_new_jump (src, NULL, prev_max_uid); if (jump) - sel_init_new_insn (jump, INSN_INIT_TODO_LUID | INSN_INIT_TODO_SIMPLEJUMP); + sel_init_new_insn (jump, INSN_INIT_TODO_LUID | INSN_INIT_TODO_SIMPLEJUMP, old_seqno); /* Only update dominator info when we don't have unreachable blocks. Otherwise we'll update in maybe_tidy_empty_bb. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 28598e5da21..d55ac28b2dc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,220 @@ +2014-08-10 Thomas Koenig <tkoenig@gcc.gnu.org> + + Backport from trunk + PR fortran/61999 + * gfortran.dg/dot_product_3.f90: New test case. + +2014-08-07 John David Anglin <danglin@gcc.gnu.org> + + PR tree-optimization/60707 + * gfortran.dg/pr45636.f90: xfail on 32-bit hppa*-*-*. + +2014-08-06 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/61801 + * gcc.target/i386/pr61801.c: Rewritten. + +2014-08-01 Thomas Preud'homme <thomas.preudhomme@arm.com> + + Backport from mainline + 2014-06-13 Thomas Preud'homme <thomas.preudhomme@arm.com> + + PR tree-optimization/61375 + * gcc.c-torture/execute/pr61375-1.c: New test. + +2014-08-01 Richard Biener <rguenther@suse.de> + + PR tree-optimization/61964 + * gcc.dg/torture/pr61964.c: New testcase. + * gcc.dg/pr51879-18.c: XFAIL. + +2014-07-28 Richard Biener <rguenther@suse.de> + + PR rtl-optimization/61801 + * gcc.target/i386/pr61801.c: Fix testcase. + +2014-07-28 Richard Biener <rguenther@suse.de> + + PR rtl-optimization/61801 + * gcc.target/i386/pr61801.c: New testcase. + +2014-07-24 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + Backport from mainline: + 2014-07-24 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + * gcc.target/powerpc/ppc64-abi-warn-3.c: New test. + + * gcc.c-torture/execute/20050316-1.x: Add -Wno-psabi. + * gcc.c-torture/execute/20050604-1.x: Add -Wno-psabi. + * gcc.c-torture/execute/20050316-3.x: New file. Add -Wno-psabi. + * gcc.c-torture/execute/pr23135.x: Likewise. + +2014-07-24 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + Backport from mainline: + 2014-07-24 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + * gcc.target/powerpc/ppc64-abi-warn-2.c: New test. + +2014-07-24 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + Backport from mainline: + 2014-07-24 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + * gcc.target/powerpc/ppc64-abi-warn-1.c: New test. + +2014-07-24 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + Backport from mainline: + 2014-07-24 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> + + * g++.dg/compat/struct-layout-1.exp: Load g++-dg.exp. + +2014-07-19 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.dg/stack-usage-2.c: Adjust. + +2014-07-19 Paul Thomas <pault@gcc.gnu.org> + + Backport from trunk. + PR fortran/61780 + * gfortran.dg/dependency_44.f90 : New test + +2014-07-10 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/opt39.adb: New test. + +2014-07-08 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/61459 + PR fortran/58883 + * gfortran.dg/allocatable_function_8.f90 : New test + +2014-07-04 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/61684 + * gcc.c-torture/compile/pr61684.c: New test. + +2014-07-02 Jakub Jelinek <jakub@redhat.com> + Fritz Reese <Reese-Fritz@zai.com> + + * gfortran.dg/oldstyle_5.f: New test. + +2014-06-30 Thomas Preud'homme <thomas.preudhomme@arm.com> + + Backport from mainline + 2014-06-11 Thomas Preud'homme <thomas.preudhomme@arm.com> + + PR tree-optimization/61306 + * gcc.c-torture/execute/pr61306-1.c: New test. + * gcc.c-torture/execute/pr61306-2.c: Likewise. + * gcc.c-torture/execute/pr61306-3.c: Likewise. + +2014-06-27 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + * gfortran.dg/nint_2.f90: Don't XFAIL for powerpc64le-*-linux*. + +2014-06-27 Uros Bizjak <ubizjak@gmail.com> + + Backport from mainline + 2014-06-26 Uros Bizjak <ubizjak@gmail.com> + + PR target/61586 + * gcc.target/alpha/pr61586.c: New test. + +2014-06-25 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + * gfortran.dg/default_format_denormal_2.f90: Remove xfail for + powerpc*-*-linux*. + +2014-06-18 Uros Bizjak <ubizjak@gmail.com> + + Backport from mainline + 2014-06-13 Ilya Enkovich <ilya.enkovich@intel.com> + + PR rtl-optimization/61094 + PR rtl-optimization/61446 + * gcc.target/i386/pr61446.c : New. + + Backport from mainline + 2014-06-06 Uros Bizjak <ubizjak@gmail.com> + + PR target/61423 + * gcc.target/i386/pr61423.c: New test. + +2014-06-17 Yufeng Zhang <yufeng.zhang@arm.com> + + Backport from mainline + + PR target/61483 + * gcc.target/aarch64/aapcs64/type-def.h (struct hfa_fx2_t): New type. + * gcc.target/aarch64/aapcs64/va_arg-13.c: New test. + * gcc.target/aarch64/aapcs64/va_arg-14.c: Ditto. + * gcc.target/aarch64/aapcs64/va_arg-15.c: Ditto. + +2014-06-15 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + Backport from trunk. + PR fortran/45187 + * gfortran.dg/cray_pointers_10.f90: New file. + +2014-06-13 Peter Bergner <bergner@vnet.ibm.com> + + Backport from mainline + + 2014-06-13 Peter Bergner <bergner@vnet.ibm.com> + PR target/61415 + * lib/target-supports.exp (check_effective_target_longdouble128): New. + * gcc.target/powerpc/pack02.c: Use it. + * gcc.target/powerpc/tfmode_off.c: Likewise. + +2014-06-12 Georg-Johann Lay <avr@gjlay.de> + + Backport from 2014-06-12 trunk r211491 + + PR target/61443 + * gcc.target/avr/torture/pr61443.c: New test. + +2014-06-04 Richard Biener <rguenther@suse.de> + + PR tree-optimization/61383 + * gcc.dg/torture/pr61383-1.c: New testcase. + +2014-06-03 Andrey Belevantsev <abel@ispras.ru> + + Backport from mainline + 2014-05-14 Andrey Belevantsev <abel@ispras.ru> + + PR rtl-optimization/60866 + * gcc.dg/pr60866.c: New test. + +2014-06-03 Andrey Belevantsev <abel@ispras.ru> + + Backport from mainline + 2014-05-14 Andrey Belevantsev <abel@ispras.ru> + + PR rtl-optimization/60901 + * gcc.target/i386/pr60901.c: New test. + +2014-05-28 Eric Botcazou <ebotcazou@adacore.com> + + Backport from mainline + 2014-05-27 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/overflow_fixed.adb: New test. + +2014-05-27 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/aliasing1.adb (dg-final): Robustify pattern matching. + +2014-05-22 Peter Bergner <bergner@vnet.ibm.com> + + Backport from mainline + 2014-05-22 Peter Bergner <bergner@vnet.ibm.com> + + * gcc.target/powerpc/htm-ttest.c: New test. + 2014-05-22 Release Manager * GCC 4.8.3 released. diff --git a/gcc/testsuite/g++.dg/compat/struct-layout-1.exp b/gcc/testsuite/g++.dg/compat/struct-layout-1.exp index 04232160fe2..608b70e7625 100644 --- a/gcc/testsuite/g++.dg/compat/struct-layout-1.exp +++ b/gcc/testsuite/g++.dg/compat/struct-layout-1.exp @@ -89,6 +89,9 @@ proc compat-use-tst-compiler { } { # This must be done after the compat-use-*-compiler definitions. load_lib compat.exp +# Provide the g++-dg-prune routine (gcc-dp.exp is loaded by compat.exp) +load_lib g++-dg.exp + g++_init # Save variables for the C++ compiler under test, which each test will diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-empty7.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-empty7.C new file mode 100644 index 00000000000..f491994a1fe --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-empty7.C @@ -0,0 +1,28 @@ +// PR c++/61959 +// { dg-do compile { target c++11 } } + +template <class Coord> struct BasePoint +{ + Coord x, y; + constexpr BasePoint (Coord, Coord) : x (0), y (0) {} +}; +template <class T> struct BaseCoord +{ + int value; + constexpr BaseCoord (T) : value (1) {} +}; +template <class units> struct IntCoordTyped : BaseCoord<int>, units +{ + typedef BaseCoord Super; + constexpr IntCoordTyped (int) : Super (0) {} +}; +template <class units> +struct IntPointTyped : BasePoint<IntCoordTyped<units> >, units +{ + typedef BasePoint<IntCoordTyped<units> > Super; + constexpr IntPointTyped (int, int) : Super (0, 0) {} +}; +struct A +{ +}; +IntPointTyped<A> a (0, 0); diff --git a/gcc/testsuite/g++.dg/cpp0x/overload3.C b/gcc/testsuite/g++.dg/cpp0x/overload3.C new file mode 100644 index 00000000000..9572a47f411 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/overload3.C @@ -0,0 +1,17 @@ +// PR c++/59823 +// { dg-options "-std=c++11" } + +struct X { }; + +void f(X&&); // { dg-message "void f" } + +struct wrap +{ + operator const X&() const; +}; + +int main() +{ + wrap w; + f(w); // { dg-error "lvalue" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/rv-cond1.C b/gcc/testsuite/g++.dg/cpp0x/rv-cond1.C new file mode 100644 index 00000000000..a8f598f17d4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/rv-cond1.C @@ -0,0 +1,13 @@ +// PR c++/58714 +// { dg-do compile { target c++11 } } + +struct X { + X& operator=(const X&) = delete; + X& operator=(X&& ) = default; +}; + +void f(bool t) { + X a, b; + *(t ? &a : &b) = X(); + (t ? a : b) = X(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic158.C b/gcc/testsuite/g++.dg/cpp0x/variadic158.C new file mode 100644 index 00000000000..cc5c24ddc67 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic158.C @@ -0,0 +1,24 @@ +// PR c++/61134 +// { dg-do compile { target c++11 } } + +struct Base { }; + +template <typename> +struct Fixed { + typedef const char* name; +}; + +template <typename VT, typename... Fields> +void New(const char* name, + typename Fixed<Fields>::name... field_names); + +template <typename VT, typename... Fields> +void CreateMetric(const char* name, + typename Fixed<Fields>::name... field_names, + const Base&) { } + + +void Fn() +{ + CreateMetric<int, const char*>("abcd", "def", Base()); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic160.C b/gcc/testsuite/g++.dg/cpp0x/variadic160.C new file mode 100644 index 00000000000..20fcd5b4fe7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic160.C @@ -0,0 +1,49 @@ +// PR c++/61539 +// { dg-do compile { target c++11 } } + +template <typename _CharT> class A; +template <typename> class B; +template <class charT> class C; +template <> class C<char> +{ + virtual void xparse (int &, const B<A<char> > &) const; +}; +template <class T, class charT = char> class G : C<charT> +{ +public: + G (void *) {} + void default_value (const T &); + void xparse (int &, const B<A<charT> > &) const; +}; +template <class T, class charT> +void validate (int &, const B<A<charT> > &, T *, int); +template <class T, class charT> +void G<T, charT>::xparse (int &p1, const B<A<charT> > &p2) const +{ + validate (p1, p2, (T *)0, 0); +} +template <class T> G<T> *value (T *) { return new G<T>(0); } +namespace Eigen +{ +template <typename T> struct D; +template <typename, int, int, int = 0, int = 0, int = 0 > class F; +template <typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, + int _MaxCols> +struct D<F<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > +{ + typedef _Scalar Scalar; +}; +template <typename, int, int, int, int, int _MaxCols> class F +{ +public: + typedef typename Eigen::D<F>::Scalar Scalar; + F (const Scalar &, const Scalar &, const Scalar &); +}; +template <class... T> +void validate (int &, const B<A<char> > &, Eigen::F<T...> *); +} +int main (int, char *[]) +{ + Eigen::F<double, 3, 1> a (0, 0, 0); + value (&a)->default_value (Eigen::F<double, 3, 1>(0, 0, 0)); +} diff --git a/gcc/testsuite/g++.dg/expr/cond12.C b/gcc/testsuite/g++.dg/expr/cond12.C new file mode 100644 index 00000000000..9134f81668f --- /dev/null +++ b/gcc/testsuite/g++.dg/expr/cond12.C @@ -0,0 +1,12 @@ +// PR c++/58714 +// { dg-do run } + +struct X { + X& operator=(const X&){} + X& operator=(X&){__builtin_abort();} +}; + +int main(int argv,char**) { + X a, b; + ((argv > 2) ? a : b) = X(); +} diff --git a/gcc/testsuite/g++.dg/parse/ambig7.C b/gcc/testsuite/g++.dg/parse/ambig7.C new file mode 100644 index 00000000000..9a5b8791d24 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/ambig7.C @@ -0,0 +1,16 @@ +// PR c++/60361 + +struct Helper +{ + Helper(int a, void (*pfunc)()); +}; + +template <int I> void function(); + +const int A = 1; +const int B = 2; + +Helper testOk(A, function<A>); +Helper testOk2(int(A), function<B>); +Helper testOk3((int(A)), function<A>); +Helper testFail(int(A), function<A>); diff --git a/gcc/testsuite/g++.dg/parse/parameter-declaration-2.C b/gcc/testsuite/g++.dg/parse/parameter-declaration-2.C index 6116630433f..3c983cc748c 100644 --- a/gcc/testsuite/g++.dg/parse/parameter-declaration-2.C +++ b/gcc/testsuite/g++.dg/parse/parameter-declaration-2.C @@ -1,2 +1,2 @@ -void f (int i, int p[i]); // { dg-error "use of parameter .i. outside function body" } +void f (int i, int p[i]); // { dg-error "use of parameter.*outside function body" } // { dg-prune-output "array bound" } diff --git a/gcc/testsuite/g++.dg/parse/typename7.C b/gcc/testsuite/g++.dg/parse/typename7.C index 2d823f8078e..3cee4bac68b 100644 --- a/gcc/testsuite/g++.dg/parse/typename7.C +++ b/gcc/testsuite/g++.dg/parse/typename7.C @@ -7,10 +7,9 @@ struct A { - template<typename> void foo(int); // { dg-message "note" } - template<typename T> void bar(T t) { // { dg-message "note" } + template<typename> void foo(int); + template<typename T> void bar(T t) { this->foo<typename T>(t); } // { dg-error "expected|parse error|no matching" } - // { dg-message "candidate" "candidate note" { target *-*-* } 12 } template<typename T> void bad(T t) { foo<typename T>(t); } // { dg-error "expected|parse error|no matching" } }; @@ -20,7 +19,6 @@ struct B { void bar(T t) { A().bar<typename T>(t); } // { dg-error "expected|parse error|no matching" } - // { dg-message "candidate" "candidate note" { target *-*-* } 22 } void bad(T t) { B<typename T>::bar(t); } // { dg-error "invalid|not a template" } }; diff --git a/gcc/testsuite/g++.dg/template/conv14.C b/gcc/testsuite/g++.dg/template/conv14.C new file mode 100644 index 00000000000..509ae6a6546 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/conv14.C @@ -0,0 +1,30 @@ +// PR c++/61647 + +class XX; + +template<typename Container, typename Key> +struct Accessor; + +template<typename Container, typename Key, typename KeyStore = Key> +class Variant { +protected: + KeyStore index; + Container state; +public: + Variant(Container st, const Key& i) : index(i), state(st) {} + + template<typename T> + operator T() const { + return Accessor<Container, KeyStore>::template get<T>(state, index); + } +}; + +class AutoCleanVariant : public Variant<XX*, int> { +public: + AutoCleanVariant(XX* st, int i) : Variant<XX*,int>(st,i) {} + + template<typename T> + operator T() const { + return Variant<XX*, int>::operator T(); + } +}; diff --git a/gcc/testsuite/g++.dg/template/friend55.C b/gcc/testsuite/g++.dg/template/friend55.C new file mode 100644 index 00000000000..4abe6ce6a23 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/friend55.C @@ -0,0 +1,18 @@ +// PR c++/59956 + +template <int I> struct A; +template <int I> class B { + int i; + template <int A_S> friend void A<A_S>::impl(); +}; + +B<0> b1; +template<int I>struct A { void impl(); }; +B<1> b2; + +template<int I> void A<I>::impl() { ++b1.i; ++b2.i; } + +int main() +{ + A<0>().impl(); +} diff --git a/gcc/testsuite/g++.dg/template/local-fn1.C b/gcc/testsuite/g++.dg/template/local-fn1.C new file mode 100644 index 00000000000..88acd17d741 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/local-fn1.C @@ -0,0 +1,8 @@ +// PR c++/60605 + +template <typename T = int> +struct Foo { + void bar() { + void bug(); + } +}; diff --git a/gcc/testsuite/g++.dg/template/memclass5.C b/gcc/testsuite/g++.dg/template/memclass5.C new file mode 100644 index 00000000000..eb32f13c916 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/memclass5.C @@ -0,0 +1,26 @@ +// PR c++/60241 + +template <typename T> +struct x +{ + template <typename U> + struct y + { + typedef T result2; + }; + + typedef y<int> zy; +}; + +template<> +template<class T> +struct x<int>::y +{ + typedef double result2; +}; + +int main() +{ + x<int>::zy::result2 xxx; + x<int>::y<int>::result2 xxx2; +} diff --git a/gcc/testsuite/g++.dg/template/ptrmem27.C b/gcc/testsuite/g++.dg/template/ptrmem27.C new file mode 100644 index 00000000000..8c63f9c2974 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/ptrmem27.C @@ -0,0 +1,22 @@ +// PR c++/61500 + +struct X { + int i; + int j; + + int foo(int X::* ptr); + + template <int X::* ptr> + int bar(); +}; + +int X::foo(int X::* ptr) { + int* p = &(this->*ptr); // OK. + return *p; +} + +template <int X::* ptr> +int X::bar() { + int* p = &(this->*ptr); // gcc 4.9.0: OK in C++98 mode, fails in C++11 mode. + return *p; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr61684.c b/gcc/testsuite/gcc.c-torture/compile/pr61684.c new file mode 100644 index 00000000000..f5b53b73a0d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr61684.c @@ -0,0 +1,15 @@ +/* PR tree-optimization/61684 */ + +int a, c; +static int *b = 0; +short d; +static short **e = 0; + +void +foo () +{ + for (; c < 1; c++) + ; + *e = &d; + a = d && (c && 1) & *b; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20050316-1.x b/gcc/testsuite/gcc.c-torture/execute/20050316-1.x index 121fcfecc2c..cb2d28fd9fc 100644 --- a/gcc/testsuite/gcc.c-torture/execute/20050316-1.x +++ b/gcc/testsuite/gcc.c-torture/execute/20050316-1.x @@ -4,4 +4,5 @@ if { [check_effective_target_int16] } { return 1 } +set additional_flags "-Wno-psabi" return 0; diff --git a/gcc/testsuite/gcc.c-torture/execute/20050316-3.x b/gcc/testsuite/gcc.c-torture/execute/20050316-3.x new file mode 100644 index 00000000000..cb7b119b8cb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050316-3.x @@ -0,0 +1,2 @@ +set additional_flags "-Wno-psabi" +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/20050604-1.x b/gcc/testsuite/gcc.c-torture/execute/20050604-1.x index f5b4aaae3d9..756242d2345 100644 --- a/gcc/testsuite/gcc.c-torture/execute/20050604-1.x +++ b/gcc/testsuite/gcc.c-torture/execute/20050604-1.x @@ -6,4 +6,5 @@ if { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } { set additional_flags "-mno-mmx" } +set additional_flags "-Wno-psabi" return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr23135.x b/gcc/testsuite/gcc.c-torture/execute/pr23135.x new file mode 100644 index 00000000000..cb7b119b8cb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr23135.x @@ -0,0 +1,2 @@ +set additional_flags "-Wno-psabi" +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr61306-1.c b/gcc/testsuite/gcc.c-torture/execute/pr61306-1.c new file mode 100644 index 00000000000..ebc90a32f98 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr61306-1.c @@ -0,0 +1,39 @@ +#ifdef __INT32_TYPE__ +typedef __INT32_TYPE__ int32_t; +#else +typedef int int32_t; +#endif + +#ifdef __UINT32_TYPE__ +typedef __UINT32_TYPE__ uint32_t; +#else +typedef unsigned uint32_t; +#endif + +#define __fake_const_swab32(x) ((uint32_t)( \ + (((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \ + (((uint32_t)(x) & (uint32_t)0x0000ff00UL) << 8) | \ + (((uint32_t)(x) & (uint32_t)0x00ff0000UL) >> 8) | \ + (( (int32_t)(x) & (int32_t)0xff000000UL) >> 24))) + +/* Previous version of bswap optimization failed to consider sign extension + and as a result would replace an expression *not* doing a bswap by a + bswap. */ + +__attribute__ ((noinline, noclone)) uint32_t +fake_bswap32 (uint32_t in) +{ + return __fake_const_swab32 (in); +} + +int +main(void) +{ + if (sizeof (int32_t) * __CHAR_BIT__ != 32) + return 0; + if (sizeof (uint32_t) * __CHAR_BIT__ != 32) + return 0; + if (fake_bswap32 (0x87654321) != 0xffffff87) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr61306-2.c b/gcc/testsuite/gcc.c-torture/execute/pr61306-2.c new file mode 100644 index 00000000000..886ecfd29da --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr61306-2.c @@ -0,0 +1,40 @@ +#ifdef __INT16_TYPE__ +typedef __INT16_TYPE__ int16_t; +#else +typedef short int16_t; +#endif + +#ifdef __UINT32_TYPE__ +typedef __UINT32_TYPE__ uint32_t; +#else +typedef unsigned uint32_t; +#endif + +#define __fake_const_swab32(x) ((uint32_t)( \ + (((uint32_t) (x) & (uint32_t)0x000000ffUL) << 24) | \ + (((uint32_t)(int16_t)(x) & (uint32_t)0x00ffff00UL) << 8) | \ + (((uint32_t) (x) & (uint32_t)0x00ff0000UL) >> 8) | \ + (((uint32_t) (x) & (uint32_t)0xff000000UL) >> 24))) + + +/* Previous version of bswap optimization failed to consider sign extension + and as a result would replace an expression *not* doing a bswap by a + bswap. */ + +__attribute__ ((noinline, noclone)) uint32_t +fake_bswap32 (uint32_t in) +{ + return __fake_const_swab32 (in); +} + +int +main(void) +{ + if (sizeof (uint32_t) * __CHAR_BIT__ != 32) + return 0; + if (sizeof (int16_t) * __CHAR_BIT__ != 16) + return 0; + if (fake_bswap32 (0x81828384) != 0xff838281) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr61306-3.c b/gcc/testsuite/gcc.c-torture/execute/pr61306-3.c new file mode 100644 index 00000000000..6086e278627 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr61306-3.c @@ -0,0 +1,13 @@ +short a = -1; +int b; +char c; + +int +main () +{ + c = a; + b = a | c; + if (b != -1) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr61375.c b/gcc/testsuite/gcc.c-torture/execute/pr61375.c new file mode 100644 index 00000000000..6fb46939edc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr61375.c @@ -0,0 +1,35 @@ +#ifdef __UINT64_TYPE__ +typedef __UINT64_TYPE__ uint64_t; +#else +typedef unsigned long long uint64_t; +#endif + +#ifndef __SIZEOF_INT128__ +#define __int128 long long +#endif + +/* Some version of bswap optimization would ICE when analyzing a mask constant + too big for an HOST_WIDE_INT (PR61375). */ + +__attribute__ ((noinline, noclone)) uint64_t +uint128_central_bitsi_ior (unsigned __int128 in1, uint64_t in2) +{ + __int128 mask = (__int128)0xffff << 56; + return ((in1 & mask) >> 56) | in2; +} + +int +main (int argc) +{ + __int128 in = 1; +#ifdef __SIZEOF_INT128__ + in <<= 64; +#endif + if (sizeof (uint64_t) * __CHAR_BIT__ != 64) + return 0; + if (sizeof (unsigned __int128) * __CHAR_BIT__ != 128) + return 0; + if (uint128_central_bitsi_ior (in, 2) != 0x102) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr51879-18.c b/gcc/testsuite/gcc.dg/pr51879-18.c index 95629f12261..9b3cb80a4e6 100644 --- a/gcc/testsuite/gcc.dg/pr51879-18.c +++ b/gcc/testsuite/gcc.dg/pr51879-18.c @@ -13,5 +13,5 @@ void bar (int c, int *p) *q = foo (); } -/* { dg-final { scan-tree-dump-times "foo \\(" 1 "pre"} } */ +/* { dg-final { scan-tree-dump-times "foo \\(" 1 "pre" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc/testsuite/gcc.dg/pr60866.c b/gcc/testsuite/gcc.dg/pr60866.c new file mode 100644 index 00000000000..020878d41de --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr60866.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } } */ +/* { dg-options "-O -fselective-scheduling -fno-if-conversion -fschedule-insns" } */ + +int n; + +void +foo (int w, int **dnroot, int **dn) +{ + int *child; + int *xchild = xchild; + for (; w < n; w++) + if (!dnroot) + { + dnroot = dn; + for (child = *dn; child; child = xchild) + ; + } +} diff --git a/gcc/testsuite/gcc.dg/stack-usage-2.c b/gcc/testsuite/gcc.dg/stack-usage-2.c index d3c17a84d88..df7e55f0560 100644 --- a/gcc/testsuite/gcc.dg/stack-usage-2.c +++ b/gcc/testsuite/gcc.dg/stack-usage-2.c @@ -1,33 +1,32 @@ /* { dg-do compile } */ /* { dg-options "-Wstack-usage=512" } */ -int foo1 (void) +int foo1 (void) /* { dg-bogus "stack usage" } */ { char arr[16]; arr[0] = 1; return 0; -} /* { dg-bogus "stack usage" } */ +} -int foo2 (void) +int foo2 (void) /* { dg-warning "stack usage is \[0-9\]* bytes" } */ { char arr[1024]; arr[0] = 1; return 0; -} /* { dg-warning "stack usage is \[0-9\]* bytes" } */ +} -int foo3 (void) +int foo3 (void) /* { dg-warning "stack usage might be \[0-9\]* bytes" } */ { char arr[1024] __attribute__((aligned (512))); arr[0] = 1; /* Force dynamic realignment of argument pointer. */ __builtin_apply ((void (*)()) foo2, 0, 0); return 0; +} -} /* { dg-warning "stack usage might be \[0-9\]* bytes" } */ - -int foo4 (int n) +int foo4 (int n) /* { dg-warning "stack usage might be unbounded" } */ { char arr[n]; arr[0] = 1; return 0; -} /* { dg-warning "stack usage might be unbounded" } */ +} diff --git a/gcc/testsuite/gcc.dg/torture/pr61383-1.c b/gcc/testsuite/gcc.dg/torture/pr61383-1.c new file mode 100644 index 00000000000..d9a0a0b398b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr61383-1.c @@ -0,0 +1,35 @@ +/* { dg-do run } */ + +int a, b = 1, c, d, e, f, g; + +int +fn1 () +{ + int h; + for (;;) + { + g = b; + g = g ? 0 : 1 % g; + e = a + 1; + for (; d < 1; d = e) + { + if (f == 0) + h = 0; + else + h = 1 % f; + if (f < 1) + c = 0; + else if (h) + break; + } + if (b) + return 0; + } +} + +int +main () +{ + fn1 (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr61964.c b/gcc/testsuite/gcc.dg/torture/pr61964.c new file mode 100644 index 00000000000..a03cfdc37bd --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr61964.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ + +extern void abort (void); + +struct node { struct node *next, *prev; } node; +struct head { struct node *first; } heads[5]; +int k = 2; +struct head *head = &heads[2]; + +static int __attribute__((noinline)) +foo() +{ + node.prev = (void *)head; + head->first = &node; + + struct node *n = head->first; + struct head *h = &heads[k]; + + if (n->prev == (void *)h) + h->first = n->next; + else + n->prev->next = n->next; + + n->next = h->first; + return n->next == &node; +} + +int main() +{ + if (foo ()) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h b/gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h index a95d06aa2ed..07e56fff857 100644 --- a/gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h @@ -34,6 +34,13 @@ struct hfa_fx2_t float b; }; +struct hfa_fx3_t +{ + float a; + float b; + float c; +}; + struct hfa_dx2_t { double a; diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-13.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-13.c new file mode 100644 index 00000000000..ae1e3ec45cf --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-13.c @@ -0,0 +1,59 @@ +/* Test AAPCS64 layout and __builtin_va_start. + + Pass named HFA/HVA argument on stack. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define AAPCS64_TEST_STDARG +#define TESTFILE "va_arg-13.c" + +struct float_float_t +{ + float a; + float b; +} float_float; + +union float_int_t +{ + float b8; + int b5; +} float_int; + +#define HAS_DATA_INIT_FUNC +void +init_data () +{ + float_float.a = 1.2f; + float_float.b = 2.2f; + + float_int.b8 = 4983.80f; +} + +#include "abitest.h" +#else + ARG (float, 1.0f, S0, 0) + ARG (float, 2.0f, S1, 1) + ARG (float, 3.0f, S2, 2) + ARG (float, 4.0f, S3, 3) + ARG (float, 5.0f, S4, 4) + ARG (float, 6.0f, S5, 5) + ARG (float, 7.0f, S6, 6) + ARG (struct float_float_t, float_float, STACK, 7) + ARG (int, 9, W0, 8) + ARG (int, 10, W1, 9) + ARG (int, 11, W2, 10) + ARG (int, 12, W3, 11) + ARG (int, 13, W4, 12) + ARG (int, 14, W5, 13) + ARG (int, 15, W6, LAST_NAMED_ARG_ID) + DOTS + /* Note on the reason of using 'X7' instead of 'W7' here: + Using 'X7' makes sure the test works in the big-endian mode. + According to PCS rules B.4 and C.10, the size of float_int is rounded + to 8 bytes and prepared in the register X7 as if loaded via LDR from + the memory, with the content of the other 4 bytes unspecified. The + test framework will only compare the 4 relavent bytes. */ + ANON (union float_int_t, float_int, X7, 15) + LAST_ANON (long long, 12683143434LL, STACK + 8, 16) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-14.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-14.c new file mode 100644 index 00000000000..91080d5afa4 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-14.c @@ -0,0 +1,35 @@ +/* Test AAPCS64 layout and __builtin_va_start. + + Pass named HFA/HVA argument on stack. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define AAPCS64_TEST_STDARG +#define TESTFILE "va_arg-14.c" +#include "type-def.h" + +struct hfa_fx2_t hfa_fx2 = {1.2f, 2.2f}; +struct hfa_fx3_t hfa_fx3 = {3.2f, 4.2f, 5.2f}; +vf4_t float32x4 = {6.2f, 7.2f, 8.2f, 9.2f}; +vf4_t float32x4_2 = {10.2f, 11.2f, 12.2f, 13.2f}; + +#include "abitest.h" +#else + ARG (float, 1.0f, S0, 0) + ARG (float, 2.0f, S1, 1) + ARG (float, 3.0f, S2, 2) + ARG (float, 4.0f, S3, 3) + ARG (float, 5.0f, S4, 4) + ARG (float, 6.0f, S5, 5) + ARG (float, 7.0f, S6, 6) + ARG (struct hfa_fx3_t, hfa_fx3, STACK, 7) + /* Previous argument size has been rounded up to the nearest multiple of + 8 bytes. */ + ARG (struct hfa_fx2_t, hfa_fx2, STACK + 16, 8) + /* NSAA is rounded up to the nearest natural alignment of float32x4. */ + ARG (vf4_t, float32x4, STACK + 32, 9) + ARG (vf4_t, float32x4_2, STACK + 48, LAST_NAMED_ARG_ID) + DOTS + LAST_ANON (double, 123456789.987, STACK + 64, 11) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-15.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-15.c new file mode 100644 index 00000000000..d8fdb322b2f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-15.c @@ -0,0 +1,39 @@ +/* Test AAPCS64 layout and __builtin_va_start. + + Pass named __128int argument on stack. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define AAPCS64_TEST_STDARG +#define TESTFILE "va_arg-15.c" +#include "type-def.h" + +union int128_t qword; + +#define HAS_DATA_INIT_FUNC +void +init_data () +{ + /* Init signed quad-word integer. */ + qword.l64 = 0xfdb9753102468aceLL; + qword.h64 = 0xeca8642013579bdfLL; +} + +#include "abitest.h" +#else + ARG (int, 1, W0, 0) + ARG (int, 2, W1, 1) + ARG (int, 3, W2, 2) + ARG (int, 4, W3, 3) + ARG (int, 5, W4, 4) + ARG (int, 6, W5, 5) + ARG (int, 7, W6, 6) + ARG (__int128, qword.i, STACK, LAST_NAMED_ARG_ID) + DOTS +#ifndef __AAPCS64_BIG_ENDIAN__ + LAST_ANON (int, 8, STACK + 16, 8) +#else + LAST_ANON (int, 8, STACK + 20, 8) +#endif +#endif diff --git a/gcc/testsuite/gcc.target/alpha/pr61586.c b/gcc/testsuite/gcc.target/alpha/pr61586.c new file mode 100644 index 00000000000..afb1af3597f --- /dev/null +++ b/gcc/testsuite/gcc.target/alpha/pr61586.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mieee" } */ + +void foo (int *dimensions, double **params, int hh) +{ + if (params[hh]) + ; + else if (dimensions[hh] > 0) + params[hh][0] = 1.0f; +} diff --git a/gcc/testsuite/gcc.target/avr/torture/pr61443.c b/gcc/testsuite/gcc.target/avr/torture/pr61443.c new file mode 100644 index 00000000000..12c6bca6663 --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/pr61443.c @@ -0,0 +1,134 @@ +/* { dg-do run } */ +/* { dg-options "-std=gnu99" } */ + +#include <stdlib.h> +#include <stdarg.h> + +#define NC __attribute__((noinline,noclone)) + +void NC vfun (char n, ...) +{ + va_list ap; + + va_start (ap, n); + + switch (n) + { + default: + abort(); + case 1: + if (11 != va_arg (ap, int)) + abort(); + break; + case 2: + if (2222 != va_arg (ap, int)) + abort(); + break; + case 3: + if (333333 != va_arg (ap, __int24)) + abort(); + break; + case 4: + if (44444444 != va_arg (ap, long)) + abort(); + break; + case 8: + if (8888888888888888 != va_arg (ap, long long)) + abort(); + break; + } + + va_end (ap); +} + + +void NC boo_qi (const __flash char *p) +{ + vfun (1, *p); +} + +void NC boox_qi (const __memx char *p) +{ + vfun (1, *p); +} + +void NC boo_hi (const __flash int *p) +{ + vfun (2, *p); +} + +void NC boox_hi (const __memx int *p) +{ + vfun (2, *p); +} + +void NC boo_psi (const __flash __int24 *p) +{ + vfun (3, *p); +} + +void NC boox_psi (const __memx __int24 *p) +{ + vfun (3, *p); +} + +void NC boo_si (const __flash long *p) +{ + vfun (4, *p); +} + +void NC boox_si (const __memx long *p) +{ + vfun (4, *p); +} + +void NC boo_di (const __flash long long *p) +{ + vfun (8, *p); +} + +void NC boox_di (const __memx long long *p) +{ + vfun (8, *p); +} + +const __flash char f_qi = 11; +const __flash int f_hi = 2222; +const __flash __int24 f_psi = 333333; +const __flash long f_si = 44444444; +const __flash long long f_di = 8888888888888888; + +const __memx char x_qi = 11; +const __memx int x_hi = 2222; +const __memx __int24 x_psi = 333333; +const __memx long x_si = 44444444; +const __memx long long x_di = 8888888888888888; + +char r_qi = 11; +int r_hi = 2222; +__int24 r_psi = 333333; +long r_si = 44444444; +long long r_di = 8888888888888888; + +int main (void) +{ + boo_qi (&f_qi); + boo_hi (&f_hi); + boo_psi (&f_psi); + boo_si (&f_si); + boo_di (&f_di); + + boox_qi (&x_qi); + boox_hi (&x_hi); + boox_psi (&x_psi); + boox_si (&x_si); + boox_di (&x_di); + + boox_qi (&r_qi); + boox_hi (&r_hi); + boox_psi (&r_psi); + boox_si (&r_si); + boox_di (&r_di); + + exit (0); +} diff --git a/gcc/testsuite/gcc.target/i386/pr60901.c b/gcc/testsuite/gcc.target/i386/pr60901.c new file mode 100644 index 00000000000..f0f25a1dc2c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr60901.c @@ -0,0 +1,17 @@ +/* { dg-options "-O -fselective-scheduling -fschedule-insns -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops -fno-tree-dominator-opts" } */ + +extern int n; +extern void bar (void); +extern int baz (int); + +void +foo (void) +{ + int i, j; + for (j = 0; j < n; j++) + { + for (i = 1; i < j; i++) + bar (); + baz (0); + } +} diff --git a/gcc/testsuite/gcc.target/i386/pr61423.c b/gcc/testsuite/gcc.target/i386/pr61423.c new file mode 100644 index 00000000000..5b538a26508 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr61423.c @@ -0,0 +1,38 @@ +/* PR target/61423 */ +/* { dg-do run { target ia32 } } */ +/* { dg-options "-O1 -ftree-vectorize -msse2 -mfpmath=387 -mtune=core2" } */ + +#define N 1024 +static unsigned int A[N]; + +double +__attribute__((noinline)) +func (void) +{ + unsigned int sum = 0; + unsigned i; + double t; + + for (i = 0; i < N; i++) + sum += A[i]; + + t = sum; + return t; +} + +int +main () +{ + unsigned i; + double d; + + for(i = 0; i < N; i++) + A[i] = 1; + + d = func(); + + if (d != 1024.0) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr61446.c b/gcc/testsuite/gcc.target/i386/pr61446.c new file mode 100644 index 00000000000..fc32f63ee69 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr61446.c @@ -0,0 +1,14 @@ +/* PR rtl-optimization/61446 */ + +/* { dg-do compile { target { ia32 } } } */ +/* { dg-options "-O2 -march=corei7 -mfpmath=387" } */ + +unsigned long long +foo (float a) +{ + const double dfa = a; + const unsigned int hi = dfa / 0x1p32f; + const unsigned int lo = dfa - (double) hi * 0x1p32f; + + return ((unsigned long long) hi << (4 * (8))) | lo; +} diff --git a/gcc/testsuite/gcc.target/i386/pr61801.c b/gcc/testsuite/gcc.target/i386/pr61801.c new file mode 100644 index 00000000000..d0d08ccb401 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr61801.c @@ -0,0 +1,21 @@ +/* PR rtl-optimization/61801 */ +/* { dg-do compile } */ +/* { dg-options "-Os -fcompare-debug" } */ + +int a, c; +int bar (void); +void baz (void); + +void +foo (void) +{ + int d; + if (bar ()) + { + int e; + baz (); + asm volatile ("" : "=a" (e) : "0" (a), "i" (0)); + d = e; + } + c = d; +} diff --git a/gcc/testsuite/gcc.target/powerpc/htm-ttest.c b/gcc/testsuite/gcc.target/powerpc/htm-ttest.c new file mode 100644 index 00000000000..29cbd5b90b3 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/htm-ttest.c @@ -0,0 +1,14 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_htm_ok } */ +/* { dg-options "-O2 -mhtm" } */ + +/* { dg-final { scan-assembler "rlwinm r?\[0-9\]+,r?\[0-9\]+,3,30,31" { target { ilp32 } } } } */ +/* { dg-final { scan-assembler "rldicl r?\[0-9\]+,r?\[0-9\]+,35,62" { target { lp64 } } } } */ + +#include <htmintrin.h> +long +ttest (void) +{ + return _HTM_STATE(__builtin_ttest()); +} diff --git a/gcc/testsuite/gcc.target/powerpc/pack02.c b/gcc/testsuite/gcc.target/powerpc/pack02.c index 584d6c29205..f85d3ff00b0 100644 --- a/gcc/testsuite/gcc.target/powerpc/pack02.c +++ b/gcc/testsuite/gcc.target/powerpc/pack02.c @@ -2,6 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ /* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ /* { dg-require-effective-target powerpc_fprs } */ +/* { dg-require-effective-target longdouble128 } */ /* { dg-options "-O2 -mhard-float" } */ #include <stddef.h> diff --git a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c new file mode 100644 index 00000000000..6e0d54883a8 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ +/* { dg-options "-mabi=elfv2" } */ + +struct f8 + { + float x[8]; + }; + +void test (struct f8 a, struct f8 b) /* { dg-message "note: the ABI of passing homogeneous float aggregates will change" } */ +{ +} + diff --git a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c new file mode 100644 index 00000000000..9b443bf2aed --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ +/* { dg-options "-mno-compat-align-parm" } */ + +struct test + { + long a __attribute__((aligned (16))); + }; + +void test (struct test a) /* { dg-message "note: the ABI of passing aggregates with 16-byte alignment will change" } */ +{ +} + diff --git a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c new file mode 100644 index 00000000000..830de6bcca2 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c @@ -0,0 +1,9 @@ +/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-maltivec" } */ + +struct test + { + int a __attribute__((vector_size (8))); + }; /* { dg-message "note: the layout of aggregates containing vectors with 8-byte alignment will change" } */ + diff --git a/gcc/testsuite/gcc.target/powerpc/tfmode_off.c b/gcc/testsuite/gcc.target/powerpc/tfmode_off.c index e6578ef31a8..ea703f0ee0a 100644 --- a/gcc/testsuite/gcc.target/powerpc/tfmode_off.c +++ b/gcc/testsuite/gcc.target/powerpc/tfmode_off.c @@ -1,6 +1,7 @@ /* { dg-do assemble } */ /* { dg-skip-if "" { powerpc-ibm-aix* } { "*" } { "" } } */ /* { dg-skip-if "no TFmode" { powerpc-*-eabi* } { "*" } { "" } } */ +/* { dg-require-effective-target longdouble128 } */ /* { dg-options "-O2 -fno-align-functions -mtraceback=no -save-temps" } */ typedef float TFmode __attribute__ ((mode (TF))); diff --git a/gcc/testsuite/gfortran.dg/allocatable_function_8.f90 b/gcc/testsuite/gfortran.dg/allocatable_function_8.f90 new file mode 100644 index 00000000000..7d0d69d2043 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/allocatable_function_8.f90 @@ -0,0 +1,47 @@ +! { dg-do run } +! Test the fix for PR61459. +! +! Contributed by John Wingate <johnww@tds.net> +! +module a + + implicit none + private + public :: f_segfault, f_segfault_plus, f_workaround + integer, dimension(2,2) :: b = reshape([1,-1,1,1],[2,2]) + +contains + + function f_segfault(x) + real, dimension(:), allocatable :: f_segfault + real, dimension(:), intent(in) :: x + allocate(f_segfault(2)) + f_segfault = matmul(b,x) + end function f_segfault + +! Sefaulted without the ALLOCATE as well. + function f_segfault_plus(x) + real, dimension(:), allocatable :: f_segfault_plus + real, dimension(:), intent(in) :: x + f_segfault_plus = matmul(b,x) + end function f_segfault_plus + + function f_workaround(x) + real, dimension(:), allocatable :: f_workaround + real, dimension(:), intent(in) :: x + real, dimension(:), allocatable :: tmp + allocate(f_workaround(2),tmp(2)) + tmp = matmul(b,x) + f_workaround = tmp + end function f_workaround + +end module a + +program main + use a + implicit none + real, dimension(2) :: x = 1.0, y + y = f_workaround (x) + if (any (f_segfault (x) .ne. y)) call abort + if (any (f_segfault_plus (x) .ne. y)) call abort +end program main diff --git a/gcc/testsuite/gfortran.dg/cray_pointers_10.f90 b/gcc/testsuite/gfortran.dg/cray_pointers_10.f90 new file mode 100644 index 00000000000..1ac98f3ea46 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/cray_pointers_10.f90 @@ -0,0 +1,18 @@ +! { dg-do run } +! { dg-options "-fcray-pointer" } +! +! PR fortran/45187 +! +module foo + implicit none + real :: a + pointer(c_a, a) +end module foo + +program test + use foo + real :: z + c_a = loc(z) + a = 42 + if (z /= 42) call abort +end program test diff --git a/gcc/testsuite/gfortran.dg/default_format_denormal_2.f90 b/gcc/testsuite/gfortran.dg/default_format_denormal_2.f90 index a5337ca3b9e..6134a562531 100644 --- a/gcc/testsuite/gfortran.dg/default_format_denormal_2.f90 +++ b/gcc/testsuite/gfortran.dg/default_format_denormal_2.f90 @@ -1,6 +1,6 @@ ! { dg-require-effective-target fortran_large_real } -! { dg-do run { xfail powerpc*-apple-darwin* powerpc*-*-linux* } } -! Test XFAILed on these platforms because the system's printf() lacks +! { dg-do run { xfail powerpc*-apple-darwin* } } +! Test XFAILed on this platform because the system's printf() lacks ! proper support for denormalized long doubles. See PR24685 ! ! This tests that the default formats for formatted I/O of reals are diff --git a/gcc/testsuite/gfortran.dg/dependency_44.f90 b/gcc/testsuite/gfortran.dg/dependency_44.f90 new file mode 100644 index 00000000000..ebfeec64c8d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dependency_44.f90 @@ -0,0 +1,36 @@ +! { dg-do run } +! Tests fix for PR61780 in which the loop reversal mechanism was +! not accounting for the first index being an element so that no +! loop in this dimension is created. +! +! Contributed by Manfred Tietze on clf. +! +program prgm3 + implicit none + integer, parameter :: n = 10, k = 3 + integer :: i, j + integer, dimension(n,n) :: y + integer :: res1(n), res2(n) + +1 format(10i5) + +!initialize + do i=1,n + do j=1,n + y(i,j) = n*i + j + end do + end do + res2 = y(k,:) + +!shift right + y(k,4:n) = y(k,3:n-1) + y(k,3) = 0 + res1 = y(k,:) + y(k,:) = res2 + y(k,n:4:-1) = y(k,n-1:3:-1) + y(k,3) = 0 + res2 = y(k,:) +! print *, res1 +! print *, res2 + if (any(res1 /= res2)) call abort () +end program prgm3 diff --git a/gcc/testsuite/gfortran.dg/dot_product_3.f90 b/gcc/testsuite/gfortran.dg/dot_product_3.f90 new file mode 100644 index 00000000000..6e11556ee86 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dot_product_3.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! { dg-options "-fdump-tree-original" } +! PR 61999 - this used to ICE. +! Original test case by A. Kasahara +program main + use, intrinsic:: iso_fortran_env, only: output_unit + + implicit none + + write(output_unit, *) dot_product([1, 2], [2.0, 3.0]) + + stop +end program main +! { dg-final { scan-tree-dump-times "8\\.0e\\+0" 1 "original" } } +! { dg-final { cleanup-tree-dump "original" } } diff --git a/gcc/testsuite/gfortran.dg/nint_2.f90 b/gcc/testsuite/gfortran.dg/nint_2.f90 index 7520727f042..c617a7021fc 100644 --- a/gcc/testsuite/gfortran.dg/nint_2.f90 +++ b/gcc/testsuite/gfortran.dg/nint_2.f90 @@ -4,7 +4,8 @@ ! http://gcc.gnu.org/ml/fortran/2005-04/msg00139.html ! ! { dg-do run } -! { dg-xfail-run-if "PR 33271, math library bug" { powerpc-ibm-aix powerpc*-*-linux* *-*-mingw* } { "-O0" } { "" } } +! { dg-xfail-run-if "PR 33271, math library bug" { powerpc-ibm-aix powerpc-*-linux* powerpc64-*-linux* *-*-mingw* } { "-O0" } { "" } } +! Note that this doesn't fail on powerpc64le-*-linux*. real(kind=8) :: a integer(kind=8) :: i1, i2 real :: b diff --git a/gcc/testsuite/gfortran.dg/oldstyle_5.f b/gcc/testsuite/gfortran.dg/oldstyle_5.f new file mode 100644 index 00000000000..8a0d3119fb4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/oldstyle_5.f @@ -0,0 +1,8 @@ +C { dg-do compile } + TYPE T + INTEGER A(2)/1,2/ ! { dg-error "Invalid old style initialization for derived type component" } + END TYPE + TYPE S + INTEGER B/1/ ! { dg-error "Invalid old style initialization for derived type component" } + END TYPE + END diff --git a/gcc/testsuite/gfortran.dg/pr45636.f90 b/gcc/testsuite/gfortran.dg/pr45636.f90 index ee7cf3863cb..c80dda45ba4 100644 --- a/gcc/testsuite/gfortran.dg/pr45636.f90 +++ b/gcc/testsuite/gfortran.dg/pr45636.f90 @@ -10,5 +10,5 @@ program main b = y call sub(a, b) end program main -! { dg-final { scan-tree-dump-times "memset" 0 "forwprop2" { xfail { mips*-*-* && { ! nomips16 } } } } } +! { dg-final { scan-tree-dump-times "memset" 0 "forwprop2" { xfail { { hppa*-*-* && { ! lp64 } } || { mips*-*-* && { ! nomips16 } } } } } } ! { dg-final { cleanup-tree-dump "forwprop2" } } diff --git a/gcc/testsuite/gnat.dg/aliasing1.adb b/gcc/testsuite/gnat.dg/aliasing1.adb index b2b7d123b1f..bffc4225b47 100644 --- a/gcc/testsuite/gnat.dg/aliasing1.adb +++ b/gcc/testsuite/gnat.dg/aliasing1.adb @@ -18,5 +18,5 @@ package body Aliasing1 is end Aliasing1; --- { dg-final { scan-tree-dump-not "__gnat_rcheck" "optimized" } } +-- { dg-final { scan-tree-dump-not "gnat_rcheck" "optimized" } } -- { dg-final { cleanup-tree-dump "optimized" } } diff --git a/gcc/testsuite/gnat.dg/opt39.adb b/gcc/testsuite/gnat.dg/opt39.adb new file mode 100644 index 00000000000..a00cac75fb5 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt39.adb @@ -0,0 +1,31 @@ +-- { dg-do compile } +-- { dg-options "-O2 -fno-inline -fdump-tree-optimized" } + +procedure Opt39 (I : Integer) is + + type Rec is record + I1 : Integer; + I2 : Integer; + I3 : Integer; + I4 : Integer; + I5 : Integer; + end record; + + procedure Set (A : access Rec; I : Integer) is + Tmp : Rec := A.all; + begin + Tmp.I1 := I; + A.all := Tmp; + end; + + R : aliased Rec; + +begin + Set (R'Access, I); + if R.I1 /= I then + raise Program_Error; + end if; +end; + +-- { dg-final { scan-tree-dump-times "MEM" 1 "optimized" } } +-- { dg-final { cleanup-tree-dump "optimized" } } diff --git a/gcc/testsuite/gnat.dg/overflow_fixed.adb b/gcc/testsuite/gnat.dg/overflow_fixed.adb new file mode 100644 index 00000000000..6ece5152333 --- /dev/null +++ b/gcc/testsuite/gnat.dg/overflow_fixed.adb @@ -0,0 +1,19 @@ +-- { dg-do run } +-- { dg-options "-gnato -O" } + +procedure Overflow_Fixed is + + type Unsigned_8_Bit is mod 2**8; + + procedure Fixed_To_Eight (Value : Duration) is + Item : Unsigned_8_Bit; + begin + Item := Unsigned_8_Bit(Value); + raise Program_Error; + exception + when Constraint_Error => null; -- expected case + end; + +begin + Fixed_To_Eight (-0.5); +end; diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 85898c63e97..befd224291c 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1783,6 +1783,15 @@ proc check_effective_target_large_double { } { }] } +# Return 1 if the target supports long double of 128 bits, +# 0 otherwise. + +proc check_effective_target_longdouble128 { } { + return [check_no_compiler_messages longdouble128 object { + int dummy[sizeof(long double) == 16 ? 1 : -1]; + }] +} + # Return 1 if the target supports double of 64 bits, # 0 otherwise. diff --git a/gcc/toplev.c b/gcc/toplev.c index 7bced044634..33b80f5a2b4 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1036,16 +1036,19 @@ output_stack_usage (void) if (warn_stack_usage >= 0) { + const location_t loc = DECL_SOURCE_LOCATION (current_function_decl); + if (stack_usage_kind == DYNAMIC) - warning (OPT_Wstack_usage_, "stack usage might be unbounded"); + warning_at (loc, OPT_Wstack_usage_, "stack usage might be unbounded"); else if (stack_usage > warn_stack_usage) { if (stack_usage_kind == DYNAMIC_BOUNDED) - warning (OPT_Wstack_usage_, "stack usage might be %wd bytes", - stack_usage); + warning_at (loc, + OPT_Wstack_usage_, "stack usage might be %wd bytes", + stack_usage); else - warning (OPT_Wstack_usage_, "stack usage is %wd bytes", - stack_usage); + warning_at (loc, OPT_Wstack_usage_, "stack usage is %wd bytes", + stack_usage); } } } diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c index cc06ca13b1e..186e140d690 100644 --- a/gcc/tree-ssa-ifcombine.c +++ b/gcc/tree-ssa-ifcombine.c @@ -105,7 +105,11 @@ bb_no_side_effects_p (basic_block bb) { gimple stmt = gsi_stmt (gsi); + if (is_gimple_debug (stmt)) + continue; + if (gimple_has_side_effects (stmt) + || gimple_could_trap_p (stmt) || gimple_vuse (stmt)) return false; } @@ -197,7 +201,8 @@ recognize_single_bit_test (gimple cond, tree *name, tree *bit, bool inv) while (is_gimple_assign (stmt) && ((CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt)) && (TYPE_PRECISION (TREE_TYPE (gimple_assign_lhs (stmt))) - <= TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (stmt))))) + <= TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (stmt)))) + && TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME) || gimple_assign_ssa_name_copy_p (stmt))) stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt)); diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index 508a240bf89..523cc3ca563 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -1537,7 +1537,7 @@ struct gimple_opt_pass pass_cse_sincos = struct symbolic_number { unsigned HOST_WIDEST_INT n; - int size; + tree type; }; /* Perform a SHIFT or ROTATE operation by COUNT bits on symbolic @@ -1549,13 +1549,15 @@ do_shift_rotate (enum tree_code code, struct symbolic_number *n, int count) { + int bitsize = TYPE_PRECISION (n->type); + if (count % 8 != 0) return false; /* Zero out the extra bits of N in order to avoid them being shifted into the significant bits. */ - if (n->size < (int)sizeof (HOST_WIDEST_INT)) - n->n &= ((unsigned HOST_WIDEST_INT)1 << (n->size * BITS_PER_UNIT)) - 1; + if (bitsize < 8 * (int)sizeof (HOST_WIDEST_INT)) + n->n &= ((unsigned HOST_WIDEST_INT)1 << bitsize) - 1; switch (code) { @@ -1563,20 +1565,24 @@ do_shift_rotate (enum tree_code code, n->n <<= count; break; case RSHIFT_EXPR: + /* Arithmetic shift of signed type: result is dependent on the value. */ + if (!TYPE_UNSIGNED (n->type) + && (n->n & ((unsigned HOST_WIDEST_INT) 0xff << (bitsize - 8)))) + return false; n->n >>= count; break; case LROTATE_EXPR: - n->n = (n->n << count) | (n->n >> ((n->size * BITS_PER_UNIT) - count)); + n->n = (n->n << count) | (n->n >> (bitsize - count)); break; case RROTATE_EXPR: - n->n = (n->n >> count) | (n->n << ((n->size * BITS_PER_UNIT) - count)); + n->n = (n->n >> count) | (n->n << (bitsize - count)); break; default: return false; } /* Zero unused bits for size. */ - if (n->size < (int)sizeof (HOST_WIDEST_INT)) - n->n &= ((unsigned HOST_WIDEST_INT)1 << (n->size * BITS_PER_UNIT)) - 1; + if (bitsize < 8 * (int)sizeof (HOST_WIDEST_INT)) + n->n &= ((unsigned HOST_WIDEST_INT)1 << bitsize) - 1; return true; } @@ -1593,7 +1599,7 @@ verify_symbolic_number_p (struct symbolic_number *n, gimple stmt) if (TREE_CODE (lhs_type) != INTEGER_TYPE) return false; - if (TYPE_PRECISION (lhs_type) != n->size * BITS_PER_UNIT) + if (TYPE_PRECISION (lhs_type) != TYPE_PRECISION (n->type)) return false; return true; @@ -1650,20 +1656,25 @@ find_bswap_1 (gimple stmt, struct symbolic_number *n, int limit) to initialize the symbolic number. */ if (!source_expr1) { + int size; + /* Set up the symbolic number N by setting each byte to a value between 1 and the byte size of rhs1. The highest order byte is set to n->size and the lowest order byte to 1. */ - n->size = TYPE_PRECISION (TREE_TYPE (rhs1)); - if (n->size % BITS_PER_UNIT != 0) + n->type = TREE_TYPE (rhs1); + size = TYPE_PRECISION (n->type); + if (size % BITS_PER_UNIT != 0) return NULL_TREE; - n->size /= BITS_PER_UNIT; + if (size > HOST_BITS_PER_WIDEST_INT) + return NULL_TREE; + size /= BITS_PER_UNIT; n->n = (sizeof (HOST_WIDEST_INT) < 8 ? 0 : (unsigned HOST_WIDEST_INT)0x08070605 << 32 | 0x04030201); - if (n->size < (int)sizeof (HOST_WIDEST_INT)) + if (size < (int)sizeof (HOST_WIDEST_INT)) n->n &= ((unsigned HOST_WIDEST_INT)1 << - (n->size * BITS_PER_UNIT)) - 1; + (size * BITS_PER_UNIT)) - 1; source_expr1 = rhs1; } @@ -1672,12 +1683,12 @@ find_bswap_1 (gimple stmt, struct symbolic_number *n, int limit) { case BIT_AND_EXPR: { - int i; + int i, size = TYPE_PRECISION (n->type) / BITS_PER_UNIT; unsigned HOST_WIDEST_INT val = widest_int_cst_value (rhs2); unsigned HOST_WIDEST_INT tmp = val; /* Only constants masking full bytes are allowed. */ - for (i = 0; i < n->size; i++, tmp >>= BITS_PER_UNIT) + for (i = 0; i < size; i++, tmp >>= BITS_PER_UNIT) if ((tmp & 0xff) != 0 && (tmp & 0xff) != 0xff) return NULL_TREE; @@ -1693,11 +1704,23 @@ find_bswap_1 (gimple stmt, struct symbolic_number *n, int limit) break; CASE_CONVERT: { - int type_size; + int type_size, old_type_size; + tree type; - type_size = TYPE_PRECISION (gimple_expr_type (stmt)); + type = gimple_expr_type (stmt); + type_size = TYPE_PRECISION (type); if (type_size % BITS_PER_UNIT != 0) return NULL_TREE; + if (type_size > (int) HOST_BITS_PER_WIDEST_INT) + return NULL_TREE; + + /* Sign extension: result is dependent on the value. */ + old_type_size = TYPE_PRECISION (n->type); + if (!TYPE_UNSIGNED (n->type) + && type_size > old_type_size + && n->n & + ((unsigned HOST_WIDEST_INT) 0xff << (old_type_size - 8))) + return NULL_TREE; if (type_size / BITS_PER_UNIT < (int)(sizeof (HOST_WIDEST_INT))) { @@ -1705,7 +1728,7 @@ find_bswap_1 (gimple stmt, struct symbolic_number *n, int limit) belonging to the target type. */ n->n &= ((unsigned HOST_WIDEST_INT)1 << type_size) - 1; } - n->size = type_size / BITS_PER_UNIT; + n->type = type; } break; default: @@ -1718,7 +1741,7 @@ find_bswap_1 (gimple stmt, struct symbolic_number *n, int limit) if (rhs_class == GIMPLE_BINARY_RHS) { - int i; + int i, size; struct symbolic_number n1, n2; unsigned HOST_WIDEST_INT mask; tree source_expr2; @@ -1742,11 +1765,12 @@ find_bswap_1 (gimple stmt, struct symbolic_number *n, int limit) source_expr2 = find_bswap_1 (rhs2_stmt, &n2, limit - 1); if (source_expr1 != source_expr2 - || n1.size != n2.size) + || TYPE_PRECISION (n1.type) != TYPE_PRECISION (n2.type)) return NULL_TREE; - n->size = n1.size; - for (i = 0, mask = 0xff; i < n->size; i++, mask <<= BITS_PER_UNIT) + n->type = n1.type; + size = TYPE_PRECISION (n->type) / BITS_PER_UNIT; + for (i = 0, mask = 0xff; i < size; i++, mask <<= BITS_PER_UNIT) { unsigned HOST_WIDEST_INT masked1, masked2; @@ -1785,7 +1809,7 @@ find_bswap (gimple stmt) struct symbolic_number n; tree source_expr; - int limit; + int limit, bitsize; /* The last parameter determines the depth search limit. It usually correlates directly to the number of bytes to be touched. We @@ -1800,13 +1824,14 @@ find_bswap (gimple stmt) return NULL_TREE; /* Zero out the extra bits of N and CMP. */ - if (n.size < (int)sizeof (HOST_WIDEST_INT)) + bitsize = TYPE_PRECISION (n.type); + if (bitsize < 8 * (int)sizeof (HOST_WIDEST_INT)) { unsigned HOST_WIDEST_INT mask = - ((unsigned HOST_WIDEST_INT)1 << (n.size * BITS_PER_UNIT)) - 1; + ((unsigned HOST_WIDEST_INT)1 << bitsize) - 1; n.n &= mask; - cmp >>= (sizeof (HOST_WIDEST_INT) - n.size) * BITS_PER_UNIT; + cmp >>= sizeof (HOST_WIDEST_INT) * BITS_PER_UNIT - bitsize; } /* A complete byte swap should make the symbolic number to start @@ -1828,7 +1853,7 @@ execute_optimize_bswap (void) bool changed = false; tree bswap16_type = NULL_TREE, bswap32_type = NULL_TREE, bswap64_type = NULL_TREE; - if (BITS_PER_UNIT != 8) + if (BITS_PER_UNIT != 8 || CHAR_BIT != 8) return 0; if (sizeof (HOST_WIDEST_INT) < 8) diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c index 419b4ec024e..61add6e0445 100644 --- a/gcc/tree-ssa-tail-merge.c +++ b/gcc/tree-ssa-tail-merge.c @@ -1060,6 +1060,24 @@ set_cluster (basic_block bb1, basic_block bb2) gcc_unreachable (); } +/* Return true if gimple operands T1 and T2 have the same value. */ + +static bool +gimple_operand_equal_value_p (tree t1, tree t2) +{ + if (t1 == t2) + return true; + + if (t1 == NULL_TREE + || t2 == NULL_TREE) + return false; + + if (operand_equal_p (t1, t2, 0)) + return true; + + return gvn_uses_equal (t1, t2); +} + /* Return true if gimple statements S1 and S2 are equal. Gimple_bb (s1) and gimple_bb (s2) are members of SAME_SUCC. */ @@ -1122,8 +1140,9 @@ gimple_equal_p (same_succ same_succ, gimple s1, gimple s2) lhs2 = gimple_get_lhs (s2); if (TREE_CODE (lhs1) != SSA_NAME && TREE_CODE (lhs2) != SSA_NAME) - return (vn_valueize (gimple_vdef (s1)) - == vn_valueize (gimple_vdef (s2))); + return (operand_equal_p (lhs1, lhs2, 0) + && gimple_operand_equal_value_p (gimple_assign_rhs1 (s1), + gimple_assign_rhs1 (s2))); else if (TREE_CODE (lhs1) == SSA_NAME && TREE_CODE (lhs2) == SSA_NAME) return vn_valueize (lhs1) == vn_valueize (lhs2); diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 1aaf6845cd7..a0868cd72cd 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,75 @@ +2014-07-31 Janne Blomqvist <jb@gcc.gnu.org> + + Backport from mainline + CVE-2014-5044 + * libgfortran.h (xmallocarray): New prototype. + * runtime/memory.c (xmallocarray): New function. + (xcalloc): Check for nonzero separately instead of multiplying. + * generated/*.c: Regenerated. + * intrinsics/cshift0.c (cshift0): Call xmallocarray instead of + xmalloc. + * intrinsics/eoshift0.c (eoshift0): Likewise. + * intrinsics/eoshift2.c (eoshift2): Likewise. + * intrinsics/pack_generic.c (pack_internal): Likewise. + (pack_s_internal): Likewise. + * intrinsics/reshape_generic.c (reshape_internal): Likewise. + * intrinsics/spread_generic.c (spread_internal): Likewise. + (spread_internal_scalar): Likewise. + * intrinsics/string_intrinsics_inc.c (string_trim): Likewise. + (string_minmax): Likewise. + * intrinsics/transpose_generic.c (transpose_internal): Likewise. + * intrinsics/unpack_generic.c (unpack_internal): Likewise. + * io/list_read.c (nml_touch_nodes): Don't cast xmalloc return value. + * io/transfer.c (st_set_nml_var): Call xmallocarray instead of + xmalloc. + * io/unit.c (get_internal_unit): Likewise. + (filename_from_unit): Don't cast xmalloc return value. + * io/write.c (nml_write_obj): Likewise, formatting. + * m4/bessel.m4 (bessel_jn_r'rtype_kind`): Call xmallocarray + instead of xmalloc. + (besse_yn_r'rtype_kind`): Likewise. + * m4/cshift1.m4 (cshift1): Likewise. + * m4/eoshift1.m4 (eoshift1): Likewise. + * m4/eoshift3.m4 (eoshift3): Likewise. + * m4/iforeach.m4: Likewise. + * m4/ifunction.m4: Likewise. + * m4/ifunction_logical.m4 (name`'rtype_qual`_'atype_code): + Likewise. + * m4/in_pack.m4 (internal_pack_'rtype_ccode`): Likewise. + * m4/matmul.m4 (matmul_'rtype_code`): Likewise. + * m4/matmull.m4 (matmul_'rtype_code`): Likewise. + * m4/pack.m4 (pack_'rtype_code`): Likewise. + * m4/reshape.m4 (reshape_'rtype_ccode`): Likewise. + * m4/shape.m4 (shape_'rtype_kind`): Likewise. + * m4/spread.m4 (spread_'rtype_code`): Likewise. + (spread_scalar_'rtype_code`): Likewise. + * m4/transpose.m4 (transpose_'rtype_code`): Likewise. + * m4/unpack.m4 (unpack0_'rtype_code`): Likewise. + (unpack1_'rtype_code`): Likewise. + * runtime/convert_char.c (convert_char1_to_char4): Likewise. + (convert_char4_to_char1): Simplify. + * runtime/environ.c (init_unformatted): Call xmallocarray instead + of xmalloc. + * runtime/in_pack_generic.c (internal_pack): Likewise. + +2014-05-26 Janne Blomqvist <jb@gcc.gnu.org> + + Backport from mainline + PR libfortran/61310 + * intrinsics/ctime.c (strctime): Rename to gf_ctime, use snprintf + instead of strftime. + (fdate): Use gf_ctime. + (fdate_sub): Likewise. + (ctime): Likewise. + (ctime_sub): Likewise. + +2014-05-25 Janne Blomqvist <jb@gcc.gnu.org> + + Backport from trunk. + PR libfortran/61187 + * io/unix.c (raw_close): Check if s->fd is -1. + (fd_to_stream): Check return value of fstat(), handle error. + 2014-05-22 Release Manager * GCC 4.8.3 released. diff --git a/libgfortran/generated/all_l1.c b/libgfortran/generated/all_l1.c index 75b2485fe30..497c3a29371 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->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ all_l1 (gfc_array_l1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1)); } else { diff --git a/libgfortran/generated/all_l16.c b/libgfortran/generated/all_l16.c index 17361e5076b..3c683fa537a 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->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ all_l16 (gfc_array_l16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16)); } else { diff --git a/libgfortran/generated/all_l2.c b/libgfortran/generated/all_l2.c index 02635a2ff7c..e64c445d875 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->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ all_l2 (gfc_array_l2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_2)); } else { diff --git a/libgfortran/generated/all_l4.c b/libgfortran/generated/all_l4.c index db3f56583d3..4369eb26c35 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->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ all_l4 (gfc_array_l4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_4)); } else { diff --git a/libgfortran/generated/all_l8.c b/libgfortran/generated/all_l8.c index 86ecbd41ac0..f92c0eeaf3b 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->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ all_l8 (gfc_array_l8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_8)); } else { diff --git a/libgfortran/generated/any_l1.c b/libgfortran/generated/any_l1.c index e083434d897..edf4229f948 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->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ any_l1 (gfc_array_l1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1)); } else { diff --git a/libgfortran/generated/any_l16.c b/libgfortran/generated/any_l16.c index 26f8b494722..f0207c7254d 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->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ any_l16 (gfc_array_l16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16)); } else { diff --git a/libgfortran/generated/any_l2.c b/libgfortran/generated/any_l2.c index 7980b5b2e07..720fa921e0f 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->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ any_l2 (gfc_array_l2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_2)); } else { diff --git a/libgfortran/generated/any_l4.c b/libgfortran/generated/any_l4.c index 3eb9975ab03..0102a237fc4 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->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ any_l4 (gfc_array_l4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_4)); } else { diff --git a/libgfortran/generated/any_l8.c b/libgfortran/generated/any_l8.c index 475ce8c917e..4ba857d6ae6 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->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ any_l8 (gfc_array_l8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_8)); } else { diff --git a/libgfortran/generated/bessel_r10.c b/libgfortran/generated/bessel_r10.c index f58da5c3d8d..44da8478a8c 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-1, 1); - ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_10)); ret->offset = 0; } @@ -122,7 +122,7 @@ bessel_yn_r10 (gfc_array_r10 * const restrict ret, int n1, int n2, { size_t size = n2 < n1 ? 0 : n2-n1+1; GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); - ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_10)); ret->offset = 0; } diff --git a/libgfortran/generated/bessel_r16.c b/libgfortran/generated/bessel_r16.c index b742e0fa80c..d0ad50a9ff0 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-1, 1); - ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_16)); ret->offset = 0; } @@ -126,7 +126,7 @@ bessel_yn_r16 (gfc_array_r16 * const restrict ret, int n1, int n2, { size_t size = n2 < n1 ? 0 : n2-n1+1; GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); - ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_16)); ret->offset = 0; } diff --git a/libgfortran/generated/bessel_r4.c b/libgfortran/generated/bessel_r4.c index 67002282c10..5fe486bb77e 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-1, 1); - ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_4)); ret->offset = 0; } @@ -122,7 +122,7 @@ bessel_yn_r4 (gfc_array_r4 * const restrict ret, int n1, int n2, { size_t size = n2 < n1 ? 0 : n2-n1+1; GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); - ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_4)); ret->offset = 0; } diff --git a/libgfortran/generated/bessel_r8.c b/libgfortran/generated/bessel_r8.c index 34eae0fb456..2150042cef3 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-1, 1); - ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_8)); ret->offset = 0; } @@ -122,7 +122,7 @@ bessel_yn_r8 (gfc_array_r8 * const restrict ret, int n1, int n2, { size_t size = n2 < n1 ? 0 : n2-n1+1; GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); - ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * size); + ret->base_addr = xmallocarray (size, sizeof (GFC_REAL_8)); ret->offset = 0; } diff --git a/libgfortran/generated/count_16_l.c b/libgfortran/generated/count_16_l.c index 653271c6aac..3151be6c53d 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->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ count_16_l (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/count_1_l.c b/libgfortran/generated/count_1_l.c index 17c4631e4dc..0f72e186ed9 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->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ count_1_l (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else { diff --git a/libgfortran/generated/count_2_l.c b/libgfortran/generated/count_2_l.c index 76bbd8da6d5..3ce15b92ed2 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->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ count_2_l (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else { diff --git a/libgfortran/generated/count_4_l.c b/libgfortran/generated/count_4_l.c index 55bc39f3bcd..14d0acebbab 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->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ count_4_l (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/count_8_l.c b/libgfortran/generated/count_8_l.c index a04ad90fc69..6c6ca2ff1c4 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->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -111,7 +110,7 @@ count_8_l (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/cshift1_16.c b/libgfortran/generated/cshift1_16.c index 817633362af..ddd2eb66ff1 100644 --- a/libgfortran/generated/cshift1_16.c +++ b/libgfortran/generated/cshift1_16.c @@ -80,7 +80,7 @@ cshift1 (gfc_array_char * const restrict ret, { int i; - ret->base_addr = xmalloc (size * arraysize); + ret->base_addr = xmallocarray (arraysize, size); ret->offset = 0; ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) diff --git a/libgfortran/generated/cshift1_4.c b/libgfortran/generated/cshift1_4.c index 2a37cb0d7ba..04a29c2c71f 100644 --- a/libgfortran/generated/cshift1_4.c +++ b/libgfortran/generated/cshift1_4.c @@ -80,7 +80,7 @@ cshift1 (gfc_array_char * const restrict ret, { int i; - ret->base_addr = xmalloc (size * arraysize); + ret->base_addr = xmallocarray (arraysize, size); ret->offset = 0; ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) diff --git a/libgfortran/generated/cshift1_8.c b/libgfortran/generated/cshift1_8.c index e293fed9e99..41760d61955 100644 --- a/libgfortran/generated/cshift1_8.c +++ b/libgfortran/generated/cshift1_8.c @@ -80,7 +80,7 @@ cshift1 (gfc_array_char * const restrict ret, { int i; - ret->base_addr = xmalloc (size * arraysize); + ret->base_addr = xmallocarray (arraysize, size); ret->offset = 0; ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) diff --git a/libgfortran/generated/eoshift1_16.c b/libgfortran/generated/eoshift1_16.c index 1b352f9daa9..d8bd4f65953 100644 --- a/libgfortran/generated/eoshift1_16.c +++ b/libgfortran/generated/eoshift1_16.c @@ -105,8 +105,8 @@ eoshift1 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/eoshift1_4.c b/libgfortran/generated/eoshift1_4.c index c9fe7b26f9a..7dd05084fab 100644 --- a/libgfortran/generated/eoshift1_4.c +++ b/libgfortran/generated/eoshift1_4.c @@ -105,8 +105,8 @@ eoshift1 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/eoshift1_8.c b/libgfortran/generated/eoshift1_8.c index 8cd59995285..97070de4d7d 100644 --- a/libgfortran/generated/eoshift1_8.c +++ b/libgfortran/generated/eoshift1_8.c @@ -105,8 +105,8 @@ eoshift1 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/eoshift3_16.c b/libgfortran/generated/eoshift3_16.c index 345792b0b78..de4b8d85e46 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->offset = 0; ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) @@ -107,8 +107,8 @@ eoshift3 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/eoshift3_4.c b/libgfortran/generated/eoshift3_4.c index f28bb99cb17..53bb31ad471 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->offset = 0; ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) @@ -107,8 +107,8 @@ eoshift3 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/eoshift3_8.c b/libgfortran/generated/eoshift3_8.c index fa38b3b1942..d9af6a1d446 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->offset = 0; ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) @@ -107,8 +107,8 @@ eoshift3 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/iall_i1.c b/libgfortran/generated/iall_i1.c index af23fb8d93f..5db5dbb48e4 100644 --- a/libgfortran/generated/iall_i1.c +++ b/libgfortran/generated/iall_i1.c @@ -97,10 +97,9 @@ iall_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miall_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miall_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else @@ -430,8 +428,7 @@ siall_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siall_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else { diff --git a/libgfortran/generated/iall_i16.c b/libgfortran/generated/iall_i16.c index dacce10371d..298f4e3aa11 100644 --- a/libgfortran/generated/iall_i16.c +++ b/libgfortran/generated/iall_i16.c @@ -97,10 +97,9 @@ iall_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miall_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miall_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -430,8 +428,7 @@ siall_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siall_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/iall_i2.c b/libgfortran/generated/iall_i2.c index a68b69ed83d..99de7b66afd 100644 --- a/libgfortran/generated/iall_i2.c +++ b/libgfortran/generated/iall_i2.c @@ -97,10 +97,9 @@ iall_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miall_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miall_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else @@ -430,8 +428,7 @@ siall_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siall_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else { diff --git a/libgfortran/generated/iall_i4.c b/libgfortran/generated/iall_i4.c index 2d6c2faadb5..4923b13341c 100644 --- a/libgfortran/generated/iall_i4.c +++ b/libgfortran/generated/iall_i4.c @@ -97,10 +97,9 @@ iall_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miall_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miall_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -430,8 +428,7 @@ siall_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siall_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/iall_i8.c b/libgfortran/generated/iall_i8.c index 5be4f8176f4..70be373d051 100644 --- a/libgfortran/generated/iall_i8.c +++ b/libgfortran/generated/iall_i8.c @@ -97,10 +97,9 @@ iall_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miall_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miall_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -430,8 +428,7 @@ siall_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siall_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/iany_i1.c b/libgfortran/generated/iany_i1.c index e3756bc3a37..50e0f0c71e1 100644 --- a/libgfortran/generated/iany_i1.c +++ b/libgfortran/generated/iany_i1.c @@ -97,10 +97,9 @@ iany_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miany_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miany_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else @@ -430,8 +428,7 @@ siany_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siany_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else { diff --git a/libgfortran/generated/iany_i16.c b/libgfortran/generated/iany_i16.c index ffc2f9a6a86..6f458ea9110 100644 --- a/libgfortran/generated/iany_i16.c +++ b/libgfortran/generated/iany_i16.c @@ -97,10 +97,9 @@ iany_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miany_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miany_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -430,8 +428,7 @@ siany_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siany_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/iany_i2.c b/libgfortran/generated/iany_i2.c index 3b4953878b0..57fdbd7d267 100644 --- a/libgfortran/generated/iany_i2.c +++ b/libgfortran/generated/iany_i2.c @@ -97,10 +97,9 @@ iany_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miany_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miany_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else @@ -430,8 +428,7 @@ siany_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siany_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else { diff --git a/libgfortran/generated/iany_i4.c b/libgfortran/generated/iany_i4.c index 03c429abab1..8a7156816b7 100644 --- a/libgfortran/generated/iany_i4.c +++ b/libgfortran/generated/iany_i4.c @@ -97,10 +97,9 @@ iany_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miany_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miany_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -430,8 +428,7 @@ siany_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siany_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/iany_i8.c b/libgfortran/generated/iany_i8.c index a8c7afc8b20..422e221a3e1 100644 --- a/libgfortran/generated/iany_i8.c +++ b/libgfortran/generated/iany_i8.c @@ -97,10 +97,9 @@ iany_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miany_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miany_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -430,8 +428,7 @@ siany_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siany_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/in_pack_c10.c b/libgfortran/generated/in_pack_c10.c index cdbe900348e..7a7c2ccd2bb 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 04863f65d22..50300c80b98 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 c4468aebc75..d7f70561c55 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 29680dd86cc..5b2c52f583c 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 da356aa87e6..13208b8f567 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 ba38768fc75..e71da3368fa 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 f8cd6a61c3c..71f38d5c7d9 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 3309cc9eb44..915c67e9e51 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 e241a6aa658..c22ed28d480 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 76bcc7ad961..3ea0308b2e5 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 b10e99ff77b..ba73f3f69dc 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 f34f0affc0c..49cdd7e2f6c 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 23310b6f583..28508b3ed95 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 114c50c0ace..2c292edc6b2 100644 --- a/libgfortran/generated/iparity_i1.c +++ b/libgfortran/generated/iparity_i1.c @@ -97,10 +97,9 @@ iparity_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miparity_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miparity_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else @@ -430,8 +428,7 @@ siparity_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siparity_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else { diff --git a/libgfortran/generated/iparity_i16.c b/libgfortran/generated/iparity_i16.c index 42dbe2942a8..4306af83062 100644 --- a/libgfortran/generated/iparity_i16.c +++ b/libgfortran/generated/iparity_i16.c @@ -97,10 +97,9 @@ iparity_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miparity_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miparity_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -430,8 +428,7 @@ siparity_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siparity_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/iparity_i2.c b/libgfortran/generated/iparity_i2.c index c1690946d94..507f27b6b0d 100644 --- a/libgfortran/generated/iparity_i2.c +++ b/libgfortran/generated/iparity_i2.c @@ -97,10 +97,9 @@ iparity_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miparity_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miparity_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else @@ -430,8 +428,7 @@ siparity_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siparity_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else { diff --git a/libgfortran/generated/iparity_i4.c b/libgfortran/generated/iparity_i4.c index 3c9123c118a..3f46f2148e8 100644 --- a/libgfortran/generated/iparity_i4.c +++ b/libgfortran/generated/iparity_i4.c @@ -97,10 +97,9 @@ iparity_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miparity_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miparity_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -430,8 +428,7 @@ siparity_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siparity_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/iparity_i8.c b/libgfortran/generated/iparity_i8.c index 6cfb20c6ed5..13c431830ad 100644 --- a/libgfortran/generated/iparity_i8.c +++ b/libgfortran/generated/iparity_i8.c @@ -97,10 +97,9 @@ iparity_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ miparity_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ miparity_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -430,8 +428,7 @@ siparity_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ siparity_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/matmul_c10.c b/libgfortran/generated/matmul_c10.c index ad79edf9cdc..db8e433a137 100644 --- a/libgfortran/generated/matmul_c10.c +++ b/libgfortran/generated/matmul_c10.c @@ -124,7 +124,7 @@ matmul_c10 (gfc_array_c10 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_COMPLEX_10) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_10)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_c16.c b/libgfortran/generated/matmul_c16.c index 0524464c483..3b53688086d 100644 --- a/libgfortran/generated/matmul_c16.c +++ b/libgfortran/generated/matmul_c16.c @@ -124,7 +124,7 @@ matmul_c16 (gfc_array_c16 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_COMPLEX_16) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_16)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_c4.c b/libgfortran/generated/matmul_c4.c index 9d2f1661c7c..c4b1b81c63b 100644 --- a/libgfortran/generated/matmul_c4.c +++ b/libgfortran/generated/matmul_c4.c @@ -124,7 +124,7 @@ matmul_c4 (gfc_array_c4 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_COMPLEX_4) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_4)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_c8.c b/libgfortran/generated/matmul_c8.c index 4afec2ed1d9..93f566928e3 100644 --- a/libgfortran/generated/matmul_c8.c +++ b/libgfortran/generated/matmul_c8.c @@ -124,7 +124,7 @@ matmul_c8 (gfc_array_c8 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_COMPLEX_8) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_COMPLEX_8)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_i1.c b/libgfortran/generated/matmul_i1.c index 5cff9bbfc67..8e006797029 100644 --- a/libgfortran/generated/matmul_i1.c +++ b/libgfortran/generated/matmul_i1.c @@ -124,7 +124,7 @@ matmul_i1 (gfc_array_i1 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_INTEGER_1) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_1)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_i16.c b/libgfortran/generated/matmul_i16.c index 80d8ce8e3cd..6d975cbef38 100644 --- a/libgfortran/generated/matmul_i16.c +++ b/libgfortran/generated/matmul_i16.c @@ -124,7 +124,7 @@ matmul_i16 (gfc_array_i16 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_INTEGER_16) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_16)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_i2.c b/libgfortran/generated/matmul_i2.c index b9428f76ef2..0da27a3ea7b 100644 --- a/libgfortran/generated/matmul_i2.c +++ b/libgfortran/generated/matmul_i2.c @@ -124,7 +124,7 @@ matmul_i2 (gfc_array_i2 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_INTEGER_2) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_2)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_i4.c b/libgfortran/generated/matmul_i4.c index ab9695feaaf..10cfdf9efd2 100644 --- a/libgfortran/generated/matmul_i4.c +++ b/libgfortran/generated/matmul_i4.c @@ -124,7 +124,7 @@ matmul_i4 (gfc_array_i4 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_INTEGER_4) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_4)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_i8.c b/libgfortran/generated/matmul_i8.c index 4001bbc254a..17832be3b57 100644 --- a/libgfortran/generated/matmul_i8.c +++ b/libgfortran/generated/matmul_i8.c @@ -124,7 +124,7 @@ matmul_i8 (gfc_array_i8 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_INTEGER_8) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_INTEGER_8)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_l16.c b/libgfortran/generated/matmul_l16.c index 1d88f26ccbc..7af40293798 100644 --- a/libgfortran/generated/matmul_l16.c +++ b/libgfortran/generated/matmul_l16.c @@ -88,7 +88,7 @@ matmul_l16 (gfc_array_l16 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_LOGICAL_16) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_LOGICAL_16)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_l4.c b/libgfortran/generated/matmul_l4.c index 8ed612a1316..56a375439c0 100644 --- a/libgfortran/generated/matmul_l4.c +++ b/libgfortran/generated/matmul_l4.c @@ -88,7 +88,7 @@ matmul_l4 (gfc_array_l4 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_LOGICAL_4) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_LOGICAL_4)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_l8.c b/libgfortran/generated/matmul_l8.c index ab9ec0cb00e..19c6511779e 100644 --- a/libgfortran/generated/matmul_l8.c +++ b/libgfortran/generated/matmul_l8.c @@ -88,7 +88,7 @@ matmul_l8 (gfc_array_l8 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_LOGICAL_8) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_LOGICAL_8)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_r10.c b/libgfortran/generated/matmul_r10.c index 86750ee5e99..11a143367c9 100644 --- a/libgfortran/generated/matmul_r10.c +++ b/libgfortran/generated/matmul_r10.c @@ -124,7 +124,7 @@ matmul_r10 (gfc_array_r10 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_REAL_10) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_10)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_r16.c b/libgfortran/generated/matmul_r16.c index 7a7f4aeedb5..e82f1807243 100644 --- a/libgfortran/generated/matmul_r16.c +++ b/libgfortran/generated/matmul_r16.c @@ -124,7 +124,7 @@ matmul_r16 (gfc_array_r16 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_REAL_16) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_16)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_r4.c b/libgfortran/generated/matmul_r4.c index 5b10799b968..c06c261ead8 100644 --- a/libgfortran/generated/matmul_r4.c +++ b/libgfortran/generated/matmul_r4.c @@ -124,7 +124,7 @@ matmul_r4 (gfc_array_r4 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_REAL_4) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_4)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/matmul_r8.c b/libgfortran/generated/matmul_r8.c index 985f6bfb35f..4376b9daa55 100644 --- a/libgfortran/generated/matmul_r8.c +++ b/libgfortran/generated/matmul_r8.c @@ -124,7 +124,7 @@ matmul_r8 (gfc_array_r8 * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof (GFC_REAL_8) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof (GFC_REAL_8)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/generated/maxloc0_16_i1.c b/libgfortran/generated/maxloc0_16_i1.c index c2360df5db4..8da6db99da6 100644 --- a/libgfortran/generated/maxloc0_16_i1.c +++ b/libgfortran/generated/maxloc0_16_i1.c @@ -58,7 +58,7 @@ maxloc0_16_i1 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ smaxloc0_16_i1 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_16_i16.c b/libgfortran/generated/maxloc0_16_i16.c index 499e2fe1310..8b032dfb156 100644 --- a/libgfortran/generated/maxloc0_16_i16.c +++ b/libgfortran/generated/maxloc0_16_i16.c @@ -58,7 +58,7 @@ maxloc0_16_i16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ smaxloc0_16_i16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_16_i2.c b/libgfortran/generated/maxloc0_16_i2.c index d4ab7279123..9981f162ba6 100644 --- a/libgfortran/generated/maxloc0_16_i2.c +++ b/libgfortran/generated/maxloc0_16_i2.c @@ -58,7 +58,7 @@ maxloc0_16_i2 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ smaxloc0_16_i2 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_16_i4.c b/libgfortran/generated/maxloc0_16_i4.c index 18c8553b549..b5835f3c8f7 100644 --- a/libgfortran/generated/maxloc0_16_i4.c +++ b/libgfortran/generated/maxloc0_16_i4.c @@ -58,7 +58,7 @@ maxloc0_16_i4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ smaxloc0_16_i4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_16_i8.c b/libgfortran/generated/maxloc0_16_i8.c index 4af7fdcd6f9..fb1031c6147 100644 --- a/libgfortran/generated/maxloc0_16_i8.c +++ b/libgfortran/generated/maxloc0_16_i8.c @@ -58,7 +58,7 @@ maxloc0_16_i8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ smaxloc0_16_i8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_16_r10.c b/libgfortran/generated/maxloc0_16_r10.c index b8ce8de516c..46c4a0d250e 100644 --- a/libgfortran/generated/maxloc0_16_r10.c +++ b/libgfortran/generated/maxloc0_16_r10.c @@ -58,7 +58,7 @@ maxloc0_16_r10 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ smaxloc0_16_r10 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_16_r16.c b/libgfortran/generated/maxloc0_16_r16.c index 5e3214b9c0c..e2b8853540c 100644 --- a/libgfortran/generated/maxloc0_16_r16.c +++ b/libgfortran/generated/maxloc0_16_r16.c @@ -58,7 +58,7 @@ maxloc0_16_r16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ smaxloc0_16_r16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_16_r4.c b/libgfortran/generated/maxloc0_16_r4.c index e4433bd65c4..e8f9828d9b1 100644 --- a/libgfortran/generated/maxloc0_16_r4.c +++ b/libgfortran/generated/maxloc0_16_r4.c @@ -58,7 +58,7 @@ maxloc0_16_r4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ smaxloc0_16_r4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_16_r8.c b/libgfortran/generated/maxloc0_16_r8.c index 3b2e748fd2b..e2c2d7eed3c 100644 --- a/libgfortran/generated/maxloc0_16_r8.c +++ b/libgfortran/generated/maxloc0_16_r8.c @@ -58,7 +58,7 @@ maxloc0_16_r8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ smaxloc0_16_r8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_4_i1.c b/libgfortran/generated/maxloc0_4_i1.c index 6ff342cfc6c..e0e52d6e16b 100644 --- a/libgfortran/generated/maxloc0_4_i1.c +++ b/libgfortran/generated/maxloc0_4_i1.c @@ -58,7 +58,7 @@ maxloc0_4_i1 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ smaxloc0_4_i1 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_4_i16.c b/libgfortran/generated/maxloc0_4_i16.c index 60c558058e4..3ef727f484f 100644 --- a/libgfortran/generated/maxloc0_4_i16.c +++ b/libgfortran/generated/maxloc0_4_i16.c @@ -58,7 +58,7 @@ maxloc0_4_i16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ smaxloc0_4_i16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_4_i2.c b/libgfortran/generated/maxloc0_4_i2.c index 331acd03a94..bb15f7519fb 100644 --- a/libgfortran/generated/maxloc0_4_i2.c +++ b/libgfortran/generated/maxloc0_4_i2.c @@ -58,7 +58,7 @@ maxloc0_4_i2 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ smaxloc0_4_i2 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_4_i4.c b/libgfortran/generated/maxloc0_4_i4.c index 641b6189b59..593c808e546 100644 --- a/libgfortran/generated/maxloc0_4_i4.c +++ b/libgfortran/generated/maxloc0_4_i4.c @@ -58,7 +58,7 @@ maxloc0_4_i4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ smaxloc0_4_i4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_4_i8.c b/libgfortran/generated/maxloc0_4_i8.c index be059835cf7..e9c320013ea 100644 --- a/libgfortran/generated/maxloc0_4_i8.c +++ b/libgfortran/generated/maxloc0_4_i8.c @@ -58,7 +58,7 @@ maxloc0_4_i8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ smaxloc0_4_i8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_4_r10.c b/libgfortran/generated/maxloc0_4_r10.c index c2f052b9303..17356686804 100644 --- a/libgfortran/generated/maxloc0_4_r10.c +++ b/libgfortran/generated/maxloc0_4_r10.c @@ -58,7 +58,7 @@ maxloc0_4_r10 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ smaxloc0_4_r10 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_4_r16.c b/libgfortran/generated/maxloc0_4_r16.c index 63a1bfbd93a..006576cb16b 100644 --- a/libgfortran/generated/maxloc0_4_r16.c +++ b/libgfortran/generated/maxloc0_4_r16.c @@ -58,7 +58,7 @@ maxloc0_4_r16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ smaxloc0_4_r16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_4_r4.c b/libgfortran/generated/maxloc0_4_r4.c index da72d4ca8d2..c88a90ce336 100644 --- a/libgfortran/generated/maxloc0_4_r4.c +++ b/libgfortran/generated/maxloc0_4_r4.c @@ -58,7 +58,7 @@ maxloc0_4_r4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ smaxloc0_4_r4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_4_r8.c b/libgfortran/generated/maxloc0_4_r8.c index 8f35f152e8b..7750a25a845 100644 --- a/libgfortran/generated/maxloc0_4_r8.c +++ b/libgfortran/generated/maxloc0_4_r8.c @@ -58,7 +58,7 @@ maxloc0_4_r8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ smaxloc0_4_r8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_8_i1.c b/libgfortran/generated/maxloc0_8_i1.c index 2851201394d..368ceea4c2c 100644 --- a/libgfortran/generated/maxloc0_8_i1.c +++ b/libgfortran/generated/maxloc0_8_i1.c @@ -58,7 +58,7 @@ maxloc0_8_i1 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ smaxloc0_8_i1 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_8_i16.c b/libgfortran/generated/maxloc0_8_i16.c index d4ec2bb89ec..73209f849e9 100644 --- a/libgfortran/generated/maxloc0_8_i16.c +++ b/libgfortran/generated/maxloc0_8_i16.c @@ -58,7 +58,7 @@ maxloc0_8_i16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ smaxloc0_8_i16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_8_i2.c b/libgfortran/generated/maxloc0_8_i2.c index 4973f295ad3..df3bec6e059 100644 --- a/libgfortran/generated/maxloc0_8_i2.c +++ b/libgfortran/generated/maxloc0_8_i2.c @@ -58,7 +58,7 @@ maxloc0_8_i2 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ smaxloc0_8_i2 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_8_i4.c b/libgfortran/generated/maxloc0_8_i4.c index 1cd628d3b63..e5b1e9bfa28 100644 --- a/libgfortran/generated/maxloc0_8_i4.c +++ b/libgfortran/generated/maxloc0_8_i4.c @@ -58,7 +58,7 @@ maxloc0_8_i4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ smaxloc0_8_i4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_8_i8.c b/libgfortran/generated/maxloc0_8_i8.c index 26d9937c59e..0a043b1abe7 100644 --- a/libgfortran/generated/maxloc0_8_i8.c +++ b/libgfortran/generated/maxloc0_8_i8.c @@ -58,7 +58,7 @@ maxloc0_8_i8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ smaxloc0_8_i8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_8_r10.c b/libgfortran/generated/maxloc0_8_r10.c index ce82088a2e8..f5edaf138ad 100644 --- a/libgfortran/generated/maxloc0_8_r10.c +++ b/libgfortran/generated/maxloc0_8_r10.c @@ -58,7 +58,7 @@ maxloc0_8_r10 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ smaxloc0_8_r10 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_8_r16.c b/libgfortran/generated/maxloc0_8_r16.c index 8bc4651bd93..9140127f183 100644 --- a/libgfortran/generated/maxloc0_8_r16.c +++ b/libgfortran/generated/maxloc0_8_r16.c @@ -58,7 +58,7 @@ maxloc0_8_r16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ smaxloc0_8_r16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_8_r4.c b/libgfortran/generated/maxloc0_8_r4.c index f5d00449d61..3b3563f85ca 100644 --- a/libgfortran/generated/maxloc0_8_r4.c +++ b/libgfortran/generated/maxloc0_8_r4.c @@ -58,7 +58,7 @@ maxloc0_8_r4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ smaxloc0_8_r4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc0_8_r8.c b/libgfortran/generated/maxloc0_8_r8.c index 13cfbcc4870..540e290a058 100644 --- a/libgfortran/generated/maxloc0_8_r8.c +++ b/libgfortran/generated/maxloc0_8_r8.c @@ -58,7 +58,7 @@ maxloc0_8_r8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ smaxloc0_8_r8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/maxloc1_16_i1.c b/libgfortran/generated/maxloc1_16_i1.c index c26735d8873..e5acee1bd82 100644 --- a/libgfortran/generated/maxloc1_16_i1.c +++ b/libgfortran/generated/maxloc1_16_i1.c @@ -98,10 +98,9 @@ maxloc1_16_i1 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ smaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxloc1_16_i16.c b/libgfortran/generated/maxloc1_16_i16.c index 54ddcf7bd78..6d1a99e2a72 100644 --- a/libgfortran/generated/maxloc1_16_i16.c +++ b/libgfortran/generated/maxloc1_16_i16.c @@ -98,10 +98,9 @@ maxloc1_16_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ smaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxloc1_16_i2.c b/libgfortran/generated/maxloc1_16_i2.c index 5e3cc538c9f..1e85e2c3974 100644 --- a/libgfortran/generated/maxloc1_16_i2.c +++ b/libgfortran/generated/maxloc1_16_i2.c @@ -98,10 +98,9 @@ maxloc1_16_i2 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ smaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxloc1_16_i4.c b/libgfortran/generated/maxloc1_16_i4.c index 033869efcb2..0b7bc67a5bf 100644 --- a/libgfortran/generated/maxloc1_16_i4.c +++ b/libgfortran/generated/maxloc1_16_i4.c @@ -98,10 +98,9 @@ maxloc1_16_i4 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ smaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxloc1_16_i8.c b/libgfortran/generated/maxloc1_16_i8.c index 74b5943b78a..42422a70362 100644 --- a/libgfortran/generated/maxloc1_16_i8.c +++ b/libgfortran/generated/maxloc1_16_i8.c @@ -98,10 +98,9 @@ maxloc1_16_i8 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ smaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxloc1_16_r10.c b/libgfortran/generated/maxloc1_16_r10.c index e8a340a5f7a..cf2f40bf80a 100644 --- a/libgfortran/generated/maxloc1_16_r10.c +++ b/libgfortran/generated/maxloc1_16_r10.c @@ -98,10 +98,9 @@ maxloc1_16_r10 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ smaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxloc1_16_r16.c b/libgfortran/generated/maxloc1_16_r16.c index 8cd67ba4afc..2c47b478bef 100644 --- a/libgfortran/generated/maxloc1_16_r16.c +++ b/libgfortran/generated/maxloc1_16_r16.c @@ -98,10 +98,9 @@ maxloc1_16_r16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ smaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxloc1_16_r4.c b/libgfortran/generated/maxloc1_16_r4.c index 550608357e7..5ffc2691d35 100644 --- a/libgfortran/generated/maxloc1_16_r4.c +++ b/libgfortran/generated/maxloc1_16_r4.c @@ -98,10 +98,9 @@ maxloc1_16_r4 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ smaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxloc1_16_r8.c b/libgfortran/generated/maxloc1_16_r8.c index b2c07dfd2e3..bc0daa960c9 100644 --- a/libgfortran/generated/maxloc1_16_r8.c +++ b/libgfortran/generated/maxloc1_16_r8.c @@ -98,10 +98,9 @@ maxloc1_16_r8 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ smaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxloc1_4_i1.c b/libgfortran/generated/maxloc1_4_i1.c index 4d3293cb4ad..91024871b56 100644 --- a/libgfortran/generated/maxloc1_4_i1.c +++ b/libgfortran/generated/maxloc1_4_i1.c @@ -98,10 +98,9 @@ maxloc1_4_i1 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ smaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxloc1_4_i16.c b/libgfortran/generated/maxloc1_4_i16.c index e470bc200df..cd82fc98478 100644 --- a/libgfortran/generated/maxloc1_4_i16.c +++ b/libgfortran/generated/maxloc1_4_i16.c @@ -98,10 +98,9 @@ maxloc1_4_i16 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ smaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxloc1_4_i2.c b/libgfortran/generated/maxloc1_4_i2.c index 2d50b4bb7f0..2b8d968dd23 100644 --- a/libgfortran/generated/maxloc1_4_i2.c +++ b/libgfortran/generated/maxloc1_4_i2.c @@ -98,10 +98,9 @@ maxloc1_4_i2 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ smaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxloc1_4_i4.c b/libgfortran/generated/maxloc1_4_i4.c index 876488579e3..e949a109c6d 100644 --- a/libgfortran/generated/maxloc1_4_i4.c +++ b/libgfortran/generated/maxloc1_4_i4.c @@ -98,10 +98,9 @@ maxloc1_4_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ smaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxloc1_4_i8.c b/libgfortran/generated/maxloc1_4_i8.c index 4d23dbe023c..1f2430b6299 100644 --- a/libgfortran/generated/maxloc1_4_i8.c +++ b/libgfortran/generated/maxloc1_4_i8.c @@ -98,10 +98,9 @@ maxloc1_4_i8 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ smaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxloc1_4_r10.c b/libgfortran/generated/maxloc1_4_r10.c index 473626475b2..23e32c59eeb 100644 --- a/libgfortran/generated/maxloc1_4_r10.c +++ b/libgfortran/generated/maxloc1_4_r10.c @@ -98,10 +98,9 @@ maxloc1_4_r10 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ smaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxloc1_4_r16.c b/libgfortran/generated/maxloc1_4_r16.c index 2d53061d5d5..d48a506c761 100644 --- a/libgfortran/generated/maxloc1_4_r16.c +++ b/libgfortran/generated/maxloc1_4_r16.c @@ -98,10 +98,9 @@ maxloc1_4_r16 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ smaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxloc1_4_r4.c b/libgfortran/generated/maxloc1_4_r4.c index af3e6e1bdfc..b07873bb60b 100644 --- a/libgfortran/generated/maxloc1_4_r4.c +++ b/libgfortran/generated/maxloc1_4_r4.c @@ -98,10 +98,9 @@ maxloc1_4_r4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ smaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxloc1_4_r8.c b/libgfortran/generated/maxloc1_4_r8.c index 647d989e56d..5b88fe9322d 100644 --- a/libgfortran/generated/maxloc1_4_r8.c +++ b/libgfortran/generated/maxloc1_4_r8.c @@ -98,10 +98,9 @@ maxloc1_4_r8 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ smaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxloc1_8_i1.c b/libgfortran/generated/maxloc1_8_i1.c index 65cf6da6b7e..bddb76e15ee 100644 --- a/libgfortran/generated/maxloc1_8_i1.c +++ b/libgfortran/generated/maxloc1_8_i1.c @@ -98,10 +98,9 @@ maxloc1_8_i1 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ smaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxloc1_8_i16.c b/libgfortran/generated/maxloc1_8_i16.c index a64521183cd..396e7a3e33e 100644 --- a/libgfortran/generated/maxloc1_8_i16.c +++ b/libgfortran/generated/maxloc1_8_i16.c @@ -98,10 +98,9 @@ maxloc1_8_i16 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ smaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxloc1_8_i2.c b/libgfortran/generated/maxloc1_8_i2.c index 6c4861e1b3f..e22bd24f553 100644 --- a/libgfortran/generated/maxloc1_8_i2.c +++ b/libgfortran/generated/maxloc1_8_i2.c @@ -98,10 +98,9 @@ maxloc1_8_i2 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ smaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxloc1_8_i4.c b/libgfortran/generated/maxloc1_8_i4.c index d32e4d176e9..505e451465a 100644 --- a/libgfortran/generated/maxloc1_8_i4.c +++ b/libgfortran/generated/maxloc1_8_i4.c @@ -98,10 +98,9 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ smaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxloc1_8_i8.c b/libgfortran/generated/maxloc1_8_i8.c index 1c387e40a45..4efe4a2b8b7 100644 --- a/libgfortran/generated/maxloc1_8_i8.c +++ b/libgfortran/generated/maxloc1_8_i8.c @@ -98,10 +98,9 @@ maxloc1_8_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ smaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxloc1_8_r10.c b/libgfortran/generated/maxloc1_8_r10.c index 640f80fe67e..f12331a8aba 100644 --- a/libgfortran/generated/maxloc1_8_r10.c +++ b/libgfortran/generated/maxloc1_8_r10.c @@ -98,10 +98,9 @@ maxloc1_8_r10 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ smaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxloc1_8_r16.c b/libgfortran/generated/maxloc1_8_r16.c index 97435584db2..449de56fa3b 100644 --- a/libgfortran/generated/maxloc1_8_r16.c +++ b/libgfortran/generated/maxloc1_8_r16.c @@ -98,10 +98,9 @@ maxloc1_8_r16 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ smaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxloc1_8_r4.c b/libgfortran/generated/maxloc1_8_r4.c index a5f5a241477..182e68cc75c 100644 --- a/libgfortran/generated/maxloc1_8_r4.c +++ b/libgfortran/generated/maxloc1_8_r4.c @@ -98,10 +98,9 @@ maxloc1_8_r4 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ smaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxloc1_8_r8.c b/libgfortran/generated/maxloc1_8_r8.c index 85dfdde2665..82037bdc313 100644 --- a/libgfortran/generated/maxloc1_8_r8.c +++ b/libgfortran/generated/maxloc1_8_r8.c @@ -98,10 +98,9 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ smaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ smaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxval_i1.c b/libgfortran/generated/maxval_i1.c index c03156c3826..4bb8953426b 100644 --- a/libgfortran/generated/maxval_i1.c +++ b/libgfortran/generated/maxval_i1.c @@ -97,10 +97,9 @@ maxval_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else @@ -472,8 +470,7 @@ smaxval_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ smaxval_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else { diff --git a/libgfortran/generated/maxval_i16.c b/libgfortran/generated/maxval_i16.c index bb654372500..465344e9dfd 100644 --- a/libgfortran/generated/maxval_i16.c +++ b/libgfortran/generated/maxval_i16.c @@ -97,10 +97,9 @@ maxval_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -472,8 +470,7 @@ smaxval_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ smaxval_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/maxval_i2.c b/libgfortran/generated/maxval_i2.c index 352e606cb97..ed2a1042aac 100644 --- a/libgfortran/generated/maxval_i2.c +++ b/libgfortran/generated/maxval_i2.c @@ -97,10 +97,9 @@ maxval_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else @@ -472,8 +470,7 @@ smaxval_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ smaxval_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else { diff --git a/libgfortran/generated/maxval_i4.c b/libgfortran/generated/maxval_i4.c index 363ee228dc7..719ac48402d 100644 --- a/libgfortran/generated/maxval_i4.c +++ b/libgfortran/generated/maxval_i4.c @@ -97,10 +97,9 @@ maxval_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -472,8 +470,7 @@ smaxval_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ smaxval_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/maxval_i8.c b/libgfortran/generated/maxval_i8.c index f14617fa2bc..d3473664e69 100644 --- a/libgfortran/generated/maxval_i8.c +++ b/libgfortran/generated/maxval_i8.c @@ -97,10 +97,9 @@ maxval_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -472,8 +470,7 @@ smaxval_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ smaxval_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/maxval_r10.c b/libgfortran/generated/maxval_r10.c index ed148c4b5f8..c36d70a8f80 100644 --- a/libgfortran/generated/maxval_r10.c +++ b/libgfortran/generated/maxval_r10.c @@ -97,10 +97,9 @@ maxval_r10 (gfc_array_r10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); } else @@ -472,8 +470,7 @@ smaxval_r10 (gfc_array_r10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ smaxval_r10 (gfc_array_r10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); } else { diff --git a/libgfortran/generated/maxval_r16.c b/libgfortran/generated/maxval_r16.c index cebe18ad638..2d6fd1a7553 100644 --- a/libgfortran/generated/maxval_r16.c +++ b/libgfortran/generated/maxval_r16.c @@ -97,10 +97,9 @@ maxval_r16 (gfc_array_r16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); } else @@ -472,8 +470,7 @@ smaxval_r16 (gfc_array_r16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ smaxval_r16 (gfc_array_r16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); } else { diff --git a/libgfortran/generated/maxval_r4.c b/libgfortran/generated/maxval_r4.c index 0b497c3f109..ff0ee6d7a29 100644 --- a/libgfortran/generated/maxval_r4.c +++ b/libgfortran/generated/maxval_r4.c @@ -97,10 +97,9 @@ maxval_r4 (gfc_array_r4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); } else @@ -472,8 +470,7 @@ smaxval_r4 (gfc_array_r4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ smaxval_r4 (gfc_array_r4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); } else { diff --git a/libgfortran/generated/maxval_r8.c b/libgfortran/generated/maxval_r8.c index 812d3866676..9e66f10ed80 100644 --- a/libgfortran/generated/maxval_r8.c +++ b/libgfortran/generated/maxval_r8.c @@ -97,10 +97,9 @@ maxval_r8 (gfc_array_r8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); } else @@ -472,8 +470,7 @@ smaxval_r8 (gfc_array_r8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ smaxval_r8 (gfc_array_r8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); } else { diff --git a/libgfortran/generated/minloc0_16_i1.c b/libgfortran/generated/minloc0_16_i1.c index 156bdd3858b..ede4acb6452 100644 --- a/libgfortran/generated/minloc0_16_i1.c +++ b/libgfortran/generated/minloc0_16_i1.c @@ -58,7 +58,7 @@ minloc0_16_i1 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mminloc0_16_i1 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ sminloc0_16_i1 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_16_i16.c b/libgfortran/generated/minloc0_16_i16.c index e55ef200d5a..9b160ef539b 100644 --- a/libgfortran/generated/minloc0_16_i16.c +++ b/libgfortran/generated/minloc0_16_i16.c @@ -58,7 +58,7 @@ minloc0_16_i16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ sminloc0_16_i16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_16_i2.c b/libgfortran/generated/minloc0_16_i2.c index 7ac1629ebb6..21b9daabb18 100644 --- a/libgfortran/generated/minloc0_16_i2.c +++ b/libgfortran/generated/minloc0_16_i2.c @@ -58,7 +58,7 @@ minloc0_16_i2 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mminloc0_16_i2 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ sminloc0_16_i2 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_16_i4.c b/libgfortran/generated/minloc0_16_i4.c index 0c207053677..2c69989812c 100644 --- a/libgfortran/generated/minloc0_16_i4.c +++ b/libgfortran/generated/minloc0_16_i4.c @@ -58,7 +58,7 @@ minloc0_16_i4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ sminloc0_16_i4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_16_i8.c b/libgfortran/generated/minloc0_16_i8.c index 452d7980e0f..45f77bdede7 100644 --- a/libgfortran/generated/minloc0_16_i8.c +++ b/libgfortran/generated/minloc0_16_i8.c @@ -58,7 +58,7 @@ minloc0_16_i8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ sminloc0_16_i8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_16_r10.c b/libgfortran/generated/minloc0_16_r10.c index 12a443795e6..2a71a0cce10 100644 --- a/libgfortran/generated/minloc0_16_r10.c +++ b/libgfortran/generated/minloc0_16_r10.c @@ -58,7 +58,7 @@ minloc0_16_r10 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ sminloc0_16_r10 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_16_r16.c b/libgfortran/generated/minloc0_16_r16.c index bd2e97f29ca..e45f1515425 100644 --- a/libgfortran/generated/minloc0_16_r16.c +++ b/libgfortran/generated/minloc0_16_r16.c @@ -58,7 +58,7 @@ minloc0_16_r16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ sminloc0_16_r16 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_16_r4.c b/libgfortran/generated/minloc0_16_r4.c index 99a602dc799..cf1aa9ce133 100644 --- a/libgfortran/generated/minloc0_16_r4.c +++ b/libgfortran/generated/minloc0_16_r4.c @@ -58,7 +58,7 @@ minloc0_16_r4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ sminloc0_16_r4 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_16_r8.c b/libgfortran/generated/minloc0_16_r8.c index d98f14011c0..61cc29b549c 100644 --- a/libgfortran/generated/minloc0_16_r8.c +++ b/libgfortran/generated/minloc0_16_r8.c @@ -58,7 +58,7 @@ minloc0_16_r8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -199,7 +199,7 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else { @@ -367,7 +367,7 @@ sminloc0_16_r8 (gfc_array_i16 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_4_i1.c b/libgfortran/generated/minloc0_4_i1.c index 4633d6bf706..1b2957f8761 100644 --- a/libgfortran/generated/minloc0_4_i1.c +++ b/libgfortran/generated/minloc0_4_i1.c @@ -58,7 +58,7 @@ minloc0_4_i1 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mminloc0_4_i1 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ sminloc0_4_i1 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_4_i16.c b/libgfortran/generated/minloc0_4_i16.c index 63a3b20106f..f5e5dd83d4b 100644 --- a/libgfortran/generated/minloc0_4_i16.c +++ b/libgfortran/generated/minloc0_4_i16.c @@ -58,7 +58,7 @@ minloc0_4_i16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ sminloc0_4_i16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_4_i2.c b/libgfortran/generated/minloc0_4_i2.c index 8e46066d4e0..524309fcfd7 100644 --- a/libgfortran/generated/minloc0_4_i2.c +++ b/libgfortran/generated/minloc0_4_i2.c @@ -58,7 +58,7 @@ minloc0_4_i2 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mminloc0_4_i2 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ sminloc0_4_i2 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_4_i4.c b/libgfortran/generated/minloc0_4_i4.c index e52c133488e..1fdfd5a94d0 100644 --- a/libgfortran/generated/minloc0_4_i4.c +++ b/libgfortran/generated/minloc0_4_i4.c @@ -58,7 +58,7 @@ minloc0_4_i4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ sminloc0_4_i4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_4_i8.c b/libgfortran/generated/minloc0_4_i8.c index 8e75acde64e..5cde3f84a40 100644 --- a/libgfortran/generated/minloc0_4_i8.c +++ b/libgfortran/generated/minloc0_4_i8.c @@ -58,7 +58,7 @@ minloc0_4_i8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ sminloc0_4_i8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_4_r10.c b/libgfortran/generated/minloc0_4_r10.c index b45f3bd6cba..5db9607123b 100644 --- a/libgfortran/generated/minloc0_4_r10.c +++ b/libgfortran/generated/minloc0_4_r10.c @@ -58,7 +58,7 @@ minloc0_4_r10 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ sminloc0_4_r10 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_4_r16.c b/libgfortran/generated/minloc0_4_r16.c index 8265f032dec..197e2e58834 100644 --- a/libgfortran/generated/minloc0_4_r16.c +++ b/libgfortran/generated/minloc0_4_r16.c @@ -58,7 +58,7 @@ minloc0_4_r16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ sminloc0_4_r16 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_4_r4.c b/libgfortran/generated/minloc0_4_r4.c index 28d3e74bf19..0387def985f 100644 --- a/libgfortran/generated/minloc0_4_r4.c +++ b/libgfortran/generated/minloc0_4_r4.c @@ -58,7 +58,7 @@ minloc0_4_r4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ sminloc0_4_r4 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_4_r8.c b/libgfortran/generated/minloc0_4_r8.c index 05c1cbd16e7..4ad756c562e 100644 --- a/libgfortran/generated/minloc0_4_r8.c +++ b/libgfortran/generated/minloc0_4_r8.c @@ -58,7 +58,7 @@ minloc0_4_r8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -199,7 +199,7 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else { @@ -367,7 +367,7 @@ sminloc0_4_r8 (gfc_array_i4 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_8_i1.c b/libgfortran/generated/minloc0_8_i1.c index be6109eed5f..2ebb0f31a1a 100644 --- a/libgfortran/generated/minloc0_8_i1.c +++ b/libgfortran/generated/minloc0_8_i1.c @@ -58,7 +58,7 @@ minloc0_8_i1 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mminloc0_8_i1 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ sminloc0_8_i1 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_8_i16.c b/libgfortran/generated/minloc0_8_i16.c index 8c4153e855d..155963ce3b9 100644 --- a/libgfortran/generated/minloc0_8_i16.c +++ b/libgfortran/generated/minloc0_8_i16.c @@ -58,7 +58,7 @@ minloc0_8_i16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ sminloc0_8_i16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_8_i2.c b/libgfortran/generated/minloc0_8_i2.c index cbf983a0776..69b8b5f05fb 100644 --- a/libgfortran/generated/minloc0_8_i2.c +++ b/libgfortran/generated/minloc0_8_i2.c @@ -58,7 +58,7 @@ minloc0_8_i2 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mminloc0_8_i2 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ sminloc0_8_i2 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_8_i4.c b/libgfortran/generated/minloc0_8_i4.c index 2b6c3bcb488..5c735d37f00 100644 --- a/libgfortran/generated/minloc0_8_i4.c +++ b/libgfortran/generated/minloc0_8_i4.c @@ -58,7 +58,7 @@ minloc0_8_i4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ sminloc0_8_i4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_8_i8.c b/libgfortran/generated/minloc0_8_i8.c index 238c9640271..74014af0ac4 100644 --- a/libgfortran/generated/minloc0_8_i8.c +++ b/libgfortran/generated/minloc0_8_i8.c @@ -58,7 +58,7 @@ minloc0_8_i8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ sminloc0_8_i8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_8_r10.c b/libgfortran/generated/minloc0_8_r10.c index 7ad3005473e..5fb7cf88f82 100644 --- a/libgfortran/generated/minloc0_8_r10.c +++ b/libgfortran/generated/minloc0_8_r10.c @@ -58,7 +58,7 @@ minloc0_8_r10 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ sminloc0_8_r10 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_8_r16.c b/libgfortran/generated/minloc0_8_r16.c index 12f48a38c98..79e3e2cd167 100644 --- a/libgfortran/generated/minloc0_8_r16.c +++ b/libgfortran/generated/minloc0_8_r16.c @@ -58,7 +58,7 @@ minloc0_8_r16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ sminloc0_8_r16 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_8_r4.c b/libgfortran/generated/minloc0_8_r4.c index 45bf228024d..8909c8303d4 100644 --- a/libgfortran/generated/minloc0_8_r4.c +++ b/libgfortran/generated/minloc0_8_r4.c @@ -58,7 +58,7 @@ minloc0_8_r4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ sminloc0_8_r4 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc0_8_r8.c b/libgfortran/generated/minloc0_8_r8.c index 012410f26b1..9073de13a5e 100644 --- a/libgfortran/generated/minloc0_8_r8.c +++ b/libgfortran/generated/minloc0_8_r8.c @@ -58,7 +58,7 @@ minloc0_8_r8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -199,7 +199,7 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else { @@ -367,7 +367,7 @@ sminloc0_8_r8 (gfc_array_i8 * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/minloc1_16_i1.c b/libgfortran/generated/minloc1_16_i1.c index f3950c09cd5..e623cf737c5 100644 --- a/libgfortran/generated/minloc1_16_i1.c +++ b/libgfortran/generated/minloc1_16_i1.c @@ -98,10 +98,9 @@ minloc1_16_i1 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ sminloc1_16_i1 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_16_i1 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minloc1_16_i16.c b/libgfortran/generated/minloc1_16_i16.c index a3eab7085b7..26e3c389c0f 100644 --- a/libgfortran/generated/minloc1_16_i16.c +++ b/libgfortran/generated/minloc1_16_i16.c @@ -98,10 +98,9 @@ minloc1_16_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ sminloc1_16_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_16_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minloc1_16_i2.c b/libgfortran/generated/minloc1_16_i2.c index 2482a4fae57..ae47da178f6 100644 --- a/libgfortran/generated/minloc1_16_i2.c +++ b/libgfortran/generated/minloc1_16_i2.c @@ -98,10 +98,9 @@ minloc1_16_i2 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ sminloc1_16_i2 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_16_i2 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minloc1_16_i4.c b/libgfortran/generated/minloc1_16_i4.c index f5ad3a98538..a0a1f361ad9 100644 --- a/libgfortran/generated/minloc1_16_i4.c +++ b/libgfortran/generated/minloc1_16_i4.c @@ -98,10 +98,9 @@ minloc1_16_i4 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ sminloc1_16_i4 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_16_i4 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minloc1_16_i8.c b/libgfortran/generated/minloc1_16_i8.c index c32c7ce762c..a90f8e4c5a3 100644 --- a/libgfortran/generated/minloc1_16_i8.c +++ b/libgfortran/generated/minloc1_16_i8.c @@ -98,10 +98,9 @@ minloc1_16_i8 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ sminloc1_16_i8 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_16_i8 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minloc1_16_r10.c b/libgfortran/generated/minloc1_16_r10.c index fe6160f1597..1e9d6e686cd 100644 --- a/libgfortran/generated/minloc1_16_r10.c +++ b/libgfortran/generated/minloc1_16_r10.c @@ -98,10 +98,9 @@ minloc1_16_r10 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ sminloc1_16_r10 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_16_r10 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minloc1_16_r16.c b/libgfortran/generated/minloc1_16_r16.c index 0986169bd8d..17314664c5c 100644 --- a/libgfortran/generated/minloc1_16_r16.c +++ b/libgfortran/generated/minloc1_16_r16.c @@ -98,10 +98,9 @@ minloc1_16_r16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ sminloc1_16_r16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_16_r16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minloc1_16_r4.c b/libgfortran/generated/minloc1_16_r4.c index 7fa8ec55da0..1274e04fda4 100644 --- a/libgfortran/generated/minloc1_16_r4.c +++ b/libgfortran/generated/minloc1_16_r4.c @@ -98,10 +98,9 @@ minloc1_16_r4 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ sminloc1_16_r4 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_16_r4 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minloc1_16_r8.c b/libgfortran/generated/minloc1_16_r8.c index 568008ff22f..c63138a1bf0 100644 --- a/libgfortran/generated/minloc1_16_r8.c +++ b/libgfortran/generated/minloc1_16_r8.c @@ -98,10 +98,9 @@ minloc1_16_r8 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -485,8 +483,7 @@ sminloc1_16_r8 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_16_r8 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minloc1_4_i1.c b/libgfortran/generated/minloc1_4_i1.c index 774eb1fe8c3..6518d42f463 100644 --- a/libgfortran/generated/minloc1_4_i1.c +++ b/libgfortran/generated/minloc1_4_i1.c @@ -98,10 +98,9 @@ minloc1_4_i1 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ sminloc1_4_i1 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_4_i1 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minloc1_4_i16.c b/libgfortran/generated/minloc1_4_i16.c index 91aecc38754..8b5d877292f 100644 --- a/libgfortran/generated/minloc1_4_i16.c +++ b/libgfortran/generated/minloc1_4_i16.c @@ -98,10 +98,9 @@ minloc1_4_i16 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ sminloc1_4_i16 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_4_i16 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minloc1_4_i2.c b/libgfortran/generated/minloc1_4_i2.c index d9400f28705..13787575ac9 100644 --- a/libgfortran/generated/minloc1_4_i2.c +++ b/libgfortran/generated/minloc1_4_i2.c @@ -98,10 +98,9 @@ minloc1_4_i2 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ sminloc1_4_i2 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_4_i2 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minloc1_4_i4.c b/libgfortran/generated/minloc1_4_i4.c index b25c20d65e4..bbda0bc5c2e 100644 --- a/libgfortran/generated/minloc1_4_i4.c +++ b/libgfortran/generated/minloc1_4_i4.c @@ -98,10 +98,9 @@ minloc1_4_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ sminloc1_4_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_4_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minloc1_4_i8.c b/libgfortran/generated/minloc1_4_i8.c index 905068ab5bc..2f343ba1060 100644 --- a/libgfortran/generated/minloc1_4_i8.c +++ b/libgfortran/generated/minloc1_4_i8.c @@ -98,10 +98,9 @@ minloc1_4_i8 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ sminloc1_4_i8 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_4_i8 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minloc1_4_r10.c b/libgfortran/generated/minloc1_4_r10.c index e085aeb6054..2bfb7a38c0f 100644 --- a/libgfortran/generated/minloc1_4_r10.c +++ b/libgfortran/generated/minloc1_4_r10.c @@ -98,10 +98,9 @@ minloc1_4_r10 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ sminloc1_4_r10 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_4_r10 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minloc1_4_r16.c b/libgfortran/generated/minloc1_4_r16.c index 929fe4c3367..785a9228184 100644 --- a/libgfortran/generated/minloc1_4_r16.c +++ b/libgfortran/generated/minloc1_4_r16.c @@ -98,10 +98,9 @@ minloc1_4_r16 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ sminloc1_4_r16 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_4_r16 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minloc1_4_r4.c b/libgfortran/generated/minloc1_4_r4.c index 223507fce0c..1c3cb184e73 100644 --- a/libgfortran/generated/minloc1_4_r4.c +++ b/libgfortran/generated/minloc1_4_r4.c @@ -98,10 +98,9 @@ minloc1_4_r4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ sminloc1_4_r4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_4_r4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minloc1_4_r8.c b/libgfortran/generated/minloc1_4_r8.c index 8809d660b34..4090dd04a93 100644 --- a/libgfortran/generated/minloc1_4_r8.c +++ b/libgfortran/generated/minloc1_4_r8.c @@ -98,10 +98,9 @@ minloc1_4_r8 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -485,8 +483,7 @@ sminloc1_4_r8 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_4_r8 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minloc1_8_i1.c b/libgfortran/generated/minloc1_8_i1.c index 4e8a5bc2f0f..1fcd186de38 100644 --- a/libgfortran/generated/minloc1_8_i1.c +++ b/libgfortran/generated/minloc1_8_i1.c @@ -98,10 +98,9 @@ minloc1_8_i1 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ sminloc1_8_i1 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_8_i1 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minloc1_8_i16.c b/libgfortran/generated/minloc1_8_i16.c index 98f397ce613..6728e853ba3 100644 --- a/libgfortran/generated/minloc1_8_i16.c +++ b/libgfortran/generated/minloc1_8_i16.c @@ -98,10 +98,9 @@ minloc1_8_i16 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ sminloc1_8_i16 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_8_i16 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minloc1_8_i2.c b/libgfortran/generated/minloc1_8_i2.c index 3e0c3384ed7..e31f3727377 100644 --- a/libgfortran/generated/minloc1_8_i2.c +++ b/libgfortran/generated/minloc1_8_i2.c @@ -98,10 +98,9 @@ minloc1_8_i2 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ sminloc1_8_i2 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_8_i2 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minloc1_8_i4.c b/libgfortran/generated/minloc1_8_i4.c index 4c7bba896fb..3c1ecedfc76 100644 --- a/libgfortran/generated/minloc1_8_i4.c +++ b/libgfortran/generated/minloc1_8_i4.c @@ -98,10 +98,9 @@ minloc1_8_i4 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ sminloc1_8_i4 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_8_i4 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minloc1_8_i8.c b/libgfortran/generated/minloc1_8_i8.c index 40459765848..56b8edf2e88 100644 --- a/libgfortran/generated/minloc1_8_i8.c +++ b/libgfortran/generated/minloc1_8_i8.c @@ -98,10 +98,9 @@ minloc1_8_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ sminloc1_8_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_8_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minloc1_8_r10.c b/libgfortran/generated/minloc1_8_r10.c index 90c49d9beee..a9a01b0f32d 100644 --- a/libgfortran/generated/minloc1_8_r10.c +++ b/libgfortran/generated/minloc1_8_r10.c @@ -98,10 +98,9 @@ minloc1_8_r10 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ sminloc1_8_r10 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_8_r10 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minloc1_8_r16.c b/libgfortran/generated/minloc1_8_r16.c index e93d589a275..7a468cc64a4 100644 --- a/libgfortran/generated/minloc1_8_r16.c +++ b/libgfortran/generated/minloc1_8_r16.c @@ -98,10 +98,9 @@ minloc1_8_r16 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ sminloc1_8_r16 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_8_r16 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minloc1_8_r4.c b/libgfortran/generated/minloc1_8_r4.c index 40df434e58a..817a32ac9a2 100644 --- a/libgfortran/generated/minloc1_8_r4.c +++ b/libgfortran/generated/minloc1_8_r4.c @@ -98,10 +98,9 @@ minloc1_8_r4 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ sminloc1_8_r4 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_8_r4 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minloc1_8_r8.c b/libgfortran/generated/minloc1_8_r8.c index 08486140342..265d61542b2 100644 --- a/libgfortran/generated/minloc1_8_r8.c +++ b/libgfortran/generated/minloc1_8_r8.c @@ -98,10 +98,9 @@ minloc1_8_r8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -294,8 +293,7 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -307,7 +305,7 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -485,8 +483,7 @@ sminloc1_8_r8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -495,7 +492,7 @@ sminloc1_8_r8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minval_i1.c b/libgfortran/generated/minval_i1.c index ac8d78fc23c..e82a8229195 100644 --- a/libgfortran/generated/minval_i1.c +++ b/libgfortran/generated/minval_i1.c @@ -97,10 +97,9 @@ minval_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mminval_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mminval_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else @@ -472,8 +470,7 @@ sminval_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ sminval_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else { diff --git a/libgfortran/generated/minval_i16.c b/libgfortran/generated/minval_i16.c index 52ce7f86d85..0c2448e24e0 100644 --- a/libgfortran/generated/minval_i16.c +++ b/libgfortran/generated/minval_i16.c @@ -97,10 +97,9 @@ minval_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mminval_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mminval_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -472,8 +470,7 @@ sminval_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ sminval_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/minval_i2.c b/libgfortran/generated/minval_i2.c index b2c0660a296..5c80bfe5991 100644 --- a/libgfortran/generated/minval_i2.c +++ b/libgfortran/generated/minval_i2.c @@ -97,10 +97,9 @@ minval_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mminval_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mminval_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else @@ -472,8 +470,7 @@ sminval_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ sminval_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else { diff --git a/libgfortran/generated/minval_i4.c b/libgfortran/generated/minval_i4.c index dabb82b99aa..45cc8c65da6 100644 --- a/libgfortran/generated/minval_i4.c +++ b/libgfortran/generated/minval_i4.c @@ -97,10 +97,9 @@ minval_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mminval_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mminval_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -472,8 +470,7 @@ sminval_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ sminval_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/minval_i8.c b/libgfortran/generated/minval_i8.c index 4fbb8c2f7ea..8293b6364e2 100644 --- a/libgfortran/generated/minval_i8.c +++ b/libgfortran/generated/minval_i8.c @@ -97,10 +97,9 @@ minval_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mminval_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mminval_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -472,8 +470,7 @@ sminval_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ sminval_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/minval_r10.c b/libgfortran/generated/minval_r10.c index 51f4e99c46f..2f8ed098387 100644 --- a/libgfortran/generated/minval_r10.c +++ b/libgfortran/generated/minval_r10.c @@ -97,10 +97,9 @@ minval_r10 (gfc_array_r10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mminval_r10 (gfc_array_r10 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mminval_r10 (gfc_array_r10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); } else @@ -472,8 +470,7 @@ sminval_r10 (gfc_array_r10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ sminval_r10 (gfc_array_r10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); } else { diff --git a/libgfortran/generated/minval_r16.c b/libgfortran/generated/minval_r16.c index 9978bf1bc09..686c833dc60 100644 --- a/libgfortran/generated/minval_r16.c +++ b/libgfortran/generated/minval_r16.c @@ -97,10 +97,9 @@ minval_r16 (gfc_array_r16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mminval_r16 (gfc_array_r16 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mminval_r16 (gfc_array_r16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); } else @@ -472,8 +470,7 @@ sminval_r16 (gfc_array_r16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ sminval_r16 (gfc_array_r16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); } else { diff --git a/libgfortran/generated/minval_r4.c b/libgfortran/generated/minval_r4.c index 2803d3cb5a6..3f2fc5db5f6 100644 --- a/libgfortran/generated/minval_r4.c +++ b/libgfortran/generated/minval_r4.c @@ -97,10 +97,9 @@ minval_r4 (gfc_array_r4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mminval_r4 (gfc_array_r4 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mminval_r4 (gfc_array_r4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); } else @@ -472,8 +470,7 @@ sminval_r4 (gfc_array_r4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ sminval_r4 (gfc_array_r4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); } else { diff --git a/libgfortran/generated/minval_r8.c b/libgfortran/generated/minval_r8.c index d398cafb3e4..ff2c01592ac 100644 --- a/libgfortran/generated/minval_r8.c +++ b/libgfortran/generated/minval_r8.c @@ -97,10 +97,9 @@ minval_r8 (gfc_array_r8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -286,8 +285,7 @@ mminval_r8 (gfc_array_r8 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -299,7 +297,7 @@ mminval_r8 (gfc_array_r8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); } else @@ -472,8 +470,7 @@ sminval_r8 (gfc_array_r8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -482,7 +479,7 @@ sminval_r8 (gfc_array_r8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); } else { diff --git a/libgfortran/generated/norm2_r10.c b/libgfortran/generated/norm2_r10.c index 70a134ba9f0..02336397b44 100644 --- a/libgfortran/generated/norm2_r10.c +++ b/libgfortran/generated/norm2_r10.c @@ -101,10 +101,9 @@ norm2_r10 (gfc_array_r10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ diff --git a/libgfortran/generated/norm2_r16.c b/libgfortran/generated/norm2_r16.c index 00f26af2862..5ee008b3980 100644 --- a/libgfortran/generated/norm2_r16.c +++ b/libgfortran/generated/norm2_r16.c @@ -105,10 +105,9 @@ norm2_r16 (gfc_array_r16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ diff --git a/libgfortran/generated/norm2_r4.c b/libgfortran/generated/norm2_r4.c index 5b0d4e6c033..d1ef16df0ec 100644 --- a/libgfortran/generated/norm2_r4.c +++ b/libgfortran/generated/norm2_r4.c @@ -101,10 +101,9 @@ norm2_r4 (gfc_array_r4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ diff --git a/libgfortran/generated/norm2_r8.c b/libgfortran/generated/norm2_r8.c index 794314be906..2cf469ec132 100644 --- a/libgfortran/generated/norm2_r8.c +++ b/libgfortran/generated/norm2_r8.c @@ -101,10 +101,9 @@ norm2_r8 (gfc_array_r8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ diff --git a/libgfortran/generated/pack_c10.c b/libgfortran/generated/pack_c10.c index 7ea389e52ea..7ed58a0565f 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 4a3780b9f33..2ceb1d6b077 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 75d128b5c84..ba3d5d00e69 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 67696477ad1..adbaa71f5dc 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 5bf8582b1e6..732a3dac57f 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 6e9a78aa549..931a42f6062 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 1c184edb974..6524a82dc3a 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 00acf483d93..d29e71b2fe4 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 4c4110af664..c7b8efe1dd6 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 425ef435fe3..c5b4e6c15d6 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 6cde6423f62..c18fd6ca080 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 bee47874d45..f0c7091cfd0 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 22fc8c83516..dd16561cde4 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 75903f69a28..8b4d27ed4dd 100644 --- a/libgfortran/generated/parity_l1.c +++ b/libgfortran/generated/parity_l1.c @@ -98,10 +98,9 @@ parity_l1 (gfc_array_l1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ diff --git a/libgfortran/generated/parity_l16.c b/libgfortran/generated/parity_l16.c index c202cad4906..17e395c6c48 100644 --- a/libgfortran/generated/parity_l16.c +++ b/libgfortran/generated/parity_l16.c @@ -98,10 +98,9 @@ parity_l16 (gfc_array_l16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ diff --git a/libgfortran/generated/parity_l2.c b/libgfortran/generated/parity_l2.c index fccb7d67e22..c31944d4813 100644 --- a/libgfortran/generated/parity_l2.c +++ b/libgfortran/generated/parity_l2.c @@ -98,10 +98,9 @@ parity_l2 (gfc_array_l2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_2)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ diff --git a/libgfortran/generated/parity_l4.c b/libgfortran/generated/parity_l4.c index 9d569615522..d2b53f2243e 100644 --- a/libgfortran/generated/parity_l4.c +++ b/libgfortran/generated/parity_l4.c @@ -98,10 +98,9 @@ parity_l4 (gfc_array_l4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ diff --git a/libgfortran/generated/parity_l8.c b/libgfortran/generated/parity_l8.c index 3b2167bbb02..55caa12b33a 100644 --- a/libgfortran/generated/parity_l8.c +++ b/libgfortran/generated/parity_l8.c @@ -98,10 +98,9 @@ parity_l8 (gfc_array_l8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_LOGICAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ diff --git a/libgfortran/generated/product_c10.c b/libgfortran/generated/product_c10.c index 2cd217c75ed..f2beffa125a 100644 --- a/libgfortran/generated/product_c10.c +++ b/libgfortran/generated/product_c10.c @@ -97,10 +97,9 @@ product_c10 (gfc_array_c10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray, } - alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); } else @@ -430,8 +428,7 @@ sproduct_c10 (gfc_array_c10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_c10 (gfc_array_c10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); } else { diff --git a/libgfortran/generated/product_c16.c b/libgfortran/generated/product_c16.c index 9b8c37d96a8..b25129de580 100644 --- a/libgfortran/generated/product_c16.c +++ b/libgfortran/generated/product_c16.c @@ -97,10 +97,9 @@ product_c16 (gfc_array_c16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray, } - alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); } else @@ -430,8 +428,7 @@ sproduct_c16 (gfc_array_c16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_c16 (gfc_array_c16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); } else { diff --git a/libgfortran/generated/product_c4.c b/libgfortran/generated/product_c4.c index 0ee83ea4069..920f5084687 100644 --- a/libgfortran/generated/product_c4.c +++ b/libgfortran/generated/product_c4.c @@ -97,10 +97,9 @@ product_c4 (gfc_array_c4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray, } - alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); } else @@ -430,8 +428,7 @@ sproduct_c4 (gfc_array_c4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_c4 (gfc_array_c4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); } else { diff --git a/libgfortran/generated/product_c8.c b/libgfortran/generated/product_c8.c index aa701021621..214d6e0a4d9 100644 --- a/libgfortran/generated/product_c8.c +++ b/libgfortran/generated/product_c8.c @@ -97,10 +97,9 @@ product_c8 (gfc_array_c8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray, } - alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); } else @@ -430,8 +428,7 @@ sproduct_c8 (gfc_array_c8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_c8 (gfc_array_c8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); } else { diff --git a/libgfortran/generated/product_i1.c b/libgfortran/generated/product_i1.c index ad63a1265e7..497518410c6 100644 --- a/libgfortran/generated/product_i1.c +++ b/libgfortran/generated/product_i1.c @@ -97,10 +97,9 @@ product_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else @@ -430,8 +428,7 @@ sproduct_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else { diff --git a/libgfortran/generated/product_i16.c b/libgfortran/generated/product_i16.c index bd8214c4115..62b9b290371 100644 --- a/libgfortran/generated/product_i16.c +++ b/libgfortran/generated/product_i16.c @@ -97,10 +97,9 @@ product_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -430,8 +428,7 @@ sproduct_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/product_i2.c b/libgfortran/generated/product_i2.c index e4b61941151..6addf13ba18 100644 --- a/libgfortran/generated/product_i2.c +++ b/libgfortran/generated/product_i2.c @@ -97,10 +97,9 @@ product_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else @@ -430,8 +428,7 @@ sproduct_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else { diff --git a/libgfortran/generated/product_i4.c b/libgfortran/generated/product_i4.c index 9a6c0cfed56..33412408b8b 100644 --- a/libgfortran/generated/product_i4.c +++ b/libgfortran/generated/product_i4.c @@ -97,10 +97,9 @@ product_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -430,8 +428,7 @@ sproduct_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/product_i8.c b/libgfortran/generated/product_i8.c index 3e9df63b41b..23e2b2c69cd 100644 --- a/libgfortran/generated/product_i8.c +++ b/libgfortran/generated/product_i8.c @@ -97,10 +97,9 @@ product_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -430,8 +428,7 @@ sproduct_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/product_r10.c b/libgfortran/generated/product_r10.c index ae2c7a52be9..1b741b36998 100644 --- a/libgfortran/generated/product_r10.c +++ b/libgfortran/generated/product_r10.c @@ -97,10 +97,9 @@ product_r10 (gfc_array_r10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); } else @@ -430,8 +428,7 @@ sproduct_r10 (gfc_array_r10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_r10 (gfc_array_r10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); } else { diff --git a/libgfortran/generated/product_r16.c b/libgfortran/generated/product_r16.c index f5beec2b0ae..2c5cbfabaa4 100644 --- a/libgfortran/generated/product_r16.c +++ b/libgfortran/generated/product_r16.c @@ -97,10 +97,9 @@ product_r16 (gfc_array_r16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); } else @@ -430,8 +428,7 @@ sproduct_r16 (gfc_array_r16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_r16 (gfc_array_r16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); } else { diff --git a/libgfortran/generated/product_r4.c b/libgfortran/generated/product_r4.c index ff68e425ade..fc6616131d1 100644 --- a/libgfortran/generated/product_r4.c +++ b/libgfortran/generated/product_r4.c @@ -97,10 +97,9 @@ product_r4 (gfc_array_r4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); } else @@ -430,8 +428,7 @@ sproduct_r4 (gfc_array_r4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_r4 (gfc_array_r4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); } else { diff --git a/libgfortran/generated/product_r8.c b/libgfortran/generated/product_r8.c index ac799d6ec12..8acdda286ec 100644 --- a/libgfortran/generated/product_r8.c +++ b/libgfortran/generated/product_r8.c @@ -97,10 +97,9 @@ product_r8 (gfc_array_r8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); } else @@ -430,8 +428,7 @@ sproduct_r8 (gfc_array_r8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ sproduct_r8 (gfc_array_r8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); } else { diff --git a/libgfortran/generated/reshape_c10.c b/libgfortran/generated/reshape_c10.c index 195c068b363..bc29d3e840d 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 * sizeof (GFC_COMPLEX_10); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_c16.c b/libgfortran/generated/reshape_c16.c index 4e8b3cef6a5..294701750c6 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 * sizeof (GFC_COMPLEX_16); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_c4.c b/libgfortran/generated/reshape_c4.c index 1cc2f95a415..ca4bfae7f44 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 * sizeof (GFC_COMPLEX_4); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_c8.c b/libgfortran/generated/reshape_c8.c index 4de7fd64284..058d44df088 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 * sizeof (GFC_COMPLEX_8); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_i16.c b/libgfortran/generated/reshape_i16.c index 752388b5475..7264a1332d8 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 * sizeof (GFC_INTEGER_16); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_i4.c b/libgfortran/generated/reshape_i4.c index 15a04b5056d..009999c07bf 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 * sizeof (GFC_INTEGER_4); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_i8.c b/libgfortran/generated/reshape_i8.c index 89fe850647b..8099f033deb 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 * sizeof (GFC_INTEGER_8); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_r10.c b/libgfortran/generated/reshape_r10.c index cee37af854b..78a16cd01ce 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 * sizeof (GFC_REAL_10); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_r16.c b/libgfortran/generated/reshape_r16.c index aa5f75763d6..f9f4d196e88 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 * sizeof (GFC_REAL_16); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_r4.c b/libgfortran/generated/reshape_r4.c index 9969918abc3..4f410565f8e 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 * sizeof (GFC_REAL_4); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/reshape_r8.c b/libgfortran/generated/reshape_r8.c index 98f970ffbf1..44fba459777 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 * sizeof (GFC_REAL_8); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/generated/shape_i16.c b/libgfortran/generated/shape_i16.c index 30ef5b59f96..9fbab6eb05c 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 - 1, 1); ret->offset = 0; - ret->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * rank); + ret->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_16)); } stride = GFC_DESCRIPTOR_STRIDE(ret,0); diff --git a/libgfortran/generated/shape_i4.c b/libgfortran/generated/shape_i4.c index cd446f5f313..941b8393c80 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 - 1, 1); ret->offset = 0; - ret->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * rank); + ret->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_4)); } stride = GFC_DESCRIPTOR_STRIDE(ret,0); diff --git a/libgfortran/generated/shape_i8.c b/libgfortran/generated/shape_i8.c index db765f83b3d..dc3902465bd 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 - 1, 1); ret->offset = 0; - ret->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * rank); + ret->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } stride = GFC_DESCRIPTOR_STRIDE(ret,0); diff --git a/libgfortran/generated/spread_c10.c b/libgfortran/generated/spread_c10.c index 236fda857b5..c2616aed159 100644 --- a/libgfortran/generated/spread_c10.c +++ b/libgfortran/generated/spread_c10.c @@ -101,8 +101,8 @@ spread_c10 (gfc_array_c10 *ret, const gfc_array_c10 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_10)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_10)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_c10 (gfc_array_c10 *ret, const GFC_COMPLEX_10 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_10)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_10)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_c16.c b/libgfortran/generated/spread_c16.c index 68875235ce3..2758049093f 100644 --- a/libgfortran/generated/spread_c16.c +++ b/libgfortran/generated/spread_c16.c @@ -101,8 +101,8 @@ spread_c16 (gfc_array_c16 *ret, const gfc_array_c16 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_16)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_16)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_c16 (gfc_array_c16 *ret, const GFC_COMPLEX_16 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_16)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_16)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_c4.c b/libgfortran/generated/spread_c4.c index 6ac723e536d..452eeea6b9d 100644 --- a/libgfortran/generated/spread_c4.c +++ b/libgfortran/generated/spread_c4.c @@ -101,8 +101,8 @@ spread_c4 (gfc_array_c4 *ret, const gfc_array_c4 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_4)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_4)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_c4 (gfc_array_c4 *ret, const GFC_COMPLEX_4 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_4)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_4)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_c8.c b/libgfortran/generated/spread_c8.c index c53410ae690..814b0fa0e95 100644 --- a/libgfortran/generated/spread_c8.c +++ b/libgfortran/generated/spread_c8.c @@ -101,8 +101,8 @@ spread_c8 (gfc_array_c8 *ret, const gfc_array_c8 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_COMPLEX_8)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_COMPLEX_8)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_c8 (gfc_array_c8 *ret, const GFC_COMPLEX_8 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_COMPLEX_8)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_COMPLEX_8)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_i1.c b/libgfortran/generated/spread_i1.c index 3c38a656128..b47e7f4aea7 100644 --- a/libgfortran/generated/spread_i1.c +++ b/libgfortran/generated/spread_i1.c @@ -101,8 +101,8 @@ spread_i1 (gfc_array_i1 *ret, const gfc_array_i1 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_1)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_1)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_i1 (gfc_array_i1 *ret, const GFC_INTEGER_1 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_1)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_1)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_i16.c b/libgfortran/generated/spread_i16.c index 336020c9131..7e0c919ee59 100644 --- a/libgfortran/generated/spread_i16.c +++ b/libgfortran/generated/spread_i16.c @@ -101,8 +101,8 @@ spread_i16 (gfc_array_i16 *ret, const gfc_array_i16 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_16)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_16)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_i16 (gfc_array_i16 *ret, const GFC_INTEGER_16 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_16)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_16)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_i2.c b/libgfortran/generated/spread_i2.c index c4c9d45eed2..5ba01681a85 100644 --- a/libgfortran/generated/spread_i2.c +++ b/libgfortran/generated/spread_i2.c @@ -101,8 +101,8 @@ spread_i2 (gfc_array_i2 *ret, const gfc_array_i2 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_2)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_2)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_i2 (gfc_array_i2 *ret, const GFC_INTEGER_2 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_2)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_2)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_i4.c b/libgfortran/generated/spread_i4.c index 8407ad84fc4..ce31c42c7e2 100644 --- a/libgfortran/generated/spread_i4.c +++ b/libgfortran/generated/spread_i4.c @@ -101,8 +101,8 @@ spread_i4 (gfc_array_i4 *ret, const gfc_array_i4 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_4)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_4)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_i4 (gfc_array_i4 *ret, const GFC_INTEGER_4 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_4)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_4)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_i8.c b/libgfortran/generated/spread_i8.c index ae422945c6d..ec19b20e574 100644 --- a/libgfortran/generated/spread_i8.c +++ b/libgfortran/generated/spread_i8.c @@ -101,8 +101,8 @@ spread_i8 (gfc_array_i8 *ret, const gfc_array_i8 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_INTEGER_8)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_INTEGER_8)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_i8 (gfc_array_i8 *ret, const GFC_INTEGER_8 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_INTEGER_8)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_8)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_r10.c b/libgfortran/generated/spread_r10.c index 74eeb9eb639..8a85e6efb96 100644 --- a/libgfortran/generated/spread_r10.c +++ b/libgfortran/generated/spread_r10.c @@ -101,8 +101,8 @@ spread_r10 (gfc_array_r10 *ret, const gfc_array_r10 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_10)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_10)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_r10 (gfc_array_r10 *ret, const GFC_REAL_10 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_10)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_10)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_r16.c b/libgfortran/generated/spread_r16.c index 995070a8b50..cea03bd4391 100644 --- a/libgfortran/generated/spread_r16.c +++ b/libgfortran/generated/spread_r16.c @@ -101,8 +101,8 @@ spread_r16 (gfc_array_r16 *ret, const gfc_array_r16 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_16)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_16)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_r16 (gfc_array_r16 *ret, const GFC_REAL_16 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_16)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_16)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_r4.c b/libgfortran/generated/spread_r4.c index 56fc4ccfaf6..7db91f36d13 100644 --- a/libgfortran/generated/spread_r4.c +++ b/libgfortran/generated/spread_r4.c @@ -101,8 +101,8 @@ spread_r4 (gfc_array_r4 *ret, const gfc_array_r4 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_4)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_4)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_r4 (gfc_array_r4 *ret, const GFC_REAL_4 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_4)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_4)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/spread_r8.c b/libgfortran/generated/spread_r8.c index 95181ca8560..5183015c073 100644 --- a/libgfortran/generated/spread_r8.c +++ b/libgfortran/generated/spread_r8.c @@ -101,8 +101,8 @@ spread_r8 (gfc_array_r8 *ret, const gfc_array_r8 *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof(GFC_REAL_8)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof(GFC_REAL_8)); if (rs <= 0) return; } @@ -244,7 +244,7 @@ spread_scalar_r8 (gfc_array_r8 *ret, const GFC_REAL_8 *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof (GFC_REAL_8)); + ret->base_addr = xmallocarray (ncopies, sizeof (GFC_REAL_8)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/generated/sum_c10.c b/libgfortran/generated/sum_c10.c index 55d71e7ad22..8a8cd269f15 100644 --- a/libgfortran/generated/sum_c10.c +++ b/libgfortran/generated/sum_c10.c @@ -97,10 +97,9 @@ sum_c10 (gfc_array_c10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_c10 (gfc_array_c10 * const restrict retarray, } - alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_c10 (gfc_array_c10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); } else @@ -430,8 +428,7 @@ ssum_c10 (gfc_array_c10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_c10 (gfc_array_c10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10)); } else { diff --git a/libgfortran/generated/sum_c16.c b/libgfortran/generated/sum_c16.c index 0b4c3be3757..d7d71f79e46 100644 --- a/libgfortran/generated/sum_c16.c +++ b/libgfortran/generated/sum_c16.c @@ -97,10 +97,9 @@ sum_c16 (gfc_array_c16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_c16 (gfc_array_c16 * const restrict retarray, } - alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_c16 (gfc_array_c16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); } else @@ -430,8 +428,7 @@ ssum_c16 (gfc_array_c16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_c16 (gfc_array_c16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16)); } else { diff --git a/libgfortran/generated/sum_c4.c b/libgfortran/generated/sum_c4.c index 588109226ff..d5c5e5622c6 100644 --- a/libgfortran/generated/sum_c4.c +++ b/libgfortran/generated/sum_c4.c @@ -97,10 +97,9 @@ sum_c4 (gfc_array_c4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_c4 (gfc_array_c4 * const restrict retarray, } - alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_c4 (gfc_array_c4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); } else @@ -430,8 +428,7 @@ ssum_c4 (gfc_array_c4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_c4 (gfc_array_c4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4)); } else { diff --git a/libgfortran/generated/sum_c8.c b/libgfortran/generated/sum_c8.c index ca7e2e613a3..83630f92425 100644 --- a/libgfortran/generated/sum_c8.c +++ b/libgfortran/generated/sum_c8.c @@ -97,10 +97,9 @@ sum_c8 (gfc_array_c8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_c8 (gfc_array_c8 * const restrict retarray, } - alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_c8 (gfc_array_c8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); } else @@ -430,8 +428,7 @@ ssum_c8 (gfc_array_c8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_COMPLEX_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_c8 (gfc_array_c8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8)); } else { diff --git a/libgfortran/generated/sum_i1.c b/libgfortran/generated/sum_i1.c index 244c3ac3568..9c2d07a0f3c 100644 --- a/libgfortran/generated/sum_i1.c +++ b/libgfortran/generated/sum_i1.c @@ -97,10 +97,9 @@ sum_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_i1 (gfc_array_i1 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else @@ -430,8 +428,7 @@ ssum_i1 (gfc_array_i1 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_1) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_i1 (gfc_array_i1 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1)); } else { diff --git a/libgfortran/generated/sum_i16.c b/libgfortran/generated/sum_i16.c index c02f90ba1c9..62f5cd76e03 100644 --- a/libgfortran/generated/sum_i16.c +++ b/libgfortran/generated/sum_i16.c @@ -97,10 +97,9 @@ sum_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_i16 (gfc_array_i16 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else @@ -430,8 +428,7 @@ ssum_i16 (gfc_array_i16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_i16 (gfc_array_i16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/sum_i2.c b/libgfortran/generated/sum_i2.c index 9e63f766590..37eeb6b1ade 100644 --- a/libgfortran/generated/sum_i2.c +++ b/libgfortran/generated/sum_i2.c @@ -97,10 +97,9 @@ sum_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_i2 (gfc_array_i2 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else @@ -430,8 +428,7 @@ ssum_i2 (gfc_array_i2 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_2) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_i2 (gfc_array_i2 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2)); } else { diff --git a/libgfortran/generated/sum_i4.c b/libgfortran/generated/sum_i4.c index e9ec2e8bc8b..f619476aaca 100644 --- a/libgfortran/generated/sum_i4.c +++ b/libgfortran/generated/sum_i4.c @@ -97,10 +97,9 @@ sum_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_i4 (gfc_array_i4 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else @@ -430,8 +428,7 @@ ssum_i4 (gfc_array_i4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_i4 (gfc_array_i4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/sum_i8.c b/libgfortran/generated/sum_i8.c index 6c04cca672a..2a0532ce0c9 100644 --- a/libgfortran/generated/sum_i8.c +++ b/libgfortran/generated/sum_i8.c @@ -97,10 +97,9 @@ sum_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_i8 (gfc_array_i8 * const restrict retarray, } - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else @@ -430,8 +428,7 @@ ssum_i8 (gfc_array_i8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_i8 (gfc_array_i8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/sum_r10.c b/libgfortran/generated/sum_r10.c index 52bb61b5d0e..87090f4ce15 100644 --- a/libgfortran/generated/sum_r10.c +++ b/libgfortran/generated/sum_r10.c @@ -97,10 +97,9 @@ sum_r10 (gfc_array_r10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_r10 (gfc_array_r10 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_r10 (gfc_array_r10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); } else @@ -430,8 +428,7 @@ ssum_r10 (gfc_array_r10 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_10) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_r10 (gfc_array_r10 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10)); } else { diff --git a/libgfortran/generated/sum_r16.c b/libgfortran/generated/sum_r16.c index fe1dc953496..c44b7bb7ad6 100644 --- a/libgfortran/generated/sum_r16.c +++ b/libgfortran/generated/sum_r16.c @@ -97,10 +97,9 @@ sum_r16 (gfc_array_r16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_r16 (gfc_array_r16 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_r16 (gfc_array_r16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); } else @@ -430,8 +428,7 @@ ssum_r16 (gfc_array_r16 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_16) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_r16 (gfc_array_r16 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16)); } else { diff --git a/libgfortran/generated/sum_r4.c b/libgfortran/generated/sum_r4.c index 59265f1b7c6..76c77d97a69 100644 --- a/libgfortran/generated/sum_r4.c +++ b/libgfortran/generated/sum_r4.c @@ -97,10 +97,9 @@ sum_r4 (gfc_array_r4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_r4 (gfc_array_r4 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_r4 (gfc_array_r4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); } else @@ -430,8 +428,7 @@ ssum_r4 (gfc_array_r4 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_4) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_r4 (gfc_array_r4 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4)); } else { diff --git a/libgfortran/generated/sum_r8.c b/libgfortran/generated/sum_r8.c index 46366b2b5cf..f2d3d72bf69 100644 --- a/libgfortran/generated/sum_r8.c +++ b/libgfortran/generated/sum_r8.c @@ -97,10 +97,9 @@ sum_r8 (gfc_array_r8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -272,8 +271,7 @@ msum_r8 (gfc_array_r8 * const restrict retarray, } - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -285,7 +283,7 @@ msum_r8 (gfc_array_r8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); } else @@ -430,8 +428,7 @@ ssum_r8 (gfc_array_r8 * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (GFC_REAL_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -440,7 +437,7 @@ ssum_r8 (gfc_array_r8 * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8)); } else { diff --git a/libgfortran/generated/transpose_c10.c b/libgfortran/generated/transpose_c10.c index 9f7478dd072..38b315888ec 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) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_10) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_COMPLEX_10)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_c16.c b/libgfortran/generated/transpose_c16.c index ceaeea92b9b..20deb24a3a0 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) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_16) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_COMPLEX_16)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_c4.c b/libgfortran/generated/transpose_c4.c index 0b2ab62faef..b769208ef90 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) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_4) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_COMPLEX_4)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_c8.c b/libgfortran/generated/transpose_c8.c index 3065b8d75a9..74dd82a021d 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) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_COMPLEX_8) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_COMPLEX_8)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_i16.c b/libgfortran/generated/transpose_i16.c index e7fd09a816b..990e911ac9c 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) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_INTEGER_16) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_INTEGER_16)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_i4.c b/libgfortran/generated/transpose_i4.c index fc7431ca32c..d095fc1a918 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) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_INTEGER_4) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_INTEGER_4)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_i8.c b/libgfortran/generated/transpose_i8.c index 7439e245b47..b11b6acdd40 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) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_INTEGER_8) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_INTEGER_8)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_r10.c b/libgfortran/generated/transpose_r10.c index f60b0fe79c2..a6986c2042d 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) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_REAL_10) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_REAL_10)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_r16.c b/libgfortran/generated/transpose_r16.c index 467345a5ec3..4ede21586cb 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) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_REAL_16) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_REAL_16)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_r4.c b/libgfortran/generated/transpose_r4.c index 9f6755f13f9..75f977f830c 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) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_REAL_4) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_REAL_4)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/transpose_r8.c b/libgfortran/generated/transpose_r8.c index 17cc2d9ae9b..1996ef63049 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) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof (GFC_REAL_8) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof (GFC_REAL_8)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/generated/unpack_c10.c b/libgfortran/generated/unpack_c10.c index 2af35d6a80e..fe737695717 100644 --- a/libgfortran/generated/unpack_c10.c +++ b/libgfortran/generated/unpack_c10.c @@ -99,7 +99,7 @@ unpack0_c10 (gfc_array_c10 *ret, const gfc_array_c10 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_10)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_10)); } else { @@ -244,7 +244,7 @@ unpack1_c10 (gfc_array_c10 *ret, const gfc_array_c10 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_10)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_10)); } else { diff --git a/libgfortran/generated/unpack_c16.c b/libgfortran/generated/unpack_c16.c index d3829fa55e4..ca75f4425a4 100644 --- a/libgfortran/generated/unpack_c16.c +++ b/libgfortran/generated/unpack_c16.c @@ -99,7 +99,7 @@ unpack0_c16 (gfc_array_c16 *ret, const gfc_array_c16 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_16)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_16)); } else { @@ -244,7 +244,7 @@ unpack1_c16 (gfc_array_c16 *ret, const gfc_array_c16 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_16)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_16)); } else { diff --git a/libgfortran/generated/unpack_c4.c b/libgfortran/generated/unpack_c4.c index 35089effab3..d182dc57b75 100644 --- a/libgfortran/generated/unpack_c4.c +++ b/libgfortran/generated/unpack_c4.c @@ -99,7 +99,7 @@ unpack0_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_4)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_4)); } else { @@ -244,7 +244,7 @@ unpack1_c4 (gfc_array_c4 *ret, const gfc_array_c4 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_4)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_4)); } else { diff --git a/libgfortran/generated/unpack_c8.c b/libgfortran/generated/unpack_c8.c index 4c604e17b5a..ba3e1646203 100644 --- a/libgfortran/generated/unpack_c8.c +++ b/libgfortran/generated/unpack_c8.c @@ -99,7 +99,7 @@ unpack0_c8 (gfc_array_c8 *ret, const gfc_array_c8 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_8)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_8)); } else { @@ -244,7 +244,7 @@ unpack1_c8 (gfc_array_c8 *ret, const gfc_array_c8 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_COMPLEX_8)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_COMPLEX_8)); } else { diff --git a/libgfortran/generated/unpack_i1.c b/libgfortran/generated/unpack_i1.c index 61c8d4c2482..d8594394743 100644 --- a/libgfortran/generated/unpack_i1.c +++ b/libgfortran/generated/unpack_i1.c @@ -99,7 +99,7 @@ unpack0_i1 (gfc_array_i1 *ret, const gfc_array_i1 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_1)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_1)); } else { @@ -244,7 +244,7 @@ unpack1_i1 (gfc_array_i1 *ret, const gfc_array_i1 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_1)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_1)); } else { diff --git a/libgfortran/generated/unpack_i16.c b/libgfortran/generated/unpack_i16.c index 313b8958364..aa022ddd9bb 100644 --- a/libgfortran/generated/unpack_i16.c +++ b/libgfortran/generated/unpack_i16.c @@ -99,7 +99,7 @@ unpack0_i16 (gfc_array_i16 *ret, const gfc_array_i16 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_16)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_16)); } else { @@ -244,7 +244,7 @@ unpack1_i16 (gfc_array_i16 *ret, const gfc_array_i16 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_16)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_16)); } else { diff --git a/libgfortran/generated/unpack_i2.c b/libgfortran/generated/unpack_i2.c index 3e97e69f74e..ee03377345c 100644 --- a/libgfortran/generated/unpack_i2.c +++ b/libgfortran/generated/unpack_i2.c @@ -99,7 +99,7 @@ unpack0_i2 (gfc_array_i2 *ret, const gfc_array_i2 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_2)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_2)); } else { @@ -244,7 +244,7 @@ unpack1_i2 (gfc_array_i2 *ret, const gfc_array_i2 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_2)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_2)); } else { diff --git a/libgfortran/generated/unpack_i4.c b/libgfortran/generated/unpack_i4.c index 7115a72acb7..3d000c4c07f 100644 --- a/libgfortran/generated/unpack_i4.c +++ b/libgfortran/generated/unpack_i4.c @@ -99,7 +99,7 @@ unpack0_i4 (gfc_array_i4 *ret, const gfc_array_i4 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_4)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_4)); } else { @@ -244,7 +244,7 @@ unpack1_i4 (gfc_array_i4 *ret, const gfc_array_i4 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_4)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_4)); } else { diff --git a/libgfortran/generated/unpack_i8.c b/libgfortran/generated/unpack_i8.c index c259d7825dc..630dca03276 100644 --- a/libgfortran/generated/unpack_i8.c +++ b/libgfortran/generated/unpack_i8.c @@ -99,7 +99,7 @@ unpack0_i8 (gfc_array_i8 *ret, const gfc_array_i8 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_8)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_8)); } else { @@ -244,7 +244,7 @@ unpack1_i8 (gfc_array_i8 *ret, const gfc_array_i8 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_INTEGER_8)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_INTEGER_8)); } else { diff --git a/libgfortran/generated/unpack_r10.c b/libgfortran/generated/unpack_r10.c index bd565df2ad2..9c32f03bcc9 100644 --- a/libgfortran/generated/unpack_r10.c +++ b/libgfortran/generated/unpack_r10.c @@ -99,7 +99,7 @@ unpack0_r10 (gfc_array_r10 *ret, const gfc_array_r10 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_10)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_10)); } else { @@ -244,7 +244,7 @@ unpack1_r10 (gfc_array_r10 *ret, const gfc_array_r10 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_10)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_10)); } else { diff --git a/libgfortran/generated/unpack_r16.c b/libgfortran/generated/unpack_r16.c index a76156b7b39..f758a29a079 100644 --- a/libgfortran/generated/unpack_r16.c +++ b/libgfortran/generated/unpack_r16.c @@ -99,7 +99,7 @@ unpack0_r16 (gfc_array_r16 *ret, const gfc_array_r16 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_16)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_16)); } else { @@ -244,7 +244,7 @@ unpack1_r16 (gfc_array_r16 *ret, const gfc_array_r16 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_16)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_16)); } else { diff --git a/libgfortran/generated/unpack_r4.c b/libgfortran/generated/unpack_r4.c index fc02d32f152..b66bd37ecd8 100644 --- a/libgfortran/generated/unpack_r4.c +++ b/libgfortran/generated/unpack_r4.c @@ -99,7 +99,7 @@ unpack0_r4 (gfc_array_r4 *ret, const gfc_array_r4 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_4)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_4)); } else { @@ -244,7 +244,7 @@ unpack1_r4 (gfc_array_r4 *ret, const gfc_array_r4 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_4)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_4)); } else { diff --git a/libgfortran/generated/unpack_r8.c b/libgfortran/generated/unpack_r8.c index 798a20e409e..e520d418e51 100644 --- a/libgfortran/generated/unpack_r8.c +++ b/libgfortran/generated/unpack_r8.c @@ -99,7 +99,7 @@ unpack0_r8 (gfc_array_r8 *ret, const gfc_array_r8 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_8)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_8)); } else { @@ -244,7 +244,7 @@ unpack1_r8 (gfc_array_r8 *ret, const gfc_array_r8 *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof (GFC_REAL_8)); + ret->base_addr = xmallocarray (rs, sizeof (GFC_REAL_8)); } else { diff --git a/libgfortran/intrinsics/cshift0.c b/libgfortran/intrinsics/cshift0.c index 759c40429c9..a010b54744c 100644 --- a/libgfortran/intrinsics/cshift0.c +++ b/libgfortran/intrinsics/cshift0.c @@ -79,8 +79,8 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array, GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/intrinsics/ctime.c b/libgfortran/intrinsics/ctime.c index 5a762844aac..6684a6645d0 100644 --- a/libgfortran/intrinsics/ctime.c +++ b/libgfortran/intrinsics/ctime.c @@ -31,31 +31,53 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <string.h> -/* strftime-like function that fills a C string with %c format which - is identical to ctime in the default locale. As ctime and ctime_r - are poorly specified and their usage not recommended, the - implementation instead uses strftime. */ - -static size_t -strctime (char *s, size_t max, const time_t *timep) +/* Maximum space a ctime-like string might need. A "normal" ctime + string is 26 bytes, and in our case 24 bytes as we don't include + the trailing newline and null. However, the longest possible year + number is -2,147,481,748 (1900 - 2,147,483,648, since tm_year is a + 32-bit signed integer) so an extra 7 bytes are needed. */ +#define CTIME_BUFSZ 31 + + +/* Thread-safe ctime-like function that fills a Fortran + string. ctime_r is a portability headache and marked as obsolescent + in POSIX 2008, which recommends strftime in its place. However, + strftime(..., "%c",...) doesn't produce ctime-like output on + MinGW, so do it manually with snprintf. */ + +static int +gf_ctime (char *s, size_t max, const time_t timev) { struct tm ltm; int failed; + char buf[CTIME_BUFSZ + 1]; /* Some targets provide a localtime_r based on a draft of the POSIX standard where the return type is int rather than the standardized struct tm*. */ - __builtin_choose_expr (__builtin_classify_type (localtime_r (timep, <m)) + __builtin_choose_expr (__builtin_classify_type (localtime_r (&timev, <m)) == 5, - failed = localtime_r (timep, <m) == NULL, - failed = localtime_r (timep, <m) != 0); + failed = localtime_r (&timev, <m) == NULL, + failed = localtime_r (&timev, <m) != 0); if (failed) - return 0; - return strftime (s, max, "%c", <m); + goto blank; + int n = snprintf (buf, sizeof (buf), + "%3.3s %3.3s%3d %.2d:%.2d:%.2d %d", + "SunMonTueWedThuFriSat" + ltm.tm_wday * 3, + "JanFebMarAprMayJunJulAugSepOctNovDec" + ltm.tm_mon * 3, + ltm.tm_mday, ltm.tm_hour, ltm.tm_min, ltm.tm_sec, + 1900 + ltm.tm_year); + if (n < 0) + goto blank; + if ((size_t) n <= max) + { + cf_strcpy (s, max, buf); + return n; + } + blank: + memset (s, ' ', max); + return 0; } -/* In the default locale, the date and time representation fits in 26 - bytes. However, other locales might need more space. */ -#define CSZ 100 extern void fdate (char **, gfc_charlen_type *); export_proto(fdate); @@ -64,8 +86,8 @@ void fdate (char ** date, gfc_charlen_type * date_len) { time_t now = time(NULL); - *date = xmalloc (CSZ); - *date_len = strctime (*date, CSZ, &now); + *date = xmalloc (CTIME_BUFSZ); + *date_len = gf_ctime (*date, CTIME_BUFSZ, now); } @@ -76,10 +98,7 @@ void fdate_sub (char * date, gfc_charlen_type date_len) { time_t now = time(NULL); - char *s = xmalloc (date_len + 1); - size_t n = strctime (s, date_len + 1, &now); - fstrcpy (date, date_len, s, n); - free (s); + gf_ctime (date, date_len, now); } @@ -91,8 +110,8 @@ void PREFIX(ctime) (char ** date, gfc_charlen_type * date_len, GFC_INTEGER_8 t) { time_t now = t; - *date = xmalloc (CSZ); - *date_len = strctime (*date, CSZ, &now); + *date = xmalloc (CTIME_BUFSZ); + *date_len = gf_ctime (*date, CTIME_BUFSZ, now); } @@ -103,8 +122,5 @@ void ctime_sub (GFC_INTEGER_8 * t, char * date, gfc_charlen_type date_len) { time_t now = *t; - char *s = xmalloc (date_len + 1); - size_t n = strctime (s, date_len + 1, &now); - fstrcpy (date, date_len, s, n); - free (s); + gf_ctime (date, date_len, now); } diff --git a/libgfortran/intrinsics/eoshift0.c b/libgfortran/intrinsics/eoshift0.c index 118ea6822e7..1e66db3f51e 100644 --- a/libgfortran/intrinsics/eoshift0.c +++ b/libgfortran/intrinsics/eoshift0.c @@ -86,8 +86,8 @@ eoshift0 (gfc_array_char * ret, const gfc_array_char * array, } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/intrinsics/eoshift2.c b/libgfortran/intrinsics/eoshift2.c index b0973a7399b..5f7ec28605f 100644 --- a/libgfortran/intrinsics/eoshift2.c +++ b/libgfortran/intrinsics/eoshift2.c @@ -78,8 +78,8 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array, ret->offset = 0; ret->dtype = array->dtype; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) { diff --git a/libgfortran/intrinsics/pack_generic.c b/libgfortran/intrinsics/pack_generic.c index 843f3bd6bd7..dae18c49f43 100644 --- a/libgfortran/intrinsics/pack_generic.c +++ b/libgfortran/intrinsics/pack_generic.c @@ -152,8 +152,8 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array, GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1); ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * total); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (total, size); if (total == 0) return; /* In this case, nothing remains to be done. */ @@ -519,7 +519,7 @@ pack_s_internal (gfc_array_char *ret, const gfc_array_char *array, ret->offset = 0; - ret->base_addr = xmalloc (size * total); + ret->base_addr = xmallocarray (total, size); if (total == 0) return; diff --git a/libgfortran/intrinsics/reshape_generic.c b/libgfortran/intrinsics/reshape_generic.c index 11a363c070f..bc313d708ca 100644 --- a/libgfortran/intrinsics/reshape_generic.c +++ b/libgfortran/intrinsics/reshape_generic.c @@ -99,11 +99,11 @@ reshape_internal (parray *ret, parray *source, shape_type *shape, ret->offset = 0; if (unlikely (rs < 1)) - alloc_size = 1; + alloc_size = 0; /* xmalloc will allocate 1 byte. */ else - alloc_size = rs * size; + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, size); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/intrinsics/spread_generic.c b/libgfortran/intrinsics/spread_generic.c index cb534956b5e..49b345ddf26 100644 --- a/libgfortran/intrinsics/spread_generic.c +++ b/libgfortran/intrinsics/spread_generic.c @@ -100,7 +100,7 @@ spread_internal (gfc_array_char *ret, const gfc_array_char *source, GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride); } ret->offset = 0; - ret->base_addr = xmalloc (rs * size); + ret->base_addr = xmallocarray (rs, size); if (rs <= 0) return; @@ -245,7 +245,7 @@ spread_internal_scalar (gfc_array_char *ret, const char *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * size); + ret->base_addr = xmallocarray (ncopies, size); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/intrinsics/string_intrinsics_inc.c b/libgfortran/intrinsics/string_intrinsics_inc.c index 27014a0d8f6..f201029344e 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 967cb15815e..524b4589ca4 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) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (size * size0 ((array_t*)ret)); + ret->base_addr = xmallocarray (size0 ((array_t*)ret), size); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/intrinsics/unpack_generic.c b/libgfortran/intrinsics/unpack_generic.c index d06e0a99e27..0a421f37953 100644 --- a/libgfortran/intrinsics/unpack_generic.c +++ b/libgfortran/intrinsics/unpack_generic.c @@ -125,7 +125,7 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * size); + ret->base_addr = xmallocarray (rs, size); } else { diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index 91ef8b5c864..3c766d7c780 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -2354,7 +2354,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 5260be74013..2e11727d1a3 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -3776,9 +3776,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 d1b1a712ed2..3b46bba5662 100644 --- a/libgfortran/io/unit.c +++ b/libgfortran/io/unit.c @@ -455,7 +455,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/unix.c b/libgfortran/io/unix.c index 8b9d7a77342..185d0dca157 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -407,7 +407,9 @@ raw_close (unix_stream * s) { int retval; - if (s->fd != STDOUT_FILENO + if (s->fd == -1) + retval = -1; + else if (s->fd != STDOUT_FILENO && s->fd != STDERR_FILENO && s->fd != STDIN_FILENO) retval = close (s->fd); @@ -983,7 +985,15 @@ fd_to_stream (int fd) /* Get the current length of the file. */ - fstat (fd, &statbuf); + if (fstat (fd, &statbuf) == -1) + { + s->st_dev = s->st_ino = -1; + s->file_length = 0; + if (errno == EBADF) + s->fd = -1; + raw_init (s); + return (stream *) s; + } s->st_dev = statbuf.st_dev; s->st_ino = statbuf.st_ino; diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index f17528edc56..a3c78ce7c6f 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -1863,7 +1863,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); @@ -1892,7 +1892,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 f54edc09634..9a713d852d3 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -751,6 +751,9 @@ internal_proto(set_fpu); 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 b28e5ad5d71..bfdbf9a81e7 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-1, 1); - ret->base_addr = xmalloc (sizeof ('rtype_name`) * size); + ret->base_addr = xmallocarray (size, sizeof ('rtype_name`)); ret->offset = 0; } @@ -123,7 +123,7 @@ bessel_yn_r'rtype_kind` ('rtype` * const restrict ret, int n1, int n2, { size_t size = n2 < n1 ? 0 : n2-n1+1; GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1); - ret->base_addr = xmalloc (sizeof ('rtype_name`) * size); + ret->base_addr = xmallocarray (size, sizeof ('rtype_name`)); ret->offset = 0; } diff --git a/libgfortran/m4/cshift1.m4 b/libgfortran/m4/cshift1.m4 index 0bae030e6f0..61a598bbb3f 100644 --- a/libgfortran/m4/cshift1.m4 +++ b/libgfortran/m4/cshift1.m4 @@ -81,7 +81,7 @@ cshift1 (gfc_array_char * const restrict ret, { int i; - ret->base_addr = xmalloc (size * arraysize); + ret->base_addr = xmallocarray (arraysize, size); ret->offset = 0; ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) diff --git a/libgfortran/m4/eoshift1.m4 b/libgfortran/m4/eoshift1.m4 index 2c0d5de28cb..69d5e2cb38b 100644 --- a/libgfortran/m4/eoshift1.m4 +++ b/libgfortran/m4/eoshift1.m4 @@ -106,8 +106,8 @@ eoshift1 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/m4/eoshift3.m4 b/libgfortran/m4/eoshift3.m4 index cc256e07eab..0add1bbe5e6 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->offset = 0; ret->dtype = array->dtype; for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++) @@ -108,8 +108,8 @@ eoshift3 (gfc_array_char * const restrict ret, GFC_DIMENSION_SET(ret->dim[i], 0, ub, str); } - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (size * arraysize); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (arraysize, size); } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/m4/iforeach.m4 b/libgfortran/m4/iforeach.m4 index a875a2ac273..2b916af66dd 100644 --- a/libgfortran/m4/iforeach.m4 +++ b/libgfortran/m4/iforeach.m4 @@ -30,7 +30,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (rtype_name) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (rtype_name)); } else { @@ -133,7 +133,7 @@ void GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (rtype_name) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (rtype_name)); } else { @@ -264,7 +264,7 @@ void GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; retarray->offset = 0; - retarray->base_addr = xmalloc (sizeof (rtype_name) * rank); + retarray->base_addr = xmallocarray (rank, sizeof (rtype_name)); } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/m4/ifunction.m4 b/libgfortran/m4/ifunction.m4 index 1555aebbc4a..b4de9a87608 100644 --- a/libgfortran/m4/ifunction.m4 +++ b/libgfortran/m4/ifunction.m4 @@ -85,10 +85,9 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name)); if (alloc_size == 0) { /* Make sure we have a zero-sized array. */ @@ -260,8 +259,7 @@ void } - alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; @@ -273,7 +271,7 @@ void return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name)); } else @@ -417,8 +415,7 @@ void retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -427,7 +424,7 @@ void return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name)); } else { diff --git a/libgfortran/m4/ifunction_logical.m4 b/libgfortran/m4/ifunction_logical.m4 index 13dd7a928f3..fd3afb074f8 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->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; - alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1) - * extent[rank-1]; + alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]; if (alloc_size == 0) { @@ -99,7 +98,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, return; } else - retarray->base_addr = xmalloc (alloc_size); + retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name)); } else { diff --git a/libgfortran/m4/in_pack.m4 b/libgfortran/m4/in_pack.m4 index 1767485094d..97ad243e731 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 33f29e60725..29ac2efabf8 100644 --- a/libgfortran/m4/matmul.m4 +++ b/libgfortran/m4/matmul.m4 @@ -125,7 +125,7 @@ matmul_'rtype_code` ('rtype` * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof ('rtype_name`) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof ('rtype_name`)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/m4/matmull.m4 b/libgfortran/m4/matmull.m4 index 59af5973a40..90a0855f54f 100644 --- a/libgfortran/m4/matmull.m4 +++ b/libgfortran/m4/matmull.m4 @@ -89,7 +89,7 @@ matmul_'rtype_code` ('rtype` * const restrict retarray, } retarray->base_addr - = xmalloc (sizeof ('rtype_name`) * size0 ((array_t *) retarray)); + = xmallocarray (size0 ((array_t *) retarray), sizeof ('rtype_name`)); retarray->offset = 0; } else if (unlikely (compile_options.bounds_check)) diff --git a/libgfortran/m4/pack.m4 b/libgfortran/m4/pack.m4 index 334d66e91f1..1b867d465f1 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 7c3ef4ec8dd..2b41bf5c037 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 * sizeof ('rtype_name`); + alloc_size = rs; - ret->base_addr = xmalloc (alloc_size); + ret->base_addr = xmallocarray (alloc_size, sizeof ('rtype_name`)); ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim; } diff --git a/libgfortran/m4/shape.m4 b/libgfortran/m4/shape.m4 index 9ff8f76bba4..5a52a85c5ea 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 - 1, 1); ret->offset = 0; - ret->base_addr = xmalloc (sizeof ('rtype_name`) * rank); + ret->base_addr = xmallocarray (rank, sizeof ('rtype_name`)); } stride = GFC_DESCRIPTOR_STRIDE(ret,0); diff --git a/libgfortran/m4/spread.m4 b/libgfortran/m4/spread.m4 index 59d934764da..c1c86cb47a7 100644 --- a/libgfortran/m4/spread.m4 +++ b/libgfortran/m4/spread.m4 @@ -102,8 +102,8 @@ spread_'rtype_code` ('rtype` *ret, const 'rtype` *source, } ret->offset = 0; - /* xmalloc allocates a single byte for zero size. */ - ret->base_addr = xmalloc (rs * sizeof('rtype_name`)); + /* xmallocarray allocates a single byte for zero size. */ + ret->base_addr = xmallocarray (rs, sizeof('rtype_name`)); if (rs <= 0) return; } @@ -245,7 +245,7 @@ spread_scalar_'rtype_code` ('rtype` *ret, const 'rtype_name` *source, if (ret->base_addr == NULL) { - ret->base_addr = xmalloc (ncopies * sizeof ('rtype_name`)); + ret->base_addr = xmallocarray (ncopies, sizeof ('rtype_name`)); ret->offset = 0; GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1); } diff --git a/libgfortran/m4/transpose.m4 b/libgfortran/m4/transpose.m4 index d8847bdc7e9..731e73d25a0 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) - 1, GFC_DESCRIPTOR_EXTENT(source, 1)); - ret->base_addr = xmalloc (sizeof ('rtype_name`) * size0 ((array_t *) ret)); + ret->base_addr = xmallocarray (size0 ((array_t *) ret), + sizeof ('rtype_name`)); ret->offset = 0; } else if (unlikely (compile_options.bounds_check)) { diff --git a/libgfortran/m4/unpack.m4 b/libgfortran/m4/unpack.m4 index 6bfd56dc177..95c10368374 100644 --- a/libgfortran/m4/unpack.m4 +++ b/libgfortran/m4/unpack.m4 @@ -100,7 +100,7 @@ unpack0_'rtype_code` ('rtype` *ret, const 'rtype` *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof ('rtype_name`)); + ret->base_addr = xmallocarray (rs, sizeof ('rtype_name`)); } else { @@ -245,7 +245,7 @@ unpack1_'rtype_code` ('rtype` *ret, const 'rtype` *vector, rs *= extent[n]; } ret->offset = 0; - ret->base_addr = xmalloc (rs * sizeof ('rtype_name`)); + ret->base_addr = xmallocarray (rs, sizeof ('rtype_name`)); } else { diff --git a/libgfortran/runtime/convert_char.c b/libgfortran/runtime/convert_char.c index e30a2f63443..5058890001d 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 8c09391f0c8..c941d201ea0 100644 --- a/libgfortran/runtime/environ.c +++ b/libgfortran/runtime/environ.c @@ -833,7 +833,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/in_pack_generic.c b/libgfortran/runtime/in_pack_generic.c index 330f0f425db..3f9e37c3c72 100644 --- a/libgfortran/runtime/in_pack_generic.c +++ b/libgfortran/runtime/in_pack_generic.c @@ -180,7 +180,7 @@ internal_pack (gfc_array_char * source) return source->base_addr; /* Allocate storage for the destination. */ - destptr = xmalloc (ssize * size); + destptr = xmallocarray (ssize, size); dest = (char *)destptr; src = source->base_addr; stride0 = stride[0] * size; diff --git a/libgfortran/runtime/memory.c b/libgfortran/runtime/memory.c index d25a97a279c..fc71e4e478c 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); diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index 73985a66c03..79160098fc2 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,3 +1,16 @@ +2014-07-27 Ulrich Weigand <uweigand@de.ibm.com> + + PR libobjc/61920 + * encoding.c (rs6000_special_adjust_field_align_p): Use definition + that matches the 4.8 branch ABI. + +2014-07-27 Alan Modra <amodra@gmail.com> + Matthias Klose <doko@ubuntu.com> + + PR libobjc/61920 + + * encoding.c: Define rs6000_special_adjust_field_align_p. + 2014-05-22 Release Manager * GCC 4.8.3 released. diff --git a/libobjc/encoding.c b/libobjc/encoding.c index 79ad32ae1af..a6d1ca6e3af 100644 --- a/libobjc/encoding.c +++ b/libobjc/encoding.c @@ -192,6 +192,8 @@ _darwin_rs6000_special_round_type_align (const char *struc, int comp, int spec) ? MAX (MAX (COMPUTED, SPECIFIED), 64) \ : MAX (COMPUTED, SPECIFIED));}) +#define rs6000_special_adjust_field_align_p(FIELD, COMPUTED) \ + (TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) /* Skip a variable name, enclosed in quotes ("). */ static inline diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 3147708a683..9c8408d8d09 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,43 @@ +2014-08-04 Jonathan Wakely <jwakely@redhat.com> + + Backported from mainline + 2014-07-29 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/61946 + * include/ext/rope (rope::rope(char_producer<_CharT>*, size_t, bool, + const allocator_type&)): Pass non-const allocator to + _S_new_RopeFunction. + * testsuite/ext/rope/61946.cc: New. + +2014-08-04 Zifei Tong <zifeitong@gmail.com> + + * libsupc++/atexit_thread.cc (HAVE___CXA_THREAD_ATEXIT_IMPL): Add + _GLIBCXX_ prefix to macro. + +2014-06-03 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2014-04-15 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/60734 + * include/bits/stl_tree.h (_Rb_tree::_M_end): Fix invalid cast. + + Backport from mainline + 2014-05-16 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/60966 + * include/std/future (__future_base::_State_baseV2::_M_set_result): + Signal condition variable after call_once returns. + (__future_base::_State_baseV2::_M_do_set): Do not signal here. + (promise::set_value, promise::set_exception): Increment the reference + count on the shared state until the function returns. + * testsuite/30_threads/promise/60966.cc: New. + +2014-05-29 Jonathan Wakely <jwakely@redhat.com> + + * include/tr2/bool_set: Use UTF-8 for accented characters. + * scripts/run_doxygen: Handle Doxygen 1.8.x change. + 2014-05-22 Release Manager * GCC 4.8.3 released. diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index 91bf4df4511..a9bd3d6fe6f 100644 --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -510,11 +510,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Link_type _M_end() - { return static_cast<_Link_type>(&this->_M_impl._M_header); } + { return reinterpret_cast<_Link_type>(&this->_M_impl._M_header); } _Const_Link_type _M_end() const - { return static_cast<_Const_Link_type>(&this->_M_impl._M_header); } + { return reinterpret_cast<_Const_Link_type>(&this->_M_impl._M_header); } static const_reference _S_value(_Const_Link_type __x) diff --git a/libstdc++-v3/include/ext/rope b/libstdc++-v3/include/ext/rope index 38eb1e83a3d..75c8fc2cb20 100644 --- a/libstdc++-v3/include/ext/rope +++ b/libstdc++-v3/include/ext/rope @@ -1544,7 +1544,7 @@ protected: typedef typename _Base::allocator_type allocator_type; using _Base::_M_tree_ptr; using _Base::get_allocator; - using _Base::_M_get_allocator; + using _Base::_M_get_allocator; typedef __GC_CONST _CharT* _Cstrptr; static _CharT _S_empty_c_str[1]; @@ -1876,8 +1876,9 @@ protected: const allocator_type& __a = allocator_type()) : _Base(__a) { - this->_M_tree_ptr = (0 == __len) ? - 0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a); + this->_M_tree_ptr = (0 == __len) + ? 0 + : _S_new_RopeFunction(__fn, __len, __delete_fn, _M_get_allocator()); } rope(const rope& __x, const allocator_type& __a = allocator_type()) diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future index 00dc978f5c7..507c395eca8 100644 --- a/libstdc++-v3/include/std/future +++ b/libstdc++-v3/include/std/future @@ -351,12 +351,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION void _M_set_result(function<_Ptr_type()> __res, bool __ignore_failure = false) { - bool __set = __ignore_failure; + bool __set = false; // all calls to this function are serialized, // side-effects of invoking __res only happen once call_once(_M_once, &_State_base::_M_do_set, this, ref(__res), ref(__set)); - if (!__set) + if (__set) + _M_cond.notify_all(); + else if (!__ignore_failure) __throw_future_error(int(future_errc::promise_already_satisfied)); } @@ -471,7 +473,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION lock_guard<mutex> __lock(_M_mutex); _M_result.swap(__res); } - _M_cond.notify_all(); __set = true; } @@ -983,22 +984,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION void set_value(const _Res& __r) { + auto __future = _M_future; auto __setter = _State::__setter(this, __r); - _M_future->_M_set_result(std::move(__setter)); + __future->_M_set_result(std::move(__setter)); } void set_value(_Res&& __r) { + auto __future = _M_future; auto __setter = _State::__setter(this, std::move(__r)); - _M_future->_M_set_result(std::move(__setter)); + __future->_M_set_result(std::move(__setter)); } void set_exception(exception_ptr __p) { + auto __future = _M_future; auto __setter = _State::__setter(__p, this); - _M_future->_M_set_result(std::move(__setter)); + __future->_M_set_result(std::move(__setter)); } }; @@ -1081,15 +1085,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION void set_value(_Res& __r) { + auto __future = _M_future; auto __setter = _State::__setter(this, __r); - _M_future->_M_set_result(std::move(__setter)); + __future->_M_set_result(std::move(__setter)); } void set_exception(exception_ptr __p) { + auto __future = _M_future; auto __setter = _State::__setter(__p, this); - _M_future->_M_set_result(std::move(__setter)); + __future->_M_set_result(std::move(__setter)); } }; @@ -1166,8 +1172,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION void set_exception(exception_ptr __p) { + auto __future = _M_future; auto __setter = _State::__setter(__p, this); - _M_future->_M_set_result(std::move(__setter)); + __future->_M_set_result(std::move(__setter)); } }; @@ -1193,8 +1200,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline void promise<void>::set_value() { + auto __future = _M_future; auto __setter = _State::__setter(this); - _M_future->_M_set_result(std::move(__setter)); + __future->_M_set_result(std::move(__setter)); } diff --git a/libstdc++-v3/include/tr2/bool_set b/libstdc++-v3/include/tr2/bool_set index 56a56e0e769..b3e33eac6c8 100644 --- a/libstdc++-v3/include/tr2/bool_set +++ b/libstdc++-v3/include/tr2/bool_set @@ -44,7 +44,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * bool_set * * See N2136, Bool_set: multi-valued logic - * by Hervé Brönnimann, Guillaume Melquiond, Sylvain Pion. + * by HervĂ© Brönnimann, Guillaume Melquiond, Sylvain Pion. * * The implicit conversion to bool is slippery! I may use the new * explicit conversion. This has been specialized in the language diff --git a/libstdc++-v3/libsupc++/atexit_thread.cc b/libstdc++-v3/libsupc++/atexit_thread.cc index 11f1dbdeac4..450e6465fea 100644 --- a/libstdc++-v3/libsupc++/atexit_thread.cc +++ b/libstdc++-v3/libsupc++/atexit_thread.cc @@ -26,7 +26,7 @@ #include <new> #include "bits/gthr.h" -#if HAVE___CXA_THREAD_ATEXIT_IMPL +#if _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL extern "C" int __cxa_thread_atexit_impl (void (*func) (void *), void *arg, void *d); @@ -38,7 +38,7 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), return __cxa_thread_atexit_impl (dtor, obj, dso_handle); } -#else /* HAVE___CXA_THREAD_ATEXIT_IMPL */ +#else /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */ namespace { // One element in a singly-linked stack of cleanups. @@ -142,4 +142,4 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), void *obj, void */*dso_ha return 0; } -#endif /* HAVE___CXA_THREAD_ATEXIT_IMPL */ +#endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */ diff --git a/libstdc++-v3/scripts/run_doxygen b/libstdc++-v3/scripts/run_doxygen index 75b2f4f9758..54a5acc851b 100644 --- a/libstdc++-v3/scripts/run_doxygen +++ b/libstdc++-v3/scripts/run_doxygen @@ -193,8 +193,15 @@ fi if $do_latex; then cd ${outdir}/${mode} - # Also drop in the header file and style sheet - doxygen -w latex header.tex doxygen.sty + # Grrr, Doxygen 1.8.x changed the -w latex options. + need_footer=`doxygen -h | sed -n -e '/-w latex/s=.*footer.*=true=p'` + + # Also drop in the header file (maybe footer file) and style sheet + if $need_footer; then + doxygen -w latex header.tex footer.tex doxygen.sty + else + doxygen -w latex header.tex doxygen.sty + fi echo :: echo :: LaTeX pages begin with diff --git a/libstdc++-v3/testsuite/30_threads/promise/60966.cc b/libstdc++-v3/testsuite/30_threads/promise/60966.cc new file mode 100644 index 00000000000..269268b989b --- /dev/null +++ b/libstdc++-v3/testsuite/30_threads/promise/60966.cc @@ -0,0 +1,67 @@ +// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } +// { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-require-cstdint "" } +// { dg-require-gthreads "" } +// { dg-require-atomic-builtins "" } + +// Copyright (C) 2014 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// libstdc++/60966 +// This test hangs if std::promise::~promise() destroys the +// shared state before std::promise::set_value() finishes using it. + +#include <future> +#include <thread> +#include <vector> + +const int THREADS = 10; + +void run_task(std::promise<void>* pr) +{ + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + pr->set_value(); +} + +int main() +{ + std::vector<std::promise<void>*> tasks(THREADS); + std::vector<std::thread> threads(THREADS); + std::vector<std::future<void>> futures(THREADS); + + for (int i = 0; i < THREADS; ++i) + { + std::promise<void>* task = new std::promise<void>; + tasks[i] = task; + futures[i] = task->get_future(); + threads[i] = std::thread(run_task, task); + } + + for (int i = 0; i < THREADS; ++i) + { + // the temporary future releases the state as soon as wait() returns + std::future<void>(std::move(futures[i])).wait(); + // state is ready, should now be safe to delete promise, so it + // releases the shared state too + delete tasks[i]; + } + + for (auto& t : threads) + t.join(); +} diff --git a/libstdc++-v3/testsuite/ext/rope/61946.cc b/libstdc++-v3/testsuite/ext/rope/61946.cc new file mode 100644 index 00000000000..ba73b485667 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/rope/61946.cc @@ -0,0 +1,31 @@ +// Copyright (C) 2014 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-do compile } + +#include <ext/rope> + +struct empty_char_prod : __gnu_cxx::char_producer<char> +{ + virtual void operator()(size_t, size_t, char*) {} +}; + +int main () +{ + empty_char_prod* ecp = new empty_char_prod; + __gnu_cxx::crope excrope( ecp, 10L, true ); +} |