From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57289 invoked by alias); 5 Dec 2015 15:20:58 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 57277 invoked by uid 89); 5 Dec 2015 15:20:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-oi0-f54.google.com Received: from mail-oi0-f54.google.com (HELO mail-oi0-f54.google.com) (209.85.218.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 05 Dec 2015 15:20:56 +0000 Received: by oies6 with SMTP id s6so81453951oie.1 for ; Sat, 05 Dec 2015 07:20:54 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.202.229.132 with SMTP id c126mr15982231oih.112.1449328854410; Sat, 05 Dec 2015 07:20:54 -0800 (PST) Received: by 10.202.83.141 with HTTP; Sat, 5 Dec 2015 07:20:54 -0800 (PST) In-Reply-To: <20151203064341.GA62254@troutmask.apl.washington.edu> References: <20151128161940.GA97246@troutmask.apl.washington.edu> <20151203060233.GA62024@troutmask.apl.washington.edu> <20151203062630.GA62157@troutmask.apl.washington.edu> <20151203064341.GA62254@troutmask.apl.washington.edu> Date: Sat, 05 Dec 2015 15:20:00 -0000 Message-ID: Subject: Re: [Patch, fortran] PR68534 - No error on mismatch in number of arguments between submodule and module interface From: Paul Richard Thomas To: Steve Kargl Cc: "fortran@gcc.gnu.org" Content-Type: multipart/mixed; boundary=001a1141b7e087e5200526282ba6 X-IsSubscribed: yes X-SW-Source: 2015-12/txt/msg00043.txt.bz2 --001a1141b7e087e5200526282ba6 Content-Type: text/plain; charset=UTF-8 Content-length: 4097 Dear Steve, Going back through my notes on the original submodule patch, I ran into all sorts of problems with extraneous errors and ICEs if I tried to avoid the ugliness. I spent some time today trying to overcome these problems but got nowhere. The cause of the segfault, I believe, was an error: 'sym' being used instead of 'progname': Could you please try the attached patch when you have a moment. Thanks Paul On 3 December 2015 at 07:43, Steve Kargl wrote: > On Wed, Dec 02, 2015 at 10:26:30PM -0800, Steve Kargl wrote: >> On Wed, Dec 02, 2015 at 10:02:33PM -0800, Steve Kargl wrote: >> > Paul, >> > >> > I'm stumped. Something is broken on i386-*-freebsd. :-( >> > >> > Running /mnt/kargl/gcc/gcc/testsuite/gfortran.dg/dg.exp ... >> > FAIL: gfortran.dg/submodule_10.f08 -O (internal compiler error) >> > FAIL: gfortran.dg/submodule_10.f08 -O (test for excess errors) >> > FAIL: gfortran.dg/submodule_11.f08 -O0 (internal compiler error) >> > FAIL: gfortran.dg/submodule_11.f08 -O0 (test for excess errors) >> > FAIL: gfortran.dg/submodule_11.f08 -O1 (internal compiler error) >> > FAIL: gfortran.dg/submodule_11.f08 -O1 (test for excess errors) >> > FAIL: gfortran.dg/submodule_11.f08 -O2 (internal compiler error) >> > FAIL: gfortran.dg/submodule_11.f08 -O2 (test for excess errors) >> > FAIL: gfortran.dg/submodule_11.f08 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions (internal compiler error) >> > FAIL: gfortran.dg/submodule_11.f08 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions (test for excess errors) >> > FAIL: gfortran.dg/submodule_11.f08 -O3 -g (internal compiler error) >> > FAIL: gfortran.dg/submodule_11.f08 -O3 -g (test for excess errors) >> > FAIL: gfortran.dg/submodule_11.f08 -Os (internal compiler error) >> > FAIL: gfortran.dg/submodule_11.f08 -Os (test for excess errors) >> >> Well, if I change the order of the conditionals decl.c:4831, I >> can get rid of the above FAILs. >> >> Index: decl.c >> =================================================================== >> --- decl.c (revision 231219) >> +++ decl.c (working copy) >> @@ -4826,7 +4826,7 @@ ok: >> >> /* Abbreviated module procedure declaration is not meant to have any >> formal arguments! */ >> - if (!sym->abr_modproc_decl && formal && !head) >> + if (formal && !head && sym && !sym->abr_modproc_decl) >> arg_count_mismatch = true; >> >> for (p = formal, q = head; p && q; p = p->next, q = q->next) >> >> -- >> steve >> >> > FAIL: gfortran.dg/submodule_13.f08 -O (internal compiler error) >> > FAIL: gfortran.dg/submodule_13.f08 -O (test for errors, line 29) >> > FAIL: gfortran.dg/submodule_13.f08 -O (test for excess errors) > > These ICEs persist at line 4831. In looking at the code, I'm > now somewhat unsure what it should be doing. In particular, > there are 2 gfc_error_now() calls in the below: > > > for (p = formal, q = head; p && q; p = p->next, q = q->next) > { > if ((p->next != NULL && q->next == NULL) > || (p->next == NULL && q->next != NULL)) > arg_count_mismatch = true; > else if ((p->sym == NULL && q->sym == NULL) > || strcmp (p->sym->name, q->sym->name) == 0) > continue; > else > gfc_error_now ("Mismatch in MODULE PROCEDURE formal " > "argument names (%s/%s) at %C", > p->sym->name, q->sym->name); > } > > if (arg_count_mismatch) > gfc_error_now ("Mismatch in number of MODULE PROCEDURE " > "formal arguments at %C"); > } > > return MATCH_YES; > > cleanup: > gfc_free_formal_arglist (head); > return m; > > But, we return MATCH_YES? I would expect setting m = MATCH_ERROR > and jumping to cleanup. That's ugly. > > -- > Steve -- Outside of a dog, a book is a man's best friend. Inside of a dog it's too dark to read. Groucho Marx --001a1141b7e087e5200526282ba6 Content-Type: text/plain; charset=US-ASCII; name="correction.diff" Content-Disposition: attachment; filename="correction.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_iht8z3z10 Content-length: 1196 SW5kZXg6IGdjYy9mb3J0cmFuL2RlY2wuYwo9PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09Ci0tLSBnY2MvZm9ydHJhbi9kZWNsLmMJKHJldmlzaW9uIDIzMTMxNikK KysrIGdjYy9mb3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