public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "wsf at fultondesigns dot co dot uk" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/34822]  New: Compiler seg fault with incorrect templated static member variable initialization
Date: Thu, 17 Jan 2008 02:20:00 -0000	[thread overview]
Message-ID: <bug-34822-8173@http.gcc.gnu.org/bugzilla/> (raw)

Testcase (runme.cxx):

template <typename KernelPixelT>
struct DiffImContainer {
   int id;
   static short xyz;
};
template <typename KernelPixelT> short DiffImContainer<double>::xyz = 0;

int main() {
    DiffImContainer<double> d;
    d.id = 20;
    return 0;
}


william@lion:~/temp/compile$ gcc-4.2 -v -save-temps runme.cxx
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --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.2 --program-suffix=-4.2
--enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr
--enable-targets=all --enable-checking=release --build=i486-linux-gnu
--host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.2.1 (Ubuntu 4.2.1-5ubuntu4)
 /usr/lib/gcc/i486-linux-gnu/4.2.1/cc1plus -E -quiet -v -D_GNU_SOURCE runme.cxx
-mtune=generic -fpch-preprocess -o runme.ii
ignoring nonexistent directory "/usr/local/include/i486-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/i486-linux-gnu/4.2.1/../../../../i486-linux-gnu/include"
ignoring nonexistent directory "/usr/include/i486-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.2
 /usr/include/c++/4.2/i486-linux-gnu
 /usr/include/c++/4.2/backward
 /usr/local/include
 /usr/lib/gcc/i486-linux-gnu/4.2.1/include
 /usr/include
End of search list.
 /usr/lib/gcc/i486-linux-gnu/4.2.1/cc1plus -fpreprocessed runme.ii -quiet
-dumpbase runme.cxx -mtune=generic -auxbase runme -version -fstack-protector
-fstack-protector -o runme.s
GNU C++ version 4.2.1 (Ubuntu 4.2.1-5ubuntu4) (i486-linux-gnu)
        compiled by GNU C version 4.2.1 (Ubuntu 4.2.1-5ubuntu4).
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129454
Compiler executable checksum: 44e55ae5d2724830dee11801424b84d8
runme.cxx:11: internal compiler error: in import_export_decl, at
cp/decl2.c:1962
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.2/README.Bugs>.
william@lion:~/temp/compile$ 


If
template <typename KernelPixelT> short DiffImContainer<double>::xyz = 0;
is corrected to:
template <typename KernelPixelT> short DiffImContainer<KernelPixelT>::xyz = 0;
then everything is okay.


-- 
           Summary: Compiler seg fault with incorrect templated static
                    member variable initialization
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wsf at fultondesigns dot co dot uk


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


             reply	other threads:[~2008-01-17  0:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-17  2:20 wsf at fultondesigns dot co dot uk [this message]
2008-01-17  3:00 ` [Bug c++/34822] " pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-34822-8173@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).