public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/6380: Internal compiler error involving fstream and xsub (perl c++ wrapper code)
@ 2002-04-19 15:06 rsteinke
  0 siblings, 0 replies; 3+ messages in thread
From: rsteinke @ 2002-04-19 15:06 UTC (permalink / raw)
  To: gcc-gnats, debian-gcc


>Number:         6380
>Category:       c++
>Synopsis:       Internal compiler error involving fstream and xsub (perl c++ wrapper code)
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 19 15:06:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Ron Steinke
>Release:        3.0.4 (Debian testing/unstable)
>Organization:
>Environment:
System: Linux ouroboros 2.4.17 #10 Fri Mar 8 01:21:59 PST 2002 i686 unknown
Architecture: i686, Debian woody, using perl 5.6.1
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
>Description:
	Internal compiler error, happens in both g++-2.95.4 and g++-3.0.4.
	I was attempting to produce a test case for some lockups that
	were happening when I wrapped a c++ library which used iostreams
	in an xsub so it could be called from perl. The test case
	produced an internal error.
>How-To-Repeat:
	I am including both the file Conflict.xs with the original code,
	and the generated Conflict.c file (really a c++ file) with the
	c++ code. The compilation command which originally produced the
	error was:

	g++ -c  -DDEBIAN -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2   -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -fPIC -I/usr/lib/perl/5.6.1/CORE  Conflict.c

	I tried again with all the flags except for -I/usr/lib/perl/5.6.1/CORE
	removed, and the behavior was the same.

	--- begin Conflict.xs ---
#include <fstream>
#include <sstream>
#include <iostream>

extern "C" {
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
}

class Log {
 public:
  Log()
  {
    std::ostringstream ost;
    ost << "tmp/file" << filenum++;

    _log.open(ost.str().c_str(), std::ios::out | std::ios::app);
    _log << "testing\n";
  }

  ~Log() {_log.close();}

 private:
  std::fstream _log;

  static int filenum;
}

Log::filenum = 0;

MODULE = Conflict		PACKAGE = Conflict		

Log*
Log::new()

void
Log::DESTROY()
	--- end Conflict.xs, begin Conflict.c ---
/*
 * This file was generated automatically by xsubpp version 1.9508 from the 
 * contents of Conflict.xs. Do not edit this file, edit Conflict.xs instead.
 *
 *	ANY CHANGES MADE HERE WILL BE LOST! 
 *
 */

#line 1 "Conflict.xs"
#include <fstream>
#include <sstream>
#include <iostream>

extern "C" {
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
}

class Log {
 public:
  Log()
  {
    std::ostringstream ost;
    ost << "tmp/file" << filenum++;

    _log.open(ost.str().c_str(), std::ios::out | std::ios::app);
    _log << "testing\n";
  }

  ~Log() {_log.close();}

 private:
  std::fstream _log;

  static int filenum;
}

Log::filenum = 0;

#line 42 "Conflict.c"
XS(XS_Conflict_new)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Conflict::new(CLASS)");
    {
	char *	CLASS = (char *)SvPV(ST(0),PL_na);
	Log *	RETVAL;

	RETVAL = new Log();
	ST(0) = sv_newmortal();
	sv_setref_pv( ST(0), CLASS, (void*)RETVAL );

    }
    XSRETURN(1);
}

XS(XS_Conflict_DESTROY)
{
    dXSARGS;
    if (items != 1)
	Perl_croak(aTHX_ "Usage: Conflict::DESTROY(THIS)");
    {
	Log *	THIS;

	if( sv_isobject(ST(0)) && (SvTYPE(SvRV(ST(0))) == SVt_PVMG) )
		THIS = (Log *)SvIV((SV*)SvRV( ST(0) ));
	else{
		warn( "Conflict::DESTROY() -- THIS is not a blessed SV reference" );
		XSRETURN_UNDEF;
	};

	delete THIS;
    }
    XSRETURN_EMPTY;
}

#ifdef __cplusplus
extern "C"
#endif
XS(boot_Conflict)
{
    dXSARGS;
    char* file = __FILE__;

    XS_VERSION_BOOTCHECK ;

        newXS("Conflict::new", XS_Conflict_new, file);
        newXS("Conflict::DESTROY", XS_Conflict_DESTROY, file);
    XSRETURN_YES;
}
	--- end Conflict.c ---
>Fix:
	None known
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: c++/6380: Internal compiler error involving fstream and xsub (perl c++ wrapper code)
@ 2002-12-06 15:06 reichelt
  0 siblings, 0 replies; 3+ messages in thread
From: reichelt @ 2002-12-06 15:06 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, rsteinke

Synopsis: Internal compiler error involving fstream and xsub (perl c++ wrapper code)

State-Changed-From-To: feedback->closed
State-Changed-By: reichelt
State-Changed-When: Fri Dec  6 15:06:54 2002
State-Changed-Why:
    No feedback for maore than 6 months.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6380


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: c++/6380: Internal compiler error involving fstream and xsub (perl c++ wrapper code)
@ 2002-04-20  5:15 rodrigc
  0 siblings, 0 replies; 3+ messages in thread
From: rodrigc @ 2002-04-20  5:15 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, rsteinke

Synopsis: Internal compiler error involving fstream and xsub (perl c++ wrapper code)

State-Changed-From-To: open->feedback
State-Changed-By: rodrigc
State-Changed-When: Sat Apr 20 05:15:14 2002
State-Changed-Why:
    Your testcase is not standalone and needs all sorts of
    files in order to compile properly.
    Please read the instructions at http://gcc.gnu.org/bugs.html
    and submit preprocessed source.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6380


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-12-06 23:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-19 15:06 c++/6380: Internal compiler error involving fstream and xsub (perl c++ wrapper code) rsteinke
2002-04-20  5:15 rodrigc
2002-12-06 15:06 reichelt

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).