OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gfortran.dg/] [trim_1.f90] - Blame information for rev 399

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 302 jeremybenn
! { dg-do run }
2
 
3
! Torture-test TRIM and LEN_TRIM for correctness.
4
 
5
 
6
! Given a total string length and a trimmed length, construct an
7
! appropriate string and check gfortran gets it right.
8
 
9
SUBROUTINE check_trim (full_len, trimmed_len)
10
  IMPLICIT NONE
11
  INTEGER, INTENT(IN) :: full_len, trimmed_len
12
  CHARACTER(LEN=full_len) :: string
13
 
14
  string = ""
15
  IF (trimmed_len > 0) THEN
16
    string(trimmed_len:trimmed_len) = "x"
17
  END IF
18
 
19
  IF (LEN (string) /= full_len &
20
      .OR. LEN_TRIM (string) /= trimmed_len &
21
      .OR. LEN (TRIM (string)) /= trimmed_len &
22
      .OR. TRIM (string) /= string (1:trimmed_len)) THEN
23
    PRINT *, full_len, trimmed_len
24
    PRINT *, LEN (string), LEN_TRIM (string)
25
    CALL abort ()
26
  END IF
27
END SUBROUTINE check_trim
28
 
29
 
30
! The main program, check with various combinations.
31
 
32
PROGRAM main
33
  IMPLICIT NONE
34
  INTEGER :: i, j
35
 
36
  DO i = 0, 20
37
    DO j = 0, i
38
      CALL check_trim (i, j)
39
    END DO
40
  END DO
41
END PROGRAM main

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.