Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!news.uu.net!cme!durer.cme.nist.gov!przemek From: przemek@rrdstrad.nist.gov (Przemek Klosowski) Newsgroups: comp.lang.fortran Subject: Is that a bug? (please answer by e-mail) Message-ID: Date: 22 May 91 16:37:36 GMT Sender: news@cme.nist.gov Organization: U. Notre Dame/NIST Lines: 61 Hello! I turn to the collective wisdom of the net for advice whether I should complain about this peculiar behavior of DEC Fortran and linker on DECsystem 5810/Ultrix ver. 4.1. Let me add that the examples below should compile under VMS and on IBM VM systems (I did not check these particular files, but the program they were derived from did compile). Following are two Fortran files containing a common block initialised by DATA statements in both modules. :::::::::::::: :::::::::::::: tst1.f tst2.f :::::::::::::: :::::::::::::: common /aa/ aa1, aa2 subroutine tst2 data aa1 /1.0/ common /aa/ aa1, aa2 call tst2 data aa2 /2.0/ type *, aa1, aa2 aa1=1.01 end end If these files are compiled separately, each of them seems to generate a common block ACTUAL storage, because of its initialisation in each module. This results in linker error: % f77 -c tst1.f % f77 -c tst2.f % f77 tst1.o tst2.o ld: tst2.o: aa_: multiply defined fort: Severe: Failed while trying to link. Now when they are compiled together (allowing DEC fortran interprocedure optimisations), everything is fine: % f77 tst1.f tst2.f % a.out 1.010000 2.000000 Is such usage of common block contradictory to some section of Fortran 77 standard? I understand that it is primarily linking problem, and that it is hard to initialize common storage from two modules not knowing about each other (think of what happens when the SAME variable is initialised twice), but it seems to me that some systems can cope with it. As I said, please send me e-mail, as I do not receive comp.lang.fortran on a regular basis. Thank you for your help przemek klosowski _______________________________________________________________ | przemek@ndcvx.cc.nd.edu | przemek@rrdstrad.nist.gov | | Physics Department and NIST, Reactor Bldg #235 | | U. Notre Dame IN 46556 | Gaithersburg MD 20899 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- przemek klosowski (przemek@ndcvx.cc.nd.edu) Physics Department University of Notre Dame IN 46556