public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/96680] New: [11 Regression][OpenMP][LTO] Declare variant + ICE in lto_fixup_prevailing_decls, at lto/lto-common.c:2595
@ 2020-08-18 16:31 burnus at gcc dot gnu.org
  2020-08-18 16:42 ` [Bug middle-end/96680] " burnus at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-08-18 16:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96680

            Bug ID: 96680
           Summary: [11 Regression][OpenMP][LTO] Declare variant + ICE in
                    lto_fixup_prevailing_decls, at lto/lto-common.c:2595
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, openmp
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

This now fails with offloading in the device lto1 of both AMDGCN and nvptx.

The testcase is tests/5.0/declare_variant/test_declare_variant.c of
https://github.com/SOLLVE/sollve_vv 

compile, e.g., as
  gcc -fopenmp -I ompvv ./tests/5.0/declare_variant/test_declare_variant.c


lto1: internal compiler error: in lto_fixup_prevailing_decls, at
lto/lto-common.c:2595
0x6536a0 lto_fixup_prevailing_decls
        gcc-mainline/gcc/lto/lto-common.c:2595
0x65f9a1 lto_fixup_decls
        gcc-mainline/gcc/lto/lto-common.c:2645
0x65f9a1 read_cgraph_and_symbols(unsigned int, char const**)
        src/gcc-mainline/gcc/lto/lto-common.c:2897
0x63fd42 lto_main()
        gcc-mainline/gcc/lto/lto.c:625

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/96680] [11 Regression][OpenMP][LTO] Declare variant + ICE in lto_fixup_prevailing_decls, at lto/lto-common.c:2595
  2020-08-18 16:31 [Bug middle-end/96680] New: [11 Regression][OpenMP][LTO] Declare variant + ICE in lto_fixup_prevailing_decls, at lto/lto-common.c:2595 burnus at gcc dot gnu.org
@ 2020-08-18 16:42 ` burnus at gcc dot gnu.org
  2020-08-18 16:49 ` burnus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-08-18 16:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96680

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
In the debugger, the first call to lto_fixup_prevailing_decls is for
main._omp_fn.0 and the second - and failing - one is for

(gdb) p debug_tree(t)
 <tree_list 0x7ffff73d2cf8
    purpose <function_decl 0x7ffff73d3a00 p_fn

at the end, it fails for

  else
    {
      switch (code)
        {
        case TREE_LIST:
          LTO_SET_PREVAIL (TREE_VALUE (t));
          LTO_SET_PREVAIL (TREE_PURPOSE (t));
          LTO_NO_PREVAIL (TREE_PURPOSE (t));
          break;

in the call to

2595              LTO_NO_PREVAIL (TREE_PURPOSE (t));

And that's the following (I assume 'of' is 'or'):

/* Ensure that TT isn't a replacable var of function decl.  */
#define LTO_NO_PREVAIL(tt) \
  gcc_checking_assert (!(tt) || !VAR_OR_FUNCTION_DECL_P (tt))

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/96680] [11 Regression][OpenMP][LTO] Declare variant + ICE in lto_fixup_prevailing_decls, at lto/lto-common.c:2595
  2020-08-18 16:31 [Bug middle-end/96680] New: [11 Regression][OpenMP][LTO] Declare variant + ICE in lto_fixup_prevailing_decls, at lto/lto-common.c:2595 burnus at gcc dot gnu.org
  2020-08-18 16:42 ` [Bug middle-end/96680] " burnus at gcc dot gnu.org
@ 2020-08-18 16:49 ` burnus at gcc dot gnu.org
  2020-08-20 12:46 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-08-18 16:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96680

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Created attachment 49075
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49075&action=edit
C testcase - de-macro-fied version sollve_vv's 
5.0/declare_variant/test_declare_variant.c

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/96680] [11 Regression][OpenMP][LTO] Declare variant + ICE in lto_fixup_prevailing_decls, at lto/lto-common.c:2595
  2020-08-18 16:31 [Bug middle-end/96680] New: [11 Regression][OpenMP][LTO] Declare variant + ICE in lto_fixup_prevailing_decls, at lto/lto-common.c:2595 burnus at gcc dot gnu.org
  2020-08-18 16:42 ` [Bug middle-end/96680] " burnus at gcc dot gnu.org
  2020-08-18 16:49 ` burnus at gcc dot gnu.org
@ 2020-08-20 12:46 ` burnus at gcc dot gnu.org
  2020-08-25 10:47 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-08-20 12:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96680

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Some regression hunting:
* Fails with r11-652-g79ea774f9a9d36d986152d93f9eae4a9ba36b37b
* Works on OG10 = devel/omp/gcc-10 and presumably GCC 10.

