xplor-nih segfaults

Jack Howarth howarth@bromo.msbb.uc.edu
Fri Aug 5 22:52:00 GMT 2005


Jerry,
     I have been tinkering and have the following observations. I am able
to hack around the segfaults for all of the xplor tests (except for one
segfault in the python tests which I haven't had time to look at yet).
The change I used was...

+++ coorio.f    2005-08-05 16:20:40.000000000 -0400
@@ -265,6 +265,10 @@
       DOUBLE PRECISION XIN, YIN, ZIN, WIN, QIN
       CHARACTER*4 SID, RID, RID2, REN, IUP
       CHARACTER*5 A
+      CHARACTER*12 FILL12
+      CHARACTER*1 FILL1A,FILL1B
+      CHARACTER*3 FILL3
+      CHARACTER*6 FILL6
       INTEGER NUMBER, IJ
 C parameter
       INTEGER MARK
@@ -287,8 +291,10 @@
 C ==================================================
 C this section reads the Brookhaven atom coordinates
 C ==================================================
-            READ(COMLYN,'(12X,A4,1X,A4,1X,A5,3X,3F8.3,F6.2,F6.2,6X,A4)',
-     &           ERR=8888) IUP,REN,A,XIN,YIN,ZIN,QIN,WIN,SID
+C            READ(COMLYN,'(12X,A4,1X,A4,1X,A5,3X,3F8.3,F6.2,F6.2,6X,A4)',
+C     &           ERR=8888) IUP,REN,A,XIN,YIN,ZIN,QIN,WIN,SID
+            READ(COMLYN,'(A12,A4,A1,A4,A1,A5,A3,3F8.3,F6.2,F6.2,A6,A4)',
+     &           ERR=8888) FILL12,IUP,FILL1A,REN,FILL1B,A,FILL3,XIN,YIN,ZIN,QIN,WIN,FILL6,SID
 C     
 C make RESID left-justified and remove trailing blanks
             IJ=5


I made this change after tinkering with the READ statement in the CREAD
subrountine in coorio.f to see what variations on it would cause a 
segfault. What I observed was that the segfault never happened unless
you tried to read a float. Furthermore, if you removed all the preceeding
text from COMLYN before the floats, they could read in fine. If you then
prefixed 30 blank spaces to COMLYN and tried to read that in it would
segfault. However if you used A30 rather than 30X and read in those 30
spaces to a character string the segfault was suppressed.
    This lead me to substitute all of the #X space format specifiers
with dummy filler character string reads using the A# format specifier.
This suppresses the segfaults and allows the xplor test suite to pass.
So my gut instinct is that the flaw lies somewhere in the libgfortran
io handling of the space format specifier.
              Jack



More information about the Fortran mailing list