Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/17/84; site hao.UUCP
Path: utzoo!utcs!lsuc!pesnta!hplabs!hao!woods
From: woods@hao.UUCP (Greg Woods)
Newsgroups: net.lang.f77
Subject: Adjustable Arrays
Message-ID: <1386@hao.UUCP>
Date: Wed, 6-Mar-85 18:02:32 EST
Article-I.D.: hao.1386
Posted: Wed Mar  6 18:02:32 1985
Date-Received: Fri, 8-Mar-85 11:25:04 EST
Distribution: net
Organization: High Altitude Obs./NCAR, Boulder CO
Lines: 41


  I've run across what appears to be yet another bug in the 4.2BSD F77 
compiler, and I'm curious to see if the anyone else out there has seen this.
The code in question looks like:

      dimension buf(102,51),nbuf(5)
      nbuf(2)=102
      nbuf(3)=51
c
c  code here initializes the buf array
c
      write(6,*) buf
      call sub(buf,nbuf)
      stop
      end
      subroutine sub(buf,nbuf)
      dimension nbuf(5)
      dimension buf(nbuf(2),nbuf(3))
      write(6,*) buf
      return
      end

  The problem comes in when I attempt to use the elements of a dummy array
as variable dimension declarators for another dummy array. I did not find
anything in the standard which prohibits this; did I miss something? On our
VAX 11/750, this produces incorrect code, as the wrong values are written
inside the subroutine. The funny thing is, if I compile the subroutine
-g, it works properly.
   Questions: Why does it matter if I compile it -g? I was under the impression
that the generated code was the same except for the added symbol table. 
Second question: is this even legal according to the standard? Any comments
welcome.

--Greg
-- 
{ucbvax!hplabs | allegra!nbires | decvax!noao | harpo!seismo | ihnp4!noao}
       		        !hao!woods

CSNET: woods@NCAR  ARPA: woods%ncar@CSNET-RELAY
   
     "Please don't dominate the rap Jack, if you got nothing new to say..."