[PATCH] accept flexible arrays in struct in unions (c++/71912 - [6/7 regression])

Martin Sebor msebor@gmail.com
Thu Oct 6 20:29:00 GMT 2016


> I'm asking you to clarify the logic.  It seems that your change to
> fldtype affects these two tests:
>
>>           if (eltype == fldtype || TYPE_UNNAMED_P (eltype))
>
>>       if (TREE_CODE (fldtype) != ARRAY_TYPE)
>
> ...but this is extremely subtle.  It would be a lot clearer to check fld
> for FIELD_DECL or TYPE_DECL explicitly rather than relying on these
> places that treat fldtype as a type to do the right thing because you've
> obfuscated it.  But I'm tired of going back and forth on this, so here's
> a patch.
>
> And now that I notice it, there seems to be no reason to handle typedefs
> deep in the code for handling fields, it's simpler to handle them up top.

I'm sorry you're frustrated.  I have no problem changing the code to
the way you wrote it.  I agree it's more streamlined though I would
be hard pressed to consider the improvement to be worth the time and
effort we both put into it.  I'm also not sure I see how someone can
be expected to write the code exactly the way you want based on little
more than questions about why the code does what it does.  I had no
idea what your expectation was for the fldtype variable for instance.

Attached is the integrated patch.

Martin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-71912.diff
Type: text/x-patch
Size: 37851 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20161006/f6892d43/attachment.bin>


More information about the Gcc-patches mailing list