public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Gaius Mulley <gaius@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-8906] PR modula2/113848 modula2 does not build with clang
Date: Sat, 10 Feb 2024 02:19:43 +0000 (GMT)	[thread overview]
Message-ID: <20240210021943.9F25B3858D20@sourceware.org> (raw)

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

                 reply	other threads:[~2024-02-10  2:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240210021943.9F25B3858D20@sourceware.org \
    --to=gaius@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).