Bug #1531
CRASH: arithmetic with HilbertSeries (tagged object)
Description
The following input causes an assertion failure, followed by abort:
// use R ::= QQ[x,y,z]; 1 + HilbertSeries(R);
The response is
--> WARNING: I'm implicitly untagging the right operand; use untagged() to avoid this warning --> 1 + HilbertSeries(R); --> ^ CoCoAInterpreter: Interpreter.C:1448: bool CoCoA::InterpreterNS::TYPE::isProperSubtypeOf(int) const: Assertion `false' failed. Process cocoa5 aborted (core dumped)
History
#1 Updated by John Abbott over 3 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 10
The troublesome call is on line 1536 of Interpreter.C
.
The problem is that rightType
has dispatchIndex
equal to -1 (meaning tagged, I suppose).
I guess what happened is the following:
the first attempt with leftType->isProperSubtypeOf
fails, so it falls through to line 1536...
Perhaps there should be a check right before 1536, if rightType->dispatchIndex
is negative then an error should be thrown.
Or perhaps just change Interpreter.C at line 1448 to throw a normal error rather than @assert(false)
. What should the err mesg say?
Or maybe 1536 should call rightOp->getType()->isProperSybtypeOf(...)
. This seems plausible
#2 Updated by John Abbott over 3 years ago
- Priority changed from Normal to High
- % Done changed from 10 to 20
I have just tried using my last idea rightOp->getType()->isProperSybstypeOf(..)
.
It compiled, and now produces a vaguely sane error mesg:
/**/ --> WARNING: I'm implicitly untagging the right operand; use untagged() to avoid this warning --> WHERE: at line 2 (column 2) of BUG-HilbertSeries.cocoa5 --> 1+HilbertSeries(R); --> ^ --> ERROR: I don't know how to evaluate operator + between INT and RECORD --> WHERE: at line 2 (column 2) of BUG-HilbertSeries.cocoa5 --> 1+HilbertSeries(R); --> ^ --> ERROR: Read and execution of the source file "/home/jabbott/ShortTerm/BUG-HilbertSeries.cocoa5" failed --> source "/home/jabbott/ShortTerm/BUG-HilbertSeries.cocoa5"; --> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Anyway, it didn't crash/abort.
This might be a reasonable solution. All CoCoA-5 tests pass too :-)
#3 Updated by John Abbott over 3 years ago
- Assignee set to John Abbott
- % Done changed from 20 to 40
At least + is commutative: HilbertSeries(...)+1
also causes a crash!
I have modified Interpreter.C
, and checked in... sigh!
#4 Updated by John Abbott over 3 years ago
- Status changed from In Progress to Feedback
- % Done changed from 40 to 80
#5 Updated by Anna Maria Bigatti over 3 years ago
- Subject changed from CRASH: arithmetic with HilbertSeries to CRASH: arithmetic with HilbertSeries (tagged object)
It (correctly) gives error both on right and left, no crash.
#6 Updated by John Abbott over 2 years ago
- Status changed from Feedback to Closed
- % Done changed from 80 to 100
- Estimated time set to 0.99 h
There is already a test in exbugs.cocoa5
Closing after 11 months in feedback.