problem with SLATEC ccbrt function 
Author Message
 problem with SLATEC ccbrt function

I compiled the SLATEC library using Lahey/Fujitsu fortran 95 5.70c and
got the following message for file "ccbrt.f", which computes the
complex cube root:

C:\fortran>lf95 -c -f95 -nco -o0 -w ccbrt.f
Lahey/Fujitsu Fortran 95 Express Release 5.70c      
Compiling program unit CCBRT at line 1:
  3205-W: "ccbrt.f", line 25, column 15: Intrinsic procedure CARG is
not standard-conforming.
  2206-S: "ccbrt.f", line 25, column 15: Invalid type, attribute, or
value of actual argument for intrinsic function CARG.
  3205-W: "ccbrt.f", line 26, column 11: Intrinsic procedure CBRT is
not standard-conforming.
Encountered 1 error, 2 warnings in file ccbrt.f.
Compiling file ccbrt.f.

Compaq Visual Fortran 6.6c and g77 version 2.95.2 do not generate
these warning and error messages.

Is ccbrt.f standard F77 and standard F95? If not, how can it be fixed?
I never use complex variables in Fortran and am fuzzy about how to use
them and the instrinsic functions that call them.

I am attaching the source of ccbrt.f below. It can be downloaded from
http://www.*-*-*.com/
at www.netlib.org, SLATEC has been accessed more than 5 million times!

*DECK CCBRT
      COMPLEX FUNCTION CCBRT (Z)
C***BEGIN PROLOGUE  CCBRT
C***PURPOSE  Compute the cube root.
C***LIBRARY   SLATEC (FNLIB)
C***CATEGORY  C2
C***TYPE      COMPLEX (CBRT-S, DCBRT-D, CCBRT-C)
C***KEYWORDS  CUBE ROOT, ELEMENTARY FUNCTIONS, FNLIB, ROOTS
C***AUTHOR  Fullerton, W., (LANL)
C***DESCRIPTION
C
C CCBRT(Z) calculates the complex cube root of Z.  The principal root
C for which -PI .LT. arg(Z) .LE. +PI is returned.
C
C***REFERENCES  (NONE)
C***ROUTINES CALLED  CARG, CBRT
C***REVISION HISTORY  (YYMMDD)
C   770401  DATE WRITTEN
C   890531  Changed all specific intrinsics to generic.  (WRB)
C   890531  REVISION DATE from Version 3.2
C   891214  Prologue converted to Version 4.0 format.  (BAB)
C***END PROLOGUE  CCBRT
      COMPLEX Z
C***FIRST EXECUTABLE STATEMENT  CCBRT
      THETA = CARG(Z) / 3.0
      R = CBRT (ABS(Z))
C
      CCBRT = CMPLX (R*COS(THETA), R*SIN(THETA))
C
      RETURN
      END



Sat, 15 Jul 2006 23:24:01 GMT  
 problem with SLATEC ccbrt function

Quote:
> I compiled the SLATEC library using Lahey/Fujitsu Fortran 95 5.70c and
> got the following message for file "ccbrt.f", which computes the
> complex cube root:
> C:\fortran>lf95 -c -f95 -nco -o0 -w ccbrt.f
> Lahey/Fujitsu Fortran 95 Express Release 5.70c
> Compiling program unit CCBRT at line 1:
>   3205-W: "ccbrt.f", line 25, column 15: Intrinsic procedure CARG is
> not standard-conforming.
>   2206-S: "ccbrt.f", line 25, column 15: Invalid type, attribute, or
> value of actual argument for intrinsic function CARG.
>   3205-W: "ccbrt.f", line 26, column 11: Intrinsic procedure CBRT is
> not standard-conforming.

CARG(z) is just atan2(aimag(z),real(z))
CBRT(x) is just x**(real(1,kind(x))/3) ! How do you get real(1,kind(x))
in F77?  With 1+(x-x) ?  1+0*X ?

A quick search with google reveals they are in the same website
you got CCBRT.F from.

--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end



Sun, 16 Jul 2006 00:02:52 GMT  
 problem with SLATEC ccbrt function

...

Quote:
>   3205-W: "ccbrt.f", line 25, column 15: Intrinsic procedure CARG is
> not standard-conforming.
>   2206-S: "ccbrt.f", line 25, column 15: Invalid type, attribute, or
> value of actual argument for intrinsic function CARG.
>   3205-W: "ccbrt.f", line 26, column 11: Intrinsic procedure CBRT is
> not standard-conforming.
...
> Is ccbrt.f standard F77 and standard F95?

