This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR middle-end/6196: Type check C++ computed gotos
- From: Roger Sayle <roger at eyesopen dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 2 Jul 2003 14:22:29 -0600 (MDT)
- Subject: Re: [PATCH] PR middle-end/6196: Type check C++ computed gotos
On Wed, 2 Jul 2003, Jason Merrill wrote:
> On Sat, 28 Jun 2003 13:34:24 -0600 (MDT), Roger Sayle <roger@eyesopen.com> wrote:
> > The following patch fixes the problem by placing the equivalent
> > "cp_convert (ptr_type_node, x)" in g++'s finish_goto_stmt.
>
> Please use perform_implicit_conversion instead.
Hi Jason,
I've just tried the change you suggested, replacing cp_convert with
perform_implicit_conversion, and bootstrapped and regression tested
the resulting patch. Unfortunately, perform_implicit_conversion,
unlike cp_convert and the C front-end, doesn't issue an error (or
even a warning) with the following test case.
int main(void)
{
static const void* lbls[2][2] = {{&&lbl0, &&lbl0}, {&&lbl0, &&lbl0}};
// Note: this is correct if written as *lbls[0][0].
goto *lbls[0]; // { dg-error "cannot convert" }
lbl0:
return 0;
}
The patch cures the ICE in the middle-end, but I'm unsure of the
differences in semantics between the two functions, and exactly which
address it is that we'd end up branching to. Its also strange that
this GCC extension should behave differently between gcc and g++.
Are you sure that perform_implicit_conversion is what we want?
Roger
--