From patchwork Thu Feb 22 16:14:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janne Blomqvist X-Patchwork-Id: 876764 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-473719-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="vLka5ouy"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3znKFQ4Mfpz9sVw for ; Fri, 23 Feb 2018 03:15:05 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=k4V2RDfzxw1c MT/Jz6RiigIbeVz2tTF3f5hEr/raB7aZ9n/MnHs3nt/SzNeI3d1D2pIOULlJ+3aZ hIJJz3WdxbFjLTapdLwdcGU05rmIk6G2y/lm+86PkKPPmY8xTsXjvrUwcdECJ+SE YcBYxTiWntt+zWpbnYxp67vjXglRnQ4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=KDxllL9uwDSFlESUbG 3IT+k4vcY=; b=vLka5ouyF5Uj7R4LpVD7iZJw+Y0XFYYH0Pg9s9kp8IWH7qBs86 K6f6Dy+Iw9lZiYC5NsO//AxhtYZ0kZIzwUnZOCzPUHLbLTED1vfKCeZxWGGvBvZh HQVZfejk8An8aMB4eU75P+OPagvsyimqGQyyj5Hjzg+IRkJyyai4TP0vI= Received: (qmail 104942 invoked by alias); 22 Feb 2018 16:14:57 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 104838 invoked by uid 89); 22 Feb 2018 16:14:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, UNWANTED_LANGUAGE_BODY autolearn=ham version=3.3.2 spammy=Hx-languages-length:4141 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-lf0-f46.google.com Received: from mail-lf0-f46.google.com (HELO mail-lf0-f46.google.com) (209.85.215.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Feb 2018 16:14:52 +0000 Received: by mail-lf0-f46.google.com with SMTP id y19so8180055lfd.4; Thu, 22 Feb 2018 08:14:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Iy8SgxB9dUTuv0z5+b/YJGEXfKb33N1gInIY2eUA7+Q=; b=gWpZR2hEGs2nCqoP8x1k/G6lydnAi8EHVs8uujxFi9oSEret+Skr8H+hAkWJLdC5Sp eub1q9jzAEk9bFUhR1FHJj4J+uRtlBwH/fFBsS5a5tLjml55OBRCqRP0X9OKAgjZ9UZr Rn1WV+wr8E+pl8qq1ZF6hNDy1DsPF5nhpWZPFyKPHNDzJ7R/j4CU6EjDVlUegzpz/PcY dqIOYEn5tP29M0nyiyrBsoDLiBInypm6QcKfY1JMuKvxf3Wb1tNIc5nc52wKlDhgDsYS LdZOfm1ax4br9EPaDiu+5rxdx2hCm1Wn6eydnXzTGXfa8HKWyEEhUBTaZ5Hmm8yue+QE Lhmg== X-Gm-Message-State: APf1xPDhArNQ4Xkr1bR6RtYm4O+AAs5ANXbDXXd0Ppkb3Rs5iujJAPfD fpq9ZIVPTBgW6DRx5iXdaL77wg== X-Google-Smtp-Source: AH8x227d41IeuF+JxuEcND6Cs4CC+4z0jTno+ZAYoiA5pBsrdoPQ6VjecKnDQbJhfbutQ29JEKwzZA== X-Received: by 10.46.75.1 with SMTP id y1mr5213139lja.33.1519316089696; Thu, 22 Feb 2018 08:14:49 -0800 (PST) Received: from dt.lan (88-114-247-254.elisa-laajakaista.fi. [88.114.247.254]) by smtp.gmail.com with ESMTPSA id g26sm77700ljd.51.2018.02.22.08.14.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Feb 2018 08:14:48 -0800 (PST) From: Janne Blomqvist To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: Janne Blomqvist Subject: [PATCH] PR 78534, 84509 Fix libgfortran API for PAUSE statement Date: Thu, 22 Feb 2018 18:14:41 +0200 Message-Id: <1519316081-9994-1-git-send-email-blomqvist.janne@gmail.com> This patch changes the libgfortran API for the PAUSE statement. By passing a GFC_INTEGER_8 it handles -fdefault-integer-8, and for the character version passing the length as a size_t. Regtested on x86_64-pc-linux-gnu, committed as obvious. gcc/fortran/ChangeLog: 2018-02-22 Janne Blomqvist PR 78534 PR 84509 * trans-decl.c (gfc_build_builtin_function_decls): Pass gfc_int8_type node to pause_numeric, size_type_node to pause_string. * trans-stmt.c (gfc_trans_pause): Likewise. libgfortran/ChangeLog: 2018-02-22 Janne Blomqvist PR 78534 PR 84509 * runtime/pause.c (pause_numeric): Modify to take GFC_INTEGER_8 argument. (pause_string): Modify to take size_t character length argument. --- gcc/fortran/trans-decl.c | 6 +++--- gcc/fortran/trans-stmt.c | 9 +++++---- libgfortran/runtime/pause.c | 10 +++++----- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 63336b3..e8c10d4 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -3499,7 +3499,7 @@ gfc_build_intrinsic_function_decls (void) void gfc_build_builtin_function_decls (void) { - tree gfc_int4_type_node = gfc_get_int_type (4); + tree gfc_int8_type_node = gfc_get_int_type (8); gfor_fndecl_stop_numeric = gfc_build_library_function_decl ( get_identifier (PREFIX("stop_numeric")), @@ -3527,11 +3527,11 @@ gfc_build_builtin_function_decls (void) gfor_fndecl_pause_numeric = gfc_build_library_function_decl ( get_identifier (PREFIX("pause_numeric")), - void_type_node, 1, gfc_int4_type_node); + void_type_node, 1, gfc_int8_type_node); gfor_fndecl_pause_string = gfc_build_library_function_decl_with_spec ( get_identifier (PREFIX("pause_string")), ".R.", - void_type_node, 2, pchar_type_node, gfc_int4_type_node); + void_type_node, 2, pchar_type_node, size_type_node); gfor_fndecl_runtime_error = gfc_build_library_function_decl_with_spec ( get_identifier (PREFIX("runtime_error")), ".R", diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index e9e8456..f1fe8a0 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -578,7 +578,7 @@ gfc_trans_return (gfc_code * code) tree gfc_trans_pause (gfc_code * code) { - tree gfc_int4_type_node = gfc_get_int_type (4); + tree gfc_int8_type_node = gfc_get_int_type (8); gfc_se se; tree tmp; @@ -589,7 +589,7 @@ gfc_trans_pause (gfc_code * code) if (code->expr1 == NULL) { - tmp = build_int_cst (gfc_int4_type_node, 0); + tmp = build_int_cst (size_type_node, 0); tmp = build_call_expr_loc (input_location, gfor_fndecl_pause_string, 2, build_int_cst (pchar_type_node, 0), tmp); @@ -599,14 +599,15 @@ gfc_trans_pause (gfc_code * code) gfc_conv_expr (&se, code->expr1); tmp = build_call_expr_loc (input_location, gfor_fndecl_pause_numeric, 1, - fold_convert (gfc_int4_type_node, se.expr)); + fold_convert (gfc_int8_type_node, se.expr)); } else { gfc_conv_expr_reference (&se, code->expr1); tmp = build_call_expr_loc (input_location, gfor_fndecl_pause_string, 2, - se.expr, se.string_length); + se.expr, fold_convert (size_type_node, + se.string_length)); } gfc_add_expr_to_block (&se.pre, tmp); diff --git a/libgfortran/runtime/pause.c b/libgfortran/runtime/pause.c index 25690d8..3b4c17b 100644 --- a/libgfortran/runtime/pause.c +++ b/libgfortran/runtime/pause.c @@ -46,23 +46,23 @@ do_pause (void) /* A numeric PAUSE statement. */ -extern void pause_numeric (GFC_INTEGER_4); +extern void pause_numeric (GFC_INTEGER_8); export_proto(pause_numeric); void -pause_numeric (GFC_INTEGER_4 code) +pause_numeric (GFC_INTEGER_8 code) { - st_printf ("PAUSE %d\n", (int) code); + st_printf ("PAUSE %ld\n", (long) code); do_pause (); } /* A character string or blank PAUSE statement. */ -extern void pause_string (char *string, GFC_INTEGER_4 len); +extern void pause_string (char *string, size_t len); export_proto(pause_string); void -pause_string (char *string, GFC_INTEGER_4 len) +pause_string (char *string, size_t len) { estr_write ("PAUSE "); ssize_t w = write (STDERR_FILENO, string, len);