My bet is that the following commit causes the issue, but that trunk version
fails to build here: r11-382-g7a50e7087567cffb21e81fff566546b8a8dac270
(2020-05-14)
Namely:
  openmp: cgraph support for late declare variant resolution

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/96680] [11 Regression][OpenMP][LTO] Declare variant + ICE in lto_fixup_prevailing_decls, at lto/lto-common.c:2595
  2020-08-18 16:31 [Bug middle-end/96680] New: [11 Regression][OpenMP][LTO] Declare variant + ICE in lto_fixup_prevailing_decls, at lto/lto-common.c:2595 burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-08-20 12:46 ` burnus at gcc dot gnu.org
@ 2020-08-25 10:47 ` rguenth at gcc dot gnu.org
  2020-10-16 12:03 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-25 10:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96680

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug middle-end/96680] [11 Regression][OpenMP][LTO] Declare variant + ICE in lto_fixup_prevailing_decls, at lto/lto-common.c:2595
  2020-08-18 16:31 [Bug middle-end/96680] New: [11 Regression][OpenMP][LTO] Declare variant + ICE in lto_fixup_prevailing_decls, at lto/lto-common.c:2595 burnus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-08-25 10:47 ` rguenth at gcc dot gnu.org
@ 2020-10-16 12:03 ` rguenth at gcc dot gnu.org
  2020-10-28  9:29 ` [Bug lto/96680] " cvs-commit at gcc dot gnu.org
  2020-11-26  9:57 ` burnus at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-10-16 12:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96680

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
 <tree_list 0x7ffff73d2cf8
    purpose <function_decl 0x7ffff73d3a00 p_fn

looks like we eventually do not expect trees to fixup in TREE_PURPOSE
(attributes?)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug lto/96680] [11 Regression][OpenMP][LTO] Declare variant + ICE in lto_fixup_prevailing_decls, at lto/lto-common.c:2595
  2020-08-18 16:31 [Bug middle-end/96680] New: [11 Regression][OpenMP][LTO] Declare variant + ICE in lto_fixup_prevailing_decls, at lto/lto-common.c:2595 burnus at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-10-16 12:03 ` rguenth at gcc dot gnu.org
@ 2020-10-28  9:29 ` cvs-commit at gcc dot gnu.org
  2020-11-26  9:57 ` burnus at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-28  9:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96680

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:f165ef89c08ddabb19583e45e8a6819f810d95ab

commit r11-4468-gf165ef89c08ddabb19583e45e8a6819f810d95ab
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Oct 28 10:28:18 2020 +0100

    lto: LTO cgraph support for late declare variant resolution [PR96680]

    > I've tried to add the saving/restoring next to ipa refs saving/restoring,
as
    > the declare variant alt stuff is kind of extension of those,
unfortunately
    > following doesn't compile, because I need to also write or read a tree
there
    > (ctx is a portion of DECL_ATTRIBUTES of the base function), but the ipa
refs
    > write/read back functions don't have arguments that can be used for that.

    This patch adds the streaming out and in of those omp_declare_variant_alt
    hash table on the side data for the declare_variant_alt cgraph_nodes and
    treats for LTO purposes the declare_variant_alt nodes (which have no body)
    as if they contained a body that calls all the possible variants.
    After IPA all the calls to these magic declare_variant_alt calls are
    replaced with call to one of the variant depending on which one has the
    highest score in the context.

    2020-10-28  Jakub Jelinek  <jakub@redhat.com>

            PR lto/96680
    gcc/
            * lto-streamer.h (omp_lto_output_declare_variant_alt,
            omp_lto_input_declare_variant_alt): Declare variant.
            * symtab.c (symtab_node::get_partitioning_class): Return
            SYMBOL_DUPLICATE for declare_variant_alt nodes.
            * passes.c (ipa_write_summaries): Add declare_variant_alt to
            partition.
            * lto-cgraph.c (output_refs): Call
omp_lto_output_declare_variant_alt
            on declare_variant_alt nodes.
            (input_refs): Call omp_lto_input_declare_variant_alt on
            declare_variant_alt nodes.
            * lto-streamer-out.c (output_function): Don't call
            collect_block_tree_leafs if DECL_INITIAL is error_mark_node.
            (lto_output): Call output_function even for declare_variant_alt
            nodes.
            * omp-general.c (omp_lto_output_declare_variant_alt,
            omp_lto_input_declare_variant_alt): New functions.
    gcc/lto/
            * lto-common.c (lto_fixup_prevailing_decls): Don't use
            LTO_NO_PREVAIL on TREE_LIST's TREE_PURPOSE.
            * lto-partition.c (lto_balanced_map): Treat declare_variant_alt
            nodes like definitions.
    libgomp/
            * testsuite/libgomp.c/declare-variant-1.c: New test.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug lto/96680] [11 Regression][OpenMP][LTO] Declare variant + ICE in lto_fixup_prevailing_decls, at lto/lto-common.c:2595
  2020-08-18 16:31 [Bug middle-end/96680] New: [11 Regression][OpenMP][LTO] Declare variant + ICE in lto_fixup_prevailing_decls, at lto/lto-common.c:2595 burnus at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-10-28  9:29 ` [Bug lto/96680] " cvs-commit at gcc dot gnu.org
@ 2020-11-26  9:57 ` burnus at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-11-26  9:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96680

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> ---
FIXED.
(At least this issues, declare variant support itself still is not complete.)

Thanks for the patch!

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-11-26  9:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18 16:31 [Bug middle-end/96680] New: [11 Regression][OpenMP][LTO] Declare variant + ICE in lto_fixup_prevailing_decls, at lto/lto-common.c:2595 burnus at gcc dot gnu.org
2020-08-18 16:42 ` [Bug middle-end/96680] " burnus at gcc dot gnu.org
2020-08-18 16:49 ` burnus at gcc dot gnu.org
2020-08-20 12:46 ` burnus at gcc dot gnu.org
2020-08-25 10:47 ` rguenth at gcc dot gnu.org
2020-10-16 12:03 ` rguenth at gcc dot gnu.org
2020-10-28  9:29 ` [Bug lto/96680] " cvs-commit at gcc dot gnu.org
2020-11-26  9:57 ` burnus at gcc dot gnu.org

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).