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/114825] [11/12/13/14 Regression] Compiler error using gfortran and OpenMP since r5-1190
Date: Tue, 23 Apr 2024 14:57:42 +0000	[thread overview]
Message-ID: <bug-114825-4-P18jbB3SEC@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114825-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The difference between the failing program and a working program
(pointer-assignment in 'sub' comment out) is:

failing:
  'type' in gfc_omp_clause_default_ctor is '<record_type 0x7ffff7004930 t'

working:
  'type' is '<pointer_type 0x7ffff700a150 ... <record_type 0x7ffff7004930 t'

(and 'outer' is NULL in either case)

In the caller, i.e. lower_rec_input_clauses:
  working:
    p debug_tree(new_var) → <var_decl 0x7ffff720df30 d
  failing:
    p debug(new_var) → *d – i.e. with a memory dereference.

The reason is that gfc_omp_privatize_by_reference returns true in the
omp-low.cc's lower_rec_input_clauses call to it:

5737              else if (omp_privatize_by_reference (var)
5738                       && (c_kind != OMP_CLAUSE_FIRSTPRIVATE
5739                           || !OMP_CLAUSE_FIRSTPRIVATE_NO_REFERENCE (c)))



The problem is that:
      /* Array POINTER/ALLOCATABLE have aggregate types, all user variables
         that have POINTER_TYPE type and aren't scalar pointers, scalar
         allocatables, Cray pointees or C pointers are supposed to be
         privatized by reference.  */
      if (GFC_DECL_GET_SCALAR_POINTER (decl)
          || GFC_DECL_GET_SCALAR_ALLOCATABLE (decl)
          || GFC_DECL_CRAY_POINTEE (decl)
          || GFC_DECL_ASSOCIATE_VAR_P (decl)
          || VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl))))
        return false;
fails in the failing case – but works in the non-failing case – IHMO, it should
have matched the first item.

  parent reply	other threads:[~2024-04-23 14:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23 13:33 [Bug libgomp/114825] New: Compiler error using gfortran and OpenMP marcos.vanella at nist dot gov
2024-04-23 14:10 ` [Bug fortran/114825] [11/12/13/14 Regression] Compiler error using gfortran and OpenMP since r5-1190 jakub at gcc dot gnu.org
2024-04-23 14:57 ` burnus at gcc dot gnu.org [this message]
2024-04-23 15:18 ` jakub at gcc dot gnu.org
2024-04-24 16:27 ` jakub at gcc dot gnu.org
2024-04-25 18:15 ` cvs-commit at gcc dot gnu.org
2024-04-25 18:23 ` [Bug fortran/114825] [11/12/13 " jakub at gcc dot gnu.org
2024-05-09  4:26 ` cvs-commit at gcc dot gnu.org
2024-05-09  8:17 ` [Bug fortran/114825] [11/12 " 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-114825-4-P18jbB3SEC@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).