From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 61984 invoked by alias); 26 Oct 2015 05:30:51 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 61973 invoked by uid 89); 26 Oct 2015 05:30:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f53.google.com Received: from mail-pa0-f53.google.com (HELO mail-pa0-f53.google.com) (209.85.220.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 26 Oct 2015 05:30:49 +0000 Received: by pacfv9 with SMTP id fv9so185077500pac.3 for ; Sun, 25 Oct 2015 22:30:47 -0700 (PDT) X-Received: by 10.68.231.7 with SMTP id tc7mr20441345pbc.44.1445837447832; Sun, 25 Oct 2015 22:30:47 -0700 (PDT) Received: from seba.sebabeach.org.gmail.com (173-13-178-53-sfba.hfc.comcastbusiness.net. [173.13.178.53]) by smtp.gmail.com with ESMTPSA id d2sm16392024pat.24.2015.10.25.22.30.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Oct 2015 22:30:47 -0700 (PDT) From: Doug Evans To: Simon Marchi Cc: gdb-patches@sourceware.org Subject: Re: [PATCH c++ 08/12] scm-symbol.c: Add (domain_enum) casts References: <1445831204-16588-1-git-send-email-simon.marchi@polymtl.ca> <1445831204-16588-8-git-send-email-simon.marchi@polymtl.ca> Date: Mon, 26 Oct 2015 12:55:00 -0000 In-Reply-To: <1445831204-16588-8-git-send-email-simon.marchi@polymtl.ca> (Simon Marchi's message of "Sun, 25 Oct 2015 23:46:40 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg00547.txt.bz2 Simon Marchi writes: > We currently pass integers as domain_enums to lookup_symbol. The > most obvious fix is to add casts there. > > I first thought of changing the type of the domain variables to > domain_enum. However, because we pass a pointer to them to > gdbscm_parse_function_args, which expects them to be integers (because > of the format string), I don't think it would be correct. If the enum > does not have the same size as an int, gdbscm_parse_function_args could > write past the memory of domain, overwriting something else on the > stack. > > gdb/ChangeLog: > > * guile/scm-symbol.c (gdbscm_lookup_global_symbol): Add > domain_enum cast. > (gdbscm_lookup_symbol): Likewise. > --- > gdb/guile/scm-symbol.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c > index 81e4d50..10400be 100644 > --- a/gdb/guile/scm-symbol.c > +++ b/gdb/guile/scm-symbol.c > @@ -622,7 +622,8 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest) > > TRY > { > - symbol = lookup_symbol (name, block, domain, &is_a_field_of_this).symbol; > + symbol = lookup_symbol (name, block, (domain_enum) domain, > + &is_a_field_of_this).symbol; > } > CATCH (ex, RETURN_MASK_ALL) > { > @@ -662,7 +663,7 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest) > > TRY > { > - symbol = lookup_global_symbol (name, NULL, domain).symbol; > + symbol = lookup_global_symbol (name, NULL, (domain_enum) domain).symbol; > } > CATCH (ex, RETURN_MASK_ALL) > { LGTM