UNREACHABLE executed when conpiling Python code

Hi dear all,
When I'm compiling a Python code, clang got crashed , following is the
clang.exe -c -IH:\PYTHON\Python-2.7.3\PC
-IH:\PYTHON\Python-2.7.3\Include -ID:/WinSDK/Windows/v6.1/Include
-ID:/VCRT/VS9.0/include myreadline.c
and the attachment is the log . Thanks in advance.

compile-python-code.log (2.51 KB)

I've retried with clang debug build, got following asserts:

Global is marked as dllimport, but not external
i32 ()** @PyOS_InputHook
Global is marked as dllimport, but not external
%struct._ts** @_PyOS_ReadlineTState
Global is marked as dllimport, but not external
i8* (%struct._iobuf*, %struct._iobuf*, i8*)** @PyOS_ReadlineFunctionPointer
Broken module found, compilation aborted!

these message are issued from Verifier::visitGlobalValue, what's wrong
with this ? e.g. PyOS_InputHook is just an ordinary function pointer,
please help !

Got it! There is a header file which has following declaration:
extern __declspec(dllimport) int (*PyOS_InputHook)(void);
and in myreadline.c there is a line:
int (*PyOS_InputHook)(void) = NULL;
these 2 lines will trigger assert failing. Is there some switch to
avoid this ? In MSVC this is just a C4273 warning. Many thanks!

You can try -fms-extensions

Tried but not work.

Can you provide a reduced test case that triggers the assert?

OK, as follows:

extern __declspec(dllimport) void(*test)();

int main()

Thanks, I filed a bug in the tracker.


Hi Joao,
I've seen the patch. Can I sync it from svn trunk or apply it directly
against my clang 3.1 ?. Many thanks!