More LLVM on VC2010 fun

Hello, after some test my latest clang+llvm build “almsot worked” but I was experiencinf some crashes.

I found the experimental win32 binry on the repo, so I donwnloaded and tested it on other machine and that version works fine, so I got mu svn pointing to the llvn and clang 31 release final tag and recompiled it.

That improved my build (running on w7 profesional 64bits) but my clang still crashes on some files that with the provided 32bit binary work, so how can try to find/fix it…

All Im geting is somethng like this:

1>Stack dump:

1>1. parser at end of file

1>2. Code generation

1>3. Running pass ‘Function Pass Manager’ on module ‘c:/DLE/krmwork/krm/src/anm/codecs/CCodecMgr.cpp’.

1>4. Running pass ‘Peephole Optimizations’ on function ‘@_ZNK3krm3anm9CCodecMgr11GetPositionEfj’

What should I do? with 3.2 there are less crahses but without any info.

Unai

I followed the bug report guidelines and submited this bug;

http://llvm.org/bugs/show_bug.cgi?id=13400

Hope this helps.

Unai

When I try to build LLVM.sln both in Visual Studio 10 and 2012 I’m having the error below (and the IDE freezes). Any clue?

Thank you a lot.

Best regards
Mello

Project “D:\workspace\llvm\build\LLVM.sln” (1) is building "D:\workspace\llvm\build\tools\clang\test\check-clang.vcxproj.metaproj
" (431) on node 1 (default targets).
Project “D:\workspace\llvm\build\tools\clang\test\check-clang.vcxproj.metaproj” (431) is building “D:\workspace\llvm\build\tools
clang\test\check-clang.vcxproj” (432) on node 1 (default targets).
InitializeBuildStatus:
Touching “Win32\Debug\check-clang\check-clang.unsuccessfulbuild”.
CustomBuild:
Building Custom Rule D:/workspace/llvm/llvm/tools/clang/test/CMakeLists.txt
CMake does not need to re-run because D:\workspace\llvm\build\tools\clang\test\CMakeFiles\generate.stamp is up-to-date.
Running the Clang regression tests
– Testing: 4997 tests, 2 threads –
FAIL: Clang :: CXX/class/class.mem/p1b.cpp (341 of 4997)
******************** TEST ‘Clang :: CXX/class/class.mem/p1b.cpp’ FAILED ********************
Script:

It looks like you're building the clang-test project, which runs the
clang test suite. Are you sure that you have GnuWIn32 in your path as
this is needed for running the tests? If you're not interested in
running the tests, you can just build the BUILD_ALL project.

Hi all, after building the svn 3.1 version ussing the DEBUG target I have been able to compile withoit crashes, I’ll continue uptating the bug database.

As I coment in the bug this kind of bug usually is caused by uninitialized memory or bad stl use, I’ll build a RELEASE target with debug information so I can try to find the crash.

Unai

Building the versio with debug information, I found that the crash is at the

bool PeepholeOptimizer::runOnMachineFunction(MachineFunction &MF)

Functio at the PeepholeOptimizer.cpp line 460, I think there is some erro sit the stl iterator behabiour.

Is there any way to check if any bugfix to that funtion has been done siende 3.1 release?

Unai

After debuging I have been able to fix the issue;

I changed 2 lines on PeepholeOptimizer.cpp
Line 410:

Note: if items are removed from a vector, then the current iterator should be reassigned to too, as in

V::iterator it = v.begin();
it = v.erase(it);

Even though for vector it is likely to still work without this (as they are probably barebone pointers under the cover), a debug version of a STL would catch the use of it after the call to erase with an assertion.

If you correct the loops checks, could you also take care of updating the iterator’s value ?

– Matthieu

I know the standard, the problem is with the code, as I said the remove seems to be done in other function with no visibility of the “potentially broken” iterators.

That’s why I asked if this code has owner.

Imho, the safest way to fix this is to change the code to use index and check vector size every loop, the bad thing is performance and clarity, but without a deeper understanding of this optimization Is difficult to fix.

I don’t mind to change this code to use indices, if there is not any better choice.

Unai