public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/102596] [11/12 Regression] ICE in gfc_omp_clause_default_ctor, at fortran/trans-openmp.c:713 since r11-4883-ge929ef532ad52cde
Date: Mon, 07 Feb 2022 14:55:54 +0000	[thread overview]
Message-ID: <bug-102596-4-inFHFPkHbt@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102596-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
           Keywords|                            |ice-on-valid-code

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The problem is that gfc_omp_clause_default_ctor requires outer != NULL_TREE
(gcc_assert). 

(C++ does ignore the last argument and C uses the hook_tree_tree_tree_tree_null
fallback.)

That is used in Fortran for:
  /* Allocatable arrays and scalars in PRIVATE clauses need to be set to
     "not currently allocated" allocation status if outer
     array is "not currently allocated", otherwise should be allocated.  */

But omp-low.cc has:
                  x = lang_hooks.decls.omp_clause_default_ctor
                                (c, unshare_expr (new_var),
                                 cond ? NULL_TREE
                                 : build_outer_var_ref (var, ctx));
Note the NULL_TREE.


My impression is that NULL_TREE is fine for reduction - and there is also code
like:


  /* Reduction clause requires allocated ALLOCATABLE.  */
  if (OMP_CLAUSE_CODE (clause) != OMP_CLAUSE_REDUCTION
      && OMP_CLAUSE_CODE (clause) != OMP_CLAUSE_IN_REDUCTION
      && OMP_CLAUSE_CODE (clause) != OMP_CLAUSE_TASK_REDUCTION)
    {
      gfc_init_block (&cond_block);
...
      tree tem = fold_convert (pvoid_type_node,
                               GFC_DESCRIPTOR_TYPE_P (type)
                               ? gfc_conv_descriptor_data_get (outer) :
outer);/*...*/
      cond = fold_build2_loc (input_location, NE_EXPR, logical_type_node,
                              tem, null_pointer_node);


However - there is other code which uses 'outer' like:
      tree tem = gfc_walk_alloc_comps (outer, decl,
or 
      gfc_add_modify (&cond_block, decl, outer);
and those make use of 'outer'.

I don't quickly see whether outer is always required or it can be deduced in
this case. 
(Does using OMP_CLAUSE_REDUCTION_PLACEHOLDER() make sense here?) — Or whether
some is-always-used case (→ 'cond' case) is needed as additional flag or
encoded in outer.


PS: I don't think it is a real regression as 'reduction(task:' wasn't supported
before.

  parent reply	other threads:[~2022-02-07 14:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-04 18:42 [Bug fortran/102596] New: [11/12 Regression] ICE in gfc_omp_clause_default_ctor, at fortran/trans-openmp.c:713 gscfq@t-online.de
2021-10-04 20:58 ` [Bug fortran/102596] " pinskia at gcc dot gnu.org
2021-10-11  8:19 ` [Bug fortran/102596] [11/12 Regression] ICE in gfc_omp_clause_default_ctor, at fortran/trans-openmp.c:713 since r11-4883-ge929ef532ad52cde marxin at gcc dot gnu.org
2022-01-20  9:24 ` rguenth at gcc dot gnu.org
2022-02-07 14:55 ` burnus at gcc dot gnu.org [this message]
2022-04-21  7:50 ` rguenth at gcc dot gnu.org
2023-05-29 10:05 ` [Bug fortran/102596] [11/12/13/14 " jakub at gcc dot gnu.org

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=bug-102596-4-inFHFPkHbt@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).