From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19194 invoked by alias); 25 Jan 2012 23:39:24 -0000 Received: (qmail 19186 invoked by uid 22791); 25 Jan 2012 23:39:24 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 25 Jan 2012 23:39:11 +0000 From: "mikael at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/50981] [4.4/4.5/4.6 Regression] Wrong-code for scalarizing ELEMENTAL call with absent OPTIONAL argument Date: Thu, 26 Jan 2012 00:37:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: mikael at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: mikael at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.4.7 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-01/txt/msg02996.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50981 --- Comment #29 from Mikael Morin 2012-01-25 23:38:28 UTC --- (In reply to comment #27) > (In reply to comment #22) > > Created attachment 26386 [details] > > Updated patch > > +gfc_array_spec * > +symbol_as (gfc_symbol *sym) > +{ > + if (sym->ts.type == BT_CLASS) > + return CLASS_DATA (sym)->as; > > I think the function rather belongs to symbol.c than to resolve.c, unless it is > "static". But the real issue is the "if" condition. It should be: > if (sym->ts.type == BT_CLASS && sym->attr.class_ok) > otherwise, one might get a segfault with gfortran.dg/coarray_poly_1.f90 Sorry, I didn't see your comment. I solved the issue differently, but I'll try with your suggestion. The test in comment #23 should be rejected, as sub_ctae is elemental with a non-scalar dummy. Otherwise, it should work with the just posted patch.