Issue 90060

Summary: Wrong result of nested IF() functions in array context.
Product: Calc Reporter: lvyue <lvyue>
Component: programmingAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: issues, lvyue
Version: 680m247   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: PATCH Latest Confirmation in: ---
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 72764    
Attachments:
Description Flags
A test case.
none
patch 1 for i90060
none
patch 2 for i90060
none
patch 3.
none
patch 4. none

Description lvyue 2008-05-28 10:20:40 UTC
I find a bug in IF(), if I input =IF(cond1; IF(cond2;....);....), where cond2 
is non-matrix thing, such as number, the result is wrong.
A test case is attached.
Comment 1 lvyue 2008-05-28 10:24:26 UTC
Created attachment 54015 [details]
A test case.
Comment 2 ooo 2008-05-28 18:30:58 UTC
Confirmed.
Comment 3 lvyue 2008-07-02 08:27:30 UTC
Created attachment 54876 [details]
patch 1 for i90060
Comment 4 lvyue 2008-07-07 09:48:39 UTC
Created attachment 54976 [details]
patch 2 for i90060
Comment 5 ooo 2008-08-05 22:44:19 UTC
I think this approach has some flaw. While it may work, it unnecessarily creates
a JumpMatrix for _every_ conditional jump, regardless whether needed or not,
slowing things down. It should be checked whether a JumpMatrix is needed, i.e.
the execution path is in array context, and if not use the plain jump as before.
Comment 6 lvyue 2008-08-13 03:29:30 UTC
Created attachment 55729 [details]
patch 3.
Comment 7 lvyue 2008-08-14 08:26:32 UTC
Created attachment 55769 [details]
patch 4.
Comment 8 lvyue 2008-08-14 08:49:18 UTC
Hi Eike,
First, I will say sorry for my sudden left from IRC yesterday.
Please forgive me. :)

I have considered what you said, yes, there is no necessary to add another flag
for that case, nStackBase and sp can tell us where is abnormal.

But the relation ship between nStackBase and sp is not the same as you said.

In normal cases, nStackBase is equal to sp, after ScIfJump() called,
because it will pop the condition token, and push a jumpmatrix or a value (1 or o),
so sp remains the same.
and in this special case, condition is also popped, but nothing pushed,
so sp is less then nStackBase.

So, check this patch please.
Thanks. :)
Comment 9 ooo 2009-09-02 15:21:12 UTC
This change is quite invasive. Won't be able to do the necessary tests in time
for OOo3.2 branch off date. Retargeting to OOo3.3
Comment 10 ooo 2010-07-26 19:58:04 UTC
Sigh.. I didn't get to review this completely, hopefully last re-target (OOo3.4)
Comment 11 Martin Hollmichel 2011-03-15 12:50:49 UTC
set target to 3.x since not release relevant for 3.4.
Comment 12 Rob Weir 2013-03-11 15:01:31 UTC
I'm adding this comment to all open issues with Issue Type == PATCH.  We have 220 such issues, many of them quite old.  I apologize for that.  

We need your help in prioritizing which patches should be integrated into our next release, Apache OpenOffice 4.0.

If you have submitted a patch and think it is applicable for AOO 4.0, please respond with a comment to let us know.

On the other hand, if the patch is no longer relevant, please let us know that as well.

If you have any general questions or want to discuss this further, please send a note to our dev mailing list:  dev@openoffice.apache.org

Thanks!

-Rob
Comment 13 Marcus 2017-05-20 11:11:16 UTC
Reset assigne to the default "issues@openoffice.apache.org".