bugGNU Octave - Bugs: bug #52582, Dependent constant properties...

 
 

bug #52582: Dependent constant properties cause a crash

Submitted by:  Damian Gisler <zweistein>
Submitted on:  Sun 03 Dec 2017 04:47:55 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Other
Status: ConfirmedAssigned to: None
Originator Name: DamianOpen/Closed: Open
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Tue 05 Dec 2017 05:21:07 PM UTC, comment #7:

OK, "which". Yes, I'm seeing that:

It appears someone has filed a bug report related to "type" and classdef (https://savannah.gnu.org/bugs/?52585), so I think that covers most issues at the moment.

Dan Sebald <sebald>
Tue 05 Dec 2017 04:16:22 PM UTC, comment #6:

@Dan: That is what I was trying to say. Whenever a function is used for the first time, regardless of whether it is invoked, queried for help, or the target of the type() function, it is first parsed. If it fails parsing then the overall command fails.

Bug report #50541 explains a bit why which() returns "built-in function" for a classdef file. That doesn't seem right in this case where the function is a user-specified classdef file.

I filed a report about not being ablet to use the help system with classdef keywords here https://savannah.gnu.org/bugs/index.php?52591

Rik <rik5>
Project Administrator
Tue 05 Dec 2017 09:36:05 AM UTC, comment #5:

Octave must be trying to evaluate the expressing before typing out its contents, i.e., Crash() as opposed to Crash.m which must be a file...well, I suppose Crash.m could be a classdef element, ha.

Here, I'm seeing a 2 rather than a 5:

Dan Sebald <sebald>
Mon 04 Dec 2017 11:55:52 PM UTC, comment #4:

The segmentation fault is the same from type () as it is for invoking the file to create an instance of an object. The issue is that the first time Octave needs an m-file, for whatever reason, it parses it. And since this file doesn't parse correctly it causes some sort of error.

I think the other two issues should be opened as independent bug reports. One should be able to say 'type classfile' and have it work. Indeed, this works if you specifically give it the name of the file

The file type.m can be inspected to see what is going on. The problem is that

returns "Built-in Function". All classdef files do this, which is incorrect. There is a bug report about that already.

The second issue, at least minimal help for the "classdef" keyword, is a new issue report. There is a file libinterp/op-kw-docs which contains help text for keywords and operators. It probably needs the addition of "classdef", "properties", "enumeration", etc.

Rik <rik5>
Project Administrator
Mon 04 Dec 2017 10:45:43 PM UTC, comment #3:

This classdef needs some work. Just typing the file causes a crash:

The use of Crash.c1 immediately after its definition is what's causing the segfault. The following:

does not cause a crash, but it still doesn't handle typing correctly:

Note that there is no "help" for classdef:

Definitely some interpreter issues, and probably not a minor fix.

Dan Sebald <sebald>
Mon 04 Dec 2017 12:00:43 PM UTC, comment #2:

FWIW, in Matlab r2017b:

Octave 4.3.0+ (a tip from 26 nov) segfaults already at just a:

which Crash

Status -> confirmed
Release -> dev

Philip Nienhuis <philipnienhuis>
Project Member
Mon 04 Dec 2017 02:38:38 AM UTC, comment #1:

I can confirm that there is some strangeness. With 4.2.1, I get

That alone is weird. With the development branch I get a true segfault.

On the other hand, is this even valid code? Does it run under Matlab?

It appears to me that this line

will cause an infinite loop. The first time an object of the class is created the class will try to be initialized. The line 'c1 = 1' is straightforward. The next line will allocate space for the variable c2, but then will call the class constructor Crash because 'Crash.c1' does not yet exist as a class constant variable since the first initialization has not finished.

Rik <rik5>
Project Administrator
Sun 03 Dec 2017 04:47:55 PM UTC, original submission:

If an instance of the following class is created with
ans = Crash;
or if c2 is accessed with
ans = Crash.c2;
Octave will crash.

classdef Crash < handle
properties (Constant)
c1 = 1;
c2 = Crash.c1 + 1;
end
end

Damian Gisler <zweistein>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #42561:  Crash.m added by zweistein (110B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by sebald (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by zweistein (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 05 Dec 2017 04:16:22 PM UTCrik5Operating SystemMicrosoft Windows=>Any
    Mon 04 Dec 2017 12:00:43 PM UTCphilipnienhuisStatusNone=>Confirmed
      Release4.2.1=>dev
    Sun 03 Dec 2017 04:47:55 PM UTCzweisteinAttached File-=>Added Crash.m, #42561

    Back to the top


    Powered by Savane 3.1-cleanup1