This is the mail archive of the gcc-patches@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]

Re: [gfortran] Support for [...] style array constructors


Den 19.04 kl 23:53:44 skrev eedelman@acclab.helsinki.fi:
> I'll look into writing test cases to the testsuite soon. However,
> I will be a bit busy the next few days -- don't expect much to
> happen before the weekend.

After looking at a bunch of other test cases, and some trial and
error, I've come up with the test cases below.
br_array_constr_1.f90 adds 32 new "# of expected passes", and
br_array_constr_2.f90 adds 3.  If someone with better knowledge
than me on how this testsuite system is expected to work would
take the time and look at my test cases and either confirm that
they are OK, or tell me what's wrong with them, I would be most
grateful.


        Erik




2005-04-23 Erik Edelmann <erik.edelmann@iki.fi>

      * gfortran.dg/br_array_constr_1.f90: New test.
      * gfortran.dg/br_array_constr_2.f90: New test.



! { dg-do run }
! Check that [...] style array constructors work
program br_array_constr_1
    implicit none
    integer :: a(4), i
    a = [ 1, 2, 3, 4 ]  ! { dg-warning "New in Fortran 2003:" }
    do i = 1, size(a)
        if (a(i) /= i) call abort()
    end do
    a = [ (/ 1, 2, 3, 4 /) ]  ! { dg-warning "New in Fortran 2003:" }
    do i = 1, size(a)
        if (a(i) /= i) call abort()
    end do
end program br_array_constr_1




! { dg-do compile }
! Check that array constructor delimiters match
program br_array_constr_2
    implicit none
    integer :: a(4)
    a = (/ 1, 2, 3, 4 ] ! { dg-error "Syntax error in array constructor" }
    a = (/ [ 1, 2, 3, 4 /) ] ! { dg-error "Syntax error in array constructor" }
end program br_array_constr_2


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