public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Optimizer Problem
  1998-05-11 15:07 Optimizer Problem Andreas Steil - TEP (Tel. 3281)
@ 1998-05-11 11:37 ` Gerald Pfeifer
  1998-05-11 15:57   ` Wolfgang Faber
  1998-05-11 18:22 ` Carl Edwards
  1 sibling, 1 reply; 4+ messages in thread
From: Gerald Pfeifer @ 1998-05-11 11:37 UTC (permalink / raw)
  To: Andreas Steil - TEP (Tel. 3281); +Cc: egcs-bugs, egcs, wines, andreas.steil

On Mon, 11 May 1998, Andreas Steil - TEP (Tel. 3281) wrote:
> /usr/local/gnu/sol2.5.egcs/lib/g++/stl_construct.h: In function `void 
> destroy<vector<vector<int,__default_alloc_template<false,0> >,__default_alloc_template<false,0> > *>(class 
> vector<vector<int,__default_alloc_template<false,0> >,__default_alloc_template<false,0> > *, class 
> vector<vector<int,__default_alloc_template<false,0> >,__default_alloc_template<false,0> > *)':
> /usr/local/gnu/sol2.5.egcs/lib/g++/stl_construct.h:66: virtual memory exhausted
> 
> Compiling the program without optimizer, i.e. without -O2, everything works perfectly;

Well, this sounds _very_ familiar to me. It looks quite similiar to a
problem I had last year and which has been fixed by Mark Mitchell back
then.

Both egcs 1.0.2 and current snapshots contain Mark's fix.

Unfortunately I cannot access the disk with 1.0.2 on it right now, but
at least with egcs-2.91.28 19980508 (current snapshot) your code compiles
fine on my sparc-sun-solaris2.5.1 with both -O2 and -O3.


> 1) a bug or 
> 2) my wrong understanding on the application of the stl ;-( .
>  
> In the first case, please let me know how the bug can be fixed. 

I suggest updating to egcs-1.0.2, egcs-1.0.3-pre(release) or the current
snapshot (which proved quite stable for me).

Please let us know whether that fixed the problem...

Gerald
-- 
Gerald Pfeifer (Jerry)      Vienna University of Technology
pfeifer@dbai.tuwien.ac.at   http://www.dbai.tuwien.ac.at/~pfeifer/



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

* Optimizer Problem
@ 1998-05-11 15:07 Andreas Steil - TEP (Tel. 3281)
  1998-05-11 11:37 ` Gerald Pfeifer
  1998-05-11 18:22 ` Carl Edwards
  0 siblings, 2 replies; 4+ messages in thread
From: Andreas Steil - TEP (Tel. 3281) @ 1998-05-11 15:07 UTC (permalink / raw)
  To: egcs-bugs; +Cc: egcs, wines, andreas.steil

Hello,

I am working with gcc version egcs-2.90.23 980102 (egcs-1.0.1 release) running on
Solaris 2.5.1.

Working with the stl shipped with the above release, I encountered a problem
which I summarized in a very small program, cf. attachment or annex to this mail,
which reproduces the problem using the optimizer.

Compiling said program with

g++ -Wall -O2 stl_mem.cc 
	
results in the error message

/usr/local/gnu/sol2.5.egcs/lib/g++/stl_construct.h: In function `void 
destroy<vector<vector<int,__default_alloc_template<false,0> >,__default_alloc_template<false,0> > *>(class 
vector<vector<int,__default_alloc_template<false,0> >,__default_alloc_template<false,0> > *, class 
vector<vector<int,__default_alloc_template<false,0> >,__default_alloc_template<false,0> > *)':
/usr/local/gnu/sol2.5.egcs/lib/g++/stl_construct.h:66: virtual memory exhausted

Compiling the program without optimizer, i.e. without -O2, everything works perfectly;
a.out says:

 The element [0][0][4]: 400,
 
as I expected.

Could you please help me and tell me whether the above error message is 
a consequence of 

1) a bug or 
2) my wrong understanding on the application of the stl ;-( .
 
In the first case, please let me know how the bug can be fixed. 

In the second case, please help me to refine my knowledge by briefly explaining me where
I went wrong and by changing the program in a way that it can be compiled with the option -O2.

In either case, I thank you very much in advance for your help.

Desperately seeking help, 
yours,

Andreas

////////////////////////////////////////////////////////////////////////////////////////////

#include <stl.h>
#include <iostream.h>

int main (char* argc, char* argv[]) {

vector< vector< vector<int> > > my3DVector;
vector< vector<int> >           my2DVector;
vector< int >                   my1DVector;

for ( int i = 0; i < 10; i++ ) my1DVector.push_back(100*i);

my2DVector.push_back(my1DVector);

my3DVector.push_back(my2DVector);

cout << " The element [0][0][4]: " << my3DVector[0][0][4] << endl;

}


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

* Re: Optimizer Problem
  1998-05-11 11:37 ` Gerald Pfeifer
@ 1998-05-11 15:57   ` Wolfgang Faber
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Faber @ 1998-05-11 15:57 UTC (permalink / raw)
  To: Gerald Pfeifer
  Cc: Andreas Steil - TEP (Tel. 3281), egcs-bugs, egcs, wines, andreas.steil

On Mon, 11 May 1998, Gerald Pfeifer wrote:
> > Compiling the program without optimizer, i.e. without -O2, everything works perfectly;
> 
> Well, this sounds _very_ familiar to me. It looks quite similiar to a
> problem I had last year and which has been fixed by Mark Mitchell back
> then.
> 
> Both egcs 1.0.2 and current snapshots contain Mark's fix.

Indeed, egcs-1.0.2 compiles the code without problems on an
i586-pc-linux-gnulibc1 system with -O2 and -O3.

Wolfgang
-- 
Wolfgang Faber       <URL: http://stud1.tuwien.ac.at/%7Ee9225210/ >


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

* Re: Optimizer Problem
  1998-05-11 15:07 Optimizer Problem Andreas Steil - TEP (Tel. 3281)
  1998-05-11 11:37 ` Gerald Pfeifer
@ 1998-05-11 18:22 ` Carl Edwards
  1 sibling, 0 replies; 4+ messages in thread
From: Carl Edwards @ 1998-05-11 18:22 UTC (permalink / raw)
  To: egcs

If it helps any this piece of code works on my setup:


Reading specs from /usr/local/egcs/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.27/specs
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)


with -O and -O2.

-Carl E.


Andreas Steil - TEP (Tel. 3281) wrote:

> Hello,
>
> I am working with gcc version egcs-2.90.23 980102 (egcs-1.0.1 release) running on
> Solaris 2.5.1.
>
> Working with the stl shipped with the above release, I encountered a problem
> which I summarized in a very small program, cf. attachment or annex to this mail,
> which reproduces the problem using the optimizer.
>
> Compiling said program with
>
> g++ -Wall -O2 stl_mem.cc
>
> results in the error message
>
> /usr/local/gnu/sol2.5.egcs/lib/g++/stl_construct.h: In function `void
> destroy<vector<vector<int,__default_alloc_template<false,0> >,__default_alloc_template<false,0> > *>(class
> vector<vector<int,__default_alloc_template<false,0> >,__default_alloc_template<false,0> > *, class
> vector<vector<int,__default_alloc_template<false,0> >,__default_alloc_template<false,0> > *)':
> /usr/local/gnu/sol2.5.egcs/lib/g++/stl_construct.h:66: virtual memory exhausted
>
> Compiling the program without optimizer, i.e. without -O2, everything works perfectly;
> a.out says:
>
>  The element [0][0][4]: 400,
>
> as I expected.
>
> Could you please help me and tell me whether the above error message is
> a consequence of
>
> 1) a bug or
> 2) my wrong understanding on the application of the stl ;-( .
>
> In the first case, please let me know how the bug can be fixed.
>
> In the second case, please help me to refine my knowledge by briefly explaining me where
> I went wrong and by changing the program in a way that it can be compiled with the option -O2.
>
> In either case, I thank you very much in advance for your help.
>
> Desperately seeking help,
> yours,
>
> Andreas
>
> ////////////////////////////////////////////////////////////////////////////////////////////
>
> #include <stl.h>
> #include <iostream.h>
>
> int main (char* argc, char* argv[]) {
>
> vector< vector< vector<int> > > my3DVector;
> vector< vector<int> >           my2DVector;
> vector< int >                   my1DVector;
>
> for ( int i = 0; i < 10; i++ ) my1DVector.push_back(100*i);
>
> my2DVector.push_back(my1DVector);
>
> my3DVector.push_back(my2DVector);
>
> cout << " The element [0][0][4]: " << my3DVector[0][0][4] << endl;
>
> }
>
>   ------------------------------------------------------------------------
>
>                        Name: stl_mem.cc
>    stl_mem.cc          Type: Plain Text (text/plain)
>                    Encoding: 7bit
>                 Description: stl_mem.cc




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

end of thread, other threads:[~1998-05-11 18:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-05-11 15:07 Optimizer Problem Andreas Steil - TEP (Tel. 3281)
1998-05-11 11:37 ` Gerald Pfeifer
1998-05-11 15:57   ` Wolfgang Faber
1998-05-11 18:22 ` Carl Edwards

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