public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug modula2/114227] New: InstallTerminationProcedure does not work with -fiso
@ 2024-03-04 12:06 gaius at gcc dot gnu.org
  2024-03-04 12:16 ` [Bug modula2/114227] " gaius at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gaius at gcc dot gnu.org @ 2024-03-04 12:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114227
           Summary: InstallTerminationProcedure does not work with -fiso
           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: ---

Forwarded from the gm2 mailing list.  Given a program:

MODULE glibc_test2;

FROM IOChan IMPORT
  ChanId;
FROM StdChans IMPORT
  StdOutChan;
FROM TextIO IMPORT
  WriteLn, WriteString;

FROM M2RTS IMPORT
  InstallTerminationProcedure ;

VAR
  cid_out:                      ChanId;

PROCEDURE P1();
  BEGIN                         (* PROCEDURE P1 *)
    WriteString(cid_out, 'This is P1');
    WriteLn(cid_out);
  END P1;

PROCEDURE P2();
  BEGIN                         (* PROCEDURE P2 *)
    WriteString(cid_out, 'This is P2');
    WriteLn(cid_out);
  END P2;

BEGIN                           (* MODULE glibc_test *)
   cid_out:=StdOutChan();
   IF InstallTerminationProcedure (P2)
   THEN
      P1();
   END
END glibc_test2.


$ gm2 -fiso glibc_test2.mod
$ ./a.out 
This is P1

whereas if it is compiled and linked with:


$ gm2 glibc_test2.mod
$ ./a.out 
This is P1
This is P2

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

* [Bug modula2/114227] InstallTerminationProcedure does not work with -fiso
  2024-03-04 12:06 [Bug modula2/114227] New: InstallTerminationProcedure does not work with -fiso gaius at gcc dot gnu.org
@ 2024-03-04 12:16 ` gaius at gcc dot gnu.org
  2024-03-04 21:44 ` gaius at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: gaius at gcc dot gnu.org @ 2024-03-04 12:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-03-04
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1

--- Comment #1 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Confirmed it appears that the procedure
m2iso_M2RTS_ExecuteTerminationProcedures is not being called when -fiso is
present.

Single stepping via gdb shows the underlying module M2Dependents calling the
ExecuteTerminationProcedures procedure.  However M2Dependents is built and
installed as part of the pim libraries - hence it calls the pim M2RTS (which
has no termination procedures installed if -fiso is used).

The fix is to layer the termination and initial procedure functionality into
M2Dependent and change both m2pim_M2RTS and m2iso_M2RTS to use M2Dependent.

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

* [Bug modula2/114227] InstallTerminationProcedure does not work with -fiso
  2024-03-04 12:06 [Bug modula2/114227] New: InstallTerminationProcedure does not work with -fiso gaius at gcc dot gnu.org
  2024-03-04 12:16 ` [Bug modula2/114227] " gaius at gcc dot gnu.org
@ 2024-03-04 21:44 ` gaius at gcc dot gnu.org
  2024-03-04 21:47 ` cvs-commit at gcc dot gnu.org
  2024-03-04 21:50 ` gaius at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: gaius at gcc dot gnu.org @ 2024-03-04 21:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Created attachment 57604
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57604&action=edit
Proposed fix

Here is the proposed patch which moves the initial/termination user procedure
functionality in
pim and iso versions of M2RTS into M2Dependent.  This ensures that
finalization/initialization procedures will always be invoked for both -fiso
and -fpim.  Prior to this patch M2Dependent called M2RTS for
termination procedure cleanup and always invoked the pim M2RTS.

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

* [Bug modula2/114227] InstallTerminationProcedure does not work with -fiso
  2024-03-04 12:06 [Bug modula2/114227] New: InstallTerminationProcedure does not work with -fiso gaius at gcc dot gnu.org
  2024-03-04 12:16 ` [Bug modula2/114227] " gaius at gcc dot gnu.org
  2024-03-04 21:44 ` gaius at gcc dot gnu.org
@ 2024-03-04 21:47 ` cvs-commit at gcc dot gnu.org
  2024-03-04 21:50 ` gaius at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-04 21:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:d646db0e35ad9d235635b204349f5d960072f9fe

commit r14-9308-gd646db0e35ad9d235635b204349f5d960072f9fe
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Mon Mar 4 21:46:32 2024 +0000

    PR modula2/114227 InstallTerminationProcedure does not work with -fiso

    This patch moves the initial/termination user procedure functionality in
    pim and iso versions of M2RTS into M2Dependent.  This ensures that
    finalization/initialization procedures will always be invoked for both
-fiso
    and -fpim.  Prior to this patch M2Dependent called M2RTS for
    termination procedure cleanup and always invoked the pim M2RTS.

    gcc/m2/ChangeLog:

            PR modula2/114227
            * gm2-libs-iso/M2RTS.mod (ProcedureChain): Remove.
            (ProcedureList): Remove.
            (ExecuteReverse): Remove.
            (ExecuteTerminationProcedures): Rewrite.
            (ExecuteInitialProcedures): Rewrite.
            (AppendProc): Remove.
            (InstallTerminationProcedure): Rewrite.
            (InstallInitialProcedure): Rewrite.
            (InitProcList): Remove.
            * gm2-libs/M2Dependent.def (InstallTerminationProcedure):
            New procedure.
            (ExecuteTerminationProcedures): New procedure.
            (InstallInitialProcedure): New procedure.
            (ExecuteInitialProcedures): New procedure.
            * gm2-libs/M2Dependent.mod (ProcedureChain): New type.
            (ProcedureList): New type.
            (ExecuteReverse): New procedure.
            (ExecuteTerminationProcedures): New procedure.
            (ExecuteInitialProcedures): New procedure.
            (AppendProc): New procedure.
            (InstallTerminationProcedure): New procedure.
            (InstallInitialProcedure): New procedure.
            (InitProcList): New procedure.
            * gm2-libs/M2RTS.mod (ProcedureChain): Remove.
            (ProcedureList): Remove.
            (ExecuteReverse): Remove.
            (ExecuteTerminationProcedures): Rewrite.
            (ExecuteInitialProcedures): Rewrite.
            (AppendProc): Remove.
            (InstallTerminationProcedure): Rewrite.
            (InstallInitialProcedure): Rewrite.
            (InitProcList): Remove.

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

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

* [Bug modula2/114227] InstallTerminationProcedure does not work with -fiso
  2024-03-04 12:06 [Bug modula2/114227] New: InstallTerminationProcedure does not work with -fiso gaius at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-03-04 21:47 ` cvs-commit at gcc dot gnu.org
@ 2024-03-04 21:50 ` gaius at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: gaius at gcc dot gnu.org @ 2024-03-04 21:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

end of thread, other threads:[~2024-03-04 21:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-04 12:06 [Bug modula2/114227] New: InstallTerminationProcedure does not work with -fiso gaius at gcc dot gnu.org
2024-03-04 12:16 ` [Bug modula2/114227] " gaius at gcc dot gnu.org
2024-03-04 21:44 ` gaius at gcc dot gnu.org
2024-03-04 21:47 ` cvs-commit at gcc dot gnu.org
2024-03-04 21:50 ` 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).