#539 Seg fault: simpler

OTHER
closed
gcc (462)
out-of-date
Known_bugs
2013-01-28
2004-03-28
Mark Space
No

I found a seg fault in the g++ complier when I was play
around with some simple libraries I made. I isolated
the problem down to one destructor (in SimpleQueue.h)
that is a template. It's a pretty small file (60
lines) and the program does compile if I remove the
template and just use the default destructor.

I'm not sure what going on but here's the files I
isolated. Just untar them and type make, it's all ready
to go.

I checked with both gcc 3.3.2 as well as the 3.3.3
canidate, both have the same issue.

OS: Win 2k, Sp3

g++ -v
Reading specs from
d:/MinGW/bin/../lib/gcc-lib/mingw32/3.3.3/specs
Configured with: ../gcc/configure --with-gcc
--with-gnu-ld --with-gnu-as --host=mingw32
--target=mingw32 --prefix=/mingw --enable-threads
--disable-nls
--enable-languages=c,c++,f77,ada,objc,java
--disable-win32-registry --disable-shared
--enable-sjlj-exceptions --enable-libgcj
--disable-java-awt --without-x --enable-java-gc=boehm
--disable-libgcj-debug --enable-interpreter
--enable-hash-synchronization
Thread model: win32
gcc version 3.3.3 (mingw special)

ld -v
GNU ld version 2.13.90 20030111

MingGW 3.1.0.1

MSYS:
uname -a
MINGW32_NT-5.0 MARGE 1.0.9(0.46/3/2) 2003-07-03 07:26
i686 unknown

__MINGW_H :
#define __MINGW32_VERSION 3.2
#define __MINGW32_MAJOR_VERSION 3
#define __MINGW32_MINOR_VERSION 2

Discussion

  • Danny Smith

    Danny Smith - 2004-03-28

    Logged In: YES
    user_id=11494

    File not attached. Did you tick the upload checkbox before
    submitting?
    Danny

     
  • Mark Space

    Mark Space - 2004-03-29

    Logged In: YES
    user_id=869832

    Guess not, here's try #2.

     
  • Mark Space

    Mark Space - 2004-03-29
     
  • Danny Smith

    Danny Smith - 2004-03-29

    Logged In: YES
    user_id=11494

    Yes you have found a regression in gcc.

    Your code is invalid. You cannot call a dtor without an object,
    which you do at SimpleQueue.h:58. GCC should tell you that.

    In gcc-3.4 I get this error message:

    In file included from Simple_unit_test.cpp:3:
    SimpleQueue.h: In destructor
    `SimpleQueue<C>::~SimpleQueue()':
    SimpleQueue.h:58: error: too few arguments to function
    ....

    which is better than a segfault, but not very helpful.

    You don't need the call to the base dtor.
    Here is a reduced tescase.

    If you uncomment the Base::~Base();
    line you'll see the segfault on 3.x. But it works fine without
    that line.

    #include <stdio.h>

    struct Base
    {
    ~Base () { printf ("goodbye from base\n"); }
    };

    template <class C>
    struct Derived: public Base
    {
    ~Derived ()
    {
    printf ("goodbye from Derived\n");
    // Base::~Base();
    }
    };

    int main()
    {
    Derived<int> A;
    return 0;
    }

     
  • Mark Space

    Mark Space - 2004-03-29
    • status: open --> closed-later
     
  • Mark Space

    Mark Space - 2004-03-29

    Logged In: YES
    user_id=869832

    So your saying this is fixed in 3.4? Thanks all I needed,
    thanks. :)

     
  • Danny Smith

    Danny Smith - 2004-03-29
    • status: closed-later --> open-later
     
  • Danny Smith

    Danny Smith - 2004-03-29

    Logged In: YES
    user_id=11494

    Hi,
    I reported this to GCC bugzilla, and the feedbnack indicates
    that your code is indeed valid. The bug had already been
    reported, in slightly different context, at:

    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12333

    so you may want to visit there. That bug is still open. It's
    not really fxed in 3.4.0, but al least it doesn't segfault.

    Danny

     
  • Earnie Boyd

    Earnie Boyd - 2012-10-25
    • milestone: --> Aged_issue
    • status: open-later --> closed-out-of-date
     
  • Earnie Boyd

    Earnie Boyd - 2013-01-28
    • status: closed-out-of-date --> closed
    • resolution: --> out-of-date
    • category: --> Known_bugs
    • milestone: --> OTHER
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks