public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Carl Edwards <cedwards@vitesse.com>
To: egcs@cygnus.com
Subject: Re: Optimizer Problem
Date: Mon, 11 May 1998 18:22:00 -0000	[thread overview]
Message-ID: <3557A441.FD1CB74E@vitesse.com> (raw)
In-Reply-To: <199805111338.PAA20583@hqsim1tep.te>

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




      parent reply	other threads:[~1998-05-11 18:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-11 15:07 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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3557A441.FD1CB74E@vitesse.com \
    --to=cedwards@vitesse.com \
    --cc=egcs@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).