I'm wondering why it works without -O. The difference between clear_bitmap and clear_to_color is that with the former, inlining is done within the function in the DLL, while with the latter, inlining to bmp->vtable->clear_to_color is done when you compile.
So another question: Are you sure the headers in %MINGDIR%\include are from 4.1.16? The vtable struct may have changed, therefore bmp->vtable->clear_to_color points to some random memory and it crashes, but only when inlined.
Or, actually, when you executed "make install", did the MINGDIR variable point to the same directory which actually is used by mingw? I.e. if you have mingw in C:\mingw, and in C:\devcpp\mingw.. make sure MINGDIR points to the right one when doing "make install"..