[Bug 479504] [NEW] internal compiler error: offsetof within class template definition
Roger Pate
roger at qxxy.com
Mon Nov 9 20:49:27 UTC 2009
Public bug reported:
Binary package hint: gcc-4.3
The simple test case, gcc-ice-bare.cpp, is below. It should generate an
error (A is undefined at that point), but not an ICE! Other variations
are in gcc-ice.cpp.
$ cat gcc-ice-bare.cpp
template<class T>
struct A {
int d;
char a[__builtin_offsetof(A, d)];
};
int main() {
A<int> l;
}
$ g++ gcc-ice-bare.cpp
gcc-ice-bare.cpp: In instantiation of ‘A<int>’:
gcc-ice-bare.cpp:7: instantiated from here
gcc-ice-bare.cpp:4: 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++ -v
Using built-in specs.
Target: i486-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 --enable-targets=all --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4)
$ cat gcc-ice.cpp
#include <cstddef> // which just has the below anyway
//#define offsetof __builtin_offsetof
template<class T>
struct A {
int d;
//void f() { int n = offsetof(A, d); } // works (correctly)
static int const n = offsetof(A, d); // works (but shouldn't afaik)
//void f() { char a[offsetof(A, d)+1]; } // works (correctly)
//char a[offsetof(A, d)+1]; // ICE
//char a[offsetof(A, d)]; // ICE
};
int main() {
A<int> l;
}
** Affects: gcc-4.3 (Ubuntu)
Importance: Undecided
Status: New
--
internal compiler error: offsetof within class template definition
https://bugs.launchpad.net/bugs/479504
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
ubuntu-bugs at lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
More information about the universe-bugs
mailing list