This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v6 10/15] vla: evaluate operand of sizeof if its type is a vla
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Sanimir Agovic <sanimir dot agovic at intel dot com>
- Cc: gdb-patches at sourceware dot org, tromey at redhat dot com
- Date: Thu, 10 Apr 2014 07:31:31 -0700
- Subject: Re: [PATCH v6 10/15] vla: evaluate operand of sizeof if its type is a vla
- Authentication-results: sourceware.org; auth=none
- References: <1397133617-26681-1-git-send-email-sanimir dot agovic at intel dot com> <1397133617-26681-11-git-send-email-sanimir dot agovic at intel dot com>
> 2014-02-05 Sanimir Agovic <sanimir.agovic@intel.com>
> Keven Boell <keven.boell@intel.com>
>
> * eval.c (evaluate_subexp_for_sizeof): Add enum noside argument.
> (evaluate_subexp_standard): Pass noside argument.
> (evaluate_subexp_for_sizeof) <BINOP_SUBSCRIPT>: Handle subscript case
> if noside equals EVAL_NORMAL. If the subscript yields a vla type
> re-evaluate subscript operation with EVAL_NORMAL to enable sideffects.
> * gdbtypes.c (resolve_dynamic_bounds): Mark bound as evaluated.
> * gdbtypes.h (enum range_flags): Add RANGE_EVALUATED case.
>
> testsuite/gdb.base/
>
> * vla-sideeffect.c: New file.
> * vla-sideeffect.exp: New file.
Approved with some minor trivial modifications.
> /* Evaluate a subexpression of EXP, at index *POS,
> and return a value for the size of that subexpression.
> - Advance *POS over the subexpression. */
> + Advance *POS over the subexpression. If NOSIDE is EVAL_NORMAL
^^^^^^^
Minor style nit: Two spaces after a period ("If NOSIDE")
> + if (TYPE_RANGE_DATA (type)->flag_bound_evaluated)
> + {
> + val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_NORMAL);
> + return value_from_longest
> + (size_type, (LONGEST)TYPE_LENGTH (value_type (val)));
I missed this one in the my first review, but there should be a space
after "(LONGEST)".
> +set sizeof_vla [ expr "10" * "$sizeof_int" ]
> +
> +gdb_test "print sizeof (vla1\[i++\])" "= ${sizeof_int}" \
Just to be consistent, let's add a space before the "=" sign.
> + "print sizeof (vla1\[i++\])"
Thanks,
--
Joel