[Bug c++/32839] New: internal compiler error: Segmentation fault (templates)

2007-07-20 Thread danny dot boelens at artwork-systems dot com
Yesterday, one of my collegues ran into an internal compiler error when playing
with some template code.

Although she ran into the ICE on Mac OS X with an Apple gcc 4.01 build, it was
easy enough to reproduce it on a linux box with a GNU gcc build. I'm logging
this against 4.2.1, but it seems every 4.x version segfaults; I tested with
4.02, 4.1-20060113 (yep, some old build laying around), 4.2.1 and even with the
latest 4.3-20070713.

I created a small test case (see attachment) and this is the output I get with
4.2.1:

[EMAIL PROTECTED]:~/bugs/ice> ~/opt/gcc-4.2.1/bin/g++ -v -o test test.cpp
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.2.1/configure --prefix=/home/dannyb/opt/gcc-4.2.1
--enable-languages=c,c++
Thread model: posix
gcc version 4.2.1
 /home/dannyb/opt/gcc-4.2.1/libexec/gcc/i686-pc-linux-gnu/4.2.1/cc1plus -quiet
-v -D_GNU_SOURCE test.cpp -quiet -dumpbase test.cpp -mtune=generic -auxbase
test -version -o /tmp/ccyPKN6k.s
ignoring nonexistent directory
"/home/dannyb/opt/gcc-4.2.1/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:

/home/dannyb/opt/gcc-4.2.1/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../include/c++/4.2.1

/home/dannyb/opt/gcc-4.2.1/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../include/c++/4.2.1/i686-pc-linux-gnu

/home/dannyb/opt/gcc-4.2.1/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../include/c++/4.2.1/backward
 /usr/local/include
 /home/dannyb/opt/gcc-4.2.1/include
 /home/dannyb/opt/gcc-4.2.1/lib/gcc/i686-pc-linux-gnu/4.2.1/include
 /usr/include
End of search list.
GNU C++ version 4.2.1 (i686-pc-linux-gnu)
compiled by GNU C version 4.2.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: cfede80d80c2b8e19355e4026d77f0b9
test.cpp: In member function ‘void ScopeImpl::Execute() [with F = void
(*)(int)]’:
test.cpp:31:   instantiated from ‘static void ScopeImplBase::SafeExecute(J&)
[with J = ScopeImpl]’
test.cpp:50:   instantiated from ‘ScopeImpl::~ScopeImpl() [with F = void
(*)(int)]’
test.cpp:46:   instantiated from ‘static void ScopeImpl::MakeGuard(F) [with
F = void (*)(int)]’
test.cpp:68:   instantiated from ‘void DoAtExit(F) [with F = void (*)(int)]’
test.cpp:74:   instantiated from here
test.cpp:54: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html> for instructions.


-- 
   Summary: internal compiler error: Segmentation fault (templates)
   Product: gcc
   Version: 4.2.1
Status: UNCONFIRMED
  Severity: major
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: danny dot boelens at artwork-systems dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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



[Bug c++/32839] internal compiler error: Segmentation fault (templates)

2007-07-20 Thread danny dot boelens at artwork-systems dot com


--- Comment #1 from danny dot boelens at artwork-systems dot com  
2007-07-20 12:41 ---
Created an attachment (id=13944)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13944&action=view)
Test case that triggers the ICE


-- 


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



[Bug c++/29615] New: Class can't be friends of itself?

2006-10-27 Thread danny dot boelens at artwork-systems dot com
The following simple C++ file:


class A
{
  friend class A;
};

int main() { return 0; }


results in the following error when I try to compile it with g++:

$ ~/gcc-build-4.2-20061007/gcc/g++ -o test test.cpp
test.cpp:3: error: class 'A' is implicitly friends with itself

I was using a snapshot (GCC 4.2 2006/10/07), but I got the same behaviour with
several 4.1.x and 4.0.x builds on both Linux and Windows 2000 (Cygwin).

I agree that it's pointless to make a class a friend of itself (which is why I
used severity 'minor'), but I haven't found anything in my C++ spec (ISO/IEC
14882) that say it is not allowed. Please point my to the relevant section in
case I missed anything.

By the way: all other compilers I've tried accept this file without a problem.
These include Visual Studio .NET 2003, CodeWarrior 8.3, CodeWarrior 9.6 and the
online test drive for Comeau. Comeau does exactly what I'd expect:

Your Comeau C/C++ test results are as follows: 

Comeau C/C++ 4.3.8 (Aug 19 2006 13:36:48) for  ONLINE_EVALUATION_Alpha1
Copyright 1988-2006 Comeau Computing.  All rights reserved.
MODE:strict errors C++

"ComeauTest.c", line 3: warning: pointless friend declaration
   friend class A;
   ^

Not a big issue, but I thought it might be a good idea to log this anyway,
since a search didn't result in relevant hits :-)


-- 
   Summary: Class can't be friends of itself?
   Product: gcc
   Version: 4.2.0
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: danny dot boelens at artwork-systems dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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