This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: why are we not using const?


Andrew Pinski <pinskia@physics.uc.edu> writes:

| On Jun 27, 2006, at 7:58 AM, Gabriel Dos Reis wrote:
| 
| > We we do have numbers that support that claim for real programs, then
| > we have a bug in the optimizers :-)
| 
| Huh?

Yes.

| "Stupid" example where a const argument can change:
| tree a;
| int f(const tree b)
| {
|    TREE_CODE(a) = TREE_CODE (b) + 1;
|    return TREE_CODE (b);
| }

Notice that the value of the parameter "b" is never changed in the
function body.  Consequently, if the current optimizers cannot figure
that simple cases out (where "b" is not annotated const), then the
optimizers in deficient in that respect.  That is the point.  

-- Gaby


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