From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3833 invoked by alias); 30 Oct 2010 15:11:30 -0000 Received: (qmail 3819 invoked by uid 22791); 30 Oct 2010 15:11:30 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,MISSING_MID 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; Sat, 30 Oct 2010 15:11:25 +0000 From: "janus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/46244] gfc_compare_derived_types is buggy X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: janus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: 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 Date: Sat, 30 Oct 2010 15:11:00 -0000 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: 2010-10/txt/msg02587.txt.bz2 Message-ID: <20101030151100.BCtWABhq5L7a9KYdkiEIP4lrYGQABgi8WC6iRF-PBW8@z> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46244 --- Comment #4 from janus at gcc dot gnu.org 2010-10-30 15:11:19 UTC --- (In reply to comment #3) > The test case in comment #1 can be fixed by: Or better: Index: gcc/fortran/interface.c =================================================================== --- gcc/fortran/interface.c (revision 166089) +++ gcc/fortran/interface.c (working copy) @@ -422,8 +422,11 @@ gfc_compare_derived_types (gfc_symbol *derived1, g /* Since subtypes of SEQUENCE types must be SEQUENCE types as well, a simple test can speed things up. Otherwise, lots of things have to match. */ - for (;;) + while (dt1 || dt2) { + if (dt1 == NULL || dt2 == NULL) + return 0; + if (strcmp (dt1->name, dt2->name) != 0) return 0; @@ -459,11 +462,6 @@ gfc_compare_derived_types (gfc_symbol *derived1, g dt1 = dt1->next; dt2 = dt2->next; - - if (dt1 == NULL && dt2 == NULL) - break; - if (dt1 == NULL || dt2 == NULL) - return 0; } return 1;