I think the loop should be at a lower level. This also crashes today (while
diagnosing an empty loop body):

int f() {
  if (false)
#pragma weak f
    return 0;
  return 1;
}

... and if we didn't have that diagnostic, we'd generate wrong code instead.


On Wed, Sep 18, 2013 at 1:09 AM, Olivier Goffart <[email protected]> wrote:

> On Monday 16 September 2013 11:43:00 Richard Smith wrote:
> > I don't particularly like adding a NullStmt here -- there was no null
> > statement in the source code, so this is not a faithful AST
> representation
> > of the source.
> >
> > This approach seems like it will also accept this:
> >
> > switch (t) {
> >   case 1:
> > #pragma weak t
> > }
> >
> > We should probably reject this, because there is no statement after the
> > case label. (That said, GCC accepts the above code, and fully treats
> these
> > pragmas as being statement-like entities, so your patch would be
> > bug-compatible with them.)
> >
> > Does the same issue exist for goto labels?
>
> The problem was the same for goto.
>
> I attached a new patch that reject invalid code.
>
> --
> Olivier
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to