This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/83548] [6/7/8 Regression] Compilation Error using logical function in parameter


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

--- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Fri, Dec 22, 2017 at 06:07:47PM +0000, kargl at gcc dot gnu.org wrote:
>
> This is caused by the patch that allowed a type-spec
> in an array constructor.  There is special-case code in
> match.c(gfc_match_type_spec) lines 2112-2207 that
> checks for something like
> 
>   x(4) = [real :: 1., 2. ]
> 
> versus
> 
>   x(4) = [real(1), real(2)]
> 
> It seems that the person who wrote that code overlooked
> that there is a conflict between logical, the type, and
> logical, the intrinsic procedure.
> 

The obvious work around is

program testit

   integer, parameter :: n = 2
   logical(kind=1), parameter ::  a(n) = [ .true._1,  .false._1 ]

    do k=1,n
       write(6,*) ' a = ', k, a(k)
    end do

end program testit

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]