Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Cc: Sanimir Agovic <sanimir.agovic@intel.com>
Subject: [vla v7 pushed] Re: [PATCH v6 00/15] Please have a final look
Date: Mon, 14 Apr 2014 17:13:00 -0000	[thread overview]
Message-ID: <1397495596-25364-1-git-send-email-brobecker@adacore.com> (raw)
In-Reply-To: <0377C58828D86C4588AEEC42FC3B85A71D8507B7@IRSMSX105.ger.corp.intel.com>

> Keith, Joel, all, sorry for causing any inconvenience and thanks to
> you both for taking care of the issue on Friday.

No worries - it can happen to anyone.

> The root cause was this code fragment below. It was in my repo and I
> git-amend it accidently as I was playing around with an alternative to
> solve the pointer-to-vla issue.
> 
> @@ -2985,7 +2984,6 @@ evaluate_subexp_with_coercion (struct expression *exp,
>         {
>           (*pos) += 4;
>           val = address_of_variable (var, exp->elts[pc + 1].block);
> -         type = value_type (val);
>           return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
>                              val);

OK. That indeed solved the regressions outside of gdb.ada, so thanks
a lot for that. It saved me a ton of time not having to investigate
this issue.

This did not solve, on the other hand, the regressions with gdb.ada,
which turned out to be caused by a discrepancy between is_dynamic_type
which considers references to dynamic arrays as being dynamic, and
resolve_dynamic_bounds, which was handling the case of typedefs OK,
but otherwise expected the type to be an array type via the following
assert (which allowed us to find the bug, btw, so well placed one!):

  gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY);

So, when you have code like the following (resolve_dynamic_type)...

  if (!is_dynamic_type (real_type))
    return type;

  resolved_type = resolve_dynamic_bounds (type, addr);

... it is possible for a reference to dynamic array to get through
the check and then be passed to resolve_dynamic_bounds.

I ammended your patch as follow, essentially making resolve_dynamic_bounds
handle reference types as well:

| --- a/gdb/gdbtypes.c
| +++ b/gdb/gdbtypes.c
| @@ -40,6 +40,7 @@
|  #include "cp-support.h"
|  #include "bcache.h"
|  #include "dwarf2loc.h"
| +#include "gdbcore.h"
|  
|  /* Initialize BADNESS constants.  */
|  
| @@ -1665,6 +1666,16 @@ resolve_dynamic_bounds (struct type *type, CORE_ADDR addr)
|        return copy;
|      }
|  
| +  if (TYPE_CODE (type) == TYPE_CODE_REF)
| +    {
| +      struct type *copy = copy_type (type);
| +      CORE_ADDR target_addr = read_memory_typed_address (addr, type);
| +
| +      TYPE_TARGET_TYPE (copy)
| +	= resolve_dynamic_bounds (TYPE_TARGET_TYPE (type), target_addr);
| +      return copy;
| +    }
| +
|    gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY);
|  
|    elt_type = type;

I re-tested everything after making those changes, and everything
seems to be clean, now, so I pushed your patch series. In the process,
I had to fix a number of little nits, mostly related to the ChangeLog
file and the revision logs. From memory:

  - ChangeLog: The entries, when still part of the commit, were
    not located at the start of the ChangeLog, and the date still
    refered to the 11th. It's easier, IMO, to manipulate commits
    without ChangeLog entries, and to add them at the very last
    minute, when just about to push to the official repo. But
    some tips on how to management have been also shared on the gdb@
    mailing-list as well as on various blogs.

  - Some testsuite/ChangeLog entries were incorrect, missing
    the name of the gdb.[...] subdirectory in the file name,
    of mentioning it as the path to the (nonexistant) ChangeLog
    file.

  - The revision logs had traces of "Conflict:" sections, which
    are automatically added when you do a cherry-pick, I think,
    which results in a conflict that you resolve before commit.
    I removed those.

I think that's about it. Let's hope that we're in the clear now! :)

For the record, patch 01 and 02...

        [PATCH 01/12] type: add c99 variable length array support
        [PATCH 02/12] vla: enable sizeof operator to work with variable

... when individually tested on x86_64-linux, and then I only ran
the testsuite after applying the remaining commits. But I did test
each one of them in sequence last Friday, so I didn't see a reason
to do it again.

