public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug modula2/111675] Incorrect parameter value passed when attempting to pass a field of a packed record as a parameter
Date: Wed, 11 Oct 2023 12:27:15 +0000	[thread overview]
Message-ID: <bug-111675-4-AokduaJ1WV@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111675-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from CVS 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:2b783fe2e8103d97db7c5d6c1514ba16091f39f6

commit r14-4556-g2b783fe2e8103d97db7c5d6c1514ba16091f39f6
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Wed Oct 11 13:26:47 2023 +0100

    PR modula2/111675 Incorrect packed record field value passed to a procedure

    This patch allows a packed field to be extracted and passed to a
    procedure.  It ensures that the subrange type is the same for both the
    procedure and record field.  It also extends the <* bytealignment (0) *>
    to cover packed subrange types.

    gcc/m2/ChangeLog:

            PR modula2/111675
            * gm2-compiler/M2CaseList.mod (appendTree): Replace
            InitStringCharStar with InitString.
            * gm2-compiler/M2GCCDeclare.mod: Import AreConstantsEqual.
            (DeclareSubrange): Add zero alignment test and call
            BuildSmallestTypeRange if necessary.
            (WalkSubrangeDependants): Walk the align expression.
            (IsSubrangeDependants): Test the align expression.
            * gm2-compiler/M2Quads.mod (BuildStringAdrParam): Correct end name.
            * gm2-compiler/P2SymBuild.mod (BuildTypeAlignment): Allow subranges
            to be zero aligned (packed).
            * gm2-compiler/SymbolTable.mod (Subrange): Add Align field.
            (MakeSubrange): Set Align to NulSym.
            (PutAlignment): Assign Subrange.Align to align.
            (GetAlignment): Return Subrange.Align.
            * gm2-gcc/m2expr.cc (noBitsRequired): Rewrite.
            (calcNbits): Rename ...
            (m2expr_calcNbits): ... to this and test for negative values.
            (m2expr_BuildTBitSize): Replace calcNBits with m2expr_calcNbits.
            * gm2-gcc/m2expr.def (calcNbits): Export.
            * gm2-gcc/m2expr.h (m2expr_calcNbits): New prototype.
            * gm2-gcc/m2type.cc (noBitsRequired): Remove.
            (m2type_BuildSmallestTypeRange): Call m2expr_calcNbits.
            (m2type_BuildSubrangeType): Create range_type from
            build_range_type (type, lowval, highval).

    gcc/testsuite/ChangeLog:

            PR modula2/111675
            * gm2/extensions/run/pass/packedrecord3.mod: New test.

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

  parent reply	other threads:[~2023-10-11 12:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03 10:35 [Bug modula2/111675] New: " gaius at gcc dot gnu.org
2023-10-03 10:35 ` [Bug modula2/111675] " gaius at gcc dot gnu.org
2023-10-11 12:27 ` cvs-commit at gcc dot gnu.org [this message]
2023-10-11 12:28 ` gaius at gcc dot gnu.org

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=bug-111675-4-AokduaJ1WV@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).