From patchwork Wed Sep 25 20:24:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Koenig X-Patchwork-Id: 1167600 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-509580-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=netcologne.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="IqCKIZLg"; dkim=pass (2048-bit key; unprotected) header.d=netcologne.de header.i=@netcologne.de header.b="YI8+lOhk"; 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 46dqLC1KxXz9sNw for ; Thu, 26 Sep 2019 06:25:04 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=rDzC9qVD9sFMgRA20rjA+mebBRuI4GaCjUCxn3oD9C+iCQwrQb PYsbSDq1qjMu7BwN4Mj8WgQzdcbsyzhRD4XqVc6R7DFvghfpLuueccDLqewYmuxl d15IQud0nWBTwupXhmwGYBeAnPaKgt4bK0kq8syQ0Om2CjBwGEkIpBP5o= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=3PcpmhdazD5h6aXk94hxhltrU94=; b=IqCKIZLgXAs4BTTZ3diP 54XaOh5HAnMxYVOUxfu05BauKDvftYGNCApnZoTLt+VRGRF6Kh69qrNsWrK+zv+w boX9397rYQoPENQkG9NbxyINos9EiD7etPm+zRnNAt9N7oasS+7qUKVSQJBjb7eN +sc0SnTEgwj9EC4MCkIKDHE= Received: (qmail 13250 invoked by alias); 25 Sep 2019 20:24: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 13236 invoked by uid 89); 25 Sep 2019 20:24:57 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=dan, transdeclc, UD:trans-decl.c, trans-decl.c X-HELO: cc-smtpout1.netcologne.de Received: from cc-smtpout1.netcologne.de (HELO cc-smtpout1.netcologne.de) (89.1.8.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 25 Sep 2019 20:24:55 +0000 Received: from cc-smtpin1.netcologne.de (cc-smtpin1.netcologne.de [89.1.8.201]) by cc-smtpout1.netcologne.de (Postfix) with ESMTP id AF94313445; Wed, 25 Sep 2019 22:24:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=netcologne.de; s=nc1116a; t=1569443092; bh=Q0oySxMR3q9Yyyv+cKAwemUQNatthBjIeVMBnMQ/OhM=; h=To:From:Subject:Message-ID:Date:From; b=YI8+lOhkymPDmKGsZfLOkzYFBjCGp7mtR3iW/iNMPj8464xfl8DMMYO6Tor+6ozPW 2NT1YJ97XrQDl++t2CTV1vBTF6I8WlnHo08BH9EuppauQbcy8+6nHMS6zSA7I8VxFD i3bBq3OORdgEj1Diqm+vswMvZqeIrZyspK5UXpayarRudu6TlLqJMfCsZU5H75q3QO O9Kc0S7Fo6TprgIW1xBw/yJHitmcfItaYok7AH7WLO47IVCy/+FFBsZ9aQF8f8Eic7 M1bFhh1BaQW8wZI7+rqannIZJ0nUWkTFnBwrJuXgqHCAgHwXHDyjepMpymHLIgrsfA gFhNdMRNQVaLw== Received: from localhost (localhost [127.0.0.1]) by cc-smtpin1.netcologne.de (Postfix) with ESMTP id A1D6B11EF7; Wed, 25 Sep 2019 22:24:52 +0200 (CEST) Received: from [2001:4dd7:c359:0:7285:c2ff:fe6c:992d] (helo=cc-smtpin1.netcologne.de) by localhost with ESMTP (eXpurgate 4.6.0) (envelope-from ) id 5d8bcd14-5e31-7f0000012729-7f000001e0b8-1 for ; Wed, 25 Sep 2019 22:24:52 +0200 Received: from [IPv6:2001:4dd7:c359:0:7285:c2ff:fe6c:992d] (2001-4dd7-c359-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de [IPv6:2001:4dd7:c359:0:7285:c2ff:fe6c:992d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by cc-smtpin1.netcologne.de (Postfix) with ESMTPSA; Wed, 25 Sep 2019 22:24:51 +0200 (CEST) To: "fortran@gcc.gnu.org" , gcc-patches From: Thomas Koenig Subject: [patch, fortran] PR 84487 Message-ID: <23849d2b-9339-95d8-8589-f9fdea4b8e9e@netcologne.de> Date: Wed, 25 Sep 2019 22:24:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 Hello world, this patch makes sure that the __def_init variables, which have been generated for normal allocatable arrays for quite some time, do not fill up huge amounts of space in the object files with zeros. This is done by not marking them read-only, which means that they are put into the BSS. Setting DECL_ARTIFICIAL on the __def_init variable makes sure it is handled as predetermined shared in gfc_omp_predetermined_sharing . This is not an optimum solution. As the xfail shows, we are now missing out on an optimization (as seen by the xfail that is now needed), and having large all-zero variables seems wrong. However, this patch solves the most urgent problem in this respect. This is an 8/9/10 regression, so I would like to commit this to all of these branches (waiting before gcc 9 reopens, of course). I wold then close the PR and open an enchancement PR for the xfail and the design improvement. Test case... I'm not sure what to test for. Regression-tested. OK for all affected branches? Regards Thomas 2019-09-25 Thomas Koenig PR fortran/84487 * trans-decl.c (gfc_get_symbol_decl): For __def_init, set DECL_ARTIFICAL and do not set TREE_READONLY. 2019-09-25 Thomas Koenig PR fortran/84487 * gfortran.dg/typebound_call_22.f03: xfail. Index: fortran/trans-decl.c =================================================================== --- fortran/trans-decl.c (Revision 275719) +++ fortran/trans-decl.c (Arbeitskopie) @@ -1911,9 +1911,13 @@ gfc_get_symbol_decl (gfc_symbol * sym) if (sym->attr.associate_var) GFC_DECL_ASSOCIATE_VAR_P (decl) = 1; + /* We no longer mark __def_init as read-only so it does not take up + space in the read-only section and dan go into the BSS instead, + see PR 84487. Marking this as artificial means that OpenMP will + treat this as predetermined shared. */ if (sym->attr.vtab || (sym->name[0] == '_' && gfc_str_startswith (sym->name, "__def_init"))) - TREE_READONLY (decl) = 1; + DECL_ARTIFICIAL (decl) = 1; return decl; } Index: testsuite/gfortran.dg/typebound_call_22.f03 =================================================================== --- testsuite/gfortran.dg/typebound_call_22.f03 (Revision 275713) +++ testsuite/gfortran.dg/typebound_call_22.f03 (Arbeitskopie) @@ -26,4 +26,4 @@ program test call x%bar () end program -! { dg-final { scan-tree-dump-times "base \\(\\);" 1 "optimized" } } +! { dg-final { scan-tree-dump-times "base \\(\\);" 1 "optimized" { xfail *-*-* } } }