public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexander Ivchenko <aivchenk@gmail.com>
To: Ilya Enkovich <enkovich.gnu@gmail.com>
Cc: Jeff Law <law@redhat.com>,
	marxin@gcc.gnu.org, 	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: Fix for PR79987
Date: Tue, 09 May 2017 15:41:00 -0000	[thread overview]
Message-ID: <CACysShg0cCxp=hnxY3sn--Uzdn9S8aeG6gwP-8KEVmfU7Y96xg@mail.gmail.com> (raw)
In-Reply-To: <CAMbmDYboU14OUFSEgLYUN-fY7wH1iDEJz6OcXtEOt=LjwioU2Q@mail.gmail.com>

If we use chkp_generate_extern_var_bounds for void variable just as
for arrays with unknown size, we will create the following gimple seq:

# VUSE <.MEM>
__size_tmp.0 = __builtin_ia32_sizeof (foo);
__size_tmp.1_3 = __size_tmp.0;

However, this will fail in verify_gimple_call:

tree arg = gimple_call_arg (stmt, i);
if ((is_gimple_reg_type (TREE_TYPE (arg))
     && !is_gimple_val (arg))
    || (!is_gimple_reg_type (TREE_TYPE (arg))
        && !is_gimple_lvalue (arg)))
  {
    error ("invalid argument to gimple call");
    debug_generic_expr (arg);
    return true;
  }
..here the TREE_TYPE(arg)==void. Any ideas for a good workaround ?

Alexander



2017-04-08 21:59 GMT+02:00 Ilya Enkovich <enkovich.gnu@gmail.com>:
> 2017-04-04 18:34 GMT+03:00 Jeff Law <law@redhat.com>:
>> On 04/04/2017 09:07 AM, Alexander Ivchenko wrote:
>>>
>>> Hi,
>>>
>>> When creating static bounds for foo below we end up with:
>>>
>>> *((unsigned long *) &__chkp_bounds_of_foo + 8) =
>>> ~(__builtin_ia32_sizeof (foo) + ((long unsigned int) &foo +
>>> 18446744073709551615));
>>>
>>> This fails in gimplify_function_tree with gcc_assert (!VOID_TYPE_P
>>> (TREE_TYPE (*expr_p)));
>>>
>>> Is it OK?
>>>
>>> gcc/ChangeLog:
>>>
>>> 2017-04-04  Alexander Ivchenko  <aivchenk@gmail.com>
>>>
>>>         * tree-chkp.c (chkp_get_bounds_for_decl_addr):
>>> assigning zero bounds to void variables
>>>
>>>
>>> gcc/testsuite/ChangeLog:
>>>
>>> 2017-04-04  Alexander Ivchenko  <aivchenk@gmail.com>
>>>
>>>         * gcc.target/i386/mpx/PR79987.c: New test.
>>
>> I've put this (and other CHKP fixes) in the queue for gcc-8 as AFAICT it's
>> not a regression.
>>
>> Jeff
>>
>
> Hi,
>
> If we delay it for GCC8 anyway then I think we may fix it in a better way. If we
> cannot detect size of a variable then size relocations may be used. It is done
> already for arrays with unknown size and also can be done for void vars.
>
> Thanks,
> Ilya

  reply	other threads:[~2017-05-09 15:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 15:07 Alexander Ivchenko
2017-04-04 15:34 ` Jeff Law
2017-04-08 19:59   ` Ilya Enkovich
2017-05-09 15:41     ` Alexander Ivchenko [this message]
     [not found]       ` <CAMbmDYYj++Trk1JHs0dXBR4NfLCaKNnzLHN1PBF7a_96YCJGWg@mail.gmail.com>
     [not found]         ` <CACysShjZboYogD31Ujgt-xpE3jK2co1nUpEzxbbrSWbOV_Z4Tg@mail.gmail.com>
     [not found]           ` <CAMbmDYbHjZEXz3YcTvPQa950sxmR3fa+yYsCPkzhychFtjW4Cw@mail.gmail.com>
     [not found]             ` <CACysShip_WNDryk1kUiJCO0Mpc_8SVNRkByTdmzEC0xfxFuviw@mail.gmail.com>
2017-05-11 18:41               ` Ilya Enkovich
2017-06-09 12:22                 ` Alexander Ivchenko
2017-06-09 17:46                   ` Ilya Enkovich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACysShg0cCxp=hnxY3sn--Uzdn9S8aeG6gwP-8KEVmfU7Y96xg@mail.gmail.com' \
    --to=aivchenk@gmail.com \
    --cc=enkovich.gnu@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=marxin@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).