From patchwork Tue Mar 22 08:21:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 87872 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 91321B6F10 for ; Tue, 22 Mar 2011 19:22:15 +1100 (EST) Received: (qmail 20578 invoked by alias); 22 Mar 2011 08:22:07 -0000 Received: (qmail 20508 invoked by uid 22791); 22 Mar 2011 08:22:06 -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, 22 Mar 2011 08:21:59 +0000 Received: from [192.168.178.22] (port-92-204-81-219.dynamic.qsc.de [92.204.81.219]) by mx02.qsc.de (Postfix) with ESMTP id 07A591E43F; Tue, 22 Mar 2011 09:21:55 +0100 (CET) Message-ID: <4D885C23.1070206@net-b.de> Date: Tue, 22 Mar 2011 09:21:55 +0100 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206 SUSE/3.1.7 Thunderbird/3.1.7 MIME-Version: 1.0 To: gcc patches , gfortran Subject: [Patch, Fortran] PR 48174+45304: No varags if interface is known 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 This patch makes sure that there is no vararg if the procedure interface is known. Before, for functions and subroutines without arguments, no void_list_node. (Related, separate and unfixed issue: For procedures without explicit interface, the interface should be deduced from the usage.) Build and regtested on x86-64-linux. OK for the trunk? Tobias 2011-03-22 Tobias Burnus PR fortran/48174 PR fortran/45304 * trans-types.c (gfc_get_function_type): Don't use varargs if the procedure is known to have no arguments. 2011-03-22 Tobias Burnus PR fortran/48174 PR fortran/45304 * gfortran.dg/ishft_4.f90: Adapt scan-tree-dump-times. * gfortran.dg/leadz_trailz_3.f90: Ditto diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 258685e..8ecceea 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -2618,7 +2618,7 @@ gfc_get_function_type (gfc_symbol * sym) if (typelist) typelist = chainon (typelist, void_list_node); - else if (sym->attr.is_main_program) + else if (sym->attr.is_main_program || sym->attr.if_source != IFSRC_UNKNOWN) typelist = void_list_node; if (alternate_return) diff --git a/gcc/testsuite/gfortran.dg/ishft_4.f90 b/gcc/testsuite/gfortran.dg/ishft_4.f90 index 0315c7f..4e2ad2b 100644 --- a/gcc/testsuite/gfortran.dg/ishft_4.f90 +++ b/gcc/testsuite/gfortran.dg/ishft_4.f90 @@ -35,6 +35,6 @@ end program ! -- once in the function definition itself ! -- plus as many times as the function is called ! -! { dg-final { scan-tree-dump-times "foo *\\\(\\\)" 6 "original" } } -! { dg-final { scan-tree-dump-times "bar *\\\(\\\)" 6 "original" } } +! { dg-final { scan-tree-dump-times "foo *\\\(\\\)" 5 "original" } } +! { dg-final { scan-tree-dump-times "bar *\\\(\\\)" 5 "original" } } ! { dg-final { cleanup-tree-dump "original" } } diff --git a/gcc/testsuite/gfortran.dg/leadz_trailz_3.f90 b/gcc/testsuite/gfortran.dg/leadz_trailz_3.f90 index f8466ff..b54a11f 100644 --- a/gcc/testsuite/gfortran.dg/leadz_trailz_3.f90 +++ b/gcc/testsuite/gfortran.dg/leadz_trailz_3.f90 @@ -26,5 +26,5 @@ end program ! -- once in the function definition itself ! -- plus as many times as the function is called ! -! { dg-final { scan-tree-dump-times "foo *\\\(\\\)" 8 "original" } } +! { dg-final { scan-tree-dump-times "foo *\\\(\\\)" 7 "original" } } ! { dg-final { cleanup-tree-dump "original" } }