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] dead code after an assertion unknown status



Hi Pascal,

Of course, f1 is the entry point and you are right about my intention.
I've founded the sections in the manual that you mention, and they are 
explicits (but in ?7.1.2 and ?8.2.1).
I don't have the intention of sending a bug on the mantis as I consider 
with your answer that is not a bug.

thank you,

St?phane

CUOQ Pascal a ?crit :
> Hi Stephane,
>
>   
>> I cannot explain why the code immediately following the assert is seen
>> as dead code.
>>     
>
> Presumably f1 is the entry point of the analysis.
> This is exactly the same situation as last time:
> without any information about the argument buf,
> the value analysis assumes that buf points to a fresh
> variable star_buf that is not in alias with any other
> variable of the program. Therefore, it is impossible to
> have buf==tab and the code after the assertion is
> dead. If your intention with the assertion is to force
> the analysis to consider the possibility that buf points
> to tab, it won't work this way (first limitation
> in section 6.1.2 of the manual). The simplest way
> at this time is to write a context, in C, using the
> non-deterministic primitives of section 7.2.1 to
> create a state that encompasses all the possibilities
> that you want the analysis to consider.
>
>   
>> Status of the assert is "unknown" for the value analysis.
>>     
>
> This is strange, and I will look into it if you report it as
> a bug. I guess that you expected "false", and this is fair.
>
> Note that the evaluation of the truth value of the
> assertion (that results in "unknown") and the reduction
> of the propagated state (that results in bottom and
> causes the rest of the function to be reported as dead
> code) are independent processes. On this example,
> both function according to spec, only
> one (the reduction) is more precise than the other
> (the truth value). The truth value "unknown" is a
> correct, if surprising, answer by the value analysis.
>
> Pascal
> __
>
> char tab[10];
> int f1(char* buf, int v)
> {
>   int i;
>   //@ assert buf==tab;
>   i++;
>   memcpy(buf, &v, sizeof(int));
>   i++;
>   return *((int*)buf);
> }
>   

-- 
-----------------------------------------------
Stephane DUPRAT
Innovation et Bureau m?thode
R?gion Midi-Pyr?n?es - Agence de Toulouse
6 Impasse Alice Guy
B.P. 43045
31024 - Toulouse Cedex 03
T?l : 05 34 36 32 78
Fax : 05 34 36 31 00

mailto :stephane.duprat at atosorigin.com

=======================================================================
Ce  message  electronique  est  confidentiel.   Il  peut  contenir  des
informations  protegees  par  le  secret  professionnel,  le  secret de
fabrication ou  autres regles legales.  Si vous recevez ce message  par
erreur,  il vous est interdit  de le reproduire  ou de le distribuer en
tout ou en partie,  ou de le divulguer de quelque maniere que ce soit a
quelque  personne  que ce soit.  Nous vous prions  de bien  vouloir  en
informer  Atos Origin,  par telephone  ou par retour  d'e-mail  puis de
detruire le message et toutes copies de votre systeme informatique.  Le
contenu  de ce message  ne reflete pas  necessairement  ni les opinions
d'Atos Origin  ni celle des membres de son groupe.  Bien que l'emetteur
de ce message  ait fait  tout son possible  pour maintenir  son systeme
informatique sans virus,  il ne peut garantir que cette transmission ne
comporte  aucun virus  et il ne pourra  etre tenu  pour responsable  de
quelque dommage que ce soit resultant de la transmission d'un virus.
=======================================================================
This   electronic  transmission   is  confidential.   It  may   contain
information  that  is  covered  by legal professional  privilege,  work
product  immunity  or other  legal rules.  If  you have  received  this
transmission in error,  you must not copy or distribute this message or
any part  of it  or otherwise disclose  its contents to anyone.  Please
notify  Atos Origin Legal Services  by telephone or return E-mail,  and
then delete this transmission  and any copies of it  from your computer
system.  The views  expressed  in this  electronic transmission  do not
necessarily reflect those of Atos Origin SA or any member of its group.
Although  the sender  endeavours  to  maintain  a computer  virus  free
network,  the sender  does not warrant  that this transmission is virus
free  and will not be liable  for any damages resulting  from any virus
transmitted.
=======================================================================