public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug fortran/99266] New: CLASS array/dimension handling does not work - when DIMENSION comes in an extra line @ 2021-02-25 10:43 burnus at gcc dot gnu.org 2021-02-25 10:46 ` [Bug fortran/99266] " burnus at gcc dot gnu.org 2021-02-25 11:10 ` burnus at gcc dot gnu.org 0 siblings, 2 replies; 3+ messages in thread From: burnus at gcc dot gnu.org @ 2021-02-25 10:43 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99266 Bug ID: 99266 Summary: CLASS array/dimension handling does not work - when DIMENSION comes in an extra line Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: ice-on-valid-code, rejects-valid Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org Target Milestone: --- Found when looking at PR99254 & PR99138. For 's2': f951: internal compiler error: find_array_spec(): Missing spec For 's1': Error: The SELECT RANK selector at (1) must be an assumed rank variable implicit none (type, external) integer :: a(5) call s1(a) call s2(a) contains !subroutine s1(x) ! class(*) :: x ! dimension :: x(..) ! select rank (y=>x) ! rank (1) ! ! OK ! rank(*) ! stop 1 ! end select !end subroutine s2(x) class(*) :: x dimension :: x(:) select type (y=>x) type is (integer) x(1) = 5 class default stop 1 end select end end ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/99266] CLASS array/dimension handling does not work - when DIMENSION comes in an extra line 2021-02-25 10:43 [Bug fortran/99266] New: CLASS array/dimension handling does not work - when DIMENSION comes in an extra line burnus at gcc dot gnu.org @ 2021-02-25 10:46 ` burnus at gcc dot gnu.org 2021-02-25 11:10 ` burnus at gcc dot gnu.org 1 sibling, 0 replies; 3+ messages in thread From: burnus at gcc dot gnu.org @ 2021-02-25 10:46 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99266 --- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> --- I tried to add to gfc_build_class_symbol: if (attr->class_ok && ((attr->allocatable && !ts->u.derived->components->attr.allocatable) || (attr->pointer && !ts->u.derived->components->attr.class_pointer) || (*as && !ts->u.derived->components->as) || (attr->dimension && !ts->u.derived->components->attr.dimension) || (attr->codimension && !ts->u.derived->components->attr.codimension))) attr->class_ok = 0; but that did not work - For 's2', dimension == 1 but *as == NULL !!! ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/99266] CLASS array/dimension handling does not work - when DIMENSION comes in an extra line 2021-02-25 10:43 [Bug fortran/99266] New: CLASS array/dimension handling does not work - when DIMENSION comes in an extra line burnus at gcc dot gnu.org 2021-02-25 10:46 ` [Bug fortran/99266] " burnus at gcc dot gnu.org @ 2021-02-25 11:10 ` burnus at gcc dot gnu.org 1 sibling, 0 replies; 3+ messages in thread From: burnus at gcc dot gnu.org @ 2021-02-25 11:10 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99266 --- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> --- subroutine foo(dummy) class(*) :: dummy allocatable :: dummy end gets rejected with: Error: ALLOCATABLE attribute conflicts with POINTER attribute at (1) The following is accepted, except after the patch proposed for PR99254: subroutine foo class(*) :: local allocatable :: local end The reason is how 'class_ok = ' is set. – And in general, the issue is due to how attributes are checked. NOTE: If attributes change after the symbol is used, we may create unused derived types, which is hopefully harmless. The following is also a bit odd: rank = !(*as) || (*as)->rank == -1 ? GFC_MAX_DIMENSIONS : (*as)->rank; why do become become scalars (as == NULL) rank = 15 but not coarray scalars rank == 0? Shouldn't this be: rank = (!(*as) ? 0 : (...rank == -1 ? ...MAX... : ...rank)) ? ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-25 11:10 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-02-25 10:43 [Bug fortran/99266] New: CLASS array/dimension handling does not work - when DIMENSION comes in an extra line burnus at gcc dot gnu.org 2021-02-25 10:46 ` [Bug fortran/99266] " burnus at gcc dot gnu.org 2021-02-25 11:10 ` 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).