Skip to content

Conversation

@ferdymercury
Copy link
Collaborator

@ferdymercury ferdymercury commented Nov 26, 2024

This Pull request:

Changes or fixes:

Fixes #6607
Related: #10749

Sibling roottest PR: root-project/roottest#1237

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

@dpiparo
Copy link
Member

dpiparo commented Nov 26, 2024

Thanks for this PR. Would it make sense to also transform in a test (or add to the one written for this PR) the example reported in the original issue ?

std::string n;
TClassEdit::GetNormalizedName(n, "std::vector<float, class std::allocator<float>>");
n == std::string("vector<float>"); 

@ferdymercury
Copy link
Collaborator Author

ferdymercury commented Nov 26, 2024

@bellenot Do you understand by chance why the build fails on Windows after this change?

2024-11-26T12:01:15.3137073Z   Stack dump:
2024-11-26T12:01:15.3209869Z   0.	Program arguments: C:/ROOT-CI/build/bin/rootcling.exe -rootbuild -v2 -f G__Geom.cxx -s C:/ROOT-CI/build/bin/libGeom.dll -m libThread_rdict.pcm -m libRIO_rdict.pcm -m libMathCore_rdict.pcm -m libHist_rdict.pcm -excludePath C:/ROOT-CI/src -excludePath C:/ROOT-CI/build/ginclude -excludePath C:/ROOT-CI/build/externals -excludePath C:/ROOT-CI/build/builtins -rml libGeom.dll -rmf C:/ROOT-CI/build/bin/libGeom.rootmap -IC:/ROOT-CI/build/include -IC:/ROOT-CI/build/LZMA/src/LZMA/include -IC:/ROOT-CI/src/geom/geom/inc -IC:/ROOT-CI/src/core/winnt/inc -IC:/ROOT-CI/src/builtins/zstd -IC:/ROOT-CI/src/core/zstd/inc -IC:/ROOT-CI/src/core/lz4/inc -IC:/ROOT-CI/build/LZMA/src/LZMA/include -IC:/ROOT-CI/src/core/lzma/inc -IC:/ROOT-CI/src/core/zip/inc -IC:/ROOT-CI/src/core/thread/inc -IC:/ROOT-CI/src/core/textinput/src -IC:/ROOT-CI/src/core/textinput/inc -IC:/ROOT-CI/src/core/rint/inc -IC:/ROOT-CI/src/core/meta/inc -IC:/ROOT-CI/src/core/gui/inc -IC:/ROOT-CI/src/core/foundation/res -IC:/ROOT-CI/src/core/foundation/v7/inc -IC:/ROOT-CI/src/core/foundation/inc -IC:/ROOT-CI/src/core/cont/inc -IC:/ROOT-CI/src/core/clingutils/res -IC:/ROOT-CI/src/core/clingutils/inc -IC:/ROOT-CI/src/core/clib/inc -IC:/ROOT-CI/src/core/base/v7/inc -IC:/ROOT-CI/src/core/base/inc -IC:/ROOT-CI/build/ginclude -IC:/ROOT-CI/src/io/io/v7/inc -IC:/ROOT-CI/src/io/io/inc -IC:/ROOT-CI/src/core/clib/res -IC:/ROOT-CI/src/builtins -IC:/ROOT-CI/src/math/mathcore/v7/inc -IC:/ROOT-CI/src/math/mathcore/inc -IC:/ROOT-CI/src/core/imt/inc -IC:/ROOT-CI/src/hist/hist/inc -IC:/ROOT-CI/src/math/matrix/inc TGDMLMatrix.h TGeoArb8.h TGeoAtt.h TGeoBBox.h TGeoBoolNode.h TGeoBranchArray.h TGeoBuilder.h TGeoCache.h TGeoCompositeShape.h TGeoCone.h TGeoElement.h TGeoEltu.h TGeoExtension.h TGeoGlobalMagField.h TGeoHalfSpace.h TGeoHelix.h TGeoHype.h TGeoManager.h TGeoMaterial.h TGeoMatrix.h TGeoMedium.h TGeoNavigator.h TGeoNode.h TGeoOpticalSurface.h TGeoPara.h TGeoParaboloid.h TGeoParallelWorld.h TGeoPatternFinder.h TGeoPcon.h TGeoPgon.h TGeoPhysicalConstants.h TGeoPhysicalNode.h TGeoPolygon.h TGeoRCPtr.h TGeoRegion.h TGeoScaledShape.h TGeoShape.h TGeoShapeAssembly.h TGeoSphere.h TGeoStateInfo.h TGeoSystemOfUnits.h TGeoTorus.h TGeoTrd1.h TGeoTrd2.h TGeoTube.h TGeoUniformMagField.h TGeoVolume.h TGeoVoxelFinder.h TGeoXtru.h TGeoTessellated.h TGeoVector3.h TVirtualGeoConverter.h TVirtualGeoPainter.h TVirtualGeoTrack.h TVirtualMagField.h C:/ROOT-CI/src/geom/geom/inc/LinkDef.h
2024-11-26T12:01:15.3223877Z   Exception Code: 0xE06D7363
2024-11-26T12:01:15.5947639Z    #0 0x76600f22 (C:\Windows\System32\KERNELBASE.dll+0x140f22)
2024-11-26T12:01:15.5948365Z    #1 0x70337e96 (C:\Windows\SYSTEM32\VCRUNTIME140.dll+0x7e96)
2024-11-26T12:01:15.5949037Z    #2 0x6ff1d11f (C:\Windows\SYSTEM32\MSVCP140.dll+0x2d11f)
2024-11-26T12:01:15.5953319Z    #3 0x6bf2ef2a std::_String_val<struct std::_Simple_types<char>>::_Xran(void) (C:\ROOT-CI\build\bin\libCore.dll+0x9ef2a)
2024-11-26T12:01:15.5954641Z    #4 0x6bf4035a TClassEdit::ResolveTypedef(char const *, bool) (C:\ROOT-CI\build\bin\libCore.dll+0xb035a)
2024-11-26T12:01:15.5955813Z    #5 0x6bf3fce9 TClassEdit::ResolveTypedef(char const *, bool) (C:\ROOT-CI\build\bin\libCore.dll+0xafce9)
2024-11-26T12:01:15.5957370Z    #6 0x6bf41c19 TClassEdit::TSplitType::ShortType(class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> &, int) (C:\ROOT-CI\build\bin\libCore.dll+0xb1c19)
2024-11-26T12:01:15.5959889Z    #7 0x6bf3c253 TClassEdit::GetNormalizedName(class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> &, class std::basic_string_view<char, struct std::char_traits<char>>) (C:\ROOT-CI\build\bin\libCore.dll+0xac253)
2024-11-26T12:01:15.5962058Z    #8 0x6bf3e811 TClassEdit::IsDefAlloc(char const *, char const *) (C:\ROOT-CI\build\bin\libCore.dll+0xae811)
2024-11-26T12:01:15.5964374Z    #9 0x6bf3deda TClassEdit::IsDefAlloc(char const *, char const *, char const *) (C:\ROOT-CI\build\bin\libCore.dll+0xadeda)
2024-11-26T12:01:15.5967204Z   #10 0x6bf4192a TClassEdit::TSplitType::ShortType(class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> &, int) (C:\ROOT-CI\build\bin\libCore.dll+0xb192a)
2024-11-26T12:01:15.5971909Z   #11 0x6c4e0a5b ExtractClassesListAndDeclLines(class RScanner &, class std::list<class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>>, class std::allocator<class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>>>> &, class std::list<class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>>, class std::allocator<class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>>>> &, class std::list<class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>>, class std::allocator<class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>>>> &, class cling::Interpreter const &) (C:\ROOT-CI\build\bin\libCling.dll+0xa0a5b)
2024-11-26T12:01:15.5975949Z   #12 0x6c4f0b2d RootClingMain(int, char **, bool) (C:\ROOT-CI\build\bin\libCling.dll+0xb0b2d)
2024-11-26T12:01:15.5976976Z   #13 0x6c4fed6d ROOT_rootcling_Driver (C:\ROOT-CI\build\bin\libCling.dll+0xbed6d)
2024-11-26T12:01:15.5978211Z   #14 0x00991084 main (C:\ROOT-CI\build\bin\rootcling.exe+0x1084)
2024-11-26T12:01:15.5978908Z   #15 0x00991274 main (C:\ROOT-CI\build\bin\rootcling.exe+0x1274)
2024-11-26T12:01:15.5979654Z   #16 0x7722fcc9 (C:\Windows\System32\KERNEL32.DLL+0x1fcc9)
2024-11-26T12:01:15.5980290Z   #17 0x77de809e (C:\Windows\SYSTEM32\ntdll.dll+0x6809e)
2024-11-26T12:01:15.5980883Z   #18 0x77de806e (C:\Windows\SYSTEM32\ntdll.dll+0x6806e)
2024-11-26T12:01:15.6438910Z C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'C:\ROOT-CI\build\CMakeFiles\1aa06453c354d599410084f38094f3b8\G__Geom.cxx.rule;C:\ROOT-CI\src\geom\geom\CMakeLists.txt' exited with code -529697949. [C:\ROOT-CI\build\geom\geom\G__Geom.vcxproj]
2024-11-26T18:24:53.0219913Z   Stack dump:
2024-11-26T18:24:53.0262018Z   0.	Program arguments: C:/ROOT-CI/build/bin/rootcling.exe -rootbuild -v2 -f G__Geom.cxx -s C:/ROOT-CI/build/bin/libGeom.dll -m libThread_rdict.pcm -m libRIO_rdict.pcm -m libMathCore_rdict.pcm -m libHist_rdict.pcm -excludePath C:/ROOT-CI/src -excludePath C:/ROOT-CI/build/ginclude -excludePath C:/ROOT-CI/build/externals -excludePath C:/ROOT-CI/build/builtins -rml libGeom.dll -rmf C:/ROOT-CI/build/bin/libGeom.rootmap -IC:/ROOT-CI/build/include -IC:/ROOT-CI/build/LZMA/src/LZMA/include -IC:/ROOT-CI/src/geom/geom/inc -IC:/ROOT-CI/src/core/winnt/inc -IC:/ROOT-CI/src/builtins/zstd -IC:/ROOT-CI/src/core/zstd/inc -IC:/ROOT-CI/src/core/lz4/inc -IC:/ROOT-CI/build/LZMA/src/LZMA/include -IC:/ROOT-CI/src/core/lzma/inc -IC:/ROOT-CI/src/core/zip/inc -IC:/ROOT-CI/src/core/thread/inc -IC:/ROOT-CI/src/core/textinput/src -IC:/ROOT-CI/src/core/textinput/inc -IC:/ROOT-CI/src/core/rint/inc -IC:/ROOT-CI/src/core/meta/inc -IC:/ROOT-CI/src/core/gui/inc -IC:/ROOT-CI/src/core/foundation/res -IC:/ROOT-CI/src/core/foundation/v7/inc -IC:/ROOT-CI/src/core/foundation/inc -IC:/ROOT-CI/src/core/cont/inc -IC:/ROOT-CI/src/core/clingutils/res -IC:/ROOT-CI/src/core/clingutils/inc -IC:/ROOT-CI/src/core/clib/inc -IC:/ROOT-CI/src/core/base/v7/inc -IC:/ROOT-CI/src/core/base/inc -IC:/ROOT-CI/build/ginclude -IC:/ROOT-CI/src/io/io/v7/inc -IC:/ROOT-CI/src/io/io/inc -IC:/ROOT-CI/src/core/clib/res -IC:/ROOT-CI/src/builtins -IC:/ROOT-CI/src/math/mathcore/v7/inc -IC:/ROOT-CI/src/math/mathcore/inc -IC:/ROOT-CI/src/core/imt/inc -IC:/ROOT-CI/src/hist/hist/inc -IC:/ROOT-CI/src/math/matrix/inc TGDMLMatrix.h TGeoArb8.h TGeoAtt.h TGeoBBox.h TGeoBoolNode.h TGeoBranchArray.h TGeoBuilder.h TGeoCache.h TGeoCompositeShape.h TGeoCone.h TGeoElement.h TGeoEltu.h TGeoExtension.h TGeoGlobalMagField.h TGeoHalfSpace.h TGeoHelix.h TGeoHype.h TGeoManager.h TGeoMaterial.h TGeoMatrix.h TGeoMedium.h TGeoNavigator.h TGeoNode.h TGeoOpticalSurface.h TGeoPara.h TGeoParaboloid.h TGeoParallelWorld.h TGeoPatternFinder.h TGeoPcon.h TGeoPgon.h TGeoPhysicalConstants.h TGeoPhysicalNode.h TGeoPolygon.h TGeoRCPtr.h TGeoRegion.h TGeoScaledShape.h TGeoShape.h TGeoShapeAssembly.h TGeoSphere.h TGeoStateInfo.h TGeoSystemOfUnits.h TGeoTorus.h TGeoTrd1.h TGeoTrd2.h TGeoTube.h TGeoUniformMagField.h TGeoVolume.h TGeoVoxelFinder.h TGeoXtru.h TGeoTessellated.h TGeoVector3.h TVirtualGeoConverter.h TVirtualGeoPainter.h TVirtualGeoTrack.h TVirtualMagField.h C:/ROOT-CI/src/geom/geom/inc/LinkDef.h
2024-11-26T18:24:53.0269934Z   Exception Code: 0xE06D7363
2024-11-26T18:24:53.1778394Z    #0 0x00007ffcd880b699 (C:\Windows\System32\KERNELBASE.dll+0x3b699)
2024-11-26T18:24:53.1780268Z    #1 0x00007ffcc4466ba7 (C:\Windows\SYSTEM32\VCRUNTIME140.dll+0x6ba7)
2024-11-26T18:24:53.1781137Z    #2 0x00007ffcbf4d9542 (C:\Windows\SYSTEM32\MSVCP140.dll+0x39542)
2024-11-26T18:24:53.1781984Z    #3 0x00007ffca9f4e780 std::_String_val<struct std::_Simple_types<char>>::_Xran(void) (C:\ROOT-CI\build\bin\libCore.dll+0xae780)
2024-11-26T18:24:53.1784197Z    #4 0x00007ffca9f59d1e std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>>::replace(unsigned __int64, unsigned __int64, char const *const, unsigned __int64) (C:\ROOT-CI\build\bin\libCore.dll+0xb9d1e)
2024-11-26T18:24:53.1786046Z    #5 0x00007ffca9f62449 TClassEdit::ResolveTypedef(char const *, bool) (C:\ROOT-CI\build\bin\libCore.dll+0xc2449)
2024-11-26T18:24:53.1786735Z    #6 0x00007ffca9f61c4a TClassEdit::ResolveTypedef(char const *, bool) (C:\ROOT-CI\build\bin\libCore.dll+0xc1c4a)
2024-11-26T18:24:53.1787633Z    #7 0x00007ffca9f641a8 TClassEdit::TSplitType::ShortType(class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> &, int) (C:\ROOT-CI\build\bin\libCore.dll+0xc41a8)
2024-11-26T18:24:53.1789408Z    #8 0x00007ffca9f5d58a TClassEdit::GetNormalizedName(class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> &, class std::basic_string_view<char, struct std::char_traits<char>>) (C:\ROOT-CI\build\bin\libCore.dll+0xbd58a)
2024-11-26T18:24:53.1790549Z    #9 0x00007ffca9f6058b TClassEdit::IsDefAlloc(char const *, char const *) (C:\ROOT-CI\build\bin\libCore.dll+0xc058b)
2024-11-26T18:24:53.1791605Z   #10 0x00007ffca9f5f929 TClassEdit::IsDefAlloc(char const *, char const *, char const *) (C:\ROOT-CI\build\bin\libCore.dll+0xbf929)
2024-11-26T18:24:53.1792523Z   #11 0x00007ffca9f63f60 TClassEdit::TSplitType::ShortType(class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> &, int) (C:\ROOT-CI\build\bin\libCore.dll+0xc3f60)
2024-11-26T18:24:53.1795797Z   #12 0x00007ffca413e5d2 ExtractClassesListAndDeclLines(class RScanner &, class std::list<class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>>, class std::allocator<class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>>>> &, class std::list<class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>>, class std::allocator<class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>>>> &, class std::list<class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>>, class std::allocator<class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>>>> &, class cling::Interpreter const &) (C:\ROOT-CI\build\bin\libCling.dll+0xce5d2)
2024-11-26T18:24:53.1798275Z   #13 0x00007ffca4151eb1 RootClingMain(int, char **, bool) (C:\ROOT-CI\build\bin\libCling.dll+0xe1eb1)
2024-11-26T18:24:53.1798830Z   #14 0x00007ffca4161b3b ROOT_rootcling_Driver (C:\ROOT-CI\build\bin\libCling.dll+0xf1b3b)
2024-11-26T18:24:53.1799321Z   #15 0x00007ff699a510b6 main (C:\ROOT-CI\build\bin\rootcling.exe+0x10b6)
2024-11-26T18:24:53.1799732Z   #16 0x00007ff699a512d8 main (C:\ROOT-CI\build\bin\rootcling.exe+0x12d8)
2024-11-26T18:24:53.1800137Z   #17 0x00007ffcda1c7374 (C:\Windows\System32\KERNEL32.DLL+0x17374)
2024-11-26T18:24:53.1800516Z   #18 0x00007ffcdae7cc91 (C:\Windows\SYSTEM32\ntdll.dll+0x4cc91)
2024-11-26T18:24:53.2101299Z C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'C:\ROOT-CI\build\CMakeFiles\1aa06453c354d599410084f38094f3b8\G__Geom.cxx.rule;C:\ROOT-CI\src\geom\geom\CMakeLists.txt' exited with code -529697949. [C:\ROOT-CI\build\geom\geom\G__Geom.vcxproj]

