https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106856
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=54030&action=edit 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=single" } ! ! 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 attribute 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!