Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!cs.utexas.edu!uunet!tektronix!tekcae!kurtk From: kurtk@tekcae.CAX.TEK.COM (Kurt Krueger) Newsgroups: comp.lang.fortran Subject: Re: CHARACTER EQUIVALENCE (Was Re: fortran to C converter) Message-ID: <2693@tekcae.CAX.TEK.COM> Date: 24 Apr 89 16:03:54 GMT References: <67044@pyramid.pyramid.com> <1390@hudson.acc.virginia.edu> <21338@prls.UUCP> Reply-To: kurtk@tekcae.CAX.TEK.COM (Kurt Krueger) Distribution: usa Organization: Tektronix, Inc., Beaverton, OR. Lines: 22 There is a compiler that enforces separate common blocks for character and other data. A Fortran powerhouse - CDC. There are some real sticky issues about word alignment. Some machines HAVE to word align (the older CDC's for examaple). Other machines MAY or MAY NOT, but some of these machines have boundary requirements that differ for different data types. Both Gould and IBM (at least the 370 style machines) have byte addressibility but generate hardware faults if you try to fetch a full word that is not on a full word boundary. They may allow you to mix characters and full word data in the same common block, but proper alignment is usually up to you. Any goof and the code crashes. With all the possible archetectures, it is virtually impossible to write code with mixed character/full word data that won't cause grief on somebody's machine. VAXen can handle non aligned data, but only because of a special feature of the processor. Memory fetches are always aligned, but the processor can fetch twice and align it in a register. It works, but it slows things down. I know it's a pain to have two COMMON blocks where one should do. An easy way around this is to use whatever INCLUDE facility your system has. That way the code only has to mess with one INCLUDE, but both common blocks are defined in the included file.