Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing type differences in C files #12

Open
xiaotili0123 opened this issue Sep 23, 2019 · 5 comments
Open

Missing type differences in C files #12

xiaotili0123 opened this issue Sep 23, 2019 · 5 comments
Labels

Comments

@xiaotili0123
Copy link

I use gumTree to diff two C files and show the results in the web server. However, I am confused that why it didn't catch the type difference of variables in the two files. The link of the screenshot of the result is showed below:

https://drive.google.com/open?id=1a30eSvuYkCHNnt_IIMVkFS9eS8TwgzLG

@JuliaLawall
Copy link
Contributor

JuliaLawall commented Sep 23, 2019 via email

@xiaotili0123
Copy link
Author

Sure, please find the txt file in the link:
https://drive.google.com/open?id=1aMpgnI_9ie8Egmv0qyBZyVZBFNuqUESb

@jrfaller
Copy link
Member

jrfaller commented Sep 27, 2019

I can confirm the problem! By trying directly to parse the C code using cgum (cgum 2.c) on the right file (the one with long long int typed functions), I have the impression that this return type is not present in the AST

@jrfaller
Copy link
Member

jrfaller commented Nov 27, 2020

Hi @JuliaLawall !

I have looked into this simple example :

int main() {
	return 0;
}

cgum outputs

<tree type = "Program" pos = "0" length = "35" line_before = "1" col_before = "0" line_after = "4" col_after = "0">
 <tree type = "Definition" pos = "0" length = "34" line_before = "1" col_before = "0" line_after = "4" col_after = "1">
  <tree type = "Definition" pos = "0" length = "34" line_before = "1" col_before = "0" line_after = "4" col_after = "1">
    <tree type = "ParamList" pos = "9" length = "2" line_before = "1" col_before = "9" line_after = "1" col_after = "11">
    </tree>
   <tree type = "GenericString" label = "main" pos = "5" length = "4" line_before = "1" col_before = "5" line_after = "1" col_after = "9"/>
   <tree type = "Compound" pos = "12" length = "22" line_before = "1" col_before = "12" line_after = "4" col_after = "1">
    <tree type = "DeclList" pos = "15" length = "6" line_before = "2" col_before = "1" line_after = "2" col_after = "7">
     <tree type = "GenericString" label = "i" pos = "19" length = "1" line_before = "2" col_before = "5" line_after = "2" col_after = "6"/>
    </tree>
    <tree type = "ReturnExpr" pos = "23" length = "9" line_before = "3" col_before = "1" line_after = "3" col_after = "10">
     <tree type = "Constant" label = "0" pos = "30" length = "1" line_before = "3" col_before = "8" line_after = "3" col_after = "9"/>
    </tree>
   </tree>
  </tree>
 </tree>
 <tree type = "FinalDef" label = "" pos = "35" length = "0" line_before = "4" col_before = "0" line_after = "4" col_after = "0"/>
</tree>

I have three remarks/questions :

  • is it normal that there are two <tree type = "Definition" pos = "0" length = "34" line_before = "1" col_before = "0" line_after = "4" col_after = "1"> declaration nodes ?
  • there is nothing about the return type of main (should be a GenericString: int?)
  • ParamList of the function is placed before GenericString (I assume the name) in the child list of Definition

Do you think it would be hard to fix these behaviors ?

Cheers!

@jrfaller
Copy link
Member

Bonus question ;) what is the <tree type = "FinalDef" label = "" pos = "35" length = "0" line_before = "4" col_before = "0" line_after = "4" col_after = "0"/>? It corresponds to the }?

Cheers.

@jrfaller jrfaller added the bug label Nov 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants