bugGNU Octave - Bugs: bug #55469, JIT crash related to use of ranges...

 
 

bug #55469: JIT crash related to use of ranges and complex numbers

Submitter:  Julien Bect <jbect>
Submitted:  Mon 14 Jan 2019 09:46:18 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  2 Item Group:  Segfault, Bus Error, etc.
Status:  Wont Fix Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 12 Dec 2021 11:01:45 PM UTC, comment #5: 

Yes, I'll close this report as "Won't fix".

Pantxo Diribarne <pantxo>
Group Member
Tue 07 Dec 2021 10:49:38 PM UTC, comment #4: 

Since the JIT has been removed from Octave, should this bug report be closed?

Anonymous
Mon 14 Jan 2019 09:38:21 PM UTC, comment #3: 

Confirmed, although I re-titled the report to reflect that the true issue seems to be with ranges.  If you change the for loop to be


for j = [1:5]


then it works.  The '[ ]' pair convert the range object to a true array object.

Why this makes a difference, I'm not quite sure.  But it does.  If I run with ASAN compiled in the segfault I get is


==5197==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010 (pc 0x7f9bef265692 bp 0x60400028e3d0 sp 0x7fffd9aab320 T0)
==5197==The signal is caused by a READ memory access.
==5197==Hint: address points to the zero page.
    #0 0x7f9bef265691 in llvm::CallGraphNode::removeCallEdgeFor(llvm::CallSite) (/usr/lib/x86_64-linux-gnu/libLLVM-3.9.so.1+0x110b691)
    #1 0x7f9beedee3b9 in llvm::InlineFunction(llvm::CallSite, llvm::InlineFunctionInfo&, llvm::AAResults*, bool) (/usr/lib/x86_64-linux-gnu/libLLVM-3.9.so.1+0xc943b9)
    #2 0x7f9bef13e011 in llvm::Inliner::inlineCalls(llvm::CallGraphSCC&) (/usr/lib/x86_64-linux-gnu/libLLVM-3.9.so.1+0xfe4011)
    #3 0x7f9bef26aeb8  (/usr/lib/x86_64-linux-gnu/libLLVM-3.9.so.1+0x1110eb8)
    #4 0x7f9bee86baae in llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib/x86_64-linux-gnu/libLLVM-3.9.so.1+0x711aae)
    #5 0x7f9bf70f3a4a in octave::jit_module::optimize(llvm::Function*) const libinterp/parse-tree/pt-jit.cc:2482
    #6 0x7f9bf70f7c06 in octave::jit_info::compile(octave::tree&, octave::jit_type*) libinterp/parse-tree/pt-jit.cc:2827
    #7 0x7f9bf70f6a53 in octave::jit_info::jit_info(octave::tree_simple_for_command&, octave_value const&) libinterp/parse-tree/pt-jit.cc:2712
    #8 0x7f9bf70f1f7c in octave::tree_jit::do_execute(octave::tree_simple_for_command&, octave_value const&) libinterp/parse-tree/pt-jit.cc:2287
    #9 0x7f9bf70b1905 in octave::tree_jit::execute(octave::tree_simple_for_command&, octave_value const&) libinterp/parse-tree/pt-jit.h:491
    #10 0x7f9bf7090d45 in octave::tree_evaluator::visit_simple_for_command(octave::tree_simple_for_command&) libinterp/parse-tree/pt-eval.cc:1267
    #11 0x7f9bf712b5ac in octave::tree_simple_for_command::accept(octave::tree_walker&) libinterp/parse-tree/pt-loop.h:219
    #12 0x7f9bf709fb78 in octave::tree_evaluator::visit_statement(octave::tree_statement&) libinterp/parse-tree/pt-eval.cc:2754
    #13 0x7f9bf713b260 in octave::tree_statement::accept(octave::tree_walker&) libinterp/parse-tree/pt-stmt.h:119
    #14 0x7f9bf70a0425 in octave::tree_evaluator::visit_statement_list(octave::tree_statement_list&) libinterp/parse-tree/pt-eval.cc:2845
    #15 0x7f9bf6c7baee in octave::tree_statement_list::accept(octave::tree_walker&) libinterp/parse-tree/pt-stmt.h:194
    #16 0x7f9bf7093249 in octave::tree_evaluator::execute_user_script(octave_user_script&, int, octave_value_list const&) libinterp/parse-tree/pt-eval.cc:1513
    #17 0x7f9bf6df9733 in octave_user_script::call(octave::tree_evaluator&, int, octave_value_list const&) libinterp/octave-value/ov-usr-fcn.cc:168
    #18 0x7f9bf7095e94 in octave::tree_evaluator::visit_identifier(octave::tree_identifier&) libinterp/parse-tree/pt-eval.cc:1798
    #19 0x7f9bf70398e4 in octave::tree_identifier::accept(octave::tree_walker&) libinterp/parse-tree/pt-id.h:134
    #20 0x7f9bf6c7af0f in octave::tree_evaluator::evaluate(octave::tree_expression*, int) libinterp/parse-tree/pt-eval.h:312
    #21 0x7f9bf709fd4d in octave::tree_evaluator::visit_statement(octave::tree_statement&) libinterp/parse-tree/pt-eval.cc:2776
    #22 0x7f9bf713b260 in octave::tree_statement::accept(octave::tree_walker&) libinterp/parse-tree/pt-stmt.h:119
    #23 0x7f9bf70a0425 in octave::tree_evaluator::visit_statement_list(octave::tree_statement_list&) libinterp/parse-tree/pt-eval.cc:2845
    #24 0x7f9bf6c7baee in octave::tree_statement_list::accept(octave::tree_walker&) libinterp/parse-tree/pt-stmt.h:194
    #25 0x7f9bf7085a17 in octave::tree_evaluator::repl(bool) libinterp/parse-tree/pt-eval.cc:106
    #26 0x7f9bf78ca9b2 in octave::interpreter::main_loop() libinterp/corefcn/interpreter.cc:949
    #27 0x7f9bf78c7a0b in octave::interpreter::execute() libinterp/corefcn/interpreter.cc:694
    #28 0x7f9bf610f886 in octave::cli_application::execute() libinterp/octave.cc:391
    #29 0x55adb254e4d1 in main src/main-cli.cc:92
    #30 0x7f9bf331ab96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
    #31 0x55adb254ddc9 in _start (/home/rik/wip/Projects_Mine/octave-dbg/src/.libs/octave-cli+0x1dc9)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/usr/lib/x86_64-linux-gnu/libLLVM-3.9.so.1+0x110b691) in llvm::CallGraphNode::removeCallEdgeFor(llvm::CallSite)
