Thread: RE: [GD-Windows] VC makes absurd code
Brought to you by:
vexxed72
From: Andrew G. <ag...@cl...> - 2002-07-12 10:07:27
|
Maybe you could post a code snippet of what you're trying to do and where it dies? Andrew Grant- Climax Brighton > -----Original Message----- > From: Sergei Miloikov [mailto:se...@ha...] > Sent: 12 July 2002 11:03 > To: Gam...@li... > Subject: [GD-Windows] VC makes absurd code > > > Hello everybody! > A nasty problem - MSVC 6.0 / SP 5 generates absolutely absurd code - a > conversion from 'const char *' to 'const std::string' crashes > in any target > configuration except Debug one. When looking closely at the > code we saw the > problem - compiler generates code like that: > push 0 > ... > pop edx > mov [edx], bla-bla > > STLport used. > So, it is a problem with the optimizer I guess, but what it > really wierd is > that it happens only on my computer - I check all possible > options, paths, > service packs (MSVC/Win2k), processor packs - still nothing. Now I use > Release builds from other computers, but I am totally > clueless what can > cause such a problem! Anyone experienced anything similar? Thanks! > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Gadgets, caffeine, t-shirts, fun stuff. > http://thinkgeek.com/sf > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=555 > |
From: Andrew G. <ag...@cl...> - 2002-07-12 10:39:19
|
I'm not sure what you want here.... Do you want us to randomly suggest possible reasons why something doesn't work on your machine and works on others? Memory issues Optimisation settings Your desk is located over an ancient indian burial ground Who knows! Without seeing what you're attempting to do it's very hard to even guess what the problem maybe. For what it's worth I wouldn't consider casting a char* to or from a std::string a clever thing to do. If you have a std::string and want a const char*, use .c_str(), that's what it's there for. If you have a char* and want a std::string, construct a new object. Andrew Grant- Climax Brighton > -----Original Message----- > From: Sergei Miloikov [mailto:se...@ha...] > Sent: 12 July 2002 11:23 > To: Gam...@li... > Subject: Re: [GD-Windows] VC makes absurd code > > > That is nothing to do with actual code, because as I said it > happens on > single computer, everywhere it generates the right,working > code. I see the > compiler to generate absurd code once, but it was about the > 'else' clause of > one 'if' that was supposed never to execute and was not > written by that > reason, but since compiler do not understand such thing it > generates the > 'else' clause which was totally absurd - but this dead code > was there and > remains in the executable. For no reason. > My case is not like that - it is perfectly linear code, and one single > cast - there are allocations in that cast (new std::string > object comes to > life), some RB_tree accessing (?!) and a lot of code actually, then > optimizer assumes that allocator can not allocate code (?!?!) > and pushes 0 > to the stack, where the pointer must be pushed... then it is > accessed and it > crashes happily, god damn it! > > P.S. After seeing that piece of code, I use std::string <-> > const char* > casting very carefully, it is amazing how much code can > produce one single > line like that! > > ----- Original Message ----- > From: "Andrew Grant" <ag...@cl...> > To: <Gam...@li...> > Sent: Friday, July 12, 2002 1:07 PM > Subject: RE: [GD-Windows] VC makes absurd code > > > > Maybe you could post a code snippet of what you're trying > to do and where > it > > dies? > > > > Andrew Grant- > > Climax Brighton > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Gadgets, caffeine, t-shirts, fun stuff. > http://thinkgeek.com/sf > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=555 > |
From: Gareth L. <GL...@cl...> - 2002-07-12 11:02:58
|
Only climax take offices over Ancient Indian Burial grounds. Which is quite impressive since there weren't many ancient Indians in England ;) -----Original Message----- From: Andrew Grant [mailto:ag...@cl...] Sent: 12 July 2002 11:39 To: Gam...@li... Subject: RE: [GD-Windows] VC makes absurd code I'm not sure what you want here.... Do you want us to randomly suggest possible reasons why something doesn't work on your machine and works on others? Memory issues Optimisation settings Your desk is located over an ancient indian burial ground Who knows! Without seeing what you're attempting to do it's very hard to even guess what the problem maybe. For what it's worth I wouldn't consider casting a char* to or from a std::string a clever thing to do. If you have a std::string and want a const char*, use .c_str(), that's what it's there for. If you have a char* and want a std::string, construct a new object. Andrew Grant- Climax Brighton > -----Original Message----- > From: Sergei Miloikov [mailto:se...@ha...] > Sent: 12 July 2002 11:23 > To: Gam...@li... > Subject: Re: [GD-Windows] VC makes absurd code > > > That is nothing to do with actual code, because as I said it > happens on > single computer, everywhere it generates the right,working > code. I see the > compiler to generate absurd code once, but it was about the > 'else' clause of > one 'if' that was supposed never to execute and was not > written by that > reason, but since compiler do not understand such thing it > generates the > 'else' clause which was totally absurd - but this dead code > was there and > remains in the executable. For no reason. > My case is not like that - it is perfectly linear code, and one single > cast - there are allocations in that cast (new std::string > object comes to > life), some RB_tree accessing (?!) and a lot of code actually, then > optimizer assumes that allocator can not allocate code (?!?!) > and pushes 0 > to the stack, where the pointer must be pushed... then it is > accessed and it > crashes happily, god damn it! > > P.S. After seeing that piece of code, I use std::string <-> > const char* > casting very carefully, it is amazing how much code can > produce one single > line like that! > > ----- Original Message ----- > From: "Andrew Grant" <ag...@cl...> > To: <Gam...@li...> > Sent: Friday, July 12, 2002 1:07 PM > Subject: RE: [GD-Windows] VC makes absurd code > > > > Maybe you could post a code snippet of what you're trying > to do and where > it > > dies? > > > > Andrew Grant- > > Climax Brighton > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Gadgets, caffeine, t-shirts, fun stuff. > http://thinkgeek.com/sf > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=555 > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Gadgets, caffeine, t-shirts, fun stuff. http://thinkgeek.com/sf _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=555 |
From: Gareth L. <GL...@cl...> - 2002-07-12 11:03:38
|
The obvious solution would probably work. Reinstall OS Reinstall IDE Reinstall Libs -----Original Message----- From: Sergei Miloikov [mailto:se...@ha...] Sent: 12 July 2002 11:23 To: Gam...@li... Subject: Re: [GD-Windows] VC makes absurd code That is nothing to do with actual code, because as I said it happens on single computer, everywhere it generates the right,working code. I see the compiler to generate absurd code once, but it was about the 'else' clause of one 'if' that was supposed never to execute and was not written by that reason, but since compiler do not understand such thing it generates the 'else' clause which was totally absurd - but this dead code was there and remains in the executable. For no reason. My case is not like that - it is perfectly linear code, and one single cast - there are allocations in that cast (new std::string object comes to life), some RB_tree accessing (?!) and a lot of code actually, then optimizer assumes that allocator can not allocate code (?!?!) and pushes 0 to the stack, where the pointer must be pushed... then it is accessed and it crashes happily, god damn it! P.S. After seeing that piece of code, I use std::string <-> const char* casting very carefully, it is amazing how much code can produce one single line like that! ----- Original Message ----- From: "Andrew Grant" <ag...@cl...> To: <Gam...@li...> Sent: Friday, July 12, 2002 1:07 PM Subject: RE: [GD-Windows] VC makes absurd code > Maybe you could post a code snippet of what you're trying to do and where it > dies? > > Andrew Grant- > Climax Brighton ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Gadgets, caffeine, t-shirts, fun stuff. http://thinkgeek.com/sf _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=555 |
From: Gareth L. <GL...@cl...> - 2002-07-12 13:12:09
|
Have you tried this in a totally clean project ? I ask because we find that deleting your .opt file for a project solves a lot of problems. If not, as I said before, try reinstalling you entire machine, normally fixes everything for atleast 4 months. -----Original Message----- From: Sergei Miloikov [mailto:se...@ha...] Sent: 12 July 2002 14:02 To: GD-Windows Subject: Fw: [GD-Windows] VC makes absurd code > Service Pack? Latest one for MSVC++ 6.0 is SP5 I think. That was the first thing I tried after comparing all the options between my machine and one with worlking compiler. ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Gadgets, caffeine, t-shirts, fun stuff. http://thinkgeek.com/sf _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=555 |
From: Sergei M. <se...@ha...> - 2002-07-12 10:24:19
|
That is nothing to do with actual code, because as I said it happens on single computer, everywhere it generates the right,working code. I see the compiler to generate absurd code once, but it was about the 'else' clause of one 'if' that was supposed never to execute and was not written by that reason, but since compiler do not understand such thing it generates the 'else' clause which was totally absurd - but this dead code was there and remains in the executable. For no reason. My case is not like that - it is perfectly linear code, and one single cast - there are allocations in that cast (new std::string object comes to life), some RB_tree accessing (?!) and a lot of code actually, then optimizer assumes that allocator can not allocate code (?!?!) and pushes 0 to the stack, where the pointer must be pushed... then it is accessed and it crashes happily, god damn it! P.S. After seeing that piece of code, I use std::string <-> const char* casting very carefully, it is amazing how much code can produce one single line like that! ----- Original Message ----- From: "Andrew Grant" <ag...@cl...> To: <Gam...@li...> Sent: Friday, July 12, 2002 1:07 PM Subject: RE: [GD-Windows] VC makes absurd code > Maybe you could post a code snippet of what you're trying to do and where it > dies? > > Andrew Grant- > Climax Brighton |
From: Javier A. <ja...@py...> - 2002-07-12 12:19:28
|
Sergei Miloikov <se...@ha...> wrote: > That is nothing to do with actual code, because as I said it happens > on single computer, everywhere it generates the right,working code. Service Pack? Latest one for MSVC++ 6.0 is SP5 I think. Javier Arevalo Pyro Studios |