Menu

Thinking about Bug Hunting analysis, fault trees and a bit of whole program analysis

2020-12-23
2020-12-24
  • john borland

    john borland - 2020-12-23

    I was wondering about this case bellow.

    double mySqrt(double f){
        if (f > 0.0)
             return sqrt(f);
        else {
              std::string errorStr = std::string("f=") + f + "| sqrt: NAN Alert";
              logError(errorStr);
    
         return 0.0;
    }
    

    So lets say my code has hundreds of calls to mySqrt and I'm seeing "f=-0.001235| NAN Alert" in my log.
    1. Would it be possible to get all the inputs that effect the variable f?
    2. Could it use the addition knowledge of f=-0.001235 or any othere inputs I can get out of my logged data as added rules to help rule out any of my hundreds of cases?

     
  • Georgiy Komarov

    Georgiy Komarov - 2020-12-24

    Would it be possible to get all the inputs that effect the variable f?

    Yes, we have this information in data constraints at the end of the function. For you example: 1:memory:{f=$1 errorStr=(($7)+($1))+($8)} constraints:{($1)<=(0.0)}. So, we have an information that variable f has temporary value $1 which is constrained by equation $1 <= 0.0.

    1. Could it use the addition knowledge of f=-0.001235 or any othere inputs I can get out of my logged data as added rules to help rule out any of my hundreds of cases?

    Yes, you can define contracts.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.