public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31318]  New: terminate program when un-allocated array is used
@ 2007-03-22 19:03 vivekrao4 at yahoo dot com
  2007-03-22 22:33 ` [Bug fortran/31318] Run-time check for using deallocated variables burnus at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: vivekrao4 at yahoo dot com @ 2007-03-22 19:03 UTC (permalink / raw)
  To: gcc-bugs

For the illegal code

integer, allocatable :: ivec(:)
print*,"shape(ivec)=",shape(ivec)
end

gcc version 4.3.0 20070315 (experimental)

gfortran -W -Wall -pedantic-errors -std=f2003 -fbounds-check -Werror
xshape_alloc.f90

gives

 shape(ivec)= 4298784

It would be nice if a run-time error message about the use of array that has
not been allocated were emitted. A fairly common mistake I make is to pass an
array that is allocatable in the caller, before having
allocated it, to a procedure as an argument which is
not allocatable. Within the procedure, applying SIZE
or SHAPE will give strange results.


-- 
           Summary: terminate program when un-allocated array is used
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vivekrao4 at yahoo dot com


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


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

* [Bug fortran/31318] Run-time check for using deallocated variables
  2007-03-22 19:03 [Bug fortran/31318] New: terminate program when un-allocated array is used vivekrao4 at yahoo dot com
@ 2007-03-22 22:33 ` burnus at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-03-22 22:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-03-22 22:32 -------
This is related to 29616 (same for nullified pointers). As the test is
essentially the same, I added a comment there and close this PR as duplicate.
Thanks for the idea though it will likely take a while until it will be
implemented.

*** This bug has been marked as a duplicate of 29616 ***


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |RESOLVED
           Keywords|                            |diagnostic
         Resolution|                            |DUPLICATE
            Summary|terminate program when un-  |Run-time check for using
                   |allocated array is used     |deallocated variables


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


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

end of thread, other threads:[~2007-03-22 22:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-22 19:03 [Bug fortran/31318] New: terminate program when un-allocated array is used vivekrao4 at yahoo dot com
2007-03-22 22:33 ` [Bug fortran/31318] Run-time check for using deallocated variables burnus at gcc dot gnu 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).