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

            Bug ID: 127794
           Summary: Unable to allocate more than MAX(CARDINAL) bytes using
                    Storage modules
           Product: gcc
           Version: 17.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:

MODULE test ;

FROM Storage IMPORT ALLOCATE ;
FROM SYSTEM IMPORT ADDRESS ;

CONST
   MemSize = MAX(CARDINAL) + 1 ;


VAR
   start: ADDRESS ;
BEGIN
   ALLOCATE (start, MemSize)
END test.


The 2nd parameter to ALLOCATE (in both ISO and PIM libraries) is a CARDINAL.
The result is that the 2nd parameter value will be zero as the cardinal wraps.

Perhaps there should be additional LONGALLOCATE / LONGDEALLOCATE procedures (in
Storage) allowing a LONGCARD 2nd parameter or maybe a new LongStorage module
offering ALLOCATE/DEALLOCATE with a LONGCARD 2nd parameter.

Reply via email to