LLVM 2.9 64bits on Visual Studio 9

Hello everybody,

I have sucessfully compiled LLVM with CMAKE generator “Visual Studio 9 2008 Win64” (OS Windows 7).

-But when I run the Fibonacci example program in “release” mode, I get a crash with this visual studio popup message :
Microsoft Visual Studio C Runtime Library has detected a fatal error in Fibonacci.exe.

-Here is the visual studio output:
‘Fibonacci.exe’: Loaded ‘C:\Users\IUC\Desktop\BUILD_64\bin\Release\Fibonacci.exe’, Binary was not built with debug information.
‘Fibonacci.exe’: Loaded ‘C:\Windows\System32\ntdll.dll’
‘Fibonacci.exe’: Loaded ‘C:\Windows\System32\kernel32.dll’
‘Fibonacci.exe’: Loaded ‘C:\Windows\System32\KernelBase.dll’
‘Fibonacci.exe’: Loaded ‘C:\Windows\winsxs\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4967_none_08e58abba83c6451\msvcp90.dll’
‘Fibonacci.exe’: Loaded ‘C:\Windows\winsxs\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4967_none_08e58abba83c6451\msvcr90.dll’
‘Fibonacci.exe’: Loaded ‘C:\Windows\System32\dbghelp.dll’
‘Fibonacci.exe’: Loaded ‘C:\Windows\System32\msvcrt.dll’
Microsoft Visual Studio C Runtime Library has detected a fatal error in Fibonacci.exe.

Press Break to debug the program or Continue to terminate the program.

-And here is the callstack in release mode :(:

msvcr90.dll!000000006a8b9f48()
[Frames below may be incorrect and/or missing, no symbols loaded for msvcr90.dll]
msvcr90.dll!000000006a8b52a5()
msvcr90.dll!000000006a8b52f5()
Fibonacci.exe!000000013ffac08e()
Fibonacci.exe!00000001401551fd()
Fibonacci.exe!00000001401564d0()
Fibonacci.exe!0000000140156852()
Fibonacci.exe!000000013fdb7180()
Fibonacci.exe!000000013fdb749b()
Fibonacci.exe!000000013fdb7913()
Fibonacci.exe!000000013fda2231()
Fibonacci.exe!00000001401bfa82()
kernel32.dll!0000000076bdf56d()
ntdll.dll!0000000076e12cc1()

It crashes after IR compilation when calling the JIT, the last program message is :
starting fibonacci(24) with JIT…

Please also note that it works fine in debug mode.
Seems to be a bug, but maybe I have missed something… any idea would be really appreciated :slight_smile:
Thanks!
Damien

FYI, I have confirmed it works on VS10SP1 with x64|Release.

E:\llvm\build\cmake-x64-vs10>bin\Release\Fibonacci.exe 24
verifying... OK
We just constructed this LLVM module:

Hi,

Thank you for your reply.
I did not try with VS2010, maybe the issue is only with VS2009 (and/or some
SP). As it works in Debug mode, at first sight I would say it is a project
configuration issue?

I have done some little debugging, and it seems to crash in the function
LiveVariable::runOnMachineFunction, on the call to VirtRegInfo[Reg].

In the assembly code, we can see the compiler first checks that the Reg
variable is in the range of the VirtRegInfo map, but it says no... although
a call to VirtRegInfo.inBounds(Reg) returns true!

Just as if the test in the assembly code was not done on the correct
value... so I try to add a volatile keyword on the Reg variable declaration,
and then it works correctly (I have replaced all variable handling the
result of TargetRegisterInfo::index2VirtReg with a volatile variable)...

...but no idea why it is working with this change :confused:

Damien

NAKAMURA Takumi wrote: