[Bug 520043] Re: [PR44628] g++ segfaults on templated class virtuals

Bug Watch Updater 520043 at bugs.launchpad.net
Sat Mar 23 22:07:22 UTC 2013


** Changed in: gcc
   Importance: Unknown => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-4.5 in Ubuntu.
https://bugs.launchpad.net/bugs/520043

Title:
  [PR44628] g++ segfaults on templated class virtuals

Status in The GNU Compiler Collection:
  Fix Released
Status in “gcc-4.3” package in Ubuntu:
  Won't Fix
Status in “gcc-4.4” package in Ubuntu:
  Won't Fix
Status in “gcc-4.5” package in Ubuntu:
  Fix Released

Bug description:
  Binary package hint: gcc-4.3

  While trying to compile virtual methods of a templated class, I get an
  internal compiler error: SegFault.

  When you look at the code, specifically the virtual and child method,
  there is clearly a logic issue.  That is my fault.  However,  users
  shouldn't see a segfault; a syntax error would make more sense.

  The follow code will reproduce the error.

  template <typename T>
  class Temp
  {
    int Val;
    public:
    operator T&(void)  { return Val; }

    virtual T& operator=(T a )
    {
      Val = a;
      return Val;
    }
  };

  class Int : public Temp<int>
  {
    public:
    Int& operator=(int a)
    {
      return (*this);
    }
  };

  int main() { return 1; }

    //Command line
  g++ main.cpp

  main.cpp:16: internal compiler error: Segmentation fault
  Please submit a full bug report,
  with preprocessed source if appropriate.
  See <file:///usr/share/doc/gcc-4.3/README.Bugs> for instructions.

    //G++ version
  g++ -v

  Using built-in specs.
  Target: x86_64-linux-gnu
  Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.3-5ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
  Thread model: posix
  gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) 

    //lsb_release -rd
  lsb_release -rd

  Description:	Ubuntu 9.04
  Release:	9.04

    //apt-cache policy
  apt-cache policy

  g++:
    Installed: 4:4.3.3-1ubuntu1
    Candidate: 4:4.3.3-1ubuntu1
    Version table:
   *** 4:4.3.3-1ubuntu1 0
          500 http://us.archive.ubuntu.com jaunty/main Packages
          100 /var/lib/dpkg/status

  -Orby

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/520043/+subscriptions




More information about the foundations-bugs mailing list