This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/37016] [4.3/4.4 Regression] member function pointer failure with optimization
- From: "rguenther at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Aug 2008 21:11:22 -0000
- Subject: [Bug c++/37016] [4.3/4.4 Regression] member function pointer failure with optimization
- References: <bug-37016-16558@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #13 from rguenther at suse dot de 2008-08-04 21:11 -------
Subject: Re: [4.3/4.4 Regression] member function pointer
failure with optimization
On Mon, 4 Aug 2008, jason at gcc dot gnu dot org wrote:
> ------- Comment #12 from jason at gcc dot gnu dot org 2008-08-04 21:03 -------
> Well, that's the problem then: we have two POINTER_TYPE to METHOD_TYPE which
> are considered equivalent in the front end, but not equivalent in the tree-ssa
> types_compatible_p.
>
> The specific bug seems to be that useless_type_conversion_1 doesn't expect to
> need to do structural comparison of non-aggregate types. That's an invalid
> assumption; it should check TYPE_STRUCTURAL_EQUALITY_P. Does the attached
> patch seem appropriate to you? It fixes the bug for me, though I haven't
> regression tested it.
Duh, if TYPE_STRUCTURAL_EQUALITY_P is used on non-aggregates then yes,
this is a correct patch (the code currently makes FUNCTION_TYPEs and
METHOD_TYPEs distinct if they are not pointer-equivalent or linked
via TYPE_CANONICAL / TYPE_MAIN_VARIANT). So I would prefer if
you add those to the AGGREGATE_TYPE_P case instead of letting
it fall-through to the "default" case - we should probably add
some gcc_unreachable () to make sure we handled all cases.
Thanks,
Richard.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37016