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

Wrong output for diff that involves array dimension size #5

Open
stan6 opened this issue Jun 18, 2018 · 1 comment
Open

Wrong output for diff that involves array dimension size #5

stan6 opened this issue Jun 18, 2018 · 1 comment
Labels

Comments

@stan6
Copy link

stan6 commented Jun 18, 2018

The cgum parser causes GumTree to generate wrong output for diffs that involve array dimension size. To verify this bug, I have created two corresponding files in three different programming languages (Java. C, CPP) that differ only in the array dimension declaration.

In the Java version of GumTree, the update of array size is

$diff test.java test1.java
4c4
<     int a[]=new int[5];//declaration and instantiation 
---
>     int a[]=new int[6];//declaration and instantiation

$gumtree jsondiff test.java test1.java
"actions": [
    {
      "action": "update",
      "tree": 16,
      "label": "6"
    }

As can be seen from this example, the array size update in Java programs is shown correctly.

However, the array size update in C programs is not shown correctly.

diff test.c test1.c
4c4
<    char name1[50];
---
>    char name1[51];
```
```
gumtree jsondiff test.c test1.c
"actions": []
```
When I try to rename all the C files to CPP files, then the array size update will be shown correctly because a different parser (srcml) instead of cgum will be invoked instead.
```
gumtree jsondiff test.cpp test1.cpp
"actions": [
    {
      "action": "update",
      "tree": 10,
      "label": "51"
    }
```



Expected Output:
Difference that involves array dimension size should be parsed by cgum and shown correctly in GumTree.

Related Files:
[test.zip](https://github.com/GumTreeDiff/cgum/files/2111764/test.zip)
@jrfaller jrfaller added the bug label Nov 27, 2020
@jrfaller
Copy link
Member

Hi!

Thanks for the report! It seems that our parser is missing the dimension.

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

2 participants