octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #41163] Octave crashes when compiled with 64 b


From: Rik
Subject: [Octave-bug-tracker] [bug #41163] Octave crashes when compiled with 64 bit indexing and jit enabled
Date: Tue, 14 Jan 2014 18:52:39 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0

Follow-up Comment #2, bug #41163 (project octave):

The attached patch is written as


diff -r c95b23fca6fd -r 851ecd3be950 libinterp/corefcn/jit-typeinfo.cc
--- a/libinterp/corefcn/jit-typeinfo.cc Wed Jan 08 14:42:56 2014 +0100
+++ b/libinterp/corefcn/jit-typeinfo.cc Thu Jan 09 12:56:28 2014 +0100
@@ -1682,6 +1682,11 @@
   builder.SetInsertPoint (body);
   {
     llvm::Value *one = llvm::ConstantInt::get (index_t, 1);
+    llvm::Value *ione;
+    if (index_t == int_t)
+      ione = one;
+    else
+      ione = llvm::ConstantInt::get (int_t, 1);
 
     llvm::Value *mat = fn.argument (builder, 0);
     llvm::Value *idx = fn.argument (builder, 1);
@@ -1708,7 +1713,8 @@
 
     llvm::Value *rcount = builder.CreateExtractValue (mat, 0);
     rcount = builder.CreateLoad (rcount);
-    cond1 = builder.CreateICmpSGT (rcount, one);
+    // ione is needed since rcount is int_t and the compare types must match
+    cond1 = builder.CreateICmpSGT (rcount, ione);
     cond = builder.CreateOr (cond0, cond1);
 
     llvm::BasicBlock *bounds_error = fn.new_block ("bounds_error", done);


Is there a reason why one couldn't just declare the variable to be int in the
first place and avoid the if statement?


if (index_t == int_t)
...
...


The only other place in the block that uses the variable "one" is


    llvm::Value *cond1 = builder.CreateICmpSLT (int_idx, one);


which also has an int object as the first one for comparison.



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?41163>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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