[Bug c++/22248] New: Incorrect work with multiple assigment.

2005-06-30 Thread algorithmus at gmail dot com
hi!

I have a problem with multiply assigment at 
i386-portbld-freebsd5.4
gcc version 4.0.1 20050609 (prerelease) [FreeBSD]

and the same problem in DJGPP with gcc 4.0.0

I've compiled my cpp file with this command line:
g++40 new.cpp

---new.cpp
#include

#define swap(a,b) a^=b^=a^=b

const int N = 2;
int a[N];

int main()
{
for(int i=0;ihttp://gcc.gnu.org/bugzilla/show_bug.cgi?id=22248


[Bug c++/22248] Incorrect work with multiple assigment.

2005-06-30 Thread algorithmus at gmail dot com

--- Additional Comments From algorithmus at gmail dot com  2005-06-30 13:35 
---
no. I guess there is a problem.
just try this progam:


#include

#define swap(a,b) (a^=(b^=(a^=b)))

const int N = 2;
int a[N];

int main()
{
for(int i=0;ihttp://gcc.gnu.org/bugzilla/show_bug.cgi?id=22248


[Bug c++/22248] Incorrect work with multiple assigment.

2005-06-30 Thread algorithmus at gmail dot com

--- Additional Comments From algorithmus at gmail dot com  2005-06-30 18:21 
---
thanks for your suggestions. I usually use STL. But I held training contest for 
Ukrainian team before International Olympiad in Informatics and one guy's used 
this swap macros that doesn't work at my compiler but works fine with his. 

I guess, it'll be useful if the developers add some warning message for similar-
to-this cases.

-- 
   What|Removed |Added

 CC|pinskia at gcc dot gnu dot  |
   |org |


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


[Bug c++/22248] Incorrect work with multiple assigment.

2005-06-30 Thread algorithmus at gmail dot com

--- Additional Comments From algorithmus at gmail dot com  2005-07-01 05:04 
---
(In reply to comment #9)
> 
> Did you try -Wsequence-points (or similar)?

yeah. both -Wall and -Wsequence-points return nothing.

-- 


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


[Bug c++/22248] Incorrect work with multiple assigment.

2005-07-01 Thread algorithmus at gmail dot com

--- Additional Comments From algorithmus at gmail dot com  2005-07-01 12:42 
---
> | > But it will not warn about this testcase as we have array[index] but that 
is filed as PR 16202.
> I don't think you're explaining that we cannot warn.  Are you?

I can't understand what Andrew means. I agree that we should reclassify this 
bug as missing warning. 

Because sometimes programmers could get into this problem.


-- 
   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|DUPLICATE   |


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


[Bug c++/26825] New: bad allocation while adding new elements to vector

2006-03-23 Thread algorithmus at gmail dot com
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 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;


int M;

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

vector a;

pnt tmp;

int main(){
M = 100;
for(int i = 0;ihttp://gcc.gnu.org/bugzilla/show_bug.cgi?id=26825