==5197==ABORTING


Rik <rik5>
Group administrator
Mon 14 Jan 2019 07:12:51 PM UTC, comment #2: 

Ouch... actually, half of my message disappeared...

So, here is (again) a minimal example, which crashes with a segfault:

jit_enable (true);
jit_startcnt (5);

x = 1 + 1i;
for j = 1:5
    x = x + 1;
endfor


Same problem with a while loop.

The problem disappears if the initial condition is not complex.

Julien Bect <jbect>
Mon 14 Jan 2019 05:18:47 PM UTC, comment #1: 

Seems like your comment was cut off where you supplied a simple example.

Rik <rik5>
Group administrator
Mon 14 Jan 2019 09:46:18 AM UTC, original submission:  

The JIT currently crashes Octave on some very simple loops involving complex numbers.

This is not a new issue, there are already a few commented tests in jit.tst in relation with this.  I am just reporting this for later reference.

As far as I can tell, this issue is present on both stable and default, and with any version of LLVM that we can build with.

Here is a minimal snippet that reproduces the problem:

jit_enable (true);
x = 1 + 1i;
while (1),
  x = x + 1;
  break;
endwhile
-verbatim.

Or, if you prefer for loops:
+verbatim+
jit_enable (true);
jit_startcnt (100)
x = 1 + 1i;
for j = 1:200
    x = x + 1;
endfor


In both cases, Octave crashes:

fatal: caught signal Segmentation fault -- stopping myself...
Segmentation fault
-verbatim+

In both cases also, the problem disappears if the initial value is not complex.

Julien Bect <jbect>

 

(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 pantxo (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jbect (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-12-12 pantxo StatusConfirmed Wont Fix
        Open/ClosedOpen Closed
    2019-02-26 mtmiller Release5.0.1 dev
    2019-01-14 rik5 StatusNeed Info Confirmed
        SummaryJIT crash related to complex numbers JIT crash related to use of ranges and complex numbers
    2019-01-14 rik5 Priority5 - Normal 2
        StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code