Path: utzoo!attcan!uunet!tektronix!orca!tekecs!frip!andrew From: andrew@frip.gwd.tek.com (Andrew Klossner) Newsgroups: comp.unix.wizards Subject: Re: How FORTRAN allocates addresses for COMMON blocks? Message-ID: <10197@tekecs.TEK.COM> Date: 26 Jul 88 16:18:35 GMT References: <16593@brl-adm.ARPA> Sender: news@tekecs.TEK.COM Organization: Tektronix, Wilsonville, Oregon Lines: 34 [] "Does anybody out there have any idea how the different FORTRAN compilers for UNIX assign addresses to COMMON blocks?" Unix compilers don't assign addresses to COMMON blocks. The loader does this. It does not guarantee any particular order on those blocks, and the programmer cannot depend on an order. One way to force an order to common blocks is to create an assembly file which establishes the contents of those blocks in a particular order and exports them. Your example: COMMON /A/ IA(1) COMMON /B/ IAVAIL(99),LWRD might give rise to an ordering assembly file such as the following: .data .global _A_ _A_: .long 1 /* IA(1) */ .global _B_ _B_: .long 99 /* IAVAIL(99) */ .long 1 /* LWRD */ (Your assembler pseudo-ops may vary.) Needless to say, this sort of programming is fragile and hard to maintain. If you could reorganize your program not to depend on common block ordering (perhaps by putting everything into one big common block), you would be better off. -=- Andrew Klossner (decvax!tektronix!tekecs!andrew) [UUCP] (andrew%tekecs.tek.com@relay.cs.net) [ARPA]