From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29708 invoked by alias); 20 Feb 2011 23:14:03 -0000 Received: (qmail 29697 invoked by uid 22791); 20 Feb 2011 23:14:02 -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; Sun, 20 Feb 2011 23:13:58 +0000 From: "mikael 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: ice-on-valid-code, patch X-Bugzilla-Severity: normal X-Bugzilla-Who: mikael at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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 Date: Sun, 20 Feb 2011 23:18: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: 2011-02/txt/msg02388.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46244 --- Comment #15 from Mikael Morin 2011-02-20 23:13:32 UTC --- (In reply to comment #13) > Although I prefer the first form, if it is proven that it is too much work to > recover it, the second one requires only to adjust the tests. I didn't notice there was a second part in the error message, so I thought the new message was better (more precise). It is just a gfc_compare_type VS gfc_TK_compatible change, I believe. Actually none of the gfc_compare_type/gfc_TK_compatible changes are absolutely necessary to fix this bug. It is just I found it odd that gfc_compare_type was calling gfc_type_compatible (compatible types are not necessary equal/equivalent), so I changed it so that gfc_type_compatible calls gfc_compare_type instead. And then the new gfc_TK_compatible function to not upset the testsuite. Maybe I just don't understand what "compare types" means. :-( > More annoying the > patch breaks the 'move_alloc()' calls, e.g., pr42274 comment #1 or pr42769 > comment #1 (apparently this new feature is not tested in the test suite). Will look into it later. > > While looking at the code I have noticed something odd at lines 408 of > gcc/fortran/interface.c (patched file): > > if (derived1 != NULL && derived2 != NULL > && strcmp (derived1->name, derived2->name) == 0 > && derived1->module != NULL && derived2->module != NULL > && strcmp (derived1->module, derived2->module) == 0) > return 1; > > /* Compare type via the rules of the standard. Both types must have > the SEQUENCE attribute to be equal. */ > > if (strcmp (derived1->name, derived2->name)) > return 0; > > If the test 'derived1 != NULL && derived2 != NULL' is really required (i.e., > derived1 or derived2 can be NULL when entering the proc), is not it also > required later in the code (e.g., strcmp (derived1->name, derived2->name))? Hem, yes, who wrote this? ( I hope it's not me ;-) ).