[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Issue with complex type import
From: |
Gaius Mulley |
Subject: |
Re: Issue with complex type import |
Date: |
Mon, 04 Dec 2023 18:57:18 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
Michael Riedl <udo-michael.riedl@t-online.de> writes:
> Hallo Gaius,
>
> here the real reason why I detected the issue with CMPLX / RE / IM in
> my last post.
>
> Consider the following code (a part of my test codes reduced to just
> show the issue ... )
>
> MODULE TstLibBlas;
>
> FROM TypesFTN IMPORT INTEGER4,REAL8,COMPLEX16;
> IMPORT STextIO;
> IMPORT SLongIO;
>
> PROCEDURE WrZVek2( N : INTEGER4;
> VAR Z : ARRAY OF COMPLEX16;
> IncZ : INTEGER4;
> VAR Q : ARRAY OF COMPLEX16;
> IncQ : INTEGER4);
>
> VAR i,iz,iq : INTEGER4;
> re,im : REAL8;
> BEGIN
> IF (IncZ > 0) THEN iz := 0; ELSE iz := - (N-1)*IncZ; END;
> IF (IncQ > 0) THEN iq := 0; ELSE iq := - (N-1)*IncQ; END;
> STextIO.WriteLn;
> FOR i:=1 TO N DO
> re := RE(Z[iz]);
> im := IM(Z[iz]);
> SLongIO.WriteReal(re,12);
> SLongIO.WriteReal(im,12);
> INC(iz,IncZ); INC(iq,IncQ);
> END;
> STextIO.WriteLn;
> END WrZVek2;
>
> END TstLibBlas.
>
> along with the following definition module
>
> DEFINITION MODULE TypesFTN;
>
> (* INTEGER4 = INTEGER*4 / ISO_FORTRAN_ENV:INT32 *)
> (* REAL4 = REAL / ISO_FORTRAN_ENV:REAL32 *)
> (* REAL8 = DOUBLE PRECISION / ISO_FORTRAN_ENV:REAL64 *)
> (* COMPLEX8 = COMPLEX / 2 x
> ISO_FORTRAN_ENV:REAL32 *)
> (* COMPLEX16 = DOUBLE COMPLEX / 2 x
> ISO_FORTRAN_ENV:REAL64 *)
>
> IMPORT SYSTEM;
>
> CONST Tag = "Fortran types for GNU Modula-2";
>
> TYPE REAL4 = SHORTREAL;
> REAL8 = REAL;
>
> COMPLEX8 = SHORTCOMPLEX;
> COMPLEX16 = COMPLEX;
>
> INTEGER4 = SYSTEM.INTEGER32;
> INTEGER2 = SYSTEM.INTEGER16;
> INTEGER1 = SYSTEM.INTEGER8;
>
> CHAR1 = CHAR;
>
> END TypesFTN.
>
> The compiler claims:
>
> gm2 -c -fiso -flibs=m2iso,m2pim,m2log -O1 -fscaffold-main TstLibBlas.mod
> TstLibBlas.mod:20:24: error: In procedure 'WrZVek2': 'COMPLEX16' must
> be a COMPLEX type
> 20 | re := RE(Z[iz]);
> | ^
> TstLibBlas.mod:21:24: error: 'COMPLEX16' must be a COMPLEX type
> 21 | im := IM(Z[iz]);
> | ^
> TstLibBlas.MAK:35: recipe for target 'TstLibBlas.o' failed
> make: *** [TstLibBlas.o] Error 1
>
> which, in my view, is not correct. If I replace COMPLEX16 by COMPLEX
> without the imported type all is fine, but I need these definitions to
> be sure to map Fortran and Modula-2 types exactly.
Hi Michael,
many thanks for the test code and bug report - yes indeed a bug - I've
found the bug and will git commit/push it,
regards,
Gaius
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Issue with complex type import,
Gaius Mulley <=