This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] fix wrong gimple code with ptr to forward vla
On Wed, 27 Sep 2006, Olivier Hainque wrote:
> > That should avoid the TYPENAME problems like the testcase I give
> > (which should be added to the gcc.c-torture/execute testsuite)
>
> Right. One concern, still: are we sure that the initial bug (sizes
> evaluated in a conditional branch and reused in another) couldn't
> show up in the TYPENAME case ?
If the size is only evaluated conditionally (in one branch) but needed for
the type of the expression then the standard is silent but this should
probably be either undefined behavior or a constraint violation.
With the GNU extension of variably modified structure elements you might
get problems in other cases - say if an incomplete struct is completed in
one branch of the conditional expression (C allows you to define structs
in casts and sizeof) - again this should probably be undefined behavior.
In any case excluding TYPENAME shouldn't make things worse since we have
no logic at present to ensure evaluation always happens at exactly the
right time; it simply happens to be done at about the right time in most
cases.
--
Joseph S. Myers
joseph@codesourcery.com