public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/50937] New: STAT option with ALLOCATE statement on large arrays
@ 2011-10-31 17:21 fwi at inducks dot org
  2011-10-31 18:06 ` [Bug fortran/50937] " kargl at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: fwi at inducks dot org @ 2011-10-31 17:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50937

             Bug #: 50937
           Summary: STAT option with ALLOCATE statement on large arrays
    Classification: Unclassified
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: fwi@inducks.org


I'm reporting something that looks like a bug, at least I can't imagine how
this behavior could be considered right, but I admit I haven't read the entire
C and Fortran specifications that gfortran is following.

When specifying the "STAT" option with the ALLOCATE statement, no error is
returned for some extremely large arrays that obviously can not fit into
memory.

test.f90:

  PROGRAM MAIN
  IMPLICIT NONE
  DOUBLE PRECISION, ALLOCATABLE :: E(:,:,:,:)
  INTEGER :: N, ierr
  CHARACTER(LEN=32) :: arg
  CALL get_command_argument(1, arg)
  READ(arg,*) N
  ALLOCATE(E(N,N,N,N),STAT=ierr)
  IF (ierr/=0) THEN
    PRINT *,'Could not allocate array of size ',N,'**4, error code=', ierr
  ELSE
    PRINT *,'Sucesfully allocated array of size ',N,'**4'
    E(N,N,N,N)=1.0D0
    DEALLOCATE(E)
  ENDIF
  END PROGRAM MAIN

Run with:

$ gfortran test.f90; for i in `seq -w 10 10 400`; do ./a.out $i; done
 Sucesfully allocated array of size           10 **4
 Sucesfully allocated array of size           20 **4
 Sucesfully allocated array of size           30 **4
 Sucesfully allocated array of size           40 **4
 Sucesfully allocated array of size           50 **4
 Sucesfully allocated array of size           60 **4
 Sucesfully allocated array of size           70 **4
 Sucesfully allocated array of size           80 **4
 Sucesfully allocated array of size           90 **4
 Sucesfully allocated array of size          100 **4
 Sucesfully allocated array of size          110 **4
 Sucesfully allocated array of size          120 **4
 Could not allocate array of size          130 **4, error code=        5014
 Could not allocate array of size          140 **4, error code=        5014
 Could not allocate array of size          150 **4, error code=        5014
 Sucesfully allocated array of size          160 **4
 Could not allocate array of size          170 **4, error code=        5014
 Could not allocate array of size          180 **4, error code=        5014
 Sucesfully allocated array of size          190 **4
 Could not allocate array of size          200 **4, error code=        5014
 Could not allocate array of size          210 **4, error code=        5014
 Sucesfully allocated array of size          220 **4
 Sucesfully allocated array of size          230 **4
 Sucesfully allocated array of size          240 **4
 Sucesfully allocated array of size          250 **4
 Could not allocate array of size          260 **4, error code=        5014


It's obvious that on my 3Gb-RAM machine, the 250**4 array was NOT allocated.


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-11-01 12:01 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-31 17:21 [Bug fortran/50937] New: STAT option with ALLOCATE statement on large arrays fwi at inducks dot org
2011-10-31 18:06 ` [Bug fortran/50937] " kargl at gcc dot gnu.org
2011-10-31 18:16 ` fwi at inducks dot org
2011-10-31 18:25 ` jb at gcc dot gnu.org
2011-10-31 18:29 ` fwi at inducks dot org
2011-10-31 19:02 ` jb at gcc dot gnu.org
2011-10-31 19:26 ` fwi at inducks dot org
2011-10-31 19:51 ` sgk at troutmask dot apl.washington.edu
2011-10-31 20:18 ` fwi at inducks dot org
2011-10-31 21:03 ` sgk at troutmask dot apl.washington.edu
2011-11-01  7:55 ` jb at gcc dot gnu.org
2011-11-01 12:01 ` fwi at inducks dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).