From patchwork Mon Jul 26 10:31:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 59904 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id F3467B70AB for ; Mon, 26 Jul 2010 20:31:34 +1000 (EST) Received: (qmail 12432 invoked by alias); 26 Jul 2010 10:31:29 -0000 Received: (qmail 12415 invoked by uid 22791); 26 Jul 2010 10:31:28 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mx02.qsc.de (HELO mx02.qsc.de) (213.148.130.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 26 Jul 2010 10:31:21 +0000 Received: from [192.168.178.22] (port-92-204-113-1.dynamic.qsc.de [92.204.113.1]) by mx02.qsc.de (Postfix) with ESMTP id 0EC911EBCC; Mon, 26 Jul 2010 12:31:19 +0200 (CEST) Message-ID: <4C4D63F6.7020708@net-b.de> Date: Mon, 26 Jul 2010 12:31:18 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100520 SUSE/3.0.5 Thunderbird/3.0.5 MIME-Version: 1.0 To: gcc patches , gfortran Subject: [Patch, Fortran, committed] PR 40011 - Regression with namelist and -fwhole-file 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 The patch is obvious: Without whole-file, gfc_get_symbol_decl returns the decl *and* sets sym->backend_decl -- without whole-file, the latter was not done. Build and regtested on x86-64-linux. Committed as Rev. 162532. Tobias 2010-07-26 Tobias Burnus PR fortran/45066 * trans-io.c (build_dt): Use NULL_TREE rather than NULL for call to transfer_namelist_element. * trans-decl.c (gfc_get_symbol_decl): Also set sym->backend_decl for -fwhole-file. 2010-07-26 Tobias Burnus PR fortran/45066 * gfortran.dg/namelist_62.f90: New. Index: gcc/testsuite/gfortran.dg/namelist_62.f90 =================================================================== --- gcc/testsuite/gfortran.dg/namelist_62.f90 (revision 0) +++ gcc/testsuite/gfortran.dg/namelist_62.f90 (revision 0) @@ -0,0 +1,20 @@ +! { dg-do compile } +! +! PR fortran/45066 +! +! Contributed by Michael Richmond. +! +! Was failing due to a -fwhole-file bug. +! + +MODULE GA_commons + INTEGER :: nichflg(2) +END MODULE GA_commons + +PROGRAM gafortran + USE GA_commons + NAMELIST /ga/ nichflg + READ (23, nml=ga) +END PROGRAM gafortran + +! { dg-final { cleanup-modules "ga_commons" } } Index: gcc/fortran/trans-io.c =================================================================== --- gcc/fortran/trans-io.c (revision 162526) +++ gcc/fortran/trans-io.c (working copy) @@ -1760,7 +1760,7 @@ build_dt (tree function, gfc_code * code for (nml = dt->namelist->namelist; nml; nml = nml->next) transfer_namelist_element (&block, nml->sym->name, nml->sym, - NULL, NULL); + NULL, NULL_TREE); } else set_parameter_const (&block, var, IOPARM_common_flags, mask); Index: gcc/fortran/trans-decl.c =================================================================== --- gcc/fortran/trans-decl.c (revision 162526) +++ gcc/fortran/trans-decl.c (working copy) @@ -1150,7 +1150,8 @@ gfc_get_symbol_decl (gfc_symbol * sym) true); if (sym->ts.type == BT_CHARACTER) sym->ts.u.cl->backend_decl = s->ts.u.cl->backend_decl; - return s->backend_decl; + sym->backend_decl = s->backend_decl; + return sym->backend_decl; } } }