public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug modula2/112865] New: IM and RE fails to skip type equivalences
@ 2023-12-05 13:47 gaius at gcc dot gnu.org
  2023-12-05 13:48 ` [Bug modula2/112865] " gaius at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-12-05 13:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112865

            Bug ID: 112865
           Summary: IM and RE fails to skip type equivalences
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: gaius at gcc dot gnu.org
  Target Milestone: ---

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]);
      |                        ^

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug modula2/112865] IM and RE fails to skip type equivalences
  2023-12-05 13:47 [Bug modula2/112865] New: IM and RE fails to skip type equivalences gaius at gcc dot gnu.org
@ 2023-12-05 13:48 ` gaius at gcc dot gnu.org
  2023-12-05 14:55 ` cvs-commit at gcc dot gnu.org
  2023-12-05 14:56 ` gaius at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-12-05 13:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112865

Gaius Mulley <gaius at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-12-05

--- Comment #1 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Re-posted the above from the gm2 mailing list and confirming that this bug
exists.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug modula2/112865] IM and RE fails to skip type equivalences
  2023-12-05 13:47 [Bug modula2/112865] New: IM and RE fails to skip type equivalences gaius at gcc dot gnu.org
  2023-12-05 13:48 ` [Bug modula2/112865] " gaius at gcc dot gnu.org
@ 2023-12-05 14:55 ` cvs-commit at gcc dot gnu.org
  2023-12-05 14:56 ` gaius at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-05 14:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112865

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Gaius Mulley <gaius@gcc.gnu.org>:

https://gcc.gnu.org/g:805be8fbeab351dc3109aaa17fcc8cc6f74c8caa

commit r14-6185-g805be8fbeab351dc3109aaa17fcc8cc6f74c8caa
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Tue Dec 5 14:54:00 2023 +0000

    PR modula2/112865 IM and RE fails to skip type equivalences

    This patch skip type equivalences when checking IM and RE
    ISO M2 standard functions for complex data type operands.

    gcc/m2/ChangeLog:

            PR modula2/112865
            * gm2-compiler/M2Quads.mod (BuildReFunction): Use
            GetDType to retrieve the type of the operand when
            converting the complex type to its scalar equivalent.
            (BuildImFunction): Use GetDType to retrieve the type of the
            operand when converting the complex type to its scalar
            equivalent.

    Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug modula2/112865] IM and RE fails to skip type equivalences
  2023-12-05 13:47 [Bug modula2/112865] New: IM and RE fails to skip type equivalences gaius at gcc dot gnu.org
  2023-12-05 13:48 ` [Bug modula2/112865] " gaius at gcc dot gnu.org
  2023-12-05 14:55 ` cvs-commit at gcc dot gnu.org
@ 2023-12-05 14:56 ` gaius at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: gaius at gcc dot gnu.org @ 2023-12-05 14:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112865

Gaius Mulley <gaius at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #3 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Closing now that the fix has been applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-12-05 14:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-05 13:47 [Bug modula2/112865] New: IM and RE fails to skip type equivalences gaius at gcc dot gnu.org
2023-12-05 13:48 ` [Bug modula2/112865] " gaius at gcc dot gnu.org
2023-12-05 14:55 ` cvs-commit at gcc dot gnu.org
2023-12-05 14:56 ` gaius at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).