> 
> In addition I refactored the code for handling the sizeof operator to
> match Keith latest fix for PR c++/16675 (245a5f0) in:
> 
>   #02 vla: enable sizeof operator to work with variable length arrays
> 
> I used Jans diffgdb script to compare two runs (pre-/post vla) of 'make
> check' and now the patch series is free of regression as it should be.
> 
> You will find the latest patch series at:
> 
>   https://github.com/intel-gdb/vla/tree/vla-c99



  reply	other threads:[~2014-04-14 17:13 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-10 12:42 Sanimir Agovic
2014-04-10 12:42 ` [PATCH v6 01/15] refactoring: rename create_range_type to create_static_range_type Sanimir Agovic
2014-04-10 12:43 ` [PATCH v6 02/15] vla: introduce new bound type abstraction adapt uses Sanimir Agovic
2014-04-10 12:44 ` [PATCH v6 04/15] vla: enable sizeof operator to work with variable length arrays Sanimir Agovic
2014-04-10 12:44 ` [PATCH v6 03/15] type: add c99 variable length array support Sanimir Agovic
2014-04-10 14:21   ` Joel Brobecker
2014-04-10 12:45 ` [PATCH v6 05/15] vla: enable sizeof operator for indirection Sanimir Agovic
2014-04-10 12:46 ` [PATCH v6 06/15] vla: update type from newly created value Sanimir Agovic
2014-04-10 12:47 ` [PATCH v6 07/15] vla: print "variable length" for unresolved dynamic bounds Sanimir Agovic
2014-04-10 12:48 ` [PATCH v6 09/15] vla: resolve dynamic bounds if value contents is a constant byte-sequence Sanimir Agovic
2014-04-10 14:22   ` Joel Brobecker
2014-04-10 12:48 ` [PATCH v6 08/15] vla: support for DW_AT_count Sanimir Agovic
2014-04-10 12:49 ` [PATCH v6 11/15] test: cover subranges with present DW_AT_count attribute Sanimir Agovic
2014-04-10 12:49 ` [PATCH v6 10/15] vla: evaluate operand of sizeof if its type is a vla Sanimir Agovic
2014-04-10 14:31   ` Joel Brobecker
2014-04-10 12:50 ` [PATCH v6 12/15] test: multi-dimensional c99 vla Sanimir Agovic
2014-04-10 12:51 ` [PATCH v6 13/15] test: evaluate pointers to C99 vla correctly Sanimir Agovic
2014-04-10 12:52 ` [PATCH v6 14/15] test: basic c99 vla tests for C primitives Sanimir Agovic
2014-04-10 12:53 ` [PATCH v6 15/15] test: add mi vla test Sanimir Agovic
2014-04-10 14:39 ` [PATCH v6 00/15] Please have a final look Joel Brobecker
2014-04-10 14:46   ` Joel Brobecker
2014-04-22 15:33     ` Agovic, Sanimir
2014-04-22 16:58       ` Eli Zaretskii
2014-04-11 12:50   ` Agovic, Sanimir
2014-04-11 20:03     ` Keith Seitz
2014-04-11 20:27       ` Joel Brobecker
2014-04-11 20:33         ` Keith Seitz
2014-04-11 21:13           ` Joel Brobecker
2014-04-11 21:19             ` Keith Seitz
2014-04-11 22:33             ` Joel Brobecker
2014-04-14  8:34               ` Agovic, Sanimir
2014-04-14 17:13                 ` Joel Brobecker [this message]
2014-04-14 17:13                   ` [PATCH 01/12] type: add c99 variable length array support Joel Brobecker
2014-04-18 19:06                     ` Joel Brobecker
2014-04-14 17:13                   ` [PATCH 02/12] vla: enable sizeof operator to work with variable length arrays Joel Brobecker
2014-04-14 17:13                   ` [PATCH 04/12] vla: update type from newly created value Joel Brobecker
2014-04-14 17:13                   ` [PATCH 07/12] vla: resolve dynamic bounds if value contents is a constant byte-sequence Joel Brobecker
2014-04-14 17:13                   ` [PATCH 08/12] vla: evaluate operand of sizeof if its type is a vla Joel Brobecker
2014-04-14 17:13                   ` [PATCH 06/12] vla: support for DW_AT_count Joel Brobecker
2014-04-14 17:13                   ` [PATCH 05/12] vla: print "variable length" for unresolved dynamic bounds Joel Brobecker
2014-04-14 17:13                   ` [PATCH 03/12] vla: enable sizeof operator for indirection Joel Brobecker
2014-04-14 17:14                   ` [PATCH 12/12] test: add mi vla test Joel Brobecker
2014-04-14 17:14                   ` [PATCH 11/12] test: basic c99 vla tests for C primitives Joel Brobecker
2014-04-14 17:14                   ` [PATCH 10/12] test: evaluate pointers to C99 vla correctly Joel Brobecker
2014-04-14 17:14                   ` [PATCH 09/12] test: cover subranges with present DW_AT_count attribute Joel Brobecker
2014-04-14 17:36                   ` [vla v7 pushed] Re: [PATCH v6 00/15] Please have a final look Agovic, Sanimir

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=1397495596-25364-1-git-send-email-brobecker@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sanimir.agovic@intel.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