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] memset and non-chars
- Subject: [Frama-c-discuss] memset and non-chars
- From: kurt at roeckx.be (Kurt Roeckx)
- Date: Sun, 6 Sep 2015 15:11:02 +0200
- In-reply-to: <55EC3083.8010808@linux-france.org>
- References: <20150904171803.GA8422@roeckx.be> <55EC2F1A.1020008@linux-france.org> <55EC3083.8010808@linux-france.org>
On Sun, Sep 06, 2015 at 02:24:35PM +0200, David MENTRà wrote: > Le 2015-09-06 14:18, David MENTRà a écrit : > >Possible explanation: memset() expects char and giving to it violate > >this assumption. > > ... and giving to it integer violates this assumption. > > > >You have some warnings. I cannot say if they are harmful or not. > > > >kurt-memset.c:9:[wp] warning: Cast with incompatible pointers types > >(source: b*) (target: sint8*) > >kurt-memset.c:7:[wp] warning: Cast with incompatible pointers types > >(source: sint32*) (target: sint8*) > > Apparently, it could be harmful: > > https://lists.gforge.inria.fr/pipermail/frama-c-discuss/2014-June/004465.html > > My suggestion might not be that good. :-) Well, memset() takes a void *. The C standard also allows you to cast that to a char *, which is probably what memset() will use internally since you can't use void * directly. So it seems to me that memset is always problematic for the Typed+cast model. And I can someone understand it that it has problems with it. It would of course be nice that it could deal with it. But the code I'm looking at seems to like to use memset() on structs so that not all individual members of a struct need to be set to 0 but that you can do it with 1 call. Kurt
- Follow-Ups:
- [Frama-c-discuss] memset and non-chars
- From: loic.correnson at cea.fr (Loïc Correnson)
- [Frama-c-discuss] memset and non-chars
- References:
- [Frama-c-discuss] memset and non-chars
- From: kurt at roeckx.be (Kurt Roeckx)
- [Frama-c-discuss] memset and non-chars
- From: dmentre at linux-france.org (David MENTRÉ)
- [Frama-c-discuss] memset and non-chars
- From: dmentre at linux-france.org (David MENTRÉ)
- [Frama-c-discuss] memset and non-chars
- Prev by Date: [Frama-c-discuss] memset and non-chars
- Next by Date: [Frama-c-discuss] memset and non-chars
- Previous by thread: [Frama-c-discuss] memset and non-chars
- Next by thread: [Frama-c-discuss] memset and non-chars
- Index(es):