Unreproducible on 6.1.0 targeting either i686 or x86_64. In order to make a *minimal* testcase, please remove unrelated stuff, such as redundant `#include`s. For example, you can run `g++ -E -o foo.cc` to get a preprocessed source file then cut unrelated code off. ------------------ Best regards, lh_mouse 2016-08-22 ------------------------------------------------------------- 发件人:leon zadorin <leonleon77@xxxxxxxxx> 发送日期:2016-08-22 16:47 收件人:gcc-help 抄送: 主题:GCC ICE bug with segfault... Hello, I am not sure whether I can report a bug without an account in bugzilla (account creation temporarily disabled on that site) ... so I am posting this here for the time being GCC (trunk, rev 239646 -- but likely with earlier versions also, I haven't had the chance to test those yet) appears to ICE with segmentation fault given the following code (validity of which aside for the moment): #include <stdlib.h> #include <string.h> struct Blah { char * a; }; template <typename T> void Test(T & Obj) { auto && a(Obj.a); a = (char*)::malloc(1024 * 1024); ::memset(a + 28, 'X', 6); } int main() { Blah d; Test(d); return 0; } When compiled as c++ -Wall main.c++ Causes GCC itself to crash hard: main.c++: In function 'void Test(T&)': main.c++:12:25: internal compiler error: Segmentation fault ::memset(a + 28, 'X', 6); Whereas dropping -Wall prevents compiler from crashing. Taking out the 'template' nature from the above code also allows compiler not to crash (even with -Wall being used). Similar (non-crash) outcome is if one simply takes out "+ 28" offset from the code... Target: x86_64-w64-mingw32 Configured with: ../gcc-trunk/configure --enable-checking=release --disable-werror --disable-multilib --host=x86_64-w64-mingw32 --build =x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/C/YYYYY/installed --enable-lto --program-prefix= --enable-langu ages=c,c++,lto --disable-nls --disable-libgcj --enable-threads=posix --enable-seh-exceptions --enable-graphite --with-sysroot=/C/YYYYY/installed Thread model: posix gcc version 7.0.0 20160822 (experimental) (GCC) Perhaps it is something silly I have done with my GCC build, I will try to retest with the released version 6.0 on mingw 64 target soon also. Best regards leon.