Bug 21772 - ignore whitespace changes when comparing names:
Summary: ignore whitespace changes when comparing names:
Status: REOPENED
Alias: None
Product: libabigail
Classification: Unclassified
Component: default (show other bugs)
Version: unspecified
: P2 enhancement
Target Milestone: ---
Assignee: Dodji Seketeli
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-14 20:59 UTC by Ben Woodard
Modified: 2020-11-25 06:32 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
test source (61 bytes, text/x-c++src)
2017-07-14 20:59 UTC, Ben Woodard
Details
test2 (77 bytes, text/x-c++src)
2017-07-14 21:02 UTC, Ben Woodard
Details
gcc object (632 bytes, application/x-object)
2017-07-14 21:03 UTC, Ben Woodard
Details
clang object (610 bytes, application/x-object)
2017-07-14 21:03 UTC, Ben Woodard
Details
test2 gcc object (687 bytes, application/x-object)
2017-07-14 21:04 UTC, Ben Woodard
Details
test2 clang object (737 bytes, application/x-object)
2017-07-14 21:04 UTC, Ben Woodard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Woodard 2017-07-14 20:59:18 UTC
Created attachment 10258 [details]
test source

Given:
[ben@localhost c++test]$ cat test1.cpp
template <typename T, typename U = T*> struct A;

A<int> *p;
[ben@localhost c++test]$ c++ -c -g test1.cpp 
[ben@localhost c++test]$ clang++ -c -g test1.cpp -o test1-clang.o 
[ben@localhost c++test]$ ../libabigail/build/tools/abidiff test1.o test1-clang.o 
Functions changes summary: 0 Removed, 0 Changed, 0 Added function
Variables changes summary: 0 Removed, 1 Changed, 0 Added variable

1 Changed variable:

  [C]'A<int, int*>* p' was changed to 'A<int, int *>* p' at test1.cpp:3:1:
    type of variable changed:
     in pointed to type 'struct A<int, int*>':
       type name changed from 'A<int, int*>' to 'A<int, int *>'
       type size hasn't changed

These should evaluate the same because the only difference is in the whitespace.

Furthermore this is not an actual ABI artifact as can be seen by:

[ben@localhost c++test]$ cat test2.cpp 
template <typename T, typename U = T*> struct A {
  T a;
  U b;
};

A<int> i;

[ben@localhost c++test]$ c++ -c -g test2.cpp 
[ben@localhost c++test]$ clang++ -c -g test2.cpp -o test2-clang.o 
[ben@localhost c++test]$ ../libabigail/build/tools/abidiff test2.o test2-clang.o 
Functions changes summary: 0 Removed, 0 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed (1 filtered out), 0 Added variable
Comment 1 Ben Woodard 2017-07-14 21:02:43 UTC
Created attachment 10259 [details]
test2
Comment 2 Ben Woodard 2017-07-14 21:03:18 UTC
Created attachment 10260 [details]
gcc object
Comment 3 Ben Woodard 2017-07-14 21:03:48 UTC
Created attachment 10261 [details]
clang object
Comment 4 Ben Woodard 2017-07-14 21:04:33 UTC
Created attachment 10262 [details]
test2 gcc object
Comment 5 Ben Woodard 2017-07-14 21:04:59 UTC
Created attachment 10263 [details]
test2 clang object
Comment 6 Dodji Seketeli 2017-07-17 08:19:33 UTC
I think the general problem is more involved than just ignoring white spaces in type names.  That problem has already been expressed at https://sourceware.org/bugzilla/show_bug.cgi?id=21296#c2.

I am closing this bug as a duplicate of that previous bug.  This bug report is interesting though, because it adds reproducers that can be used to test the solution that will be proposed for the issue, eventually.

Thanks!

*** This bug has been marked as a duplicate of bug 21296 ***
Comment 7 Ben Woodard 2017-07-17 17:34:45 UTC
Evidently the real problem here is actually the inverse of what I reported. The problem is actually that test2 is not reporting the fact that there is a difference in the name and filtering out the change. While test1 continues to be a duplicate of 21296.
Comment 8 Ben Woodard 2017-07-26 18:18:20 UTC
Dodji, I know that we discussed this in chat and you pointed out that it was test2 that was wrong rather than test1 and that it was considering something harmless which wasn't but I can't recall what that was. Can you explain it again?

[ben@localhost c++test]$ abidiff --no-unreferenced-symbols --harmless test2.o test2-clang.o 
Functions changes summary: 0 Removed, 0 Changed, 0 Added function
Variables changes summary: 0 Removed, 1 Changed, 0 Added variable

1 Changed variable:

  [C]'A<int, int*> i' was changed to 'A<int, int *> i' at test2.cpp:6:1:
    type of variable changed:
     type name changed from 'A<int, int*>' to 'A<int, int *>'
     type size hasn't changed

     2 data member changes:
      name of 'A<int, int*>::a' changed to 'A<int, int *>::a' at test2.cpp:2:1
      name of 'A<int, int*>::b' changed to 'A<int, int *>::b' at test2.cpp:3:1


[ben@localhost c++test]$ cat test2.
test2.cpp  test2.o    
[ben@localhost c++test]$ cat test2.cpp 
template <typename T, typename U = T*> struct A {
  T a;
  U b;
};

A<int> i;

I recognize that 21296 is the issue regarding normalizing types which appears in the typenames but I don't see in this case why considering this change harmless is a problem. I think you said that it was because it was considered harmless for the wrong reason but I don't recall what you said was the reason.
Comment 9 Ben Woodard 2020-11-13 00:08:11 UTC
This problem continues to exist as of commit: 2cc1ab7ee879da20688c4a72ec93c73123d7b9aa