什么是这是由邮资-C产生的圆节点的PDGS意义 [英] what's the meaning of the circle node in pdgs which is generated by frama-c

查看:191
本文介绍了什么是这是由邮资-C产生的圆节点的PDGS意义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用的邮资-C的工具来分析下面的code。

I use frama-c tool to analyse the code below.

  int main (int argc, char *argv[])
  {
     int i,a;
     for (i = 0; i < 100; i += 1)
     {
        a=0;
        if (a==0)
        {
            continue;
        }
        else
        {
            break;
        }
     }
     return 0;
  }

在cmd是

   frama-c -pdg -dot-pdg graph main.c

我的问题是有关控制的依赖。什么是圆节点手段?我试图解释,而节点,也许它代表一次循环,因为从一个循环开始I&小于100,所以有一个控制的依赖(I&小于100------ O,而 )。是我猜的没错?但什么是破发的节点是什么意思?我想这点转到__Cont;是关系到破发;声明中的其他块。结果
  我想我已经在我的脑袋没有明确的抽象模型,完整,准确地理解控制的依赖。你能帮我或者给我任何建议?提前很多感谢道。

My question is about the control dependence. what's the circle node means? I try to explain the "while" node, maybe it stand for one time loop , because a loop start from "i<100",so there a control dependence ("i<100" ------o "while" ). Is what I guess right ? but what is the "break" node mean? I guess that node "goto __Cont;" is related to the "break;" statement in the "else" block.
I think I have no clear abstract model in my head for understanding the control dependence completely and accurately . Would you help me or give me any suggestion ?. Many Thanks in Advance Tao.

推荐答案

使用命令邮资-C -print的main.c 来看到程序是如何翻译(我包括下面的翻译版本)。

Use the command frama-c -print main.c to see how the program was translated (I include the translated version below).

语句转到__Cont; 中的归一化的版本是翻译继续。

The statement goto __Cont; in the normalized version is the translation of continue; in the original.

而且,正如本雅明所说,循环被归到,而循环。

And, as Binyamin said, the for loop was normalized into a while loop.

int main(int argc, char **argv)
{
  int __retres;
  int i;
  int a;
  i = 0;
  while (i < 100) {
    a = 0;
    if (a == 0) { goto __Cont; }
    else { break; }
    __Cont: /* internal */ i ++;
  }
  __retres = 0;
  return (__retres);
}

这篇关于什么是这是由邮资-C产生的圆节点的PDGS意义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