MantisBT - opensim
View Issue Details
0008627opensim[REGION] Scripting Enginepublic2019-11-12 23:482019-11-14 07:34
Kayaker Magic 
 
highmajoralways
resolvedopen 
Linux MonoOpenSim 0.9.1.1.Yeti Dev
0.9.1.0 
 
435c30c038f9cdd96a2e9915554ef8efe7014614
Grid (Multiple Regions per Sim)
ubODE
YEngine
Mono / Linux64
6.x
FireStorm
0008627: YEngine gives reference error for logic == expressions
Several scripts of mine that worked fine in earlier versions of OpenSim/YEngine are now reporting an error on compile:
"Error: Object reference not set to an instance of an object"
I found the simplest example that gets this error is:
default
{
    state_entry()
    {
        if (0 == 0)
            llSay(0,"true");
    }
}
This is simplified from the original code where the first 0 was an integer expression that I was testing for 0. But even comparing 0 with itself generages that reference/instance error.
I'm unsure when the error appeared, the scripts were not generating errors on a dev master version from several weeks ago. I tried this little script in 0.9.1.0 Snail Release and the error is still happening!
No tags attached.
Issue History
2019-11-12 23:48Kayaker MagicNew Issue
2019-11-12 23:56Kayaker MagicDescription Updatedbug_revision_view_page.php?rev_id=8568#r8568
2019-11-13 00:05Kayaker MagicGit Revision or version number => 435c30c038f9cdd96a2e9915554ef8efe7014614
2019-11-13 00:05Kayaker MagicAdditional Information Updatedbug_revision_view_page.php?rev_id=8570#r8570
2019-11-13 00:24Kayaker MagicAdditional Information Updatedbug_revision_view_page.php?rev_id=8571#r8571
2019-11-13 04:15tampaNote Added: 0035853
2019-11-13 04:53piusnoelNote Added: 0035854
2019-11-13 04:56tampaNote Added: 0035855
2019-11-13 10:24Kayaker MagicNote Added: 0035857
2019-11-13 13:07UbitUmarovNote Added: 0035858
2019-11-13 15:29UbitUmarovNote Added: 0035859
2019-11-14 00:31Kayaker MagicNote Added: 0035861
2019-11-14 00:32Kayaker MagicStatusnew => resolved
2019-11-14 07:34UbitUmarovNote Added: 0035875

Notes
(0035853)
tampa   
2019-11-13 04:15   
That does not seem like a reasonable thing to do and since that is effectively if(TRUE) why not use that?
(0035854)
piusnoel   
2019-11-13 04:53   
Because it might break existing scripts you even don't have access to.
(0035855)
tampa   
2019-11-13 04:56   
If a script contains if (0 == 0) or (TRUE) I think there are bigger issues to solve than that, because that is a non-sensical thing to do frankly.
(0035857)
Kayaker Magic   
2019-11-13 10:24   
My scripts do not conatain if (0 == 0). They contain
if ((complicated logical expression calling LSL bunctions)==0)
But I was able to simplify them to (0 == 0) and still get an error from the compiler.
(0035858)
UbitUmarov   
2019-11-13 13:07   
this seems to be only a Constant compareOP Constant issue right?
( compareOP beening == <= etc)
(0035859)
UbitUmarov   
2019-11-13 15:29   
made changes on master.
note that string compareOp string with
compareop diferent than '==' will work unlike standard
following c# strings order
(0035861)
Kayaker Magic   
2019-11-14 00:31   
Yes, this is a problem with comparOP Constant! And it is fixed, thank you.
Looking back at my original code that got the error, it looked something like:
if (a&CONST == 0)
According to the LL wiki, the == will be done first, which is two constants being compared. If the code is re-written to say:
if ((a&CONST) ==0)
Then there is no error. So the error yesterday is a reminder to add parentheses! I re-built and installed the new version of OpenSim (commit 45625a02a214d61dfc549d56c4a4daa44369f225) and I no longer see the error on the first if statement above. Now that I understand it is an issue with constants only, I wish you had left the error in, but changed the message to "you should fully parenthesize your if statements!".
(0035875)
UbitUmarov   
2019-11-14 07:34   
yes a&CONST == 0 is silly
a trap for those used to left -> right parsing
always good idea to use, even abuse of () to enforce priority, and on any language
( something i also forget ;) )