@bellenot
Copy link
Member

@ferdymercury I'll check after the hackathon (in a couple of days...)

GH issue

as suggested by dpiparo
@github-actions
Copy link

github-actions bot commented Nov 27, 2024

Test Results

    19 files      19 suites   3d 20h 33m 19s ⏱️
 2 702 tests  2 699 ✅ 1 💤 2 ❌
48 841 runs  48 839 ✅ 0 💤 2 ❌

For more details on these failures, see this check.

Results for commit 6ae11aa.

♻️ This comment has been updated with latest results.

@ferdymercury
Copy link
Collaborator Author

@ferdymercury I'll check after the hackathon (in a couple of days...)

Could it be maybe related to?:
#9029
#9284

@bellenot
Copy link
Member

bellenot commented Dec 3, 2024

@ferdymercury I'll debug it and let you know (need a full debug build)

@bellenot
Copy link
Member

bellenot commented Dec 3, 2024

@ferdymercury I found the problem. Trying to find the proper fix.

@bellenot
Copy link
Member

bellenot commented Dec 3, 2024

@ferdymercury maybe not the correct and maybe not the final solution, but can you try this diff (including your change):

diff --git a/core/foundation/src/TClassEdit.cxx b/core/foundation/src/TClassEdit.cxx
index d3115602c3..759dc0a730 100644
--- a/core/foundation/src/TClassEdit.cxx
+++ b/core/foundation/src/TClassEdit.cxx
@@ -621,6 +621,10 @@ static size_t findNameEnd(const std::string &full, size_t pos)
 bool TClassEdit::IsDefAlloc(const char *allocname, const char *classname)
 {
    string_view a( allocname );
+   const static int clalloclen = strlen("class ");
+   if (a.compare(0,clalloclen,"class ") == 0) {
+      a.remove_prefix(clalloclen);
+   }
    RemoveStd(a);

    if (a=="alloc")                              return true;
@@ -1538,9 +1542,8 @@ static void ResolveTypedefImpl(const char *tname,
       if (strncmp(tname+cursor,"const ",6) == 0) {
          cursor += 6;
          if (modified) result += "const ";
+         constprefix = true;
       }
-      constprefix = true;
-
    }

    if (len > 2 && strncmp(tname+cursor,"::",2) == 0) {

@pcanal can check/comment on this, but I think this code:

   if (tname[cursor]=='c' && (cursor+6<len)) {
      if (strncmp(tname+cursor,"const ",6) == 0) {
         cursor += 6;
         if (modified) result += "const ";
      }
      constprefix = true;

    }

is wrong. I.e. if (tname[cursor]=='c' && (cursor+6<len)) { is also true for tname beginning with class , and constprefix = true; should be moved inside the if (strncmp(tname+cursor,"const ",6) == 0) { condition. Or did I overlooked at this?

@pcanal
Copy link
Member

pcanal commented Dec 3, 2024

can check/comment on this, but I think this code:

Your analysis seems correct. However, it also seems that the 'error' is harmless as each use of the constprefix is followed by a double check.

@bellenot
Copy link
Member

bellenot commented Dec 3, 2024

@pcanal it crashes in result.replace at:

                     if (constprefix && scoperesult.compare(0,6,"const ",6) != 0) mod_start_of_type -= 6;
                     result.replace(mod_start_of_type, string::npos,
                                    scoperesult);

with mod_start_of_type being negative (it's zero before if (constprefix && scoperesult.compare(0,6,"const ",6) != 0))

@pcanal
Copy link
Member

pcanal commented Dec 3, 2024

it crashes in result.replace at: ...

right, I did indeed mis-read the code. The misplacement is fatal (and surprising it does not cause more trouble ...)

@ferdymercury
Copy link
Collaborator Author

It's solved now!

Copy link
Member

@bellenot bellenot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's solved now!

Congrats! Looks good to me, but I'll let @pcanal give the final green light

@ferdymercury ferdymercury requested a review from pcanal December 4, 2024 16:54
@ferdymercury
Copy link
Collaborator Author

@pcanal do you know if the remaining test failures are related to this PR ? thanks 4 the review.

@pcanal
Copy link
Member

pcanal commented Dec 5, 2024

They shouldn't but they don't usually fail either. Let's rerun the test and see.

@pcanal pcanal closed this Dec 5, 2024
@pcanal pcanal reopened this Dec 5, 2024
@ferdymercury
Copy link
Collaborator Author

They shouldn't but they don't usually fail either. Let's rerun the test and see.

Yes, now it's others which fail, so it seemed random.

@pcanal
Copy link
Member

pcanal commented Dec 6, 2024

All tests passes (after reruns).

@pcanal pcanal merged commit dc1ac98 into root-project:master Dec 6, 2024
38 of 43 checks passed
@ferdymercury ferdymercury deleted the defalloc branch December 6, 2024 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TClassEdit::GetNormalizedName does not strip std::allocator on Windows

4 participants