bugGNU Octave - Bugs: bug #61201, A "Matlab-style short-circuit...

 
 

bug #61201: A "Matlab-style short-circuit ... operator &" warning message points to wrong statement

Submitter:  Doug Strain <saintrain>
Submitted:  Tue 21 Sep 2021 09:10:10 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Doug Strain Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 23 Sep 2021 03:15:17 PM UTC, comment #4: 

I've verified this changeset on the development branch.  Marking as fixed and closing report.

Rik <rik5>
Group administrator
Thu 23 Sep 2021 03:30:58 AM UTC, comment #3: 

Thanks for the report.  I pushed the following changesets on default, so this problem should be fixed for the next major release (version 7):

http://hg.savannah.gnu.org/hgweb/octave/rev/501fe2c8a880
http://hg.savannah.gnu.org/hgweb/octave/rev/c2c11605fa7a
http://hg.savannah.gnu.org/hgweb/octave/rev/75fb18f0469a

Marking as ready for test.

John W. Eaton <jwe>
Group administrator
Tue 21 Sep 2021 11:49:21 PM UTC, comment #2: 

Not always the last statement. "Mine" was an if() in the middle of the while().

The if() beginning the 15 line block was, though, the last statement one-level in from the while. And the warning pointed to the if().

I'm done playing with it though :-)
Doug

Doug Strain <saintrain>
Tue 21 Sep 2021 09:43:13 PM UTC, comment #1: 

Simpler example:

    debug_on_error(1)
    debug_on_warning(1)

    NOVER = NLIM = 10000;
    nsucc = -666;  nchg=0;
    j = 0;
    while ((j < 100) & nsucc);
      j++;

      nsucc = 0;
      k = 0;
      while ((k < NOVER) & (nsucc < NLIM));
        k += 1;
        1;
        2;
        3;
        4;
        5;
        6;
        7;
        8;
        9;
        10;
      endwhile
    endwhile

    [j k nsucc nchg]

It appears the debug on warning always stops and points at the last line inside the while loop, hence "10;" in the above case.

Anonymous
Tue 21 Sep 2021 09:10:10 PM UTC, original submission:  

Hi!

Flatpak 6.3.0 on linux mint.

I made this ... ridiculous thing fuh yoo:

debug_on_error(1)
debug_on_warning(1)

NOVER = NLIM = 10000;
nsucc = -666;  nchg=0;
j = 0;  trip = 0;
while((j < 100) & nsucc);
  j++;

  if(nchg < nsucc) disp("Huh 01X???")  endif

  nsucc = 0;
  k = 0;
  while((k < NOVER) & (nsucc < NLIM));
    k = k + 1;

    if(nchg < nsucc) disp("Huh 1???")  endif
    if(rand < .001) nsucc++;  nchg++;  endif
    if(nchg < nsucc) disp("Huh 5??")  endif
    endwhile

  if(nchg < nsucc) disp("Huh X1???")  endif
  endwhile

[j k nsucc nchg]

Running it will (eventually) trigger a
  "Matlab-style short-circuit operation performed for operator &"
warning, but pointing to line 19, instead of either of the while(s)

Enjoy!
Doug

Doug Strain <saintrain>

 

(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 rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by saintrain (Submitted the item)
  • -email is unavailable- added by saintrain (amp bug)
  •  

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

    Date Changed by Updated Field Previous Value => Replaced by
    2021-09-23 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
        Release6.3.0 dev
    2021-09-23 jwe StatusNone Ready For Test
    2021-09-21 saintrain Carbon-Copy- Added saintrain

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code