I'm pretty much out of ideas on this.
While trying to build GLEW with the MXE cross building environment I encountered the problem that DLLs created by MinGW32/MinGW64 don't work (crash while loading the DLL, before main from the EXE even runs) when compiled with "-O2" (See https://github.com/mxe/mxe/pull/350 for my current workaround).
I tried to debug the issue but only got from error 0xC0000005 (Generic Access visolation) to 0xc0000028 (Bad stack) by fiddeling with gflags (MS debug flag setting tool) and putting "if(a == NULL) return GL_FALSE;" at the start of _glewStrSame1 (probably not a real woraround either, the backtrace that lead to that was totally bogus).
i686-w64-mingw32.shared-gcc (GCC) 4.8.2
i686-w64-mingw32.shared-ld (GNU Binutils) 2.24
i686-pc-mingw32.shared-gcc (GCC) 4.8.2
i686-pc-mingw32.shared-ld (GNU Binutils) 2.24
Any ideas what I can try? Maybe this is a compiler bug?