Bug: crash from unused forward looking model local variables

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Bug: crash from unused forward looking model local variables

Postby cfp » Thu May 20, 2010 2:56 pm

If there is a model local variable that contains a lead of an endogenous variable, and that model local variable is never used, then Dynare crashes with "an instance of 'DataTree::UnknownDerivIDException'".

This happens in 4.1.1 and in the nightly build.

The attached model file demonstrates it. (A massively stripped down version of the model file I was working with.)

To see that the two conditions are above are necessary for the crash, change the first line of the file to:
Code: Select all
@#define crash = 0

and rerun. It will then use the model local variable which is sufficient to remove the crash.

Then undo this change, and instead comment out line 44. Now the forward looking local variable does not get defined and again the crash disappears.

Tom
Attachments
dseg1_js.mod
(1.68 KiB) Downloaded 319 times
cfp
 
Posts: 60
Joined: Mon Mar 15, 2010 9:18 pm

Re: Bug: crash from unused forward looking model local variables

Postby MichelJuillard » Sat May 22, 2010 2:27 pm

Thanks cfp for reporting the bug. We are going to look into it.

Best

Michel
MichelJuillard
 
Posts: 680
Joined: Thu Nov 18, 2004 10:51 am

Re: Bug: crash from unused forward looking model local variables

Postby cfp » Thu Jul 01, 2010 7:55 pm

Hey,

Sorry to pester, but is a fix to this in the works? I'm now working with a different model with more model local variables (declared in loops) and tracking down which are unused is a real pain.

Thanks in advance,

Tom
cfp
 
Posts: 60
Joined: Mon Mar 15, 2010 9:18 pm

Re: Bug: crash from unused forward looking model local variables

Postby cfp » Wed Aug 11, 2010 10:50 pm

For anyone else experiencing this bug, the attached C# programme will trim out all the unused model local variables from an already macro expanded model file, as a temporary work around. (You run dynare with "savemacro" in the command line, wait for the crash, then run this passing in the -macroexp.mod file. You then run dynare on this programmes output.)

It may also be useful to others as it cleans up the -macroexp file making it much more readable.

Tom
Attachments
Program.cs.txt
The C# code.
(3.18 KiB) Downloaded 103 times
cfp
 
Posts: 60
Joined: Mon Mar 15, 2010 9:18 pm

Re: Bug: crash from unused forward looking model local variables

Postby SébastienVillemot » Thu Aug 12, 2010 2:00 pm

Sorry for taking long to fix this bug. We are aware of it and it will most probably be fixed in the next Dynare release.

Thanks for posting your temporary workaround.

Best,
Sébastien Villemot
Economist at OFCE – Sciences Po
SébastienVillemot
 
Posts: 706
Joined: Fri Dec 07, 2007 2:29 pm
Location: Paris, France

Re: Bug: crash from unused forward looking model local variables

Postby SébastienVillemot » Thu Sep 23, 2010 10:14 am

The fix has been applied in the git repository and will be in the next release.

See: https://www.dynare.org/trac/ticket/101

If you can't wait, use tomorrow's snapshot.
Sébastien Villemot
Economist at OFCE – Sciences Po
SébastienVillemot
 
Posts: 706
Joined: Fri Dec 07, 2007 2:29 pm
Location: Paris, France

Re: Bug: crash from unused forward looking model local variables

Postby cfp » Thu Sep 23, 2010 12:00 pm

Superb, thanks.
cfp
 
Posts: 60
Joined: Mon Mar 15, 2010 9:18 pm

Re: Bug: crash from unused forward looking model local variables

Postby cfp » Wed Sep 29, 2010 9:38 pm

There's a small residual bug related to this. Dynare currently adds auxiliary variables for leads and lags (of e.g. exogenous vars) which are only mentioned in the definition of unused model local variables.
cfp
 
Posts: 60
Joined: Mon Mar 15, 2010 9:18 pm

Re: Bug: crash from unused forward looking model local variables

Postby SébastienVillemot » Mon Oct 11, 2010 10:47 am

Thanks for reporting this. The fix has been applied. Same as above applies.
Sébastien Villemot
Economist at OFCE – Sciences Po
SébastienVillemot
 
Posts: 706
Joined: Fri Dec 07, 2007 2:29 pm
Location: Paris, France


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 7 guests