From: g DOT smith AT chem DOT canterbury DOT ac DOT nz (Greg Smith) Newsgroups: comp.os.msdos.djgpp Subject: Re: debugging? Date: Thu, 24 Aug 2000 08:40:25 GMT Organization: University of Canterbury Lines: 56 Message-ID: <39a4dd3d.106648430@news.canterbury.ac.nz> References: <39a34d59 DOT 4345588 AT news DOT canterbury DOT ac DOT nz> <8nvvk5$hst$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> NNTP-Posting-Host: 132.181.173.156 X-Newsreader: Forte Free Agent 1.21/32.243 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On 23 Aug 2000 07:48:21 GMT, Hans-Bernhard Broeker wrote: >This is by far not precise enough to give a helpful response. We'll >need compilable code (minimized to the bare necessities before >posting, please) to be able to test this out. > I thought so... I wasn't sure if I should expect a helpful response :) Glad to see I'm too cynical about such things... >The debugger can be confused, sometimes, about the values of certain >variables in highly optimized code which are currently kept in >registers during execution. This is good to know but the code isn't optimised at all. typedef struct{ double rho,hz,m,m0,kp,kpt,ftr,kbb,kt11,alpha,lambda,td, t0,trp,time,kttrp; }model_data; typedef struct{ double h; }simulation_data; main(){ int pulse = 0; model_data mdata; simulation_data sdata; double h; mdata.time = 0; mdata.t0 = 0.1; sdata.h = 0.01; mdata.td = 1; do{ if(mdata.time >= mdata.t0*pulse && mdata.t0*pulse < mdata.time+sdata.h){ pulse++; } h=sdata.h; if(sdata.h >= mdata.t0*pulse - mdata.time)h = mdata.t0*pulse - mdata.time; mdata.time += h; }while(mdata.time < mdata.td); return 0; } On my system the program hangs just before pulse = 6 but the debugger says the condition to execute 'pulse++' is satisfied. Any ideas?