bugGNU Octave - Bugs: bug #44864, lazy_index produces error with...

 
 

bug #44864: lazy_index produces error with printf("%i")

Submitter:  Martin Kunz <mkunz>
Submitted:  Fri 17 Apr 2015 02:26:44 PM UTC
   
 
Category:  Interpreter Severity:  5 - Blocker
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.0.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 02 Jun 2015 04:48:12 PM UTC, comment #7: 

Retagging release from 4.0.0-rc3 to 4.0.0.

John W. Eaton <jwe>
Group administrator
Sat 25 Apr 2015 05:29:14 PM UTC, comment #6: 

Works for me.  Closing report.

Rik <rik5>
Group administrator
Sat 25 Apr 2015 05:18:57 PM UTC, comment #5: 

I checked in the following changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/0d56160e346d

John W. Eaton <jwe>
Group administrator
Sat 25 Apr 2015 05:06:57 PM UTC, comment #4: 

Rik: I think it is the right thing to do.  The lazy_index class is only supposed to be an optimization.  If the index weren't "lazy" then the value would be a 1-based index array.

John W. Eaton <jwe>
Group administrator
Sat 25 Apr 2015 05:29:17 AM UTC, comment #3: 

The patch is very close.  It no longer errors out, but the indices are off by 1; They are zero-based rather than one-based.


printf("%i ",find([true true]))
0 1


We could always add 1 to the result of fast_elem_extract(), but I suspect that is not the right thing to do.


+octave_lazy_index::fast_elem_extract (octave_idx_type n) const
+{
+  return double (index.checkelem (n));
+}



Rik <rik5>
Group administrator
Sat 25 Apr 2015 03:52:55 AM UTC, comment #2: 

Something like the attached patch should fix this problem.

(file #33779)

John W. Eaton <jwe>
Group administrator
Fri 17 Apr 2015 03:49:01 PM UTC, comment #1: 

Confirmed.  The printf family of routines was overhauled between 3.8.2 and 4.0.0. and this bug must have been introduced.

Rik <rik5>
Group administrator
Fri 17 Apr 2015 02:26:44 PM UTC, original submission:  

Hi,

I stumbled upon a strange error which I could track to a line like this:


printf("%i ",find([true true]))


In Octave 3.8.2 the result is


1 2


as I would expect. In 4.0.0-rc3 I get


error: isnan: not defined for <unknown type>
error: isinf: not defined for <unknown type>
error: octave_base_value::double_value (): wrong type argument '<unknown type>'
error: octave_base_value::double_value (): wrong type argument '<unknown type>'
 error: isnan: not defined for <unknown type>
error: isinf: not defined for <unknown type>
error: octave_base_value::double_value (): wrong type argument '<unknown type>'
error: octave_base_value::double_value (): wrong type argument '<unknown type>'


In both cases the type returned by find is lazy_index


>> typeinfo(find([true true]))
ans = lazy_index


but it seems that this type is not properly treated by printf in 4.0.0-rc3.

Martin Kunz <mkunz>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #33779:  diffs.txt added by jwe (954B - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by rik5
  • -email is unavailable- added by mkunz (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-06-02 jwe Release4.0.0-rc3 4.0.0
    2015-04-25 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2015-04-25 jwe Attached File- Added diffs.txt, #33779
    2015-04-17 rik5 Severity3 - Normal 5 - Blocker
    2015-04-17 rik5 StatusNone Confirmed
        Operating SystemMicrosoft Windows Any
        Carbon-Copy- Added jwe

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code