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] recursive calls in value analysis



Hi Pascal,

So if I understand correctly, I could not use the value analysis for my program because the majority of my functions' are as cmd_help (). If I do the transformation that you suggest it will take a lot of time.

S.

-----Message d'origine-----
De?: frama-c-discuss-bounces at lists.gforge.inria.fr [mailto:frama-c-discuss-bounces at lists.gforge.inria.fr] De la part de Pascal Cuoq
Envoy??: mercredi 20 avril 2011 18:09
??: Frama-C public discussion
Objet?: Re: [Frama-c-discuss] recursive calls in value analysis

> I use the -ignore-recursive-calls option as recommended but it doesn't work.

This wouldn't do what you want anyway, unless what you want is to
assume that the inner call to cmd_help does nothing. And if this is
what you want, you can simply cut the unimportant recursive functions,
or just the unimportant recursive calls, out of the analyzed code.

> Does somebody know how I can fix it?

You are in a bit of a worst case. This is indirect recursion, going
through three intermediate functions.

A workaround that would only work if the recursion is very shallow
(and still require a lot of work) would be to duplicate function
cmd_help() in as many version as you need: cmd_help_0, cmd_help_1,
cmd_help_2, ..., list pointers to these functions in an array, and use
a macro to replace calls to cmd_help(...) by:

(cmd_help_array[cmd_help_counter++])(...); cmd_help_counter--;

This would effectively erase the recursion from the program while
preserving the meaning.

If cmd_help() calls other functions again (such as command_foreach()),
you may have to apply the same transformation to these other
functions, too. But the worst part is that you must force the analysis
to compute precise values for all the function_counter variables at
all times.

So, in short, it will probably never work and I can't recommend trying it.

The value analysis currently assumes that each local variable appears
only once in the call stack. This is what prevents recursion from
being handled. Removing this limitation for programs with obviously
bounded recursion (the value analysis has to be able to see that it is
bounded) could be CEA LIST's contribution to a scientific
collaboration, but meanwhile, it is not on the roadmap.

I have not thought much about non-obviously-bounded recursion, but
that would take us rather far from the value analysis' original
mission of being a general-purpose automatic analyzer for embedded C
code.

Pascal

_______________________________________________
Frama-c-discuss mailing list
Frama-c-discuss at lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/frama-c-discuss

This mail has originated outside your organization, either from an external partner or the Global Internet.
Keep this in mind if you answer this message.



The information in this e-mail is confidential. The contents may not be disclosed or used by anyone other than the addressee. Access to this e-mail by anyone else is unauthorised.
If you are not the intended recipient, please notify Airbus immediately and delete this e-mail.
Airbus cannot accept any responsibility for the accuracy or completeness of this e-mail as it has been sent over public networks. If you have any concerns over the content of this message or its Accuracy or Integrity, please contact Airbus immediately.
All outgoing e-mails from Airbus are checked using regularly updated virus scanning software but you should take whatever measures you deem to be appropriate to ensure that this message and any attachments are virus free.