public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/95551] New: [OpenMP, OpenACC] -fopenmp/-fopenacc also with -foffload=disable fails with: (.gnu.offload_vars+0x0): undefined reference to `A.10.2'
@ 2020-06-05 10:06 burnus at gcc dot gnu.org
  2020-06-05 10:09 ` [Bug middle-end/95551] " burnus at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-06-05 10:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95551
           Summary: [OpenMP, OpenACC] -fopenmp/-fopenacc also with
                    -foffload=disable fails with: (.gnu.offload_vars+0x0):
                    undefined reference to `A.10.2'
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: openacc, openmp, wrong-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

Loosely related to PR 95550 (for a variant of this test case, which fails with
an ICE).

The following test case fails to compile with -fopenmp or -fopenacc with:
   (.gnu.offload_vars+0x0): undefined reference to `A.10.2'
at least when offloading to AMDGCN (for nvidia, one runs into PR 65181) and
also with "-foffload=disable -O3".

Note: In order to reproduce this issue, an offloading compiler has to be
configured (configure-time set ENABLE_OFFLOADING has to evaluate to true) as
otherwise no .gnu.offload_vars is generated.


program main
  implicit none (type, external)
  integer :: j
  integer, allocatable :: A(:)

  A = [(3*j, j=1, 10)]
  call bar (A)
  deallocate (A)
contains
  subroutine bar (array)
    integer :: i
    integer :: array(:)

    !$omp target map(from:array)
    !$acc parallel copyout(array)
    array = [(-2*i, i = 1, size(array))]
    !$omp do private(array)
    !$acc loop gang private(array)
    do i = 1, 10
      array(i) = 9*i
    end do
    if (any (array /= [(-2*i, i = 1, 10)])) error stop 2
    !$omp end target
    !$acc end parallel
  end subroutine bar
end

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

* [Bug middle-end/95551] [OpenMP, OpenACC] -fopenmp/-fopenacc also with -foffload=disable fails with: (.gnu.offload_vars+0x0): undefined reference to `A.10.2'
  2020-06-05 10:06 [Bug middle-end/95551] New: [OpenMP, OpenACC] -fopenmp/-fopenacc also with -foffload=disable fails with: (.gnu.offload_vars+0x0): undefined reference to `A.10.2' burnus at gcc dot gnu.org
@ 2020-06-05 10:09 ` burnus at gcc dot gnu.org
  2020-06-05 13:50 ` burnus at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-06-05 10:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |94848

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
See also PR 94848 – the error is slightly different but similar enough that it
might have the same cause.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94848
[Bug 94848] [Offloading][LTO] error due to only partially eliminated var /
-ftree-pre causes link errors |  libgomp.fortran/use_device_ptr-optional-3.f90
failures

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

* [Bug middle-end/95551] [OpenMP, OpenACC] -fopenmp/-fopenacc also with -foffload=disable fails with: (.gnu.offload_vars+0x0): undefined reference to `A.10.2'
  2020-06-05 10:06 [Bug middle-end/95551] New: [OpenMP, OpenACC] -fopenmp/-fopenacc also with -foffload=disable fails with: (.gnu.offload_vars+0x0): undefined reference to `A.10.2' burnus at gcc dot gnu.org
  2020-06-05 10:09 ` [Bug middle-end/95551] " burnus at gcc dot gnu.org
@ 2020-06-05 13:50 ` burnus at gcc dot gnu.org
  2020-06-05 14:33 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-06-05 13:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #0)
>     if (any (array /= [(-2*i, i = 1, 10)])) error stop 2

The A.10.2 is the array {-2,-4,...,-20} in static memory, which has been
removed with -O3 but there is still:

.offload_var_table:
        .quad   A.10.2

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

* [Bug middle-end/95551] [OpenMP, OpenACC] -fopenmp/-fopenacc also with -foffload=disable fails with: (.gnu.offload_vars+0x0): undefined reference to `A.10.2'
  2020-06-05 10:06 [Bug middle-end/95551] New: [OpenMP, OpenACC] -fopenmp/-fopenacc also with -foffload=disable fails with: (.gnu.offload_vars+0x0): undefined reference to `A.10.2' burnus at gcc dot gnu.org
  2020-06-05 10:09 ` [Bug middle-end/95551] " burnus at gcc dot gnu.org
  2020-06-05 13:50 ` burnus at gcc dot gnu.org
@ 2020-06-05 14:33 ` jakub at gcc dot gnu.org
  2020-06-08 10:50 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-06-05 14:33 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Before IPA, we should be able to optimize away variables even if they are
marked declare target to, as long as we optimize them away completely (i.e.
neither the offloaded code nor host code will refer to them in any way), which
suggests that perhaps we should be populating the variable and function tables
for offloading later than we do now (basically immediately before IPA), but
also once we enter something into the tables, we should mark those as being
used such that e.g. IPA passes or anything later will not really optimize them
away.

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

* [Bug middle-end/95551] [OpenMP, OpenACC] -fopenmp/-fopenacc also with -foffload=disable fails with: (.gnu.offload_vars+0x0): undefined reference to `A.10.2'
  2020-06-05 10:06 [Bug middle-end/95551] New: [OpenMP, OpenACC] -fopenmp/-fopenacc also with -foffload=disable fails with: (.gnu.offload_vars+0x0): undefined reference to `A.10.2' burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-06-05 14:33 ` jakub at gcc dot gnu.org
@ 2020-06-08 10:50 ` burnus at gcc dot gnu.org
  2020-06-08 21:25 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-06-08 10:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
See RFC patch at
https://gcc.gnu.org/pipermail/gcc-patches/2020-June/547500.html
→ Don't add read-only artificial variables to the offload table (no need to)

And see experimental (but not working) patch regarding the stream out, which
highlights a state issue regarding host vs. target:
→ LTO stream out (array still present) and
host part (array already gone with -O3)
→ https://gcc.gnu.org/pipermail/gcc-patches/2020-June/547502.html

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

* [Bug middle-end/95551] [OpenMP, OpenACC] -fopenmp/-fopenacc also with -foffload=disable fails with: (.gnu.offload_vars+0x0): undefined reference to `A.10.2'
  2020-06-05 10:06 [Bug middle-end/95551] New: [OpenMP, OpenACC] -fopenmp/-fopenacc also with -foffload=disable fails with: (.gnu.offload_vars+0x0): undefined reference to `A.10.2' burnus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-06-08 10:50 ` burnus at gcc dot gnu.org
@ 2020-06-08 21:25 ` cvs-commit at gcc dot gnu.org
  2020-06-15  9:07 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-08 21:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:1c0fdaf79e3618fd7512608a2e5c62b6b306e9e8

commit r11-1075-g1c0fdaf79e3618fd7512608a2e5c62b6b306e9e8
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Mon Jun 8 23:24:57 2020 +0200

    openmp: ensure variables in offload table are streamed out (PRs 94848 +
95551)

    gcc/ChangeLog:

            PR lto/94848
            PR middle-end/95551
            * omp-offload.c (add_decls_addresses_to_decl_constructor,
            omp_finish_file): Skip removed items.
            * lto-cgraph.c (output_offload_tables): Likewise; set force_output
            to this node for variables and functions.

    libgomp/ChangeLog:

            PR lto/94848
            PR middle-end/95551
            * testsuite/libgomp.fortran/target-var.f90: New test.

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

* [Bug middle-end/95551] [OpenMP, OpenACC] -fopenmp/-fopenacc also with -foffload=disable fails with: (.gnu.offload_vars+0x0): undefined reference to `A.10.2'
  2020-06-05 10:06 [Bug middle-end/95551] New: [OpenMP, OpenACC] -fopenmp/-fopenacc also with -foffload=disable fails with: (.gnu.offload_vars+0x0): undefined reference to `A.10.2' burnus at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-06-08 21:25 ` cvs-commit at gcc dot gnu.org
@ 2020-06-15  9:07 ` cvs-commit at gcc dot gnu.org
  2020-06-15  9:11 ` burnus at gcc dot gnu.org
  2020-06-15  9:11 ` burnus at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-15  9:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Tobias Burnus
<burnus@gcc.gnu.org>:

https://gcc.gnu.org/g:9074deee2c5039ff26c8587cc598bc658d8ff32f

commit r10-8305-g9074deee2c5039ff26c8587cc598bc658d8ff32f
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Mon Jun 8 23:24:57 2020 +0200

    openmp: ensure variables in offload table are streamed out (PRs 94848 +
95551)

    gcc/ChangeLog:

            PR lto/94848
            PR middle-end/95551
            * omp-offload.c (add_decls_addresses_to_decl_constructor,
            omp_finish_file): Skip removed items.
            * lto-cgraph.c (output_offload_tables): Likewise; set force_output
            to this node for variables and functions.

    libgomp/ChangeLog:

            PR lto/94848
            PR middle-end/95551
            * testsuite/libgomp.fortran/target-var.f90: New test.

    (cherry picked from commit 1c0fdaf79e3618fd7512608a2e5c62b6b306e9e8)

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

* [Bug middle-end/95551] [OpenMP, OpenACC] -fopenmp/-fopenacc also with -foffload=disable fails with: (.gnu.offload_vars+0x0): undefined reference to `A.10.2'
  2020-06-05 10:06 [Bug middle-end/95551] New: [OpenMP, OpenACC] -fopenmp/-fopenacc also with -foffload=disable fails with: (.gnu.offload_vars+0x0): undefined reference to `A.10.2' burnus at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-06-15  9:07 ` cvs-commit at gcc dot gnu.org
@ 2020-06-15  9:11 ` burnus at gcc dot gnu.org
  2020-06-15  9:11 ` burnus at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-06-15  9:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Seemingly, I forgot the PR .../* in the commit. Hence, the follow-up commits
were now recorded here:
https://gcc.gnu.org/pipermail/gcc-patches/2020-June/547641.html

GCC mainline: https://gcc.gnu.org/g:bf4ab2689bb586971d5b2ab6b13d078cd7ac45af
GCC 10: https://gcc.gnu.org/g:0a76844b5d2db59768835318d001aa6548265cd1

    openmp: ensure variables in offload table are streamed out (PRs 94848 +
95551)

    gcc/ChangeLog:

            * omp-offload.c (add_decls_addresses_to_decl_constructor,
            omp_finish_file): With in_lto_p, stream out all offload-table
            items even if the symtab_node does not exist.

Close as FIXED. – Follow up: PR95583.

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

* [Bug middle-end/95551] [OpenMP, OpenACC] -fopenmp/-fopenacc also with -foffload=disable fails with: (.gnu.offload_vars+0x0): undefined reference to `A.10.2'
  2020-06-05 10:06 [Bug middle-end/95551] New: [OpenMP, OpenACC] -fopenmp/-fopenacc also with -foffload=disable fails with: (.gnu.offload_vars+0x0): undefined reference to `A.10.2' burnus at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2020-06-15  9:11 ` burnus at gcc dot gnu.org
@ 2020-06-15  9:11 ` burnus at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-06-15  9:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95551
Bug 95551 depends on bug 94848, which changed state.

Bug 94848 Summary: [Offloading][LTO] error due to only partially eliminated var / -ftree-pre causes link errors |  libgomp.fortran/use_device_ptr-optional-3.f90 failures
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94848

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

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

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

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-05 10:06 [Bug middle-end/95551] New: [OpenMP, OpenACC] -fopenmp/-fopenacc also with -foffload=disable fails with: (.gnu.offload_vars+0x0): undefined reference to `A.10.2' burnus at gcc dot gnu.org
2020-06-05 10:09 ` [Bug middle-end/95551] " burnus at gcc dot gnu.org
2020-06-05 13:50 ` burnus at gcc dot gnu.org
2020-06-05 14:33 ` jakub at gcc dot gnu.org
2020-06-08 10:50 ` burnus at gcc dot gnu.org
2020-06-08 21:25 ` cvs-commit at gcc dot gnu.org
2020-06-15  9:07 ` cvs-commit at gcc dot gnu.org
2020-06-15  9:11 ` burnus at gcc dot gnu.org
2020-06-15  9:11 ` 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).