From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 65CFA3858C3A; Mon, 7 Feb 2022 14:55:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 65CFA3858C3A From: "burnus at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: ice-on-valid-code, openmp X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc keywords Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Feb 2022 14:55:54 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102596 Tobias Burnus changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org Keywords| |ice-on-valid-code --- Comment #2 from Tobias Burnus --- The problem is that gfc_omp_clause_default_ctor requires outer !=3D NULL_TR= EE (gcc_assert).=20 (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 =3D 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 c= ode like: /* Reduction clause requires allocated ALLOCATABLE. */ if (OMP_CLAUSE_CODE (clause) !=3D OMP_CLAUSE_REDUCTION && OMP_CLAUSE_CODE (clause) !=3D OMP_CLAUSE_IN_REDUCTION && OMP_CLAUSE_CODE (clause) !=3D OMP_CLAUSE_TASK_REDUCTION) { gfc_init_block (&cond_block); ... tree tem =3D fold_convert (pvoid_type_node, GFC_DESCRIPTOR_TYPE_P (type) ? gfc_conv_descriptor_data_get (outer) : outer);/*...*/ cond =3D 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 =3D gfc_walk_alloc_comps (outer, decl, or=20 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.=20 (Does using OMP_CLAUSE_REDUCTION_PLACEHOLDER() make sense here?) =E2=80=94 = Or whether some is-always-used case (=E2=86=92 'cond' case) is needed as additional fl= ag or encoded in outer. PS: I don't think it is a real regression as 'reduction(task:' wasn't suppo= rted before.=