GCC ICE bug with segfault...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux