From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7522838432F2; Tue, 6 Dec 2022 22:23:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7522838432F2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670365413; bh=6baysZn5GiAZZNs3x4warmLhfZMql0NxsVPfVX+Uv60=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tR2jdizat8cyzN6UC2rrvTYXtItmwuQj2uPb3DxioG3XwD3+TuhgLJAohJUboYYaV FmVIq0lG2pVBrwDr6EBopUDQ89srnwUUiL3t/uRqzz5qRhEmQ3T4doZu9A4ShzFt+y fg1L43hqpp9d5B9j9Dow9p6Lm1RqkkMb5zaONg98= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/106856] [12/13 Regression][OOP] CLASS attribute handling / ICE in gfc_conv_expr_present, at fortran/trans-expr.cc:1977 since r12-4346-geb92cd57a1ebe7cd Date: Tue, 06 Dec 2022 22:23:32 +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: 13.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf 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: 12.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc attachments.created 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106856 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gcc dot gnu.org --- Comment #3 from anlauf at gcc dot gnu.org --- Created attachment 54030 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D54030&action=3Dedit Incremental patch The above patch on top of Tobias' initial one fixes some minor issues with it and improves the behavior for testcase class_75.f90 modified as follows: ! { dg-do compile } ! { dg-additional-options "-fcoarray=3Dsingle" } ! ! PR fortran/106856 ! ! ! subroutine foo(x,y) class(*), optional :: x, y optional :: x ! { dg-error "Duplicate OPTIONAL attribute" } target :: x allocatable :: x target :: x ! { dg-error "Duplicate TARGET attribute" } allocatable :: x ! { dg-error "Duplicate ALLOCATABLE attribute" } pointer :: y contiguous :: y pointer :: y ! { dg-error "Duplicate POINTER attribute" } contiguous :: y ! { dg-error "Duplicate CONTIGUOUS attribute" } dimension :: x(:,:) dimension :: y(:,:,:) codimension :: x[:] ! < duplicat error for dimension/codimension: TODO add decl. ! Currently gives an ICE :-( end Note that these patches "regress" as follows: - gfortran.dg/interface_41.f90 - this had a bogus error on valid code! (Removing the dg-error fixes it.) - gfortran.dg/pr69398.f90 - this ICEs due to the duplicate DIMENSION attrib= ute I tried to modify restore_old_symbol() to handle CLASS arrays, but then we ICE along a different path. Not sure if this is the right approach. Nevertheless, the patch as is already appears to be a great step forward!=