From behgi161@student.liu.se Sat Feb 10 07:36:59 2001
Received: from m125.ryd.student.liu.se ([130.236.214.125])
	by fencepost.gnu.org with esmtp (Exim 3.16 #1 (Debian))
	id 14RZGs-0003KD-00
	for <bug-commoncpp@gnu.org>; Sat, 10 Feb 2001 07:36:58 -0500
Received: from localhost (behgi161@localhost [127.0.0.1])
	by m125.ryd.student.liu.se (8.11.2/8.11.2) with ESMTP id f1ACXia00506
	for <bug-commoncpp@gnu.org>; Sat, 10 Feb 2001 13:33:44 +0100
Date: Sat, 10 Feb 2001 13:33:44 +0100 (CET)
From: Behrang Gilanpour <behgi161@student.liu.se>
X-X-Sender:  <behgi161@m125.ryd.student.liu.se>
To: <bug-commoncpp@gnu.org>
Subject: Segmentation fault
Message-ID: <Pine.LNX.4.31.0102101332430.503-100000@m125.ryd.student.liu.se>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Sender: bug-commoncpp-admin@gnu.org
Errors-To: bug-commoncpp-admin@gnu.org
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.0
Precedence: bulk
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp/>

Hi!

the code below code segfaults... ive been staring at it for quite a bit
now, and i cant seem to see the problem. I would be really happy if you could
give me hints or atleast say whats wrong :)

