bugGNU cflow - Bugs: bug #47110, Bug in recursion labelling

 
 

bug #47110: Bug in recursion labelling

Submitter:  None
Submitted:  Wed 10 Feb 2016 07:01:56 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  gray
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 08 Feb 2019 03:31:06 PM UTC, comment #2: 

Fixed in b64ca53d. Thank you.

Sergey Poznyakoff <gray>
Group administrator
Fri 12 Feb 2016 06:19:25 PM UTC, comment #1: 

I've realized now that I should have sent this to the mailing list, and am about to do so.

Anonymous
Wed 10 Feb 2016 07:01:56 PM UTC, original submission:  

I have the following two files:

foo1.c

#include <stdio.h>

struct foo {
  int bar;
};

int bar(struct foo *a) {
  return (*a).bar;
}

int main() {
  struct foo f = {3};
  printf("%d\n", bar(&f));
}


foo2.c

#include <stdio.h>

struct foo {
  int bar;
};

int bar(struct foo *a) {
  return a->bar;
}

int main() {
  struct foo f = {3};
  printf("%d\n", bar(&f));
}


The only difference is in the function bar, foo1 has return (*a).bar and foo2 has return a->bar. These are equivalent C statements. Running cflow on each, I get a different result:

 cflow foo1.c
main() <int main () at foo1.c:11>:
    printf()
    bar() <int bar (struct foo a) at foo1.c:7> (R):
        bar() <int bar (struct foo a) at foo1.c:7> (recursive: see 3)

 cflow foo2.c
main() <int main () at foo2.c:11>:
    printf()
    bar() <int bar (struct foo a) at foo2.c:7>

When (*a).bar is used, cflow flags the use of bar as a recursive call even though it is not, and when a->bar is used cflow correctly determines that this is not a recursive call. This is using cflow 1.4.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gray (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-02-08 gray StatusNone Fixed
        Assigned toNone gray
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code