| |
| Posted by Scott Mayo | PermalinkReply |
|
Scott Mayo
| My first day using dmc. I fed it some C++ code that was known to be well-behaved; the resulting .exe crashed. I couldn't get the assembler listing working, but I was able to move code and get the correct behaviour.
The crashing code:
switch (p->cmd) //dies around here
{
case CMD_Set:
setpins(p->pinset, p->set.onV);
return 0;
case CMD_SetFreq:
for (i = 0; i < 5; ++i)
..etc
The working code, which is equivalent:
//DigitalMars compiler generates a jump to address 0
//if this is a case in the switch
//no problem as an If, though.
#if 01
if (p->cmd == CMD_Set)
{
setpins(p->pinset, p->set.onV);
return 0;
}
#endif
switch (p->cmd)
{
case CMD_Set:
setpins(p->pinset, p->set.onV);
return 0;
case CMD_SetFreq:
for (i = 0; i < 5; ++i)
I'm new here - does anyone do support? I can make the source available; the
compile command line was just
dmc mycode.cpp
The code uses no explicit new/delete/malloc/stl/iostreams/overloading or any interesting trickery. There is some inline asembler, but when I compile and run it as a console app using the microsoft IDE, that same assmbler runs just fine, so I don't think it's doing any damage. Really looks like a compiler issue to me. Help?
Another trick that worked, then the code was part of the switch statement, was to put a fprintf in the case.
|