Everything works fine with the first iterator... but when I try to do
_anything_ with the i2 it segfaults ...   even that cout << *i2
segfaults and i dont see why the first one works and not the second one :(
To me it seems like something goes very wrong in the
StringTokenizer::iterator  .. but i dunno... maybe my code is wrong some
how. Anyway, I would really appreciate some guidance...

Best regards,
  Behrang

(check below for gdb backtrace and my method's code)
(btw, you should change in your README file, it says bug-commonc++@gnu.org
 instead of bug-commoncpp@gnu.org (bug-commonc++ is not deliverable))

this is from gdb:

Program received signal SIGSEGV, Segmentation fault.
0x40159b5b in chunk_alloc (ar_ptr=0x401ec280, nb=16) at malloc.c:2893
2893    malloc.c: No such file or directory.
Current language:  auto; currently c
(gdb) bt
#0  0x40159b5b in chunk_alloc (ar_ptr=0x401ec280, nb=16) at malloc.c:2893
#1  0x40159234 in __libc_malloc (bytes=4) at malloc.c:2714
#2  0x400a3979 in __builtin_new () from /usr/lib/libstdc++-libc6.1-2.so.3
#3  0x400a3b5f in __builtin_vec_new () from /usr/lib/libstdc++-libc6.1-2.so.3
#4  0x40025278 in StringTokenizer::iterator::operator* (this=0xbffff92c)
    at keydata.cpp:482
#5  0x804cb1e in myClass::PASV (this=0x8050390) at test.cpp:171

..... StringTokenizer::iterator::operator*  getting used by my method

----------------------------------------------
void myClass::PASV() {
  tcp << "PASV" << endl;     // tcp is tcpstream, created earlier
  tcp.getline(output,512);   // output is also allocated earlier
  // output == 227 Entering Passive Mode (h1,h2,h3,h4,p1,p2)

  StringTokenizer st(output, " ");
  StringTokenizer::iterator i;
  i = st.begin();
  ++i; ++i; ++i; ++i;
  char temp[35];
  strcpy(temp,*i);
  *(temp+(strlen(temp))-2) = '\0';  // temp == (h1,h2,h3,h4,p1,p2

  // temp+1 == h1,h2,h3,h4,p1,p2
  StringTokenizer st2(temp+1, ",");
  StringTokenizer::iterator i2;
  i2 = st2.begin();

  cout << *i2 << endl;  // Here's where it crashes, i never get the cout
}

-----------------------------------------------



From igodard@rational.com Sat Feb 10 18:04:05 2001
Received: from sus-ca3it02.rational.com ([130.213.2.5])
	by fencepost.gnu.org with smtp (Exim 3.16 #1 (Debian))
	id 14Rj3l-0003PO-00
	for <bug-commoncpp@gnu.org>; Sat, 10 Feb 2001 18:04:05 -0500
Received: from 172.19.8.250 by sus-ca3it02.rational.com (InterScan E-Mail VirusWall NT); Sat, 10 Feb 2001 15:12:24 -0800 (Pacific Standard Time)
Received: from rational.com (pine [192.232.3.144])
	by cupmail0.rational.com (8.9.3/8.8.7/RATIONAL-cupmail0) with ESMTP id PAA09462
	for <bug-commoncpp@gnu.org>; Sat, 10 Feb 2001 15:02:20 -0800 (PST)
Message-ID: <3A85C8D5.CBA4B8C0@rational.com>
Date: Sat, 10 Feb 2001 15:03:49 -0800
From: Ivan Godard <igodard@Rational.Com>
Organization: Rational Software Corp.
X-Mailer: Mozilla 4.61 [en] (X11; U; Linux 2.2.12-20smp i686)
X-Accept-Language: en
MIME-Version: 1.0
To: bug-commoncpp@gnu.org
Subject: Bug? Local class always public...
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: bug-commoncpp-admin@gnu.org
Errors-To: bug-commoncpp-admin@gnu.org
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.0
Precedence: bulk
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp/>

The following code compiles under:

Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)

when it should complain that  foo:lc is not in scope in the declaration of v1:

class foo {
private:
    class lc {
    public:
        int i;
    };
    int k;
public:
    int j;
};

int main() {
foo v;
foo::lc v1;
int x = v1.i;
return 0;
}


Ivan



From igodard@rational.com Sun Feb 11 01:52:15 2001
Received: from sus-ca3it02.rational.com ([130.213.2.5])
	by fencepost.gnu.org with smtp (Exim 3.16 #1 (Debian))
	id 14RqMp-0001Ya-00
	for <bug-commoncpp@gnu.org>; Sun, 11 Feb 2001 01:52:15 -0500
Received: from 172.19.8.250 by sus-ca3it02.rational.com (InterScan E-Mail VirusWall NT); Sat, 10 Feb 2001 23:00:44 -0800 (Pacific Standard Time)
Received: from rational.com (pine [192.232.3.144])
	by cupmail0.rational.com (8.9.3/8.8.7/RATIONAL-cupmail0) with ESMTP id WAA19346
	for <bug-commoncpp@gnu.org>; Sat, 10 Feb 2001 22:50:39 -0800 (PST)
Message-ID: <3A86369A.A303ED89@rational.com>
Date: Sat, 10 Feb 2001 22:52:10 -0800
From: Ivan Godard <igodard@Rational.Com>
Organization: Rational Software Corp.
X-Mailer: Mozilla 4.61 [en] (X11; U; Linux 2.2.12-20smp i686)
X-Accept-Language: en
MIME-Version: 1.0
To: bug-commoncpp@gnu.org
Subject: Bug? default args for nested templates gives error
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: bug-commoncpp-admin@gnu.org
Errors-To: bug-commoncpp-admin@gnu.org
X-BeenThere: bug-commoncpp@gnu.org
X-Mailman-Version: 2.0
Precedence: bulk
List-Help: <mailto:bug-commoncpp-request@gnu.org?subject=help>
List-Post: <mailto:bug-commoncpp@gnu.org>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=subscribe>
List-Id: Bug reports for Common C++ <bug-commoncpp.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-commoncpp>,
	<mailto:bug-commoncpp-request@gnu.org?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-commoncpp/>

Using:

igodard@pine <130> gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)

the compiler gives:

igodard@pine <131> gcc -c test3.cpp
test3.cpp:4: redefinition of default argument for `int const a2'
test3.cpp:4:   original definition appeared here
igodard@pine <132>


from this source example:

template <int a1 = 100> class c1 {};

class c {
template <int a2 = 100> class c2 {};
};

Note that the error is reported only for the nested template.



