This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Strange error


On Tue, Jul 28, 2009 at 06:54:31PM +0200, giacomo `giotti` mariani wrote:
> Steve Kargl wrote:
> > On Tue, Jul 28, 2009 at 06:22:03PM +0200, giacomo `giotti` mariani wrote:
> >   
> >> Is it a bug or the right behavior of the compiler?
> >>
> >
> > It's a bug in your code.
> >
> > Your program is invalid Fortran, so a Fortran compiler can
> > do anything it wants with your code.
> >   
> You are completely right.
> I expressed my idea in the wrong way.
> I'd like to know if something similar to the "variable used
> uninitialized" exist for the "unallocated array" to help the programmer
> writing a better code.
> 

I'm not aware of any such option.  You could modify 
your code to do your on checking with the ALLOCATED
intrinsic.

module quelche
  real (8), allocatable, dimension (:,:) :: a
end module quelche

program provaalooc
  use quelche
  real (8), dimension (2) :: v1,v2
  if (.not. allocated(a)) then
     stop 'Unallocated array'
  end if
  v1=[1.0d0,2.0d0]
  write (*,*) v2
end program


  
-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]