public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Re: [PATCH] Fix ICE when mixing VLAs and statement expressions [PR91038]
@ 2021-08-02 14:05 Uecker, Martin
  2021-08-02 14:19 ` Uecker, Martin
  2021-08-03  5:32 ` Martin Uecker
  0 siblings, 2 replies; 13+ messages in thread
From: Uecker, Martin @ 2021-08-02 14:05 UTC (permalink / raw)
  To: richard.guenther; +Cc: gcc-patches

> On Sun, Aug 1, 2021 at 7:37 PM Uecker, Martin
> <Martin.Uecker@med.uni-goettingen.de> wrote:
> >
> >
> >
> > Here is an attempt to fix some old and annoying bugs related
> > to VLAs and statement expressions. In particulary, this seems
> > to fix the issues with variably-modified types which are
> > returned from statement expressions (which works on clang),
> > but there are still bugs remaining related to structs
> > with VLA members (which seems to be a FE bug).
> >
> > Of course, I might be doing something stupid...
> 
> How's evaluation order of (f())[g()] defined (with f returning a
> pointer)?
> Isn't that just f() + g()*sizeof(int) and thus undefined?

Yes, in C it is

f() + g()

and it is unsequenced. But the order of 'f' and 'g'
is not relevant here and also the patch does not change 
it (the base expression is gimplified before the index).

Essentially, we have

({ ... }) + g() * sizeof(X) 

where X refers to a declaration in the statement expression.
Without the patch the size expressions are gimplified before
the base expression and also before the index expression. 
With the patch the ({ ... }) is gimplified also before the
size expression.

> If it's undefined then I think the incoming GENERIC is ill-defined.

I think it is OK because the arguments are evaluated 
before the operation.  Without the patch, parts of the 
operation (the size expressions) are gimplified before
the arguments and this seems wrong to me.


Martin





^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-08-10 20:33 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02 14:05 Re: [PATCH] Fix ICE when mixing VLAs and statement expressions [PR91038] Uecker, Martin
2021-08-02 14:19 ` Uecker, Martin
2021-08-02 19:52   ` Re " Uecker, Martin
2021-08-03  5:32 ` Martin Uecker
2021-08-03  8:10   ` Richard Biener
2021-08-03  8:28     ` Martin Uecker
2021-08-03  9:26       ` Richard Biener
2021-08-03 11:26         ` Martin Uecker
2021-08-03 19:31         ` Martin Uecker
2021-08-09 13:21           ` Richard Biener
2021-08-09 13:52             ` Eric Botcazou
2021-08-09 14:13               ` Martin Uecker
2021-08-10 20:33                 ` Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).