On Mon, Aug 22, 2016 at 6:58 PM, lhmouse <lh_mouse@xxxxxxx> wrote: > Unreproducible on 6.1.0 targeting either i686 or x86_64. Thanks for testing on 6.1.0 :) Just out of curiosity, which host/target triplet your gcc is configured for and what are the rest of its "configured with" options? I'm building mine on Windows 7 as x86_64-w64-mingw32 (I'll also try with recently released 6.2, but just so that I can cross-reference my config parameters with yours when I build 6.1/6.2/trunk it'd be good to know your config params/etc). > 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. Sounds good -- thanks for the advise! Kind regarsd Leon. > ------------------ > 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. > >