On Wed, Apr 29, 2020 at 6:04 AM lizekun (A) <lizek...@huawei.com> wrote:
>
> Hi,
>
> This ICE appears because gcc will stream it to the function_body section when 
> processing the
> variable with the initial value of the constructor type, and the 
> error_mark_node to the
> decls section. When recompiling, the value obtained with DECL_INITIAL will be 
> error_mark.
>
> This patch use vnode->get_constructor () to get intial in lto.
>
> Bootstrap and tested on aarch64 Linux platform.

You should use ctor_for_folding to get all the magic correct.  Note that this
function returns error_mark_node if there is no usable initializer, NULL if
there is zero-init and sth else for the actual initializer.  You can use

  if (tree init = ctor_for_folding (base))
    if (init && init != error_mark_node)
      {
...
      }

Not to mention this whole function is a red herring ...:/

Thanks,
Richard.

>
> Best regulars,
> Zekun
>
>
> gcc:
> +2020-04-29  Li Zekun  <lizek...@huawei.com>
> +
> +       PR  lto/94822
> +       * tree.c: use vnode->get_constructor () to get intial in lto
>
> gcc/testsuite:
> +2020-04-29  Li Zekun  <lizek...@huawei.com>
> +
> +       PR  lto/94822
> +       * gcc.dg/lto/pr94822.h: New test.
> +       * gcc.dg/lto/pr94822_0.c: New test.
> +       * gcc.dg/lto/pr94822_1.c: New test.

Reply via email to