This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Re-enable gimple type-checking for assignments
On Mon, 18 Aug 2008, Doug Gregor wrote:
> On Mon, Aug 18, 2008 at 10:19 AM, Richard Guenther <rguenther@suse.de> wrote:
> >
> > which somehow got lost during tuplification. Now we correctly complain
> > about PR37146.
> [snip]
> > case tcc_reference:
> > + /* All tcc_reference trees are GIMPLE_SINGLE_RHS. Verify that
> > + no implicit type change happens here. */
> > + if (!useless_type_conversion_p (lhs_type, rhs1_type))
> > + {
> > + error ("non-trivial conversion at assignment");
> > + debug_generic_expr (lhs);
> > + debug_generic_expr (rhs1);
> > + return true;
> > + }
> > return verify_types_in_gimple_reference (rhs1);
>
> For my own education, could you tell me why we emit this error during
> gimplification and not sooner? It seems that the error() you've added
> should really be an internal_error(), because the front end should
> have diagnosed the problem earlier, rather than passing incorrect code
> down to the gimplifier.
It is basically because we only decided to nail down parts of the
GIMPLE type system and we are more forgiving on GENERIC allowing
the gimplifier to "fix up" some things. If we ever get the
gimplify unit-at-a-time patch merged I would expect we are going
to fix more of this stuff in the gimplifier (even if calling back
into the frontend at this point).
Another problem is that optimization passes contain known bugs,
so we need to make sure to not verify at random places (yet).
Richard.