From patchwork Mon Aug 15 11:05:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chung-Lin Tang X-Patchwork-Id: 56746 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 84EE53858C2F for ; Mon, 15 Aug 2022 11:06:40 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 004363858C74; Mon, 15 Aug 2022 11:06:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 004363858C74 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.93,238,1654588800"; d="diff'?scan'208";a="84036307" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 15 Aug 2022 03:06:12 -0800 IronPort-SDR: HXAzkLiDeQdktvskTIh6eJDopau3JaFk5xJ1Z4aEoqOXNJ2RfUfDiv1qL1mWvTiSsDdJWGRDDX u9C3nyg66nOq8MSc6C8DPhzexHtNcIjSWx5HXwLuSeLmBXLFuSN4XVEard3Er3ROe1/SnMDMbH jeVDkUa4+I3OjDHihO49egfjIG9PsJrGSBMz19y70CPWeZPzi1LwKB5DDtI6JGP4XrpuerluMF DguAfQSHUihZ4PXHqbRdkzxYhg1wtlE2bcYlc3D2Od9THkpkuVaxHnkdYryypWQDkG7Xdo7s59 RFo= Message-ID: <05ddbeaf-2276-960a-d1e4-4cd6a09d0ed8@codesourcery.com> Date: Mon, 15 Aug 2022 19:05:55 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Content-Language: en-US From: Chung-Lin Tang Subject: [PATCH, OpenMP, Fortran] requires unified_shared_memory 1/2: adjust libgfortran memory allocators To: gcc-patches , Fortran List , Tobias Burnus , Andrew Stubbs , Catherine Moore , Jakub Jelinek X-ClientProxiedBy: svr-orw-mbx-10.mgc.mentorg.com (147.34.90.210) To svr-orw-mbx-10.mgc.mentorg.com (147.34.90.210) X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_MANYTO, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi, this patch is to fix the case where 'requires unified_shared_memory' doesn't work due to memory allocator mismatch. Currently this is only for OG12 (devel/omp/gcc-12), but will apply to mainline as well once those requires patches get in. Basically, under 'requires unified_shared_memory' enables the usm_transform pass, which transforms some of the expanded Fortran intrinsic code that uses __builtin_free() into 'omp_free (..., ompx_unified_shared_mem_alloc)'. The intention is to make all dynamic memory allocation use the OpenMP unified_shared_memory allocator, but there is a big gap in this, namely libgfortran. What happens in some tests are that libgfortran allocates stuff using normal malloc(), and the usm_transform generates code that frees the stuff using omp_free(), and chaos ensues. So the proper fix we believe is: to make it possible to move the entire libgfortran on to unified_shared_memory. This first patch is a mostly mechanical patch to change all references of malloc/free/calloc/realloc in libgfortran into xmalloc/xfree/xcalloc/xrealloc in libgfortran/runtime/memory.c, as well as strdup uses into a new internal xstrdup. All of libgfortran is adjusted this way, except libgfortran/caf, which is an independent library outside of libgfortran.so. The second patch of this series will present a way to switch the references of allocators in libgfortran/runtime/memory.c from the normal glibc malloc/free/etc. to omp_alloc/omp_free/etc. when 'requires unified_shared_memory' is detected. Tested on devel/omp/gcc-12. Plans is to commit there soon, but also seeking approval for mainline once the requires stuff goes in. Thanks, Chung-Lin 2022-08-15 Chung-Lin Tang libgfortran/ChangeLog: * m4/matmul_internal.m4: Adjust malloc/free to xmalloc/xfree. * generated/matmul_c10.c: Regenerate. * generated/matmul_c16.c: Likewise. * generated/matmul_c17.c: Likewise. * generated/matmul_c4.c: Likewise. * generated/matmul_c8.c: Likewise. * generated/matmul_i1.c: Likewise. * generated/matmul_i16.c: Likewise. * generated/matmul_i2.c: Likewise. * generated/matmul_i4.c: Likewise. * generated/matmul_i8.c: Likewise. * generated/matmul_r10.c: Likewise. * generated/matmul_r16.c: Likewise. * generated/matmul_r17.c: Likewise. * generated/matmul_r4.c: Likewise. * generated/matmul_r8.c: Likewise. * generated/matmulavx128_c10.c: Likewise. * generated/matmulavx128_c16.c: Likewise. * generated/matmulavx128_c17.c: Likewise. * generated/matmulavx128_c4.c: Likewise. * generated/matmulavx128_c8.c: Likewise. * generated/matmulavx128_i1.c: Likewise. * generated/matmulavx128_i16.c: Likewise. * generated/matmulavx128_i2.c: Likewise. * generated/matmulavx128_i4.c: Likewise. * generated/matmulavx128_i8.c: Likewise. * generated/matmulavx128_r10.c: Likewise. * generated/matmulavx128_r16.c: Likewise. * generated/matmulavx128_r17.c: Likewise. * generated/matmulavx128_r4.c: Likewise. * generated/matmulavx128_r8.c: Likewise. * intrinsics/access.c (access_func): Adjust free to xfree. * intrinsics/chdir.c (chdir_i4_sub): Likewise. (chdir_i8_sub): Likewise. * intrinsics/chmod.c (chmod_func): Likewise. * intrinsics/date_and_time.c (secnds): Likewise. * intrinsics/env.c (PREFIX(getenv)): Likewise. (get_environment_variable_i4): Likewise. * intrinsics/execute_command_line.c (execute_command_line): Likewise. * intrinsics/getcwd.c (getcwd_i4_sub): Likewise. * intrinsics/getlog.c (PREFIX(getlog)): Likewise. * intrinsics/link.c (link_internal): Likewise. * intrinsics/move_alloc.c (move_alloc): Likewise. * intrinsics/perror.c (perror_sub): Likewise. * intrinsics/random.c (constructor_random): Likewise. * intrinsics/rename.c (rename_internal): Likewise. * intrinsics/stat.c (stat_i4_sub_0): Likewise. (stat_i8_sub_0): Likewise. * intrinsics/symlnk.c (symlnk_internal): Likewise. * intrinsics/system.c (system_sub): Likewise. * intrinsics/unlink.c (unlink_i4_sub): Likewise. * io/async.c (update_pdt): Likewise. (async_io): Likewise. (free_async_unit): Likewise. (init_async_unit): Adjust calloc to xcalloc. (enqueue_done_id): Likewise. (enqueue_done): Likewise. (enqueue_close): Likewise. * io/async.h (MUTEX_DEBUG_ADD): Adjust malloc/free to xmalloc/xfree. * io/close.c (st_close): Adjust strdup/free to xstrdup/xfree. * io/fbuf.c (fbuf_destroy): Adjust free to xfree. * io/format.c (free_format_hash_table): Likewise. (save_parsed_format): Likewise. (free_format): Likewise. (free_format_data): Likewise. * io/intrinsics.c (ttynam): Likewise. * io/list_read.c (free_saved): Likewise. (free_line): Likewise. (nml_touch_nodes): Likewise. (nml_read_obj): Likewise. * io/lock.c (free_ionml): Likewise. * io/open.c (new_unit): Likewise. (already_open): Likewise. * io/read.c (read_f): Likewise. * io/transfer.c (formatted_transfer_scalar_read): Likewise. (formatted_transfer_scalar_write): Likewise. (finalize_transfer): Likewise. (st_read_done_worker): Likewise. (st_write_done_worker): Likewise. * io/unit.c (destroy_unit_mutex): Likewise. (init_units): Adjust strdup to xstrdup. (close_unit_1): Adjust free to xfree. (close_units): Likewise. (filename_from_unit): Adjust strdup to xstrdup. * io/unix.c (raw_close): Adjust free to xfree. (buf_close): Likewise. (mem_close): Likewise. (tempfile): Adjust strdup to xstrdup. (regular_file): Adjust free to xfree. (compare_file_filename): Likewise. (flush_all_units): Likewise. (file_exists): Likewise. (file_size): Likewise. (inquire_sequential): Likewise. (inquire_direct): Likewise. (inquire_formatted): Likewise. (inquire_access): Likewise. * io/write.c (write_float_0): Likewise. (write_real): Likewise. (write_real_w0): Likewise. (write_complex): Likewise. (nml_write_obj): Likewise. * runtime/ISO_Fortran_binding.c (gfc_desc_to_cfi_desc): Adjust calloc to xcalloc. (CFI_allocate): Adjust free to xfree. (CFI_deallocate): Likewise. * runtime/error.c (show_locus): Likewise. (constructor_recursion_check): Likewise. * runtime/minimal.c (show_locus): Likewise. * runtime/string.c (fc_strdup): Rename from strndup, remove HAVE_STRNDUP. (xstrdup): New function. (fc_strdup): Adjust from strndup to fc_strndup. (fc_strdup_notrim): Likewise. * libgfortran.h (xfree): Add new internal prototype. (xstrdup): Likewise. * runtime/memory.c (xfree): New function. diff --git a/libgfortran/generated/matmul_c10.c b/libgfortran/generated/matmul_c10.c index 236521e..cc9e270 100644 --- a/libgfortran/generated/matmul_c10.c +++ b/libgfortran/generated/matmul_c10.c @@ -339,7 +339,7 @@ matmul_c10_avx (gfc_array_c10 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_10)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_10)); /* Start turning the crank. */ i1 = n; @@ -550,7 +550,7 @@ matmul_c10_avx (gfc_array_c10 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -908,7 +908,7 @@ matmul_c10_avx2 (gfc_array_c10 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_10)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_10)); /* Start turning the crank. */ i1 = n; @@ -1119,7 +1119,7 @@ matmul_c10_avx2 (gfc_array_c10 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -1477,7 +1477,7 @@ matmul_c10_avx512f (gfc_array_c10 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_10)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_10)); /* Start turning the crank. */ i1 = n; @@ -1688,7 +1688,7 @@ matmul_c10_avx512f (gfc_array_c10 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2060,7 +2060,7 @@ matmul_c10_vanilla (gfc_array_c10 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_10)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_10)); /* Start turning the crank. */ i1 = n; @@ -2271,7 +2271,7 @@ matmul_c10_vanilla (gfc_array_c10 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2702,7 +2702,7 @@ matmul_c10 (gfc_array_c10 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_10)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_10)); /* Start turning the crank. */ i1 = n; @@ -2913,7 +2913,7 @@ matmul_c10 (gfc_array_c10 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmul_c16.c b/libgfortran/generated/matmul_c16.c index 5ef443c..010e1bc 100644 --- a/libgfortran/generated/matmul_c16.c +++ b/libgfortran/generated/matmul_c16.c @@ -339,7 +339,7 @@ matmul_c16_avx (gfc_array_c16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_16)); /* Start turning the crank. */ i1 = n; @@ -550,7 +550,7 @@ matmul_c16_avx (gfc_array_c16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -908,7 +908,7 @@ matmul_c16_avx2 (gfc_array_c16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_16)); /* Start turning the crank. */ i1 = n; @@ -1119,7 +1119,7 @@ matmul_c16_avx2 (gfc_array_c16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -1477,7 +1477,7 @@ matmul_c16_avx512f (gfc_array_c16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_16)); /* Start turning the crank. */ i1 = n; @@ -1688,7 +1688,7 @@ matmul_c16_avx512f (gfc_array_c16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2060,7 +2060,7 @@ matmul_c16_vanilla (gfc_array_c16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_16)); /* Start turning the crank. */ i1 = n; @@ -2271,7 +2271,7 @@ matmul_c16_vanilla (gfc_array_c16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2702,7 +2702,7 @@ matmul_c16 (gfc_array_c16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_16)); /* Start turning the crank. */ i1 = n; @@ -2913,7 +2913,7 @@ matmul_c16 (gfc_array_c16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmul_c17.c b/libgfortran/generated/matmul_c17.c index a1a7d42..979f0a2 100644 --- a/libgfortran/generated/matmul_c17.c +++ b/libgfortran/generated/matmul_c17.c @@ -339,7 +339,7 @@ matmul_c17_avx (gfc_array_c17 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_17)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_17)); /* Start turning the crank. */ i1 = n; @@ -550,7 +550,7 @@ matmul_c17_avx (gfc_array_c17 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -908,7 +908,7 @@ matmul_c17_avx2 (gfc_array_c17 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_17)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_17)); /* Start turning the crank. */ i1 = n; @@ -1119,7 +1119,7 @@ matmul_c17_avx2 (gfc_array_c17 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -1477,7 +1477,7 @@ matmul_c17_avx512f (gfc_array_c17 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_17)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_17)); /* Start turning the crank. */ i1 = n; @@ -1688,7 +1688,7 @@ matmul_c17_avx512f (gfc_array_c17 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2060,7 +2060,7 @@ matmul_c17_vanilla (gfc_array_c17 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_17)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_17)); /* Start turning the crank. */ i1 = n; @@ -2271,7 +2271,7 @@ matmul_c17_vanilla (gfc_array_c17 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2702,7 +2702,7 @@ matmul_c17 (gfc_array_c17 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_17)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_17)); /* Start turning the crank. */ i1 = n; @@ -2913,7 +2913,7 @@ matmul_c17 (gfc_array_c17 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmul_c4.c b/libgfortran/generated/matmul_c4.c index 5f86a55..47956e0 100644 --- a/libgfortran/generated/matmul_c4.c +++ b/libgfortran/generated/matmul_c4.c @@ -339,7 +339,7 @@ matmul_c4_avx (gfc_array_c4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_4)); /* Start turning the crank. */ i1 = n; @@ -550,7 +550,7 @@ matmul_c4_avx (gfc_array_c4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -908,7 +908,7 @@ matmul_c4_avx2 (gfc_array_c4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_4)); /* Start turning the crank. */ i1 = n; @@ -1119,7 +1119,7 @@ matmul_c4_avx2 (gfc_array_c4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -1477,7 +1477,7 @@ matmul_c4_avx512f (gfc_array_c4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_4)); /* Start turning the crank. */ i1 = n; @@ -1688,7 +1688,7 @@ matmul_c4_avx512f (gfc_array_c4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2060,7 +2060,7 @@ matmul_c4_vanilla (gfc_array_c4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_4)); /* Start turning the crank. */ i1 = n; @@ -2271,7 +2271,7 @@ matmul_c4_vanilla (gfc_array_c4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2702,7 +2702,7 @@ matmul_c4 (gfc_array_c4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_4)); /* Start turning the crank. */ i1 = n; @@ -2913,7 +2913,7 @@ matmul_c4 (gfc_array_c4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmul_c8.c b/libgfortran/generated/matmul_c8.c index 1e27981..353a2bf 100644 --- a/libgfortran/generated/matmul_c8.c +++ b/libgfortran/generated/matmul_c8.c @@ -339,7 +339,7 @@ matmul_c8_avx (gfc_array_c8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_8)); /* Start turning the crank. */ i1 = n; @@ -550,7 +550,7 @@ matmul_c8_avx (gfc_array_c8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -908,7 +908,7 @@ matmul_c8_avx2 (gfc_array_c8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_8)); /* Start turning the crank. */ i1 = n; @@ -1119,7 +1119,7 @@ matmul_c8_avx2 (gfc_array_c8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -1477,7 +1477,7 @@ matmul_c8_avx512f (gfc_array_c8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_8)); /* Start turning the crank. */ i1 = n; @@ -1688,7 +1688,7 @@ matmul_c8_avx512f (gfc_array_c8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2060,7 +2060,7 @@ matmul_c8_vanilla (gfc_array_c8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_8)); /* Start turning the crank. */ i1 = n; @@ -2271,7 +2271,7 @@ matmul_c8_vanilla (gfc_array_c8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2702,7 +2702,7 @@ matmul_c8 (gfc_array_c8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_8)); /* Start turning the crank. */ i1 = n; @@ -2913,7 +2913,7 @@ matmul_c8 (gfc_array_c8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmul_i1.c b/libgfortran/generated/matmul_i1.c index 0b324cd..c3b0b5f 100644 --- a/libgfortran/generated/matmul_i1.c +++ b/libgfortran/generated/matmul_i1.c @@ -339,7 +339,7 @@ matmul_i1_avx (gfc_array_i1 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_1)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_1)); /* Start turning the crank. */ i1 = n; @@ -550,7 +550,7 @@ matmul_i1_avx (gfc_array_i1 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -908,7 +908,7 @@ matmul_i1_avx2 (gfc_array_i1 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_1)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_1)); /* Start turning the crank. */ i1 = n; @@ -1119,7 +1119,7 @@ matmul_i1_avx2 (gfc_array_i1 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -1477,7 +1477,7 @@ matmul_i1_avx512f (gfc_array_i1 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_1)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_1)); /* Start turning the crank. */ i1 = n; @@ -1688,7 +1688,7 @@ matmul_i1_avx512f (gfc_array_i1 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2060,7 +2060,7 @@ matmul_i1_vanilla (gfc_array_i1 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_1)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_1)); /* Start turning the crank. */ i1 = n; @@ -2271,7 +2271,7 @@ matmul_i1_vanilla (gfc_array_i1 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2702,7 +2702,7 @@ matmul_i1 (gfc_array_i1 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_1)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_1)); /* Start turning the crank. */ i1 = n; @@ -2913,7 +2913,7 @@ matmul_i1 (gfc_array_i1 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmul_i16.c b/libgfortran/generated/matmul_i16.c index 2a6bee7..3ed8434 100644 --- a/libgfortran/generated/matmul_i16.c +++ b/libgfortran/generated/matmul_i16.c @@ -339,7 +339,7 @@ matmul_i16_avx (gfc_array_i16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_16)); /* Start turning the crank. */ i1 = n; @@ -550,7 +550,7 @@ matmul_i16_avx (gfc_array_i16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -908,7 +908,7 @@ matmul_i16_avx2 (gfc_array_i16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_16)); /* Start turning the crank. */ i1 = n; @@ -1119,7 +1119,7 @@ matmul_i16_avx2 (gfc_array_i16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -1477,7 +1477,7 @@ matmul_i16_avx512f (gfc_array_i16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_16)); /* Start turning the crank. */ i1 = n; @@ -1688,7 +1688,7 @@ matmul_i16_avx512f (gfc_array_i16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2060,7 +2060,7 @@ matmul_i16_vanilla (gfc_array_i16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_16)); /* Start turning the crank. */ i1 = n; @@ -2271,7 +2271,7 @@ matmul_i16_vanilla (gfc_array_i16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2702,7 +2702,7 @@ matmul_i16 (gfc_array_i16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_16)); /* Start turning the crank. */ i1 = n; @@ -2913,7 +2913,7 @@ matmul_i16 (gfc_array_i16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmul_i2.c b/libgfortran/generated/matmul_i2.c index 83995e7..b5199fb 100644 --- a/libgfortran/generated/matmul_i2.c +++ b/libgfortran/generated/matmul_i2.c @@ -339,7 +339,7 @@ matmul_i2_avx (gfc_array_i2 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_2)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_2)); /* Start turning the crank. */ i1 = n; @@ -550,7 +550,7 @@ matmul_i2_avx (gfc_array_i2 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -908,7 +908,7 @@ matmul_i2_avx2 (gfc_array_i2 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_2)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_2)); /* Start turning the crank. */ i1 = n; @@ -1119,7 +1119,7 @@ matmul_i2_avx2 (gfc_array_i2 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -1477,7 +1477,7 @@ matmul_i2_avx512f (gfc_array_i2 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_2)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_2)); /* Start turning the crank. */ i1 = n; @@ -1688,7 +1688,7 @@ matmul_i2_avx512f (gfc_array_i2 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2060,7 +2060,7 @@ matmul_i2_vanilla (gfc_array_i2 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_2)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_2)); /* Start turning the crank. */ i1 = n; @@ -2271,7 +2271,7 @@ matmul_i2_vanilla (gfc_array_i2 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2702,7 +2702,7 @@ matmul_i2 (gfc_array_i2 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_2)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_2)); /* Start turning the crank. */ i1 = n; @@ -2913,7 +2913,7 @@ matmul_i2 (gfc_array_i2 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmul_i4.c b/libgfortran/generated/matmul_i4.c index 4fba06f..906e6b8 100644 --- a/libgfortran/generated/matmul_i4.c +++ b/libgfortran/generated/matmul_i4.c @@ -339,7 +339,7 @@ matmul_i4_avx (gfc_array_i4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_4)); /* Start turning the crank. */ i1 = n; @@ -550,7 +550,7 @@ matmul_i4_avx (gfc_array_i4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -908,7 +908,7 @@ matmul_i4_avx2 (gfc_array_i4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_4)); /* Start turning the crank. */ i1 = n; @@ -1119,7 +1119,7 @@ matmul_i4_avx2 (gfc_array_i4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -1477,7 +1477,7 @@ matmul_i4_avx512f (gfc_array_i4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_4)); /* Start turning the crank. */ i1 = n; @@ -1688,7 +1688,7 @@ matmul_i4_avx512f (gfc_array_i4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2060,7 +2060,7 @@ matmul_i4_vanilla (gfc_array_i4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_4)); /* Start turning the crank. */ i1 = n; @@ -2271,7 +2271,7 @@ matmul_i4_vanilla (gfc_array_i4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2702,7 +2702,7 @@ matmul_i4 (gfc_array_i4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_4)); /* Start turning the crank. */ i1 = n; @@ -2913,7 +2913,7 @@ matmul_i4 (gfc_array_i4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmul_i8.c b/libgfortran/generated/matmul_i8.c index af99567..ea95c7e 100644 --- a/libgfortran/generated/matmul_i8.c +++ b/libgfortran/generated/matmul_i8.c @@ -339,7 +339,7 @@ matmul_i8_avx (gfc_array_i8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_8)); /* Start turning the crank. */ i1 = n; @@ -550,7 +550,7 @@ matmul_i8_avx (gfc_array_i8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -908,7 +908,7 @@ matmul_i8_avx2 (gfc_array_i8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_8)); /* Start turning the crank. */ i1 = n; @@ -1119,7 +1119,7 @@ matmul_i8_avx2 (gfc_array_i8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -1477,7 +1477,7 @@ matmul_i8_avx512f (gfc_array_i8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_8)); /* Start turning the crank. */ i1 = n; @@ -1688,7 +1688,7 @@ matmul_i8_avx512f (gfc_array_i8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2060,7 +2060,7 @@ matmul_i8_vanilla (gfc_array_i8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_8)); /* Start turning the crank. */ i1 = n; @@ -2271,7 +2271,7 @@ matmul_i8_vanilla (gfc_array_i8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2702,7 +2702,7 @@ matmul_i8 (gfc_array_i8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_8)); /* Start turning the crank. */ i1 = n; @@ -2913,7 +2913,7 @@ matmul_i8 (gfc_array_i8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmul_r10.c b/libgfortran/generated/matmul_r10.c index b3501ce..9d241d6 100644 --- a/libgfortran/generated/matmul_r10.c +++ b/libgfortran/generated/matmul_r10.c @@ -339,7 +339,7 @@ matmul_r10_avx (gfc_array_r10 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_10)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_10)); /* Start turning the crank. */ i1 = n; @@ -550,7 +550,7 @@ matmul_r10_avx (gfc_array_r10 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -908,7 +908,7 @@ matmul_r10_avx2 (gfc_array_r10 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_10)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_10)); /* Start turning the crank. */ i1 = n; @@ -1119,7 +1119,7 @@ matmul_r10_avx2 (gfc_array_r10 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -1477,7 +1477,7 @@ matmul_r10_avx512f (gfc_array_r10 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_10)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_10)); /* Start turning the crank. */ i1 = n; @@ -1688,7 +1688,7 @@ matmul_r10_avx512f (gfc_array_r10 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2060,7 +2060,7 @@ matmul_r10_vanilla (gfc_array_r10 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_10)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_10)); /* Start turning the crank. */ i1 = n; @@ -2271,7 +2271,7 @@ matmul_r10_vanilla (gfc_array_r10 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2702,7 +2702,7 @@ matmul_r10 (gfc_array_r10 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_10)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_10)); /* Start turning the crank. */ i1 = n; @@ -2913,7 +2913,7 @@ matmul_r10 (gfc_array_r10 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmul_r16.c b/libgfortran/generated/matmul_r16.c index f5b6725..881b74ac 100644 --- a/libgfortran/generated/matmul_r16.c +++ b/libgfortran/generated/matmul_r16.c @@ -339,7 +339,7 @@ matmul_r16_avx (gfc_array_r16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_16)); /* Start turning the crank. */ i1 = n; @@ -550,7 +550,7 @@ matmul_r16_avx (gfc_array_r16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -908,7 +908,7 @@ matmul_r16_avx2 (gfc_array_r16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_16)); /* Start turning the crank. */ i1 = n; @@ -1119,7 +1119,7 @@ matmul_r16_avx2 (gfc_array_r16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -1477,7 +1477,7 @@ matmul_r16_avx512f (gfc_array_r16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_16)); /* Start turning the crank. */ i1 = n; @@ -1688,7 +1688,7 @@ matmul_r16_avx512f (gfc_array_r16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2060,7 +2060,7 @@ matmul_r16_vanilla (gfc_array_r16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_16)); /* Start turning the crank. */ i1 = n; @@ -2271,7 +2271,7 @@ matmul_r16_vanilla (gfc_array_r16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2702,7 +2702,7 @@ matmul_r16 (gfc_array_r16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_16)); /* Start turning the crank. */ i1 = n; @@ -2913,7 +2913,7 @@ matmul_r16 (gfc_array_r16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmul_r17.c b/libgfortran/generated/matmul_r17.c index db7f05b..efde301 100644 --- a/libgfortran/generated/matmul_r17.c +++ b/libgfortran/generated/matmul_r17.c @@ -339,7 +339,7 @@ matmul_r17_avx (gfc_array_r17 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_17)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_17)); /* Start turning the crank. */ i1 = n; @@ -550,7 +550,7 @@ matmul_r17_avx (gfc_array_r17 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -908,7 +908,7 @@ matmul_r17_avx2 (gfc_array_r17 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_17)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_17)); /* Start turning the crank. */ i1 = n; @@ -1119,7 +1119,7 @@ matmul_r17_avx2 (gfc_array_r17 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -1477,7 +1477,7 @@ matmul_r17_avx512f (gfc_array_r17 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_17)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_17)); /* Start turning the crank. */ i1 = n; @@ -1688,7 +1688,7 @@ matmul_r17_avx512f (gfc_array_r17 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2060,7 +2060,7 @@ matmul_r17_vanilla (gfc_array_r17 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_17)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_17)); /* Start turning the crank. */ i1 = n; @@ -2271,7 +2271,7 @@ matmul_r17_vanilla (gfc_array_r17 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2702,7 +2702,7 @@ matmul_r17 (gfc_array_r17 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_17)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_17)); /* Start turning the crank. */ i1 = n; @@ -2913,7 +2913,7 @@ matmul_r17 (gfc_array_r17 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmul_r4.c b/libgfortran/generated/matmul_r4.c index 183bbe3..588d05c 100644 --- a/libgfortran/generated/matmul_r4.c +++ b/libgfortran/generated/matmul_r4.c @@ -339,7 +339,7 @@ matmul_r4_avx (gfc_array_r4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_4)); /* Start turning the crank. */ i1 = n; @@ -550,7 +550,7 @@ matmul_r4_avx (gfc_array_r4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -908,7 +908,7 @@ matmul_r4_avx2 (gfc_array_r4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_4)); /* Start turning the crank. */ i1 = n; @@ -1119,7 +1119,7 @@ matmul_r4_avx2 (gfc_array_r4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -1477,7 +1477,7 @@ matmul_r4_avx512f (gfc_array_r4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_4)); /* Start turning the crank. */ i1 = n; @@ -1688,7 +1688,7 @@ matmul_r4_avx512f (gfc_array_r4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2060,7 +2060,7 @@ matmul_r4_vanilla (gfc_array_r4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_4)); /* Start turning the crank. */ i1 = n; @@ -2271,7 +2271,7 @@ matmul_r4_vanilla (gfc_array_r4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2702,7 +2702,7 @@ matmul_r4 (gfc_array_r4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_4)); /* Start turning the crank. */ i1 = n; @@ -2913,7 +2913,7 @@ matmul_r4 (gfc_array_r4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmul_r8.c b/libgfortran/generated/matmul_r8.c index f6ab5ea..92b80e1 100644 --- a/libgfortran/generated/matmul_r8.c +++ b/libgfortran/generated/matmul_r8.c @@ -339,7 +339,7 @@ matmul_r8_avx (gfc_array_r8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_8)); /* Start turning the crank. */ i1 = n; @@ -550,7 +550,7 @@ matmul_r8_avx (gfc_array_r8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -908,7 +908,7 @@ matmul_r8_avx2 (gfc_array_r8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_8)); /* Start turning the crank. */ i1 = n; @@ -1119,7 +1119,7 @@ matmul_r8_avx2 (gfc_array_r8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -1477,7 +1477,7 @@ matmul_r8_avx512f (gfc_array_r8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_8)); /* Start turning the crank. */ i1 = n; @@ -1688,7 +1688,7 @@ matmul_r8_avx512f (gfc_array_r8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2060,7 +2060,7 @@ matmul_r8_vanilla (gfc_array_r8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_8)); /* Start turning the crank. */ i1 = n; @@ -2271,7 +2271,7 @@ matmul_r8_vanilla (gfc_array_r8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -2702,7 +2702,7 @@ matmul_r8 (gfc_array_r8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_8)); /* Start turning the crank. */ i1 = n; @@ -2913,7 +2913,7 @@ matmul_r8 (gfc_array_r8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmulavx128_c10.c b/libgfortran/generated/matmulavx128_c10.c index ec33ca2..4d40d54 100644 --- a/libgfortran/generated/matmulavx128_c10.c +++ b/libgfortran/generated/matmulavx128_c10.c @@ -304,7 +304,7 @@ matmul_c10_avx128_fma3 (gfc_array_c10 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_10)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_10)); /* Start turning the crank. */ i1 = n; @@ -515,7 +515,7 @@ matmul_c10_avx128_fma3 (gfc_array_c10 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -874,7 +874,7 @@ matmul_c10_avx128_fma4 (gfc_array_c10 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_10)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_10)); /* Start turning the crank. */ i1 = n; @@ -1085,7 +1085,7 @@ matmul_c10_avx128_fma4 (gfc_array_c10 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmulavx128_c16.c b/libgfortran/generated/matmulavx128_c16.c index daed5fb..f472a92 100644 --- a/libgfortran/generated/matmulavx128_c16.c +++ b/libgfortran/generated/matmulavx128_c16.c @@ -304,7 +304,7 @@ matmul_c16_avx128_fma3 (gfc_array_c16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_16)); /* Start turning the crank. */ i1 = n; @@ -515,7 +515,7 @@ matmul_c16_avx128_fma3 (gfc_array_c16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -874,7 +874,7 @@ matmul_c16_avx128_fma4 (gfc_array_c16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_16)); /* Start turning the crank. */ i1 = n; @@ -1085,7 +1085,7 @@ matmul_c16_avx128_fma4 (gfc_array_c16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmulavx128_c17.c b/libgfortran/generated/matmulavx128_c17.c index 79cfe5b..1f14f1d 100644 --- a/libgfortran/generated/matmulavx128_c17.c +++ b/libgfortran/generated/matmulavx128_c17.c @@ -304,7 +304,7 @@ matmul_c17_avx128_fma3 (gfc_array_c17 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_17)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_17)); /* Start turning the crank. */ i1 = n; @@ -515,7 +515,7 @@ matmul_c17_avx128_fma3 (gfc_array_c17 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -874,7 +874,7 @@ matmul_c17_avx128_fma4 (gfc_array_c17 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_17)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_17)); /* Start turning the crank. */ i1 = n; @@ -1085,7 +1085,7 @@ matmul_c17_avx128_fma4 (gfc_array_c17 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmulavx128_c4.c b/libgfortran/generated/matmulavx128_c4.c index 93303d6..45d0e67 100644 --- a/libgfortran/generated/matmulavx128_c4.c +++ b/libgfortran/generated/matmulavx128_c4.c @@ -304,7 +304,7 @@ matmul_c4_avx128_fma3 (gfc_array_c4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_4)); /* Start turning the crank. */ i1 = n; @@ -515,7 +515,7 @@ matmul_c4_avx128_fma3 (gfc_array_c4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -874,7 +874,7 @@ matmul_c4_avx128_fma4 (gfc_array_c4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_4)); /* Start turning the crank. */ i1 = n; @@ -1085,7 +1085,7 @@ matmul_c4_avx128_fma4 (gfc_array_c4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmulavx128_c8.c b/libgfortran/generated/matmulavx128_c8.c index 707e38b..2d4525b 100644 --- a/libgfortran/generated/matmulavx128_c8.c +++ b/libgfortran/generated/matmulavx128_c8.c @@ -304,7 +304,7 @@ matmul_c8_avx128_fma3 (gfc_array_c8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_8)); /* Start turning the crank. */ i1 = n; @@ -515,7 +515,7 @@ matmul_c8_avx128_fma3 (gfc_array_c8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -874,7 +874,7 @@ matmul_c8_avx128_fma4 (gfc_array_c8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_COMPLEX_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_COMPLEX_8)); /* Start turning the crank. */ i1 = n; @@ -1085,7 +1085,7 @@ matmul_c8_avx128_fma4 (gfc_array_c8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmulavx128_i1.c b/libgfortran/generated/matmulavx128_i1.c index b3416c5..66677eb 100644 --- a/libgfortran/generated/matmulavx128_i1.c +++ b/libgfortran/generated/matmulavx128_i1.c @@ -304,7 +304,7 @@ matmul_i1_avx128_fma3 (gfc_array_i1 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_1)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_1)); /* Start turning the crank. */ i1 = n; @@ -515,7 +515,7 @@ matmul_i1_avx128_fma3 (gfc_array_i1 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -874,7 +874,7 @@ matmul_i1_avx128_fma4 (gfc_array_i1 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_1)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_1)); /* Start turning the crank. */ i1 = n; @@ -1085,7 +1085,7 @@ matmul_i1_avx128_fma4 (gfc_array_i1 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmulavx128_i16.c b/libgfortran/generated/matmulavx128_i16.c index 8ac592b..ec9336c 100644 --- a/libgfortran/generated/matmulavx128_i16.c +++ b/libgfortran/generated/matmulavx128_i16.c @@ -304,7 +304,7 @@ matmul_i16_avx128_fma3 (gfc_array_i16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_16)); /* Start turning the crank. */ i1 = n; @@ -515,7 +515,7 @@ matmul_i16_avx128_fma3 (gfc_array_i16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -874,7 +874,7 @@ matmul_i16_avx128_fma4 (gfc_array_i16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_16)); /* Start turning the crank. */ i1 = n; @@ -1085,7 +1085,7 @@ matmul_i16_avx128_fma4 (gfc_array_i16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmulavx128_i2.c b/libgfortran/generated/matmulavx128_i2.c index 0528960..931692c 100644 --- a/libgfortran/generated/matmulavx128_i2.c +++ b/libgfortran/generated/matmulavx128_i2.c @@ -304,7 +304,7 @@ matmul_i2_avx128_fma3 (gfc_array_i2 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_2)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_2)); /* Start turning the crank. */ i1 = n; @@ -515,7 +515,7 @@ matmul_i2_avx128_fma3 (gfc_array_i2 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -874,7 +874,7 @@ matmul_i2_avx128_fma4 (gfc_array_i2 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_2)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_2)); /* Start turning the crank. */ i1 = n; @@ -1085,7 +1085,7 @@ matmul_i2_avx128_fma4 (gfc_array_i2 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmulavx128_i4.c b/libgfortran/generated/matmulavx128_i4.c index f4e3ed9..272adb5 100644 --- a/libgfortran/generated/matmulavx128_i4.c +++ b/libgfortran/generated/matmulavx128_i4.c @@ -304,7 +304,7 @@ matmul_i4_avx128_fma3 (gfc_array_i4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_4)); /* Start turning the crank. */ i1 = n; @@ -515,7 +515,7 @@ matmul_i4_avx128_fma3 (gfc_array_i4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -874,7 +874,7 @@ matmul_i4_avx128_fma4 (gfc_array_i4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_4)); /* Start turning the crank. */ i1 = n; @@ -1085,7 +1085,7 @@ matmul_i4_avx128_fma4 (gfc_array_i4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmulavx128_i8.c b/libgfortran/generated/matmulavx128_i8.c index 0c05a45..7132ad0 100644 --- a/libgfortran/generated/matmulavx128_i8.c +++ b/libgfortran/generated/matmulavx128_i8.c @@ -304,7 +304,7 @@ matmul_i8_avx128_fma3 (gfc_array_i8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_8)); /* Start turning the crank. */ i1 = n; @@ -515,7 +515,7 @@ matmul_i8_avx128_fma3 (gfc_array_i8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -874,7 +874,7 @@ matmul_i8_avx128_fma4 (gfc_array_i8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_INTEGER_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_INTEGER_8)); /* Start turning the crank. */ i1 = n; @@ -1085,7 +1085,7 @@ matmul_i8_avx128_fma4 (gfc_array_i8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmulavx128_r10.c b/libgfortran/generated/matmulavx128_r10.c index 647893e..6802f3b 100644 --- a/libgfortran/generated/matmulavx128_r10.c +++ b/libgfortran/generated/matmulavx128_r10.c @@ -304,7 +304,7 @@ matmul_r10_avx128_fma3 (gfc_array_r10 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_10)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_10)); /* Start turning the crank. */ i1 = n; @@ -515,7 +515,7 @@ matmul_r10_avx128_fma3 (gfc_array_r10 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -874,7 +874,7 @@ matmul_r10_avx128_fma4 (gfc_array_r10 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_10)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_10)); /* Start turning the crank. */ i1 = n; @@ -1085,7 +1085,7 @@ matmul_r10_avx128_fma4 (gfc_array_r10 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmulavx128_r16.c b/libgfortran/generated/matmulavx128_r16.c index 50a1aa8..ada6af1 100644 --- a/libgfortran/generated/matmulavx128_r16.c +++ b/libgfortran/generated/matmulavx128_r16.c @@ -304,7 +304,7 @@ matmul_r16_avx128_fma3 (gfc_array_r16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_16)); /* Start turning the crank. */ i1 = n; @@ -515,7 +515,7 @@ matmul_r16_avx128_fma3 (gfc_array_r16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -874,7 +874,7 @@ matmul_r16_avx128_fma4 (gfc_array_r16 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_16)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_16)); /* Start turning the crank. */ i1 = n; @@ -1085,7 +1085,7 @@ matmul_r16_avx128_fma4 (gfc_array_r16 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmulavx128_r17.c b/libgfortran/generated/matmulavx128_r17.c index a3a0480..82436f1 100644 --- a/libgfortran/generated/matmulavx128_r17.c +++ b/libgfortran/generated/matmulavx128_r17.c @@ -304,7 +304,7 @@ matmul_r17_avx128_fma3 (gfc_array_r17 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_17)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_17)); /* Start turning the crank. */ i1 = n; @@ -515,7 +515,7 @@ matmul_r17_avx128_fma3 (gfc_array_r17 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -874,7 +874,7 @@ matmul_r17_avx128_fma4 (gfc_array_r17 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_17)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_17)); /* Start turning the crank. */ i1 = n; @@ -1085,7 +1085,7 @@ matmul_r17_avx128_fma4 (gfc_array_r17 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmulavx128_r4.c b/libgfortran/generated/matmulavx128_r4.c index 03ba3db..d8731b4 100644 --- a/libgfortran/generated/matmulavx128_r4.c +++ b/libgfortran/generated/matmulavx128_r4.c @@ -304,7 +304,7 @@ matmul_r4_avx128_fma3 (gfc_array_r4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_4)); /* Start turning the crank. */ i1 = n; @@ -515,7 +515,7 @@ matmul_r4_avx128_fma3 (gfc_array_r4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -874,7 +874,7 @@ matmul_r4_avx128_fma4 (gfc_array_r4 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_4)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_4)); /* Start turning the crank. */ i1 = n; @@ -1085,7 +1085,7 @@ matmul_r4_avx128_fma4 (gfc_array_r4 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/generated/matmulavx128_r8.c b/libgfortran/generated/matmulavx128_r8.c index 2f2fbf9..db4a383 100644 --- a/libgfortran/generated/matmulavx128_r8.c +++ b/libgfortran/generated/matmulavx128_r8.c @@ -304,7 +304,7 @@ matmul_r8_avx128_fma3 (gfc_array_r8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_8)); /* Start turning the crank. */ i1 = n; @@ -515,7 +515,7 @@ matmul_r8_avx128_fma3 (gfc_array_r8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) @@ -874,7 +874,7 @@ matmul_r8_avx128_fma4 (gfc_array_r8 * const restrict retarray, if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof(GFC_REAL_8)); + t1 = xmalloc (t1_dim * sizeof(GFC_REAL_8)); /* Start turning the crank. */ i1 = n; @@ -1085,7 +1085,7 @@ matmul_r8_avx128_fma4 (gfc_array_r8 * const restrict retarray, } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/intrinsics/access.c b/libgfortran/intrinsics/access.c index 245be8c..cada2b5 100644 --- a/libgfortran/intrinsics/access.c +++ b/libgfortran/intrinsics/access.c @@ -78,7 +78,7 @@ access_func (char *name, char *mode, gfc_charlen_type name_len, /* And make the call to access(). */ int res = (access (path, m) == 0 ? 0 : errno); - free (path); + xfree (path); return res; } #endif diff --git a/libgfortran/intrinsics/chdir.c b/libgfortran/intrinsics/chdir.c index 6321633..27e304c 100644 --- a/libgfortran/intrinsics/chdir.c +++ b/libgfortran/intrinsics/chdir.c @@ -46,7 +46,7 @@ chdir_i4_sub (char *dir, GFC_INTEGER_4 *status, gfc_charlen_type dir_len) char *str = fc_strdup (dir, dir_len); val = chdir (str); - free (str); + xfree (str); if (status != NULL) *status = (val == 0) ? 0 : errno; @@ -63,7 +63,7 @@ chdir_i8_sub (char *dir, GFC_INTEGER_8 *status, gfc_charlen_type dir_len) char *str = fc_strdup (dir, dir_len); val = chdir (str); - free (str); + xfree (str); if (status != NULL) *status = (val == 0) ? 0 : errno; diff --git a/libgfortran/intrinsics/chmod.c b/libgfortran/intrinsics/chmod.c index 76f82b8..a8b15d4 100644 --- a/libgfortran/intrinsics/chmod.c +++ b/libgfortran/intrinsics/chmod.c @@ -487,7 +487,7 @@ chmod_func (char *name, char *mode, gfc_charlen_type name_len, { char *cname = fc_strdup (name, name_len); int ret = chmod_internal (cname, mode, mode_len); - free (cname); + xfree (cname); return ret; } diff --git a/libgfortran/intrinsics/date_and_time.c b/libgfortran/intrinsics/date_and_time.c index c847d8a..b07dd13 100644 --- a/libgfortran/intrinsics/date_and_time.c +++ b/libgfortran/intrinsics/date_and_time.c @@ -289,7 +289,7 @@ secnds (GFC_REAL_4 *x) date_and_time (NULL, NULL, NULL, avalues, 0, 0, 0); - free (avalues); + xfree (avalues); temp1 = 3600.0 * (GFC_REAL_4)values[4] + 60.0 * (GFC_REAL_4)values[5] + diff --git a/libgfortran/intrinsics/env.c b/libgfortran/intrinsics/env.c index e09c73c..ac82f23 100644 --- a/libgfortran/intrinsics/env.c +++ b/libgfortran/intrinsics/env.c @@ -55,7 +55,7 @@ PREFIX(getenv) (char * name, char * value, gfc_charlen_type name_len, res = getenv(name_nt); - free (name_nt); + xfree (name_nt); /* If res is NULL, it means that the environment variable didn't exist, so just return. */ @@ -121,7 +121,7 @@ get_environment_variable_i4 (char *name, char *value, GFC_INTEGER_4 *length, res = getenv(name_nt); - free (name_nt); + xfree (name_nt); if (res == NULL) stat = GFC_NAME_DOES_NOT_EXIST; diff --git a/libgfortran/intrinsics/execute_command_line.c b/libgfortran/intrinsics/execute_command_line.c index 1fac10a..21a215c 100644 --- a/libgfortran/intrinsics/execute_command_line.c +++ b/libgfortran/intrinsics/execute_command_line.c @@ -162,7 +162,7 @@ execute_command_line (const char *command, bool wait, int *exitstat, } } - free (cmd); + xfree (cmd); /* Now copy back to the Fortran string if needed. */ if (cmdstat && *cmdstat > EXEC_NOERROR && cmdmsg) diff --git a/libgfortran/intrinsics/getcwd.c b/libgfortran/intrinsics/getcwd.c index 907e8aa..0cea7a2 100644 --- a/libgfortran/intrinsics/getcwd.c +++ b/libgfortran/intrinsics/getcwd.c @@ -61,7 +61,7 @@ getcwd_i4_sub (char *cwd, GFC_INTEGER_4 *status, gfc_charlen_type cwd_len) } else err = errno; - free (buf); + xfree (buf); } else err = errno; diff --git a/libgfortran/intrinsics/getlog.c b/libgfortran/intrinsics/getlog.c index 7255e0f..6df6c0c 100644 --- a/libgfortran/intrinsics/getlog.c +++ b/libgfortran/intrinsics/getlog.c @@ -113,7 +113,7 @@ PREFIX(getlog) (char * login, gfc_charlen_type login_len) cleanup: #if defined (HAVE_POSIX_GETPWUID_R) && defined(HAVE_GETEUID) - free (buf); + xfree (buf); #else ; #endif diff --git a/libgfortran/intrinsics/link.c b/libgfortran/intrinsics/link.c index c8c24ba..7c8055b 100644 --- a/libgfortran/intrinsics/link.c +++ b/libgfortran/intrinsics/link.c @@ -50,8 +50,8 @@ link_internal (char *path1, char *path2, gfc_charlen_type path1_len, val = link (str1, str2); - free (str1); - free (str2); + xfree (str1); + xfree (str2); return ((val == 0) ? 0 : errno); } diff --git a/libgfortran/intrinsics/move_alloc.c b/libgfortran/intrinsics/move_alloc.c index 7772398..995fee2 100644 --- a/libgfortran/intrinsics/move_alloc.c +++ b/libgfortran/intrinsics/move_alloc.c @@ -34,7 +34,7 @@ move_alloc (gfc_array_char * from, gfc_array_char * to) { int i; - free (to->base_addr); + xfree (to->base_addr); for (i = 0; i < GFC_DESCRIPTOR_RANK (from); i++) { diff --git a/libgfortran/intrinsics/perror.c b/libgfortran/intrinsics/perror.c index 561349d..d7f273f 100644 --- a/libgfortran/intrinsics/perror.c +++ b/libgfortran/intrinsics/perror.c @@ -38,6 +38,6 @@ perror_sub (char *string, gfc_charlen_type string_len) { char *str = fc_strdup (string, string_len); perror (str); - free (str); + xfree (str); } iexport(perror_sub); diff --git a/libgfortran/intrinsics/random.c b/libgfortran/intrinsics/random.c index b5732e6..b1faeaf 100644 --- a/libgfortran/intrinsics/random.c +++ b/libgfortran/intrinsics/random.c @@ -1039,7 +1039,7 @@ constructor_random (void) __GTHREAD_MUTEX_INIT_FUNCTION (&random_lock); #endif if (__gthread_active_p ()) - __gthread_key_create (&rand_state_key, &free); + __gthread_key_create (&rand_state_key, &xfree); } #endif diff --git a/libgfortran/intrinsics/rename.c b/libgfortran/intrinsics/rename.c index b33f045..0f55136 100644 --- a/libgfortran/intrinsics/rename.c +++ b/libgfortran/intrinsics/rename.c @@ -35,8 +35,8 @@ rename_internal (char *path1, char *path2, gfc_charlen_type path1_len, char *str1 = fc_strdup (path1, path1_len); char *str2 = fc_strdup (path2, path2_len); int val = rename (str1, str2); - free (str1); - free (str2); + xfree (str1); + xfree (str2); return ((val == 0) ? 0 : errno); } diff --git a/libgfortran/intrinsics/stat.c b/libgfortran/intrinsics/stat.c index b771ee7..8c23bf5 100644 --- a/libgfortran/intrinsics/stat.c +++ b/libgfortran/intrinsics/stat.c @@ -76,7 +76,7 @@ stat_i4_sub_0 (char *name, gfc_array_i4 *sarray, GFC_INTEGER_4 *status, #endif val = stat(str, &sb); - free (str); + xfree (str); if (val == 0) { @@ -193,7 +193,7 @@ stat_i8_sub_0 (char *name, gfc_array_i8 *sarray, GFC_INTEGER_8 *status, #endif val = stat(str, &sb); - free (str); + xfree (str); if (val == 0) { diff --git a/libgfortran/intrinsics/symlnk.c b/libgfortran/intrinsics/symlnk.c index db36aad..5f75f9b 100644 --- a/libgfortran/intrinsics/symlnk.c +++ b/libgfortran/intrinsics/symlnk.c @@ -43,8 +43,8 @@ symlnk_internal (char *path1, char *path2, gfc_charlen_type path1_len, char *str1 = fc_strdup (path1, path1_len); char *str2 = fc_strdup (path2, path2_len); int val = symlink (str1, str2); - free (str1); - free (str2); + xfree (str1); + xfree (str2); return ((val == 0) ? 0 : errno); } diff --git a/libgfortran/intrinsics/system.c b/libgfortran/intrinsics/system.c index 34fef81..a73f46b 100644 --- a/libgfortran/intrinsics/system.c +++ b/libgfortran/intrinsics/system.c @@ -39,7 +39,7 @@ system_sub (const char *fcmd, GFC_INTEGER_4 *status, gfc_charlen_type cmd_len) flush_all_units(); stat = system (cmd); - free (cmd); + xfree (cmd); if (status) *status = stat; } diff --git a/libgfortran/intrinsics/unlink.c b/libgfortran/intrinsics/unlink.c index d236f370..49be2c9 100644 --- a/libgfortran/intrinsics/unlink.c +++ b/libgfortran/intrinsics/unlink.c @@ -50,7 +50,7 @@ unlink_i4_sub (char *name, GFC_INTEGER_4 *status, gfc_charlen_type name_len) stat = unlink (str); - free (str); + xfree (str); if (status != NULL) *status = (stat == 0) ? stat : errno; diff --git a/libgfortran/io/async.c b/libgfortran/io/async.c index 912b39e..9cedf61 100644 --- a/libgfortran/io/async.c +++ b/libgfortran/io/async.c @@ -72,7 +72,7 @@ update_pdt (st_parameter_dt **old, st_parameter_dt *new) { temp = *old; *old = new; if (temp) - free (temp); + xfree (temp); } /* Destroy an adv_cond structure. */ @@ -107,7 +107,7 @@ async_io (void *arg) while (ctq) { if (prev) - free (prev); + xfree (prev); prev = ctq; if (!au->error.has_error) { @@ -150,7 +150,7 @@ async_io (void *arg) transfer_array_inner (au->pdt, ctq->arg.array.desc, ctq->arg.array.kind, ctq->arg.array.charlen); - free (ctq->arg.array.desc); + xfree (ctq->arg.array.desc); break; case AIO_CLOSE: @@ -195,7 +195,7 @@ async_io (void *arg) au->head = NULL; au->empty = 1; SIGNAL (&au->emptysignal); - free (ctq); + xfree (ctq); UNLOCK (&au->lock); return NULL; } @@ -212,7 +212,7 @@ free_async_unit (async_unit *au) destroy_adv_cond (&au->emptysignal); destroy_adv_cond (&au->id.done); T_ERROR (__gthread_mutex_destroy, &au->lock); - free (au); + xfree (au); } /* Initialize an adv_cond structure. */ @@ -264,7 +264,7 @@ init_async_unit (gfc_unit *u) void enqueue_transfer (async_unit *au, transfer_args *arg, enum aio_do type) { - transfer_queue *tq = calloc (sizeof (transfer_queue), 1); + transfer_queue *tq = xcalloc (sizeof (transfer_queue), 1); tq->arg = *arg; tq->type = type; tq->has_id = 0; @@ -286,7 +286,7 @@ int enqueue_done_id (async_unit *au, enum aio_do type) { int ret; - transfer_queue *tq = calloc (sizeof (transfer_queue), 1); + transfer_queue *tq = xcalloc (sizeof (transfer_queue), 1); tq->type = type; tq->has_id = 1; @@ -310,7 +310,7 @@ enqueue_done_id (async_unit *au, enum aio_do type) void enqueue_done (async_unit *au, enum aio_do type) { - transfer_queue *tq = calloc (sizeof (transfer_queue), 1); + transfer_queue *tq = xcalloc (sizeof (transfer_queue), 1); tq->type = type; tq->has_id = 0; LOCK (&au->lock); @@ -330,7 +330,7 @@ enqueue_done (async_unit *au, enum aio_do type) void enqueue_close (async_unit *au) { - transfer_queue *tq = calloc (sizeof (transfer_queue), 1); + transfer_queue *tq = xcalloc (sizeof (transfer_queue), 1); tq->type = AIO_CLOSE; LOCK (&au->lock); diff --git a/libgfortran/io/async.h b/libgfortran/io/async.h index efd542a..9ad919d 100644 --- a/libgfortran/io/async.h +++ b/libgfortran/io/async.h @@ -138,7 +138,7 @@ #define MUTEX_DEBUG_ADD(mutex) do { \ aio_lock_debug *n; \ - n = malloc (sizeof(aio_lock_debug)); \ + n = xmalloc (sizeof(aio_lock_debug)); \ n->prev = TAIL_DEBUG_QUEUE; \ if (n->prev) \ n->prev->next = n; \ @@ -169,7 +169,7 @@ if (curr == aio_debug_head) \ aio_debug_head = NULL; \ } \ - free (curr); \ + xfree (curr); \ } \ INTERN_UNLOCK (&debug_queue_lock); \ INTERN_UNLOCK (mutex); \ diff --git a/libgfortran/io/close.c b/libgfortran/io/close.c index 4697ed9..600f886 100644 --- a/libgfortran/io/close.c +++ b/libgfortran/io/close.c @@ -92,7 +92,7 @@ st_close (st_parameter_close *clp) generate_error (&clp->common, LIBERROR_BAD_OPTION, "Can't KEEP a scratch file on CLOSE"); #if !HAVE_UNLINK_OPEN_FILE - path = strdup (u->filename); + path = xstrdup (u->filename); #endif } else @@ -110,7 +110,7 @@ st_close (st_parameter_close *clp) generate_error (&clp->common, LIBERROR_OS, "File cannot be deleted"); #else - path = strdup (u->filename); + path = xstrdup (u->filename); #endif } } @@ -124,7 +124,7 @@ st_close (st_parameter_close *clp) if (remove (path)) generate_error (&clp->common, LIBERROR_OS, "File cannot be deleted"); - free (path); + xfree (path); } #endif } diff --git a/libgfortran/io/fbuf.c b/libgfortran/io/fbuf.c index 761c0f1..34c31a8 100644 --- a/libgfortran/io/fbuf.c +++ b/libgfortran/io/fbuf.c @@ -50,8 +50,8 @@ fbuf_destroy (gfc_unit *u) { if (u->fbuf == NULL) return; - free (u->fbuf->buf); - free (u->fbuf); + xfree (u->fbuf->buf); + xfree (u->fbuf); u->fbuf = NULL; } diff --git a/libgfortran/io/format.c b/libgfortran/io/format.c index 96d5141..5618601 100644 --- a/libgfortran/io/format.c +++ b/libgfortran/io/format.c @@ -65,7 +65,7 @@ free_format_hash_table (gfc_unit *u) if (u->format_hash_table[i].hashed_fmt != NULL) { free_format_data (u->format_hash_table[i].hashed_fmt); - free (u->format_hash_table[i].key); + xfree (u->format_hash_table[i].key); } u->format_hash_table[i].key = NULL; u->format_hash_table[i].key_len = 0; @@ -145,7 +145,7 @@ save_parsed_format (st_parameter_dt *dtp) free_format_data (u->format_hash_table[hash].hashed_fmt); u->format_hash_table[hash].hashed_fmt = NULL; - free (u->format_hash_table[hash].key); + xfree (u->format_hash_table[hash].key); u->format_hash_table[hash].key = dtp->format; u->format_hash_table[hash].key_len = dtp->format_len; @@ -247,7 +247,7 @@ free_format (st_parameter_dt *dtp) { if ((dtp->common.flags & IOPARM_DT_HAS_FORMAT) && dtp->format) { - free (dtp->format); + xfree (dtp->format); dtp->format = NULL; } } @@ -270,17 +270,17 @@ free_format_data (format_data *fmt) if (fnp->format == FMT_DT) { if (GFC_DESCRIPTOR_DATA(fnp->u.udf.vlist)) - free (GFC_DESCRIPTOR_DATA(fnp->u.udf.vlist)); - free (fnp->u.udf.vlist); + xfree (GFC_DESCRIPTOR_DATA(fnp->u.udf.vlist)); + xfree (fnp->u.udf.vlist); } for (fa = fmt->array.next; fa; fa = fa_next) { fa_next = fa->next; - free (fa); + xfree (fa); } - free (fmt); + xfree (fmt); fmt = NULL; } diff --git a/libgfortran/io/intrinsics.c b/libgfortran/io/intrinsics.c index 16c9e0a..86a79af 100644 --- a/libgfortran/io/intrinsics.c +++ b/libgfortran/io/intrinsics.c @@ -388,7 +388,7 @@ ttynam (char **name, gfc_charlen_type *name_len, int unit) unlock_unit (u); return; } - free (*name); + xfree (*name); unlock_unit (u); } diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index 5a5634c..cdc530c 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -136,7 +136,7 @@ free_saved (st_parameter_dt *dtp) if (dtp->u.p.saved_string == NULL) return; - free (dtp->u.p.saved_string); + xfree (dtp->u.p.saved_string); dtp->u.p.saved_string = NULL; dtp->u.p.saved_used = 0; @@ -154,7 +154,7 @@ free_line (st_parameter_dt *dtp) if (dtp->u.p.line_buffer == NULL) return; - free (dtp->u.p.line_buffer); + xfree (dtp->u.p.line_buffer); dtp->u.p.line_buffer = NULL; } @@ -2727,7 +2727,7 @@ nml_touch_nodes (namelist_info *nl) else break; } - free (ext_name); + xfree (ext_name); return; } @@ -3057,18 +3057,18 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info *nl, index_type offset, pprev_nl, nml_err_msg, nml_err_msg_size, clow, chigh)) { - free (obj_name); + xfree (obj_name); return false; } if (dtp->u.p.input_complete) { - free (obj_name); + xfree (obj_name); return true; } } - free (obj_name); + xfree (obj_name); goto incr_idx; default: @@ -3324,7 +3324,7 @@ get_name: nl = find_nml_node (dtp, ext_name); if (ext_size > EXT_STACK_SZ) - free (ext_name); + xfree (ext_name); } else nl = find_nml_node (dtp, dtp->u.p.saved_string); diff --git a/libgfortran/io/lock.c b/libgfortran/io/lock.c index dc22134..3972dbc 100644 --- a/libgfortran/io/lock.c +++ b/libgfortran/io/lock.c @@ -52,13 +52,13 @@ free_ionml (st_parameter_dt *dtp) { t2 = t1; t1 = t1->next; - free (t2->var_name); + xfree (t2->var_name); if (t2->var_rank) { - free (t2->dim); - free (t2->ls); + xfree (t2->dim); + xfree (t2->ls); } - free (t2); + xfree (t2); } } dtp->u.p.ionml = NULL; diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c index c9276c7..7eb111b 100644 --- a/libgfortran/io/open.c +++ b/libgfortran/io/open.c @@ -573,8 +573,8 @@ new_unit (st_parameter_open *opp, gfc_unit *u, unit_flags *flags) snprintf (msg, msglen, "Cannot open file '%s': %s", path, gf_strerror (errno, errbuf, sizeof (errbuf))); generate_error (&opp->common, LIBERROR_OS, msg); - free (msg); - free (path); + xfree (msg); + xfree (path); goto cleanup; } @@ -671,7 +671,7 @@ new_unit (st_parameter_open *opp, gfc_unit *u, unit_flags *flags) test_endfile (u); if (flags->status == STATUS_SCRATCH && opp->file != NULL) - free (opp->file); + xfree (opp->file); if (flags->form == FORM_FORMATTED) { @@ -696,7 +696,7 @@ new_unit (st_parameter_open *opp, gfc_unit *u, unit_flags *flags) /* Free memory associated with a temporary filename. */ if (flags->status == STATUS_SCRATCH && opp->file != NULL) - free (opp->file); + xfree (opp->file); fail: @@ -736,7 +736,7 @@ already_open (st_parameter_open *opp, gfc_unit *u, unit_flags *flags) if (u->filename && u->flags.status == STATUS_SCRATCH) remove (u->filename); #endif - free (u->filename); + xfree (u->filename); u->filename = NULL; u = new_unit (opp, u, flags); diff --git a/libgfortran/io/read.c b/libgfortran/io/read.c index 21e7851..582e40d 100644 --- a/libgfortran/io/read.c +++ b/libgfortran/io/read.c @@ -1037,7 +1037,7 @@ read_f (st_parameter_dt *dtp, const fnode *f, char *dest, int length) convert_infnan (dtp, dest, buffer, length); if (buf_size > READF_TMP) - free (buffer); + xfree (buffer); return; } @@ -1231,7 +1231,7 @@ done: /* Do the actual conversion. */ convert_real (dtp, dest, buffer, length); if (buf_size > READF_TMP) - free (buffer); + xfree (buffer); return; /* The value read is zero. */ @@ -1271,7 +1271,7 @@ zero: bad_float: if (buf_size > READF_TMP) - free (buffer); + xfree (buffer); generate_error (&dtp->common, LIBERROR_READ_VALUE, "Bad value during floating point read"); next_record (dtp, 1); diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index f543dfd..11c79c8 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -1721,7 +1721,7 @@ formatted_transfer_scalar_read (st_parameter_dt *dtp, bt type, void *p, int kind dtp->u.p.current_unit->child_dtio--; if (f->u.udf.string_len != 0) - free (iotype); + xfree (iotype); /* Note: vlist is freed in free_format_data. */ break; @@ -2193,7 +2193,7 @@ formatted_transfer_scalar_write (st_parameter_dt *dtp, bt type, void *p, int kin dtp->u.p.current_unit->child_dtio--; if (f->u.udf.string_len != 0) - free (iotype); + xfree (iotype); /* Note: vlist is freed in free_format_data. */ break; @@ -4296,8 +4296,8 @@ finalize_transfer (st_parameter_dt *dtp) { if (cf & IOPARM_DT_HAS_FORMAT) { - free (dtp->u.p.fmt); - free (dtp->format); + xfree (dtp->u.p.fmt); + xfree (dtp->format); } return; } @@ -4496,10 +4496,10 @@ st_read_done_worker (st_parameter_dt *dtp, bool unlock) { if ((dtp->common.flags & IOPARM_DT_HAS_UDTIO) == 0) { - free (dtp->u.p.current_unit->filename); + xfree (dtp->u.p.current_unit->filename); dtp->u.p.current_unit->filename = NULL; if (dtp->u.p.current_unit->ls) - free (dtp->u.p.current_unit->ls); + xfree (dtp->u.p.current_unit->ls); dtp->u.p.current_unit->ls = NULL; } free_newunit = true; @@ -4593,10 +4593,10 @@ st_write_done_worker (st_parameter_dt *dtp, bool unlock) { if ((dtp->common.flags & IOPARM_DT_HAS_UDTIO) == 0) { - free (dtp->u.p.current_unit->filename); + xfree (dtp->u.p.current_unit->filename); dtp->u.p.current_unit->filename = NULL; if (dtp->u.p.current_unit->ls) - free (dtp->u.p.current_unit->ls); + xfree (dtp->u.p.current_unit->ls); dtp->u.p.current_unit->ls = NULL; } free_newunit = true; diff --git a/libgfortran/io/unit.c b/libgfortran/io/unit.c index 4d32e36..4d6c30b 100644 --- a/libgfortran/io/unit.c +++ b/libgfortran/io/unit.c @@ -254,7 +254,7 @@ static void destroy_unit_mutex (gfc_unit *u) { __gthread_mutex_destroy (&u->lock); - free (u); + xfree (u); } @@ -638,7 +638,7 @@ init_units (void) u->recl = default_recl; u->endfile = NO_ENDFILE; - u->filename = strdup (stdin_name); + u->filename = xstrdup (stdin_name); fbuf_init (u, 0); @@ -669,7 +669,7 @@ init_units (void) u->recl = default_recl; u->endfile = AT_ENDFILE; - u->filename = strdup (stdout_name); + u->filename = xstrdup (stdout_name); fbuf_init (u, 0); @@ -699,7 +699,7 @@ init_units (void) u->recl = default_recl; u->endfile = AT_ENDFILE; - u->filename = strdup (stderr_name); + u->filename = xstrdup (stderr_name); fbuf_init (u, 256); /* 256 bytes should be enough, probably not doing any kind of exotic formatting to stderr. */ @@ -739,7 +739,7 @@ close_unit_1 (gfc_unit *u, int locked) delete_unit (u); - free (u->filename); + xfree (u->filename); u->filename = NULL; free_format_hash_table (u); @@ -800,7 +800,7 @@ close_units (void) close_unit_1 (unit_root, 1); UNLOCK (&unit_lock); - free (newunits); + xfree (newunits); #ifdef HAVE_POSIX_2008_LOCALE freelocale (c_locale); @@ -867,7 +867,7 @@ filename_from_unit (int n) /* Get the filename. */ if (u != NULL && u->filename != NULL) - return strdup (u->filename); + return xstrdup (u->filename); else return (char *) NULL; } diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index 616c1aa..d69e9ee 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -485,7 +485,7 @@ raw_close (unix_stream *s) } else retval = 0; - free (s); + xfree (s); return retval; } @@ -750,7 +750,7 @@ buf_close (unix_stream *s) { if (buf_flush (s) != 0) return -1; - free (s->buffer); + xfree (s->buffer); return raw_close (s); } @@ -1029,7 +1029,7 @@ static int mem_close (unix_stream *s) { if (s) - free (s); + xfree (s); return 0; } @@ -1316,7 +1316,7 @@ tempfile (st_parameter_open *opp) buffer[0] = 0; else buffer[ret] = 0; - tempdir = strdup (buffer); + tempdir = xstrdup (buffer); fd = tempfile_open (tempdir, &fname); } #elif defined(__CYGWIN__) @@ -1550,7 +1550,7 @@ regular_file (st_parameter_open *opp, unit_flags *flags) { char *path = fc_strdup (opp->file, opp->file_len); int fd = regular_file2 (path, opp, flags); - free (path); + xfree (path); return fd; } @@ -1692,7 +1692,7 @@ compare_file_filename (gfc_unit *u, const char *name, gfc_charlen_type len) ret = 0; #endif done: - free (path); + xfree (path); return ret; } @@ -1798,14 +1798,14 @@ retry: LOCK (&unit_lock); UNLOCK (&u->lock); if (predec_waiting_locked (u) == 0) - free (u); + xfree (u); goto retry; } dec_waiting_unlocked (u); } done: - free (path); + xfree (path); return u; } @@ -1865,7 +1865,7 @@ flush_all_units (void) LOCK (&unit_lock); UNLOCK (&u->lock); if (predec_waiting_locked (u) == 0) - free (u); + xfree (u); } } while (1); @@ -1914,7 +1914,7 @@ file_exists (const char *file, gfc_charlen_type file_len) { char *path = fc_strdup (file, file_len); int res = !(access (path, F_OK)); - free (path); + xfree (path); return res; } @@ -1928,7 +1928,7 @@ file_size (const char *file, gfc_charlen_type file_len) struct stat statbuf; int err; TEMP_FAILURE_RETRY (err = stat (path, &statbuf)); - free (path); + xfree (path); if (err == -1) return -1; return (GFC_IO_INT) statbuf.st_size; @@ -1951,7 +1951,7 @@ inquire_sequential (const char *string, gfc_charlen_type len) char *path = fc_strdup (string, len); int err; TEMP_FAILURE_RETRY (err = stat (path, &statbuf)); - free (path); + xfree (path); if (err == -1) return unknown; @@ -1980,7 +1980,7 @@ inquire_direct (const char *string, gfc_charlen_type len) char *path = fc_strdup (string, len); int err; TEMP_FAILURE_RETRY (err = stat (path, &statbuf)); - free (path); + xfree (path); if (err == -1) return unknown; @@ -2009,7 +2009,7 @@ inquire_formatted (const char *string, gfc_charlen_type len) char *path = fc_strdup (string, len); int err; TEMP_FAILURE_RETRY (err = stat (path, &statbuf)); - free (path); + xfree (path); if (err == -1) return unknown; @@ -2045,7 +2045,7 @@ inquire_access (const char *string, gfc_charlen_type len, int mode) return no; char *path = fc_strdup (string, len); int res = access (path, mode); - free (path); + xfree (path); if (res == -1) return no; diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index 5e025a1..d0a29c6 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -1636,9 +1636,9 @@ write_float_0 (st_parameter_dt *dtp, const fnode *f, const char *source, int kin write_float_string (dtp, result, flt_str_len); if (buf_size > BUF_STACK_SZ) - free (buffer); + xfree (buffer); if (res_len > BUF_STACK_SZ) - free (result); + xfree (result); } void @@ -1763,9 +1763,9 @@ write_real (st_parameter_dt *dtp, const char *source, int kind) dtp->u.p.scale_factor = orig_scale; if (buf_size > BUF_STACK_SZ) - free (buffer); + xfree (buffer); if (res_len > BUF_STACK_SZ) - free (result); + xfree (result); } /* Similar to list formatted REAL output, for kPG0 where k > 0 we @@ -1818,9 +1818,9 @@ write_real_w0 (st_parameter_dt *dtp, const char *source, int kind, dtp->u.p.g0_no_blanks = 0; if (buf_size > BUF_STACK_SZ) - free (buffer); + xfree (buffer); if (res_len > BUF_STACK_SZ) - free (result); + xfree (result); } @@ -1879,11 +1879,11 @@ write_complex (st_parameter_dt *dtp, const char *source, int kind, size_t size) dtp->u.p.scale_factor = orig_scale; dtp->u.p.g0_no_blanks = 0; if (buf_size > BUF_STACK_SZ) - free (buffer); + xfree (buffer); if (res_len1 > BUF_STACK_SZ) - free (result1); + xfree (result1); if (res_len2 > BUF_STACK_SZ) - free (result2); + xfree (result2); } @@ -2384,8 +2384,8 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info *obj, index_type offset, obj, ext_name); } - free (obj_name); - free (ext_name); + xfree (obj_name); + xfree (ext_name); goto obj_loop; default: diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index 4329d4c..0b893a5 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -871,6 +871,9 @@ internal_proto(xcalloc); extern void *xrealloc (void *, size_t); internal_proto(xrealloc); +extern void xfree (void *); +internal_proto(xfree); + /* environ.c */ extern void init_variables (void); @@ -919,6 +922,9 @@ internal_proto(fc_strdup); extern char *fc_strdup_notrim(const char *, gfc_charlen_type); internal_proto(fc_strdup_notrim); +extern char *xstrdup(const char *); +internal_proto(xstrdup); + extern const char *gfc_itoa(GFC_UINTEGER_LARGEST, char *, size_t); internal_proto(gfc_itoa); diff --git a/libgfortran/m4/matmul_internal.m4 b/libgfortran/m4/matmul_internal.m4 index 0e96207..eadeea3 100644 --- a/libgfortran/m4/matmul_internal.m4 +++ b/libgfortran/m4/matmul_internal.m4 @@ -255,7 +255,7 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl if (t1_dim > 65536) t1_dim = 65536; - t1 = malloc (t1_dim * sizeof('rtype_name`)); + t1 = xmalloc (t1_dim * sizeof('rtype_name`)); /* Start turning the crank. */ i1 = n; @@ -466,7 +466,7 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl } } } - free(t1); + xfree (t1); return; } else if (rxstride == 1 && aystride == 1 && bxstride == 1) diff --git a/libgfortran/runtime/ISO_Fortran_binding.c b/libgfortran/runtime/ISO_Fortran_binding.c index 342df42..ab1a9fa 100644 --- a/libgfortran/runtime/ISO_Fortran_binding.c +++ b/libgfortran/runtime/ISO_Fortran_binding.c @@ -137,7 +137,7 @@ gfc_desc_to_cfi_desc (CFI_cdesc_t **d_ptr, const gfc_array_void *s) by setting the length to CFI_MAX_RANK. This should not be necessary but valgrind complains accesses after the allocated block. */ if (*d_ptr == NULL) - d = calloc (1, (sizeof (CFI_cdesc_t) + d = xcalloc (1, (sizeof (CFI_cdesc_t) + (CFI_type_t)(CFI_MAX_RANK * sizeof (CFI_dim_t)))); else d = *d_ptr; @@ -378,7 +378,7 @@ CFI_allocate (CFI_cdesc_t *dv, const CFI_index_t lower_bounds[], } } - dv->base_addr = calloc (arr_len, dv->elem_len); + dv->base_addr = xcalloc (arr_len, dv->elem_len); if (dv->base_addr == NULL) { fprintf (stderr, "CFI_allocate: Failure in memory allocation.\n"); @@ -418,7 +418,7 @@ CFI_deallocate (CFI_cdesc_t *dv) } /* Free and nullify memory. */ - free (dv->base_addr); + xfree (dv->base_addr); dv->base_addr = NULL; return CFI_SUCCESS; diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c index 8366cb9..80e5ebe 100644 --- a/libgfortran/runtime/error.c +++ b/libgfortran/runtime/error.c @@ -285,7 +285,7 @@ show_locus (st_parameter_common *cmp) { st_printf ("At line %d of file %s (unit = %d, file = '%s')\n", (int) cmp->line, cmp->filename, (int) cmp->unit, filename); - free (filename); + xfree (filename); } else { @@ -334,7 +334,7 @@ static void __attribute__((constructor)) constructor_recursion_check (void) { if (__gthread_active_p ()) - __gthread_key_create (&recursion_key, &free); + __gthread_key_create (&recursion_key, &xfree); } static void __attribute__((destructor)) diff --git a/libgfortran/runtime/memory.c b/libgfortran/runtime/memory.c index fd177a2..cbcec7c 100644 --- a/libgfortran/runtime/memory.c +++ b/libgfortran/runtime/memory.c @@ -43,7 +43,6 @@ xmalloc (size_t n) return p; } - void * xmallocarray (size_t nmemb, size_t size) { @@ -66,7 +65,6 @@ xmallocarray (size_t nmemb, size_t size) return p; } - /* calloc wrapper that aborts on error. */ void * @@ -82,7 +80,6 @@ xcalloc (size_t nmemb, size_t size) return p; } - void * xrealloc (void *ptr, size_t size) { @@ -95,3 +92,9 @@ xrealloc (void *ptr, size_t size) return newp; } + +void +xfree (void *ptr) +{ + free (ptr); +} diff --git a/libgfortran/runtime/minimal.c b/libgfortran/runtime/minimal.c index 326ff82..2dc4814 100644 --- a/libgfortran/runtime/minimal.c +++ b/libgfortran/runtime/minimal.c @@ -169,7 +169,7 @@ show_locus (st_parameter_common *cmp) { st_printf ("At line %d of file %s (unit = %d, file = '%s')\n", (int) cmp->line, cmp->filename, (int) cmp->unit, filename); - free (filename); + xfree (filename); } else { diff --git a/libgfortran/runtime/string.c b/libgfortran/runtime/string.c index 88bda76..73b2a14 100644 --- a/libgfortran/runtime/string.c +++ b/libgfortran/runtime/string.c @@ -106,20 +106,29 @@ strnlen (const char *s, size_t maxlen) #endif -#ifndef HAVE_STRNDUP static char * -strndup (const char *s, size_t n) +fc_strndup (const char *s, size_t n) { size_t len = strnlen (s, n); - char *p = malloc (len + 1); + char *p = xmalloc (len + 1); if (!p) return NULL; memcpy (p, s, len); p[len] = '\0'; return p; } -#endif +char * +xstrdup (const char *src) +{ + size_t len = strlen (src) + 1; + void *new = xmalloc (len); + + if (new == NULL) + return NULL; + + return (char *) memcpy (new, src, len); +} /* Duplicate a non-null-terminated Fortran string to a malloced null-terminated C string. */ @@ -128,7 +137,7 @@ char * fc_strdup (const char *src, gfc_charlen_type src_len) { gfc_charlen_type n = fstrlen (src, src_len); - char *p = strndup (src, n); + char *p = fc_strndup (src, n); if (!p) os_error ("Memory allocation failed in fc_strdup"); return p; @@ -142,7 +151,7 @@ fc_strdup (const char *src, gfc_charlen_type src_len) char * fc_strdup_notrim (const char *src, gfc_charlen_type src_len) { - char *p = strndup (src, src_len); + char *p = fc_strndup (src, src_len); if (!p) os_error ("Memory allocation failed in fc_strdup"); return p;