This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH v2] C/C++: Add -Waddress-of-packed-member
- From: Jason Merrill <jason at redhat dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, Martin Sebor <msebor at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 18 Jun 2018 14:06:24 -0400
- Subject: Re: [PATCH v2] C/C++: Add -Waddress-of-packed-member
- References: <CAMe9rOr_Q-n71hVij8hWqzUL=psrJH9VbNFJoMBbzM+v6ZOgTA@mail.gmail.com> <348fd264-f21e-96d8-cc2b-340a09c4efe0@gmail.com> <CAMe9rOqMfC6aerYrvNiYp7T6mf7w6PwjMB9bkUwFtu-MuZbf-w@mail.gmail.com> <CAMe9rOqbeZG5tON_bM5yYy0XBmzct1TP8kja3xvZa_Yi=x0xBA@mail.gmail.com> <7afd2c85-bef8-e314-6ece-904d381809e1@gmail.com> <CAMe9rOpHemk8x7Li6b8MkkTuH35jq1mAjn-n57bUCT2EP4J0Vw@mail.gmail.com> <20180518113619.GA4212@gmail.com> <CADzB+2nMoFK=AqeygDDmvWrQEWXbZ7v4pH8YTyacS1O=di4N7g@mail.gmail.com> <alpine.DEB.2.20.1806181557410.23315@digraph.polyomino.org.uk>
On Mon, Jun 18, 2018 at 11:59 AM, Joseph Myers <joseph@codesourcery.com> wrote:
> On Mon, 18 Jun 2018, Jason Merrill wrote:
>
>> > + if (TREE_CODE (rhs) == COND_EXPR)
>> > + {
>> > + /* Check the THEN path first. */
>> > + tree op1 = TREE_OPERAND (rhs, 1);
>> > + context = check_address_of_packed_member (type, op1);
>>
>> This should handle the GNU extension of re-using operand 0 if operand
>> 1 is omitted.
>
> Doesn't that just use a SAVE_EXPR?
Hmm, I suppose it does, but many places in the compiler seem to expect
that it produces a COND_EXPR with TREE_OPERAND 1 as NULL_TREE.
Perhaps that code is obsolete. Never mind it here, then.
Jason