This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/46244] gfc_compare_derived_types is buggy
- From: "mikael at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 20 Feb 2011 23:13:57 +0000
- Subject: [Bug fortran/46244] gfc_compare_derived_types is buggy
- Auto-submitted: auto-generated
- References: <bug-46244-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46244
--- Comment #15 from Mikael Morin <mikael at gcc dot gnu.org> 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 ;-) ).