octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

JIT crash on simple while-loop [MSVC]


From: Michael Goffioul
Subject: JIT crash on simple while-loop [MSVC]
Date: Mon, 11 Feb 2013 21:47:49 -0500

Hi Max,

Today I recompiled the default branch with MSVC, and although the full test suite runs fine, I still get a crash on a very simple for loop. I ran octave with --jit-debug and types the following commands:

rot_z = -150;
while (rot_z < 0), rot_z += 360; endwhile

Then the output was the following (with a crash at the end). I can't produce a backtrace at the moment as this version was compiled with optimization enabled. I'll try to recompile with debug enabled and reproduce the crash. But in the meantime, maybe this will give you a hint (I doubt it, but you never know...).

Michael.

-------------------- Compiling tree --------------------
while (rot_z < 0)
  rot_z += 360;
endwhile
-------------------- octave jit ir --------------------
body0:        %pred =
        scalar: rot_z#1 = extract rot_z
        branch: [live] while_cond_check1
while_cond_check1:        %pred = body0, interrupt_check6
        scalar: rot_z#17 phi | body0 -> scalar: rot_z#1
                             | interrupt_check6 -> scalar: rot_z#11
        scalar: #2 = call  (scalar: rot_z#17)
        bool: #3 = call binary< (scalar: #2, scalar: 0)
        branch: [live] while_cond_check2
while_cond_check2:        %pred = while_cond_check1
        bool: #5 = call logically_true (bool: #3)
        branch: [live] while_cond_check3
while_cond_check3:        %pred = while_cond_check2
        cond_branch: bool: #5, [live] while_body4, [live] while_tail7
while_body4:        %pred = while_cond_check3
        scalar: #8 = call  (scalar: rot_z#17)
        scalar: #9 = call binary+ (scalar: #8, scalar: 360)
        branch: [live] while_body5
while_body5:        %pred = while_body4
        scalar: rot_z#11 = scalar: #9
        branch: [live] interrupt_check6
interrupt_check6:        %pred = while_body5
        error_check interrupt, <normal> [live] while_cond_check1, <error> [live] final8
while_tail7:        %pred = while_cond_check3
        branch: [live] final8
final8:        %pred = interrupt_check6, while_tail7
        scalar: rot_z#18 phi | interrupt_check6 -> scalar: rot_z#11
                             | while_tail7 -> scalar: rot_z#17
        store rot_z = scalar: rot_z#18
        return

-------------------- llvm ir --------------------
define void @foobar(%octave_base_value**) {
prelude:
  %1 = getelementptr inbounds %octave_base_value** %0, i32 0
  br label %body

body:                                             ; preds = %prelude
  %2 = load %octave_base_value** %1
  %3 = call double @octave_jit_cast_scalar_any(%octave_base_value* %2)
  br label %while_cond_check

while_cond_check:                                 ; preds = %interrupt_check, %body
  %4 = phi double [ %3, %body ], [ %9, %interrupt_check ]
  %5 = call double @id_scalar(double %4)
  %6 = call i1 @"octave_jit<_scalar"(double %5, double 0.000000e+00)
  br label %while_cond_check1

while_cond_check1:                                ; preds = %while_cond_check
  %7 = call i1 @id_bool(i1 %6)
  br label %while_cond_check2

while_cond_check2:                                ; preds = %while_cond_check1
  br i1 %7, label %while_body, label %while_tail

while_body:                                       ; preds = %while_cond_check2
  %8 = call double @id_scalar(double %4)
  %9 = call double @"octave_jit_+_scalar"(double %8, double 3.600000e+02)
  br label %while_body3

while_body3:                                      ; preds = %while_body
  br label %interrupt_check

interrupt_check:                                  ; preds = %while_body3
  %10 = load volatile i32* @octave_interrupt_state
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %final, label %while_cond_check

while_tail:                                       ; preds = %while_cond_check2
  br label %final

final:                                            ; preds = %while_tail, %interrupt_check
  %12 = phi double [ %9, %interrupt_check ], [ %4, %while_tail ]
  %13 = call %octave_base_value* @octave_jit_cast_any_scalar(double %12)
  store %octave_base_value* %13, %octave_base_value** %1
  ret void
}

-------------------- optimized llvm ir --------------------

define void @foobar(%octave_base_value**) {
prelude:
  %1 = load %octave_base_value** %0, align 4
  %2 = call double @octave_jit_cast_scalar_any(%octave_base_value* %1)
  br label %while_cond_check

while_cond_check:                                 ; preds = %while_body, %prelude
  %3 = phi double [ %2, %prelude ], [ %5, %while_body ]
  %4 = fcmp ult double %3, 0.000000e+00
  br i1 %4, label %while_body, label %final

while_body:                                       ; preds = %while_cond_check
  %5 = fadd double %3, 3.600000e+02
  %6 = load volatile i32* @octave_interrupt_state, align 4
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %final, label %while_cond_check

final:                                            ; preds = %while_cond_check, %while_body
  %8 = phi double [ %5, %while_body ], [ %3, %while_cond_check ]
  %9 = call %octave_base_value* @octave_jit_cast_any_scalar(double %8)
  store %octave_base_value* %9, %octave_base_value** %0, align 4
  ret void
}

panic: Segmentation violation -- stopping myself...
attempting to save variables to 'octave-workspace'...
save to 'octave-workspace' complete


reply via email to

[Prev in Thread] Current Thread [Next in Thread]