Frama-C-discuss mailing list archives

This page gathers the archives of the old Frama-C-discuss archives, that was hosted by Inria's gforge before its demise at the end of 2020. To search for mails newer than September 2020, please visit the page of the new mailing list on Renater.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Frama-c-discuss] const pointer in local variable



On 22 avr. 2011, at 18:51, "Wayne Pineault" <wpineault at dsci.com> wrote:

> I am trying to access the const pointer attribute in
> 
> int * const p;
> 
> For global variables the attribute list for the TPtr typ contains the const but for variables in a function it does not.
> 
> Why are local variables treated differently than global ones?
> 
Speaking as a non-specialist, I would guess that the const is erased for local variables because of the way their initialization is transformed into an assignment.

We could remove this transformation completely (it seems to cause more harm than good for static analysis) or add a dedicated attribute other than const so as not to confuse compilers which have to parse transformed C code. By the way, did you check whether there wasn't already such an attribute? It sounds like the kind of hack that might already exist(there is a similar one in place for arrays as function arguments).

Pascal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/frama-c-discuss/attachments/20110422/e50de07f/attachment.htm>