public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <andrew.burgess@embecosm.com>
Subject: [PATCH 2/2] gdb: Forward VALUE_LVAL when avoiding side effects for STRUCTOP_STRUCT
Date: Wed, 25 May 2016 08:11:00 -0000	[thread overview]
Message-ID: <e23a67222211ba3d50acd7a43adcc49a2c585b65.1464162733.git.andrew.burgess@embecosm.com> (raw)
In-Reply-To: <cover.1464162733.git.andrew.burgess@embecosm.com>
In-Reply-To: <cover.1464162733.git.andrew.burgess@embecosm.com>

When evaluating an expression with EVAL_AVOID_SIDE_EFFECTS if the value
we return is forced to be of type not_lval then GDB will be unable to
take the address of the returned value.

Instead, we should properly initialise the LVAL of the returned value.

This commit builds on two previous commits 2520f728b710 and
c244f977c7b8, which in turn build on ac1ca910d74d.  This commit is
currently untested due to my lack of access to an OpenCL compiler,
however, if follows the same pattern as the previous two commits and so
I believe that it is correct.

gdb/ChangeLog:

	* opencl-lang.c (evaluate_subexp_opencl): If
	EVAL_AVOID_SIDE_EFFECTS mode, forward the VALUE_LVAL attribute to
	the returned value in the STRUCTOP_STRUCT case.
---
 gdb/ChangeLog     | 6 ++++++
 gdb/opencl-lang.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7644c08..b9005a3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
 2016-05-24  Andrew Burgess  <andrew.burgess@embecosm.com>
 
+	* opencl-lang.c (evaluate_subexp_opencl): If
+	EVAL_AVOID_SIDE_EFFECTS mode, forward the VALUE_LVAL attribute to
+	the returned value in the STRUCTOP_STRUCT case.
+
+2016-05-24  Andrew Burgess  <andrew.burgess@embecosm.com>
+
 	* eval.c (evaluate_subexp_standard): If EVAL_AVOID_SIDE_EFFECTS
 	mode, forward the VALUE_LVAL attribute to the returned value in
 	the STRUCTOP_PTR case.
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index 7799735..767d3bc 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -984,7 +984,7 @@ Cannot perform conditional operation on vectors with different sizes"));
 						"structure");
 
 	    if (noside == EVAL_AVOID_SIDE_EFFECTS)
-	      v = value_zero (value_type (v), not_lval);
+	      v = value_zero (value_type (v), VALUE_LVAL (v));
 	    return v;
 	  }
       }
-- 
2.5.1

  parent reply	other threads:[~2016-05-25  8:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25  8:11 [PATCH 0/2] Forward VALUE_LVAL for STRUCT/STRUCT-PTR expressions Andrew Burgess
2016-05-25  8:11 ` [PATCH 1/2] gdb: Forward VALUE_LVAL when avoiding side effects for STRUCTOP_PTR Andrew Burgess
2016-05-25  8:11 ` Andrew Burgess [this message]
2016-05-27 11:39 ` [PATCH 0/2] Forward VALUE_LVAL for STRUCT/STRUCT-PTR expressions Pedro Alves

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=e23a67222211ba3d50acd7a43adcc49a2c585b65.1464162733.git.andrew.burgess@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=gdb-patches@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).