public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8906] PR modula2/113848 modula2 does not build with clang
@ 2024-02-10  2:19 Gaius Mulley
  0 siblings, 0 replies; only message in thread
From: Gaius Mulley @ 2024-02-10  2:19 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:863202684dff775ae4a3e576f77044474384d41f

commit r14-8906-g863202684dff775ae4a3e576f77044474384d41f
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Sat Feb 10 02:18:54 2024 +0000

    PR modula2/113848 modula2 does not build with clang
    
    Re-write address arithmetic in gm2-libs/SArgs.mod:GetArg
    to avoid (void *) computation.  mc treats ADDRESS as (char *)
    but does not cast user type (PtrToChar) to (char *) when
    performing address arithmetic.
    
    gcc/m2/ChangeLog:
    
            PR modula2/113848
            * gm2-libs/SArgs.mod (GetArg): Re-write address arithmetic
            to avoid (void *) computation.
    
    Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>

Diff:
---
 gcc/m2/gm2-libs/SArgs.mod | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/m2/gm2-libs/SArgs.mod b/gcc/m2/gm2-libs/SArgs.mod
index d6cb448d497a..3c3fe8d85a18 100644
--- a/gcc/m2/gm2-libs/SArgs.mod
+++ b/gcc/m2/gm2-libs/SArgs.mod
@@ -60,12 +60,15 @@ if defined(GM2_DEBUG_SARGS)
 PROCEDURE GetArg (VAR s: String; n: CARDINAL) : BOOLEAN ;
 VAR
    i  : INTEGER ;
+   a  : ADDRESS ;
    ppc: PtrToPtrToChar ;
 BEGIN
    i := VAL (INTEGER, n) ;
    IF i < GetArgC ()
    THEN
-      ppc := ADDRESS (ADDRESS (GetArgV ()) + (n * TSIZE (PtrToChar))) ;
+      a := ADDRESS (GetArgV ()) ;
+      INC (a, n * TSIZE (PtrToChar)) ;
+      ppc := a ;
       s   := InitStringCharStar (ppc^) ;
       RETURN TRUE
    ELSE

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-10  2:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-10  2:19 [gcc r14-8906] PR modula2/113848 modula2 does not build with clang Gaius Mulley

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).