This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 05/10] vla: allow side effects for sizeof argument


>>>>> "Sanimir" == Agovic, Sanimir <sanimir.agovic@intel.com> writes:

Sanimir> I avoid to re-send the complete patch series, thus see my 
Sanimir> alternative proposal below. Once I receive more feedback
Sanimir> I will re-publish my patch series including this fix if 
Sanimir> applicable.

I don't see how this version of the patch solves what I thought the
problem was.

I'm sure it is just my misunderstanding though.

Sanimir> Meanwhile you can track our latest development efforts on
Sanimir> http://intel-gdb.github.io/ branch vla-c99.

Is that all rebased to binutils-gdb.git now?
If so I will start fetching from it again.

Sanimir> +    case BINOP_SUBSCRIPT:
Sanimir> +      /* In case of a variable length array we need to evaluate the subscript
Sanimir> +        with side effects to correcly infere the size.  */
Sanimir> +      val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_NORMAL);
Sanimir> +      return value_from_longest (size_type,
Sanimir> +                                (LONGEST) TYPE_LENGTH (value_type (val)));

This makes it seem like the problem case is "sizeof (vla[index])".
But I would have thought it was "sizeof (vla)".

In any case I think this patch still has the issue, just at one remove.
Like:

    (gdb) print sizeof (array[x++])

For an ordinary array this should not modify x.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]