That depends on the compiler.  Yes, you can have code that is
conforming for some compilers but not for others.  looks to me
like that's what you have here.

There are no standard intrinsics named CARG or CBRT.  However,
compilers are allowed to define compiler-specific intrinsics in
addition to those specified by the standard.  Looks to me like
that's what you are seeing.

Quote:
> If not, how can it be fixed?

The standard has an explicit recommendation about how to avoid
this problem and the similar problem caused by new versions of
the standard adding new intrinsics.

If you explicitly declare the external attribute for all external
procedures that you use, then your external procedures will be
used regardless of any intrinsic procedures that might have the
same name.  (I'm using the "generic you"; I realize this isn't
your code).

I recommend following the advice of the standard by adding

   EXTERNAL CARG, CBRT

(Heck, the comments already say that; it would be good to let the
compiler know about it also.)

There might also be ways to avoid this with a compiler switch.
Compilers have been known to have switches to disable their
added intrinsics to avoid exactly this kind of problem.  But
the better fix is to make the code robust by following the
advice of the standard.

Some people get sloppy with that particular piece of advice
because ignoring it rarely gets you in trouble.  But rarely/=never.

P.S. The comments don't explicitly use the word "external".  I
presume that the library does also have external routines CARG and CBRT
somewhere.  If it is assuming that there are intrinsics of those
names, then it has bigger problems.

--
Richard Maine                       |  Good judgment comes from experience;
email: my first.last at org.domain  |  experience comes from bad judgment.
org: nasa, domain: gov              |        -- Mark Twain



Sun, 16 Jul 2006 00:29:38 GMT  
 problem with SLATEC ccbrt function

Quote:

> I compiled the SLATEC library using Lahey/Fujitsu Fortran 95 5.70c and
> got the following message for file "ccbrt.f", which computes the
> complex cube root:

Note in the source:
C***REFERENCES  (NONE)
C***ROUTINES CALLED  CARG, CBRT

and the error message

Quote:
>   3205-W: "ccbrt.f", line 25, column 15: Intrinsic procedure CARG is
> not standard-conforming.
>   2206-S: "ccbrt.f", line 25, column 15: Invalid type, attribute, or
> value of actual argument for intrinsic function CARG.

CARG is also the name of a Lahey-only extension. I would suggest that
you go back to the library and get the slatec routine called Carg and
sort out the naming or otherwise indicate that that is the one you want
to use.


Sun, 16 Jul 2006 02:23:46 GMT  
 problem with SLATEC ccbrt function

<SNIP>

Quote:
> I recommend following the advice of the standard by adding

>    EXTERNAL CARG, CBRT

<SNIP>

Following Richard Maine's suggestion, all my compilers are now happy
-- which makes me happy :).



Sun, 16 Jul 2006 06:01:04 GMT  
 problem with SLATEC ccbrt function

Quote:


> > I compiled the SLATEC library using Lahey/Fujitsu Fortran 95 5.70c and
> > got the following message for file "ccbrt.f", which computes the
> > complex cube root:

> Note in the source:
> C***REFERENCES  (NONE)
> C***ROUTINES CALLED  CARG, CBRT

> and the error message

> >   3205-W: "ccbrt.f", line 25, column 15: Intrinsic procedure CARG is
> > not standard-conforming.
> >   2206-S: "ccbrt.f", line 25, column 15: Invalid type, attribute, or
> > value of actual argument for intrinsic function CARG.

> CARG is also the name of a Lahey-only extension. I would suggest that
> you go back to the library and get the slatec routine called Carg and
> sort out the naming or otherwise indicate that that is the one you want
> to use.

Lahey has a utility function called CARG which is used to pass
arguments to C routines. You can "turn off" the utility functions by
compiling the procedure using the "-nli" (No Lahey Intrinsics) option.

Tim Zeisloft
Lahey Computer Systems



Mon, 17 Jul 2006 05:43:26 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. problem with CTAN from SLATEC

2. Problems using dsplp (from SLATEC-library)

3. slatec on Linux problems

4. problem defining a function using built in filter function

5. Strange behaviour of SLATEC library routine DDASSL

6. using slatec in linux IFC

7. Can't link lapack and slatec netlib libs with IFC for Linux

8. Using SLATEC F77 library routine from F90 program

9. slatec ode routine, cdriv3.f

10. SLATEC library and xgen on HP/UX

11. Using DDASSL from netlib/SLATEC

12. Help me using SLATEC

 

 
Powered by phpBB® Forum Software