Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Simon Marchi <simon.marchi@ericsson.com>
Cc: GDB Patches <gdb-patches@sourceware.org>
Subject: Re: [OB PATCH] Fix uninitialized type_flags variable
Date: Thu, 16 Jan 2014 16:38:00 -0000	[thread overview]
Message-ID: <52D80AF2.5010605@redhat.com> (raw)
In-Reply-To: <52D7EECF.5020904@ericsson.com>

On 01/16/2014 02:38 PM, Simon Marchi wrote:
> If uninitialized, type_flags can contain a random value. If the
> arch-specific code doesn't set a value, this give unexpected results.

The whole point of that method is to get that value from the arch-specific
code.  If some arch-specific code is returning true but not setting
type_flags, then that's the bug to fix.  IOW, the method should only return
true if the type_flags was set.  If you're relying on this initialization,
you're papering over an arch-specific bug.

> 
> I believe this is an obvious change. Since I don't have commit access yet,
> could anybody push this?
> 
> gdb/ChangeLog
> 2014-01-16  Simon Marchi  <simon.marchi@ericsson.com>
> 
> 	* gdbtypes.c (address_space_name_to_int): Initialize type_flags to 0.
> 
> diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
> index 042c17d..7d9485a 100644
> --- a/gdb/gdbtypes.c
> +++ b/gdb/gdbtypes.c
> @@ -531,7 +531,7 @@ lookup_function_type_with_arguments (struct type *type,
>  int
>  address_space_name_to_int (struct gdbarch *gdbarch, char *space_identifier)
>  {
> -  int type_flags;
> +  int type_flags = 0;
> 
>    /* Check for known address space delimiters.  */
>    if (!strcmp (space_identifier, "code"))
> 


-- 
Pedro Alves


  reply	other threads:[~2014-01-16 16:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-16 14:37 Simon Marchi
2014-01-16 16:38 ` Pedro Alves [this message]
2014-01-16 18:01   ` Simon Marchi
2014-01-16 18:13     ` Tom Tromey
2014-01-16 18:14       ` 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=52D80AF2.5010605@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@ericsson.com \
    /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