From patchwork Wed May 25 08:11:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 12508 Received: (qmail 98059 invoked by alias); 25 May 2016 08:11:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 97938 invoked by uid 89); 25 May 2016 08:11:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=Hx-languages-length:1874 X-HELO: mail-wm0-f51.google.com Received: from mail-wm0-f51.google.com (HELO mail-wm0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 25 May 2016 08:11:24 +0000 Received: by mail-wm0-f51.google.com with SMTP id n129so167838085wmn.1 for ; Wed, 25 May 2016 01:11:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=BEoXTzElvDqJycrPK1FeTAKETE859xceS6BJQTh36yM=; b=GtaoxR0Aw7yXvRM8+UGehL5nXHRxNxhuozTuYBgFbRz9xis60i4CYqVByxu9ajp/q6 HDM3pP3Id4UFH5xyVztyQNK5ovp4uy4MHFG66bU7mZJERfHzowwJ+m7Pts+EhStI9hZ0 bRuun4PVey4n4UQOSx9o5lHUXC+YZHlLEYGGHY4XN+F9fIi0HKaBWQO3p1W+lQxCqtCq H1q6wXj/AUYq8kx73aqumn2a7Cyh91cYNQ5PdpuvvXzSwl+hvx8JGMEkdSAITn06VlyZ YD599vqs4IS/h4+mjPE8YX7wWu5y5SMUMzBNgjG74YeVFjwdIMz9O2uEpNWynx8imfBW Z3Dg== X-Gm-Message-State: ALyK8tK3+zZVEkmOaCVqBSuX/J0V9ckw8cA6Zvo7X57TSN4H1GlWcVJCLaiNu80yRcJtXA== X-Received: by 10.194.9.71 with SMTP id x7mr2297447wja.62.1464163881256; Wed, 25 May 2016 01:11:21 -0700 (PDT) Received: from localhost (host86-165-25-95.range86-165.btcentralplus.com. [86.165.25.95]) by smtp.gmail.com with ESMTPSA id y1sm5394074wjg.10.2016.05.25.01.11.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 May 2016 01:11:20 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 2/2] gdb: Forward VALUE_LVAL when avoiding side effects for STRUCTOP_STRUCT Date: Wed, 25 May 2016 09:11:01 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes 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 + * 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 + * 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; } }