bugGNU Octave - Bugs: bug #39561, MATLAB compatibility reported...

 
 

bug #39561: MATLAB compatibility reported incorrectly

Submitter:  None
Submitted:  Wed 24 Jul 2013 02:28:10 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Tom Olin Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.6.4
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 06 Aug 2013 06:57:44 PM UTC, comment #4: 

Thanks. I appreciate the support.

Tom Olin <tom_olin>
Tue 06 Aug 2013 06:52:23 PM UTC, comment #3: 

Perfect, thanks for that example script. I wasn't seeing the warning with what I was testing, but I now see exactly what you report here with the provided function under version 3.6.4.

The good news is this has already been fixed in the development version of Octave. I see no warnings at all when calling the provided bug function with the matlab compatibility warning enabled.

Since the fix is likely in the parser, there is no easy way to backport this fix to 3.6.4. To get this fix you can either build a snapshot of the development version of Octave or wait until the next major release of Octave.

Mike Miller <mtmiller>
Group Member
Tue 06 Aug 2013 05:11:33 PM UTC, comment #2: 

I cobbled up this file (bug.m) exhibiting the problem, based on some real code that originally produced the warnings. Some cases might be further reducible.


function bug()

  % example 1
  if pi > pi ...
     && pi < pi
    pi;
  end

  % example 2
  s = ['abc' ...
             'def'];

  % example 3
  v = [1 2 3 ...
         4 5 6];

  % example 4
  a = {'a', 'b', 'c', ...
       'd', 'e', 'f'};

  % example 5
  p ...
  = pi;

  % example 6
  p = pi ...
      *pi;
end


This is what it produces:


>> warning('on','Octave:matlab-incompatible');
>> bug
warning: potential Matlab compatibility problem: \ used as line continuation marker near line 5 offile /home/test/bug.m
warning: potential Matlab compatibility problem: \ used as line continuation marker near line 11 offile /home/test/bug.m
warning: potential Matlab compatibility problem: \ used as line continuation marker near line 15 offile /home/test/bug.m
warning: potential Matlab compatibility problem: \ used as line continuation marker near line 19 offile /home/test/bug.m
warning: potential Matlab compatibility problem: \ used as line continuation marker near line 23 offile /home/test/bug.m
warning: potential Matlab compatibility problem: \ used as line continuation marker near line 27 offile /home/test/bug.m
>>


Perhaps examples 2, 3 and 4 fall under the rule that continuation markers are unnecessary inside parentheses? If so, then a tweak to the documentation could clarify that. If not, then it looks like a bug.

What about examples 1, 5 and 6?

In any case, the warning's reference to a nonexistent backslash is unnecessarily confusing and unhelpful.

Tom Olin <tom_olin>
Mon 05 Aug 2013 01:27:10 PM UTC, comment #1: 

Thanks for your bug report. If you mean the following syntax


x = 7 + ...
    8;


then I do not see a warning with '...' but I do with '\', as expected.

If, on the other hand, you mean line continuation inside of a double-quoted string, then this has been fixed in the development version of Octave. This has actually been deprecated as no longer supported in the development version of Octave. AIUI this is to be more compatible since it is an error with single-quoted strings.

http://hg.savannah.gnu.org/hgweb/octave/diff/531473481084/NEWS

Trying to do a '...' line continuation inside a quoted string in 3.6.4, I indeed get:


> s = "this string ...
warning: potential Matlab compatibility problem: \ used as line continuation marker
> continues here"
warning: potential Matlab compatibility problem: " used as string delimiter
s = this string continues here


and with the development version of Octave:


> s = "this string ...
warning: '...' continuations in double-quoted character strings are obsolete and will not be allowed in a future version of Octave; please use '\' instead
> continues here"
s = this string continues here


Can you confirm this is the behavior that you were referring to?

Mike Miller <mtmiller>
Group Member
Wed 24 Jul 2013 02:28:10 PM UTC, original submission:  

When checking for MATLAB compatibility using the 'Octave:matlab-incompatible' warning, Octave flags continuation lines using '...' as if they were using '\' instead. The exact error message is:

warning: potential Matlab compatibility problem: \ used as line continuation marker

Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by tom_olin (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by None (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-08-06 mtmiller StatusWorks For Me Fixed
        Open/ClosedOpen Closed
        Operating SystemMac OS Any
    2013-08-05 mtmiller StatusNone Works For Me

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code