From patchwork Tue Sep 28 13:03:08 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 65966 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 62923B711A for ; Tue, 28 Sep 2010 23:03:23 +1000 (EST) Received: (qmail 27077 invoked by alias); 28 Sep 2010 13:03:17 -0000 Received: (qmail 27061 invoked by uid 22791); 28 Sep 2010 13:03:16 -0000 X-SWARE-Spam-Status: No, hits=-1.8 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; Tue, 28 Sep 2010 13:03:12 +0000 Received: from [192.168.178.22] (port-92-204-109-183.dynamic.qsc.de [92.204.109.183]) by mx02.qsc.de (Postfix) with ESMTP id DABC31E8EB; Tue, 28 Sep 2010 15:03:09 +0200 (CEST) Message-ID: <4CA1E78C.1010802@net-b.de> Date: Tue, 28 Sep 2010 15:03:08 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100914 SUSE/3.1.4 Thunderbird/3.1.4 MIME-Version: 1.0 To: gfortran g , gcc patches Subject: [Patch,Fortran] PR 45756 Fix muliple-decl issue with PARAMETER 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 For PARAMETERs in MODULEs which are of derived type or array-valued gfortran creates a static variable. This patch ensures that no extra declaration is generated for use associated parameters. If one runs the testcase (see PR) without patch, the result of -fdump-tree-original-uid is: iD.1554 = paraD.1556[0]; jD.1559 = paraD.1561[0]; with the patch, the result is: iD.1513 = paraD.1510[0]; jD.1516 = paraD.1510[0]; Build on x86-64-linux and currently regtesting; if it succeeds: OK for the trunk? Tobias 2010-09-28 Tobias Burnus PR fortran/45756 * trans-decl.c (gfc_get_symbol_decl): Use gsym for decl of module parameters. Index: gcc/fortran/trans-decl.c =================================================================== --- gcc/fortran/trans-decl.c (revision 164682) +++ gcc/fortran/trans-decl.c (working copy) @@ -1133,11 +1133,18 @@ gfc_get_symbol_decl (gfc_symbol * sym) if (sym->backend_decl) return sym->backend_decl; + /* Special case for array-valued named constants from intrinsic + procedures; those are inlined. */ + if (sym->attr.use_assoc && sym->from_intmod + && sym->attr.flavor == FL_PARAMETER) + intrinsic_array_parameter = true; + /* If use associated and whole file compilation, use the module declaration. */ if (gfc_option.flag_whole_file - && sym->attr.flavor == FL_VARIABLE - && sym->attr.use_assoc + && (sym->attr.flavor == FL_VARIABLE + || sym->attr.flavor == FL_PARAMETER) + && sym->attr.use_assoc && !intrinsic_array_parameter && sym->module) { gfc_gsymbol *gsym; @@ -1182,12 +1189,6 @@ gfc_get_symbol_decl (gfc_symbol * sym) if (sym->attr.intrinsic) internal_error ("intrinsic variable which isn't a procedure"); - /* Special case for array-valued named constants from intrinsic - procedures; those are inlined. */ - if (sym->attr.use_assoc && sym->from_intmod && sym->attr.dimension - && sym->attr.flavor == FL_PARAMETER) - intrinsic_array_parameter = true; - /* Create string length decl first so that they can be used in the type declaration. */ if (sym->ts.type == BT_CHARACTER)