bugGNU Octave - Bugs: bug #43249, Wrong line number in error message

 
 

bug #43249: Wrong line number in error message

Submitter:  Falk Tannhäuser <fata>
Submitted:  Thu 18 Sep 2014 01:55:42 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  lachlan
Originator Name:  fata Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 26 Mar 2016 03:40:48 PM UTC, comment #4: 

@Lachlan: Thanks for the easy fix.  I pushed the cset here (http://hg.savannah.gnu.org/hgweb/octave/rev/7ba48ff6ce83).  Closing report.

Rik <rik5>
Group administrator
Fri 26 Feb 2016 09:35:20 AM UTC, comment #3: 

The attached patch fixes this bug.  As Rik indicated, the problem was that the condition expression was cached in the loop object and there was no call to set_location when it was evaluated, so the location was just the last line executed in the loop body.

I think bug #34852 is quite a distinct issue.  That applies to all expressions, but the current bug seems unique to do...until.

(file #36469)

Lachlan Andrew <lachlan>
Sat 27 Dec 2014 05:20:32 PM UTC, comment #2: 

Adding bug #34852 as a dependency.  In that bug the line number is correct, but the column number is incorrect.  It's probably all related code in the parser and the procedure by which it determines which statement was being executed when an error occurs.

Rik <rik5>
Group administrator
Mon 15 Dec 2014 04:38:08 AM UTC, comment #1: 

Confirmed.

If I had to guess, it appears that the parser gives the line number for the last successfully parsed line, rather than for the line it is currently parsing which is the 'until' statement.

Rik <rik5>
Group administrator
Thu 18 Sep 2014 01:55:42 PM UTC, original submission:  

The following function, contained in the Octave file error_test.m, has an error in line 9 (trying to compare element-wise two character arrays of different length) which is detected by Octave during execution:


function error_test(boolflag = false)
  do
    if boolflag
      printf("true\n");   # Line 4
    else
      printf("false\n");  # Line 6
    endif
  until "abc" == "de"     # Line 9
endfunction


However, the line number given in the error message is wrong:


octave:1> error_test(false)
false
error: error_test: mx_el_eq: nonconformant arguments (op1 is 1x3, op2 is 1x2)
error: called from:
error:   /cygdrive/c/Users/tannhauser/Documents/error_test.m at line 6, column 7
octave:1> error_test(true)
true
error: error_test: mx_el_eq: nonconformant arguments (op1 is 1x3, op2 is 1x2)
error: called from:
error:   /cygdrive/c/Users/tannhauser/Documents/error_test.m at line 4, column 7


This makes it difficult to identify and to fix this kind of error, in particular if functions are larger.

Falk Tannhäuser <fata>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #32132:  error_test.m added by fata (204B - application/octet-stream)

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

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

    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 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-03-26 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2016-02-26 lachlan Attached File- Added bug_43249_until_line_number.cset, #36469
        StatusConfirmed Patch Submitted
        Assigned toNone lachlan
        Release3.8.2 dev
        Operating SystemMicrosoft Windows Any
    2014-12-27 rik5 Dependencies- Depends on bugs #34852
    2014-12-15 rik5 StatusNone Confirmed
    2014-09-18 fata Attached File- Added error_test.m, #32132
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code