public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug ada/26999] replace_operator_with_call fails to set newexp->elts
Date: Wed, 02 Dec 2020 19:47:32 +0000	[thread overview]
Message-ID: <bug-26999-4717-FBpPuUpoas@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-26999-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=26999

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 906671155d..956cf52720 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -4002,14 +4002,10 @@ replace_operator_with_call (expression_up *expp, int
pc, int n
args,
 {
   /* A new expression, with 6 more elements (3 for funcall, 4 for function
      symbol, -oplen for operator being replaced).  */
-  struct expression *newexp = (struct expression *)
-    xzalloc (sizeof (struct expression)
-            + EXP_ELEM_TO_BYTES ((*expp)->nelts + 7 - oplen));
   struct expression *exp = expp->get ();
+  struct expression *newexp
+    = new expression (exp->language_defn, exp->gdbarch, exp->nelts + 7 -
oplen);

-  newexp->nelts = exp->nelts + 7 - oplen;
-  newexp->language_defn = exp->language_defn;
-  newexp->gdbarch = exp->gdbarch;
   memcpy (newexp->elts, exp->elts, EXP_ELEM_TO_BYTES (pc));
   memcpy (newexp->elts + pc + 7, exp->elts + pc + oplen,
          EXP_ELEM_TO_BYTES (exp->nelts - pc - oplen));
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  reply	other threads:[~2020-12-02 19:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-02 19:37 [Bug ada/26999] New: " vries at gcc dot gnu.org
2020-12-02 19:47 ` vries at gcc dot gnu.org [this message]
2020-12-02 20:45 ` [Bug ada/26999] " vries at gcc dot gnu.org
2020-12-02 20:55 ` tromey at sourceware dot org
2020-12-04 14:22 ` vries at gcc dot gnu.org
2020-12-07  4:36 ` cvs-commit at gcc dot gnu.org
2020-12-07 14:21 ` tromey at sourceware dot 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-26999-4717-FBpPuUpoas@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.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).