0

I want to compile the slatec library downloaded at netlike.org. I wrote a simple Makefile to compile all routines. However, I get an error when compiling the **mach.f files like d1mach.f that contain the machine specific values. The error occurs only when I (as I should, if I understand the description correctly) uncomment the values for my machine (intel). If I don't do this, the compilation doesn't create an error, but the routine dsos doesn't work, i.e. the iteration doesn't start but instead it always evaluated the test function at the starting point.

The error message:

src/d1mach.f:85:37:

       EQUIVALENCE (DMACH(5),LOG10(1))
                                     1
Error: Expecting a comma in EQUIVALENCE at (1)
make: *** [obj/d1mach.o] Error 1

I guess the reason is If a variable name is also a function name (15.5.1), that name must not appear in the list. what I found under point 8.2.1 in the Fortran77 Standard. Anyone, ever had this issue and solved it?

EDIT:

The short version of d1mach.f is:

      DOUBLE PRECISION FUNCTION D1MACH (I)

C
      INTEGER SMALL(4)
      INTEGER LARGE(4)
      INTEGER RIGHT(4)
      INTEGER DIVER(4)
      INTEGER LOG10(4)
C
      DOUBLE PRECISION DMACH(5)
      SAVE DMACH
C
      EQUIVALENCE (DMACH(1),SMALL(1))
      EQUIVALENCE (DMACH(2),LARGE(1))
      EQUIVALENCE (DMACH(3),RIGHT(1))
      EQUIVALENCE (DMACH(4),DIVER(1))
      EQUIVALENCE (DMACH(5),LOG10(1))
C
C
     DATA DMACH(1) / Z'0010000000000000' /
     DATA DMACH(2) / Z'7FEFFFFFFFFFFFFF' /
     DATA DMACH(3) / Z'3CA0000000000000' /
     DATA DMACH(4) / Z'3CB0000000000000' /
     DATA DMACH(5) / Z'3FD34413509F79FF' /
C
C
      IF (I .LT. 1 .OR. I .GT. 5) CALL XERMSG ('SLATEC', 'D1MACH',
     +   'I OUT OF BOUNDS', 1, 2)
C
      D1MACH = DMACH(I)
      RETURN
C
      END
PeMa
  • 1,559
  • 18
  • 44
  • Can you create a [mcve] which exhibits this behaviour? I'm not going to look at the source for the project you mention but I can think of source where that line isn't a problem at all. – francescalus Jun 28 '16 at 17:24
  • I added the file, but not sure how much this helps. These definitions are used at several places in the library I guess. – PeMa Jun 28 '16 at 17:38
  • Thanks. It's helpful because I'd naturally assume (as perhaps you did) that `log10(1)` was a reference to the intrinsic function, which would of course be gibberish. It isn't. – francescalus Jun 28 '16 at 17:55
  • See if renaming the variable `LOG10` remedies the problem. (Looking at the full subroutine I think it only appears four times ). – agentp Jun 28 '16 at 18:56
  • Yes yes, I thought about that too. But I don't know all the places where it is referenced in the library. – PeMa Jun 28 '16 at 19:04
  • Hmm, tried renaming, doesn't change the behavior. – PeMa Jun 28 '16 at 19:06
  • 1
    What compiler options are you using for compiling the code? I was able to compile the code using gfortran 4.6.3 and ifort 14 without any errors. – BChow Jun 28 '16 at 21:06
  • No options, just `gfortran -c d1mach.f`. I'm using `gcc version 5.1.0`. – PeMa Jun 29 '16 at 08:01
  • Though not related to the LOG10 problem, it may be more convenient to use the BLAS version of d1mach.f, which automatically determines the machine-dependent constants for you http://stackoverflow.com/questions/37601714/undefined-reference-to-d1mach/37622182#37622182 – roygvib Jun 30 '16 at 20:55

0 Answers0