public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/26825]  New: bad allocation while adding new elements to vector
@ 2006-03-23 12:33 algorithmus at gmail dot com
  2006-03-23 14:34 ` [Bug libstdc++/26825] " rguenth at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: algorithmus at gmail dot com @ 2006-03-23 12:33 UTC (permalink / raw)
  To: gcc-bugs

I have djgpp g++ compiler 4.0.0 running on Windows. 
To compile I use
gpp -o file -O2 file.cpp

After executing following code
---------------------
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
using namespace std;


int M;

struct pnt{
        char c;
        int x;
        char dir;
};

vector<pnt> a;

pnt tmp;

int main(){
        M = 1000000;
        for(int i = 0;i<M;i++){
                tmp.c = 'S';
                tmp.x = 1;
                tmp.dir = 0;
                a.push_back(tmp);
                tmp.x = 2;
                tmp.dir = 1;
                a.push_back(tmp);
        }
        return 0;
}
---------------------
there will be memory bad_alloc exception

------------
terminate called after throwing an instance of 'std::bad_alloc'
  what():  St9bad_alloc
Abort!
Exiting due to signal SIGABRT
Raised at eip=0000e64e
eax=000d6d64 ebx=00000120 ecx=00000000 edx=00000000 esi=00000001 edi=00056f58
ebp=000d6e10 esp=000d6d60 program=D:\MYCONT~1\WROC\2\TMP.EXE
cs: sel=08ff  base=01cd0000  limit=0194ffff
ds: sel=0907  base=01cd0000  limit=0194ffff
es: sel=0907  base=01cd0000  limit=0194ffff
fs: sel=08d7  base=0000e270  limit=0000ffff
gs: sel=0917  base=00000000  limit=0010ffff
ss: sel=0907  base=01cd0000  limit=0194ffff
App stack: [000d6f58..00056f58]  Exceptn stack: [00056eac..00054f6c]

Call frame traceback EIPs:
  0x0000e574
  0x0000e64e
  0x0000b3fb
  0x00020e5e
  0x0001c0f4
  0x0001c12e
  0x0001bce3
  0x000193dd
  0x000214f7
  0x000016eb
  0x0000abd8
-----------

Of course, while using older gcc (i.e. 3.2.3) code works fine.
There must be the same problem on g++ 4.0.3 at Linux platform.


-- 
           Summary: bad allocation while adding new elements to vector
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: algorithmus at gmail dot com


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


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

* [Bug libstdc++/26825] bad allocation while adding new elements to vector
  2006-03-23 12:33 [Bug c++/26825] New: bad allocation while adding new elements to vector algorithmus at gmail dot com
@ 2006-03-23 14:34 ` rguenth at gcc dot gnu dot org
  2006-03-23 18:07 ` [Bug c++/26825] New: " DJ Delorie
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-03-23 14:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2006-03-23 14:34 -------
Works for me.  Make sure the correct libstdc++ is used for executing.


-- 


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


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

* Re: [Bug c++/26825]  New: bad allocation while adding new elements to vector
  2006-03-23 12:33 [Bug c++/26825] New: bad allocation while adding new elements to vector algorithmus at gmail dot com
  2006-03-23 14:34 ` [Bug libstdc++/26825] " rguenth at gcc dot gnu dot org
@ 2006-03-23 18:07 ` DJ Delorie
  2006-03-23 18:08 ` [Bug libstdc++/26825] " dj at redhat dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: DJ Delorie @ 2006-03-23 18:07 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs


When reporting DJGPP bugs, please run your app under gdb and use
"where" to get a traceback, or use djgpp's symify (or bfdsymify) to
replace these hex numbers with file/line information.  You may need to
compile your application with -g to get symbolic debugging
information.

> Call frame traceback EIPs:
>   0x0000e574
>   0x0000e64e
>   0x0000b3fb
>   0x00020e5e
>   0x0001c0f4
>   0x0001c12e
>   0x0001bce3
>   0x000193dd
>   0x000214f7
>   0x000016eb
>   0x0000abd8


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

* [Bug libstdc++/26825] bad allocation while adding new elements to vector
  2006-03-23 12:33 [Bug c++/26825] New: bad allocation while adding new elements to vector algorithmus at gmail dot com
  2006-03-23 14:34 ` [Bug libstdc++/26825] " rguenth at gcc dot gnu dot org
  2006-03-23 18:07 ` [Bug c++/26825] New: " DJ Delorie
@ 2006-03-23 18:08 ` dj at redhat dot com
  2006-04-30  4:13 ` pinskia at gcc dot gnu dot org
  2006-09-12  4:59 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: dj at redhat dot com @ 2006-03-23 18:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dj at redhat dot com  2006-03-23 18:07 -------
Subject: Re:   New: bad allocation while adding new elements to vector


When reporting DJGPP bugs, please run your app under gdb and use
"where" to get a traceback, or use djgpp's symify (or bfdsymify) to
replace these hex numbers with file/line information.  You may need to
compile your application with -g to get symbolic debugging
information.

> Call frame traceback EIPs:
>   0x0000e574
>   0x0000e64e
>   0x0000b3fb
>   0x00020e5e
>   0x0001c0f4
>   0x0001c12e
>   0x0001bce3
>   0x000193dd
>   0x000214f7
>   0x000016eb
>   0x0000abd8


-- 


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


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

* [Bug libstdc++/26825] bad allocation while adding new elements to vector
  2006-03-23 12:33 [Bug c++/26825] New: bad allocation while adding new elements to vector algorithmus at gmail dot com
                   ` (2 preceding siblings ...)
  2006-03-23 18:08 ` [Bug libstdc++/26825] " dj at redhat dot com
@ 2006-04-30  4:13 ` pinskia at gcc dot gnu dot org
  2006-09-12  4:59 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-30  4:13 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug libstdc++/26825] bad allocation while adding new elements to vector
  2006-03-23 12:33 [Bug c++/26825] New: bad allocation while adding new elements to vector algorithmus at gmail dot com
                   ` (3 preceding siblings ...)
  2006-04-30  4:13 ` pinskia at gcc dot gnu dot org
@ 2006-09-12  4:59 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-12  4:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-09-12 04:59 -------
No feedback in 3 months so closing.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2006-09-12  4:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-23 12:33 [Bug c++/26825] New: bad allocation while adding new elements to vector algorithmus at gmail dot com
2006-03-23 14:34 ` [Bug libstdc++/26825] " rguenth at gcc dot gnu dot org
2006-03-23 18:07 ` [Bug c++/26825] New: " DJ Delorie
2006-03-23 18:08 ` [Bug libstdc++/26825] " dj at redhat dot com
2006-04-30  4:13 ` pinskia at gcc dot gnu dot org
2006-09-12  4:59 ` pinskia at gcc dot gnu dot org

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