[ROOT] Re: weird code in CINT's expr.c

From: Masaharu Goto (MXJ02154@niftyserve.or.jp)
Date: Tue Nov 25 2003 - 13:59:08 MET


Hello Philippe,

Oops,   you are right.

This code was introduced with G__OLDIMPLEMENTATION1910
to prevent uninitialized memory access for things like '&a'.  But, it turns
out it is not working. As you found out, the test is always false.  I'll
turn it off by defining G__OLDIMPLEMENTATION1910 in G__ci.h.

However, this means  you will continue to see valgrind error for '&a'.
By the way, this access is harmless because contents of uninitialized
memory is never used.  But anyway, from your observation, this does
not make any difference.

Thank you
Masa Goto



----- Original Message -----
From: "Philippe Canal" <pcanal@fnal.gov>
To: "Masaharu Goto" <MXJ02154@nifty.ne.jp>
Sent: Tuesday, November 25, 2003 6:37 AM
Subject: weird code in CINT's expr.c


> Hi Masa,
>
>
> Around lines 543 and 591, there is code like
>
>     ebuf[lenbuf] = '\0';                                               \
>     if(up && '&'==unaopr[up] && ')'!=ebuf[lenbuf-1]) {                 \
>       int store_var_type=G__var_type;                                  \
>       G__var_type = 'P';                                               \
>       vstack[sp++] = G__getitem(ebuf);                                 \
>       G__var_type=store_var_type;                                      \
>       --up;                                                            \
>     }                                                                  \
>
> Valgrind claimed that the execution of unaopr[up] was reading unitialized
> memory.  My reading of the code comes the same conclusion.  I __thought__
> that it should be 'unaopr[up-1]' but make this change breaks the follwoing
code:
> Event *e;void *p = &e;
> After reading the code more carefully this makes sense.  I do observe than
> p is set to the VALUE of e and not its address (this is what the code
> snippets does).
>
> So my questions are:
> why do we have this test to begin with?
> why is it suppose to do?
> Is it ever activated (I claim that currently the test is NEVER true).
>
> I am actually proposing to remove the lines (in 2 places in expr.c)
>
>     if(up && '&'==unaopr[up] && ')'!=ebuf[lenbuf-1]) {                 \
>       int store_var_type=G__var_type;                                  \
>       G__var_type = 'P';                                               \
>       vstack[sp++] = G__getitem(ebuf);                                 \
>       G__var_type=store_var_type;                                      \
>       --up;                                                            \
>     }                                                                  \
>
> Cheers,
> Philippe.
>
>



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:17 MET