OSDN Git Service

2010-07-29 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / char_length_1.f90
1 ! { dg-do compile }
2 ! { dg-options "-Wall -std=f2003" }
3 ! Tests the patch for PR27996 and PR27998, in which warnings
4 ! or errors were not emitted when the length of character
5 ! constants was changed silently.
6 !
7 ! Contributed by Tobias Burnus <tobias.burnus@physik.fu-berlin.de> 
8 !
9 program test
10   implicit none
11   character(10) :: a(3)
12   character(10) :: b(3)= &
13        (/ 'Takata ', 'Tanaka', 'Hayashi' /) ! { dg-error "Different CHARACTER" }
14   character(4) :: c = "abcde"  ! { dg-warning "being truncated" }
15   a =  (/ 'Takata', 'Tanaka ', 'Hayashi' /) ! { dg-error "Different CHARACTER" }
16   a =  (/ 'Takata ', 'Tanaka ', 'Hayashi' /)
17   b = "abc" ! { dg-error "no IMPLICIT" }
18   c = "abcdefg"   ! { dg-warning "will be truncated" }
19 end program test