public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/94874] New: [OpenMP] Unhelpful 'defaultmap(none)' diagnostic for 'DECL_ARTIFICIAL': 'error: ‘array_li.0’ not specified in enclosing ‘target’'
@ 2020-04-30 10:48 tschwinge at gcc dot gnu.org
  2020-04-30 10:49 ` [Bug middle-end/94874] " tschwinge at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2020-04-30 10:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94874
           Summary: [OpenMP] Unhelpful 'defaultmap(none)' diagnostic for
                    'DECL_ARTIFICIAL': 'error: ‘array_li.0’ not specified
                    in enclosing ‘target’'
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: openmp
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tschwinge at gcc dot gnu.org
                CC: burnus at gcc dot gnu.org, jakub at gcc dot gnu.org
  Target Milestone: ---

Created attachment 48417
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48417&action=edit
'gcc/testsuite/c-c++-common/gomp/pr.c'

[...]/pr.c:24:37: error: ‘array_li.0’ not specified in enclosing ‘target’
       24 |     array_so_openmp_target = sizeof array;
          |                              ~~~~~~~^~~~~

I suppose for all such compiler-generated ('DECL_ARTIFICIAL') objects, we
shouldn't generate 'default(none)'/'defaultmap(none)' diagnostics, but instead
make them available on the offloading device in the "best possible" way.  (...,
which probably defaults to 'firstprivate' given that these are typically
small-size objects?)  (Regarding the latter, see also
'gcc/gimplify.c:omp_shared_to_firstprivate_optimizable_decl_p', which applies
similar rationale regarding "large decls".)

Also, for conceptual simplicity, I suppose any such compiler-generated
('DECL_ARTIFICIAL') objects should in some way be marked up with 'firstprivate'
clauses "explicitly by the compiler" when they are created, instead of having
'omp_default_clause' etc. do that.  (I have not studied that in detail.)  My
inclination would be to put an 'gcc_assert (!DECL_ARTIFICIAL(decl))' there? 
But maybe that's too hard.  Also need to sort out how that relates to
'lang_hooks.decls.omp_predetermined_sharing' etc.


Back to the diagnostic here, for '-x c++' we get, worse:

    [...]/pr.c:24:28: error: ‘’ not specified in enclosing ‘target’
       24 |     array_so_openmp_target = sizeof array;
          |     ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~

(Notice the empty '‘’'.)  Per GDB:

    Breakpoint 1, omp_notice_variable (ctx=0x2d2fc10,
decl=decl@entry=0x7ffff7feee10, in_code=in_code@entry=true) at
[...]/source-gcc/gcc/gimplify.c:7487
    7487                          error ("%qE not specified in enclosing
%<target%>",
    (gdb) print d
    $1 = (tree) 0x7ffff7feee10
    (gdb) call debug_tree(d)
     <var_decl 0x7ffff7feee10 D.2560
        type <integer_type 0x7ffff67c3150 ssizetype public DI
            size <integer_cst 0x7ffff67a5e70 constant 64>
            unit-size <integer_cst 0x7ffff67a5e88 constant 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff67c3150 precision:64 min <integer_cst 0x7ffff67a5000
-9223372036854775808> max <integer_cst 0x7ffff67a5f00 9223372036854775807>>
        used ignored DI [...]/pr.c:8:23 size <integer_cst 0x7ffff67a5e70 64>
unit-size <integer_cst 0x7ffff67a5e88 8>
        align:64 warn_if_not_align:0 context <function_decl 0x7ffff6933d00
vla>>
    (gdb) print d.decl_minimal.name
    $2 = (tree) 0x0

Doing something like 'gcc/fortran/trans-openmp.c:gfc_omp_report_decl' doesn't
easily help here, because:

    (gdb) print d.decl_common.artificial_flag
    $3 = 1
    (gdb) print d.decl_common.lang_specific
    $4 = (lang_decl *) 0x0

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

* [Bug middle-end/94874] [OpenMP] Unhelpful 'defaultmap(none)' diagnostic for 'DECL_ARTIFICIAL': 'error: ‘array_li.0’ not specified in enclosing ‘target’'
  2020-04-30 10:48 [Bug middle-end/94874] New: [OpenMP] Unhelpful 'defaultmap(none)' diagnostic for 'DECL_ARTIFICIAL': 'error: ‘array_li.0’ not specified in enclosing ‘target’' tschwinge at gcc dot gnu.org
@ 2020-04-30 10:49 ` tschwinge at gcc dot gnu.org
  2020-04-30 10:54 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2020-04-30 10:49 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Schwinge <tschwinge at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |burnus at gcc dot gnu.org
   Last reconfirmed|                            |2020-04-30
     Ever confirmed|0                           |1

--- Comment #1 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
Tobias, will you please familiarize yourself with this topic.

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

* [Bug middle-end/94874] [OpenMP] Unhelpful 'defaultmap(none)' diagnostic for 'DECL_ARTIFICIAL': 'error: ‘array_li.0’ not specified in enclosing ‘target’'
  2020-04-30 10:48 [Bug middle-end/94874] New: [OpenMP] Unhelpful 'defaultmap(none)' diagnostic for 'DECL_ARTIFICIAL': 'error: ‘array_li.0’ not specified in enclosing ‘target’' tschwinge at gcc dot gnu.org
  2020-04-30 10:49 ` [Bug middle-end/94874] " tschwinge at gcc dot gnu.org
@ 2020-04-30 10:54 ` jakub at gcc dot gnu.org
  2020-05-08  7:40 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-30 10:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This is something that is handled by
lang_hooks.decls.omp_predetermined_sharing
some FEs need to treat all DECL_ARTIFICIAL decls that way, others perhaps a
subset of them.

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

* [Bug middle-end/94874] [OpenMP] Unhelpful 'defaultmap(none)' diagnostic for 'DECL_ARTIFICIAL': 'error: ‘array_li.0’ not specified in enclosing ‘target’'
  2020-04-30 10:48 [Bug middle-end/94874] New: [OpenMP] Unhelpful 'defaultmap(none)' diagnostic for 'DECL_ARTIFICIAL': 'error: ‘array_li.0’ not specified in enclosing ‘target’' tschwinge at gcc dot gnu.org
  2020-04-30 10:49 ` [Bug middle-end/94874] " tschwinge at gcc dot gnu.org
  2020-04-30 10:54 ` jakub at gcc dot gnu.org
@ 2020-05-08  7:40 ` burnus at gcc dot gnu.org
  2020-05-13  9:44 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-05-08  7:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Using
// here: float array[array_li];
...
//#pragma omp target defaultmap(none)  map(from:array_so_openmp_target)
#pragma omp parallel default(none)  shared(array_so_openmp_target)
    array_so_openmp_target = sizeof array;

Shows that the latter works – with an implicit 'firstprivate(array_li.0)' while
the former has no firstprivate and fails.

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

* [Bug middle-end/94874] [OpenMP] Unhelpful 'defaultmap(none)' diagnostic for 'DECL_ARTIFICIAL': 'error: ‘array_li.0’ not specified in enclosing ‘target’'
  2020-04-30 10:48 [Bug middle-end/94874] New: [OpenMP] Unhelpful 'defaultmap(none)' diagnostic for 'DECL_ARTIFICIAL': 'error: ‘array_li.0’ not specified in enclosing ‘target’' tschwinge at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-05-08  7:40 ` burnus at gcc dot gnu.org
@ 2020-05-13  9:44 ` burnus at gcc dot gnu.org
  2020-06-03 10:31 ` cvs-commit at gcc dot gnu.org
  2020-06-03 10:44 ` burnus at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-05-13  9:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://github.com/OpenMP/s
                   |                            |pec/issues/2155

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
See comments in https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545594.html

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

* [Bug middle-end/94874] [OpenMP] Unhelpful 'defaultmap(none)' diagnostic for 'DECL_ARTIFICIAL': 'error: ‘array_li.0’ not specified in enclosing ‘target’'
  2020-04-30 10:48 [Bug middle-end/94874] New: [OpenMP] Unhelpful 'defaultmap(none)' diagnostic for 'DECL_ARTIFICIAL': 'error: ‘array_li.0’ not specified in enclosing ‘target’' tschwinge at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-05-13  9:44 ` burnus at gcc dot gnu.org
@ 2020-06-03 10:31 ` cvs-commit at gcc dot gnu.org
  2020-06-03 10:44 ` burnus at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-03 10:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:93535a2b40367e6f68433295b37dc52c0e9c2c55

commit r11-873-g93535a2b40367e6f68433295b37dc52c0e9c2c55
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Wed Jun 3 12:28:25 2020 +0200

    [OpenMP] Fix mapping of artificial variables (PR94874)

    gcc/c-family/ChangeLog:

            * c-common.h (c_omp_predetermined_mapping): Declare.
            * c-omp.c (c_omp_predetermined_mapping): New.

    gcc/c/ChangeLog:

            * c-objc-common.h (LANG_HOOKS_OMP_PREDETERMINED_MAPPING): Redefine.

    gcc/cp/ChangeLog:

            * cp-gimplify.c (cxx_omp_predetermined_mapping): New.
            * cp-objcp-common.h (LANG_HOOKS_OMP_PREDETERMINED_MAPPING):
Redfine.
            * cp-tree.h (cxx_omp_predetermined_mapping): Declare.

    gcc/fortran/ChangeLog:

            * f95-lang.c (LANG_HOOKS_OMP_PREDETERMINED_MAPPING): Redefine.
            * trans-openmp.c (gfc_omp_predetermined_mapping): New.
            * trans.h (gfc_omp_predetermined_mapping): Declare.

    gcc/ChangeLog:

            * gimplify.c (omp_notice_variable): Use new hook.
            * langhooks-def.h (lhd_omp_predetermined_mapping): Declare.
            (LANG_HOOKS_OMP_PREDETERMINED_MAPPING): Define
            (LANG_HOOKS_DECLS): Add it.
            * langhooks.c (lhd_omp_predetermined_sharing): Remove bogus unused
attr.
            (lhd_omp_predetermined_mapping): New.
            * langhooks.h (struct lang_hooks_for_decls): Add new hook.

    gcc/testsuite/ChangeLog
    2020-06-03  Thomas Schwinge  <thomas@codesourcery.com>
                Tobias Burnus  <tobias@codesourcery.com>

            PR middle-end/94874
            * c-c++-common/gomp/pr94874.c: New.

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

* [Bug middle-end/94874] [OpenMP] Unhelpful 'defaultmap(none)' diagnostic for 'DECL_ARTIFICIAL': 'error: ‘array_li.0’ not specified in enclosing ‘target’'
  2020-04-30 10:48 [Bug middle-end/94874] New: [OpenMP] Unhelpful 'defaultmap(none)' diagnostic for 'DECL_ARTIFICIAL': 'error: ‘array_li.0’ not specified in enclosing ‘target’' tschwinge at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-06-03 10:31 ` cvs-commit at gcc dot gnu.org
@ 2020-06-03 10:44 ` burnus at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-06-03 10:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Finally fixed.

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

end of thread, other threads:[~2020-06-03 10:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30 10:48 [Bug middle-end/94874] New: [OpenMP] Unhelpful 'defaultmap(none)' diagnostic for 'DECL_ARTIFICIAL': 'error: ‘array_li.0’ not specified in enclosing ‘target’' tschwinge at gcc dot gnu.org
2020-04-30 10:49 ` [Bug middle-end/94874] " tschwinge at gcc dot gnu.org
2020-04-30 10:54 ` jakub at gcc dot gnu.org
2020-05-08  7:40 ` burnus at gcc dot gnu.org
2020-05-13  9:44 ` burnus at gcc dot gnu.org
2020-06-03 10:31 ` cvs-commit at gcc dot gnu.org
2020-06-03 10:44 ` 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).