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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [negative_automatic_size.f90] - Blame information for rev 694

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do run }
2
! { dg-options "-O2" }
3
! Tests the fix PR29451, in which the negative size of the
4
! automatic array 'jello' was not detected and the
5
! runtime error: Attempt to allocate a negative amount of memory
6
! resulted.
7
!
8
! Contributed by Philip Mason  
9
!
10
program fred
11
  call jackal (1, 0)
12
  call jackal (2, 1)
13
  call jackal (3, 0)
14
end
15
 
16
subroutine jackal (b, c)
17
  integer :: b, c
18
  integer :: jello(b:c), cake(1:2, b:c), soda(b:c, 1:2)
19
  if (lbound (jello, 1) <= ubound (jello, 1)) call abort ()
20
  if (size (jello) /= 0) call abort ()
21
 
22
  if (.not.any(lbound (cake) <= ubound (cake))) call abort ()
23
  if (size (cake) /= 0) call abort ()
24
 
25
  if ((lbound (soda, 1) > ubound (soda, 1)) .and. &
26
      (lbound (soda, 2) > ubound (soda, 2))) call abort ()
27
  if (size (soda) /= 0) call abort ()
28
 
29
end subroutine jackal

powered by: WebSVN 2.1.0

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