This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bad edge created in CFG ?


Hello,

I have used -da and -dv to produce vcg files of the CFG of this simple program:

int main(int argc, char**argv)
{
       if(argc)
               printf("positive\n");
       else
               printf("zero\n");

       return 0;
}

I have expected to get a CFG as follows:

                -----------
                | BB 0 |
                -----------
             /              \
  -----------                 -----------
  | BB 1 |                  | BB 2 |
  -----------                 -----------
             \              /
                -----------
                | END |
                -----------

But instead, I was surprised to get this CFG:

                -----------
                | BB 0 |
                -----------
             /              \
  -----------                 -----------
  | BB 1 |  ------------> | BB 2 |
  -----------                 -----------
             \              /
                -----------
                | END |
                -----------

as if one case of the "if" can lead to the other !

Can someone please explain to me why it is so ?

I am attaching the VCG representation, the VCG text file, and the original
test program..

Thank You
sunzir

Attachment: CFG.JPG
Description: JPEG image

Attachment: test-if.c
Description: Text document

Attachment: test-if.c.50.compgotos.vcg
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]