Bug #1613
CRASH with RingHom from FrF
Description
The following causes a crash: why was the exception not caught and handled?
define FlattenRing(R) // Assume R = QQ(a)[x] nx := NumIndets(R); QQa := BaseRing(CoeffRing(R)); na := NumIndets(QQa); FlatRing := NewPolyRing(CoeffRing(QQa), SymbolRange("x",1,na+nx)); a_image := [indet(FlatRing, j) | j in 1..na]; EmbedQQa := PolyAlgebraHom(QQa, FlatRing, a_image); phi := InducedHom(CoeffRing(R), EmbedQQa); x_image := [indet(FlatRing, na+j) | j in 1..nx]; return PolyRingHom(R,FlatRing, phi, x_image); enddefine; -- FlattenRing /**/ QQa::=QQ[a]; /**/ FrFQQa := NewFractionField(QQa); /**/ Px ::= FrFQQa[x,y]; /**/ FlattenRing(Px); /**/ JJ := It; /**/ use Px; /**/ f := a*x^2-1/a; /**/ JJ(f); ***ERROR*** UNCAUGHT CoCoA error *************************************************************************** ****CoCoA ERROR**** ErrCode: CoCoA::ERR::BadPartialRingHomArg ****CoCoA ERROR**** Message: Partial RingHom is undefined for this argument ****CoCoA ERROR**** Context: FractionFieldImpl::InducedHomImpl::myApply ****CoCoA ERROR**** File: FractionField.C ****CoCoA ERROR**** Line: 789 *************************************************************************** Process cocoa5 exited abnormally with code 1
Related issues
History
#1 Updated by John Abbott over 2 years ago
Actually a separate bug: CommonDenom(a*x^2-1/a)
gives 1 rather than a
... Ooops!
NOTE the code looks fine, and now CommonDenom seems to work... not sure what the problem was. Ignoring.
#2 Updated by John Abbott over 2 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 10
Simpler failing example:
Qa ::= QQ[a]; Qx ::= QQ[x]; phi:=PolyAlgebraHom(Qa,Qx,[indet(Qx,1)]); F:=NewFractionField(Qa); psi := InducedHom(F,phi); use F; psi(1/a);
Even simpler:
F3 ::= ZZ/(3); phi := CanonicalHom(ZZ,F3); psi := InducedHom(QQ,phi); a:=psi(1/3);
Presumably the interpreter does not allow for "application" of a RingHom to fail... I wonder where that is in the source code (sigh)
#3 Updated by John Abbott over 2 years ago
Probable source code:RINGHOM::eval
around line 2792 in Interpreter.C
Probably called from: intrusive_ptr<Value> InvocationExpression::implEval(RuntimeEnvironment *runtimeEnv) const
at line 3908
#4 Updated by John Abbott over 2 years ago
According to gdb the fn is called (indrectly) from Interpreter.C:3032
in Interpreter::run
I think the problem may lie here.
No time to investigate now.
NOTE perhaps the catch at line 3049 should be moved inside the block above???
#5 Updated by John Abbott over 2 years ago
- Related to Bug #1614: SourceRegion gives misleading error mesg added
#6 Updated by Anna Maria Bigatti over 2 years ago
- Project changed from CoCoALib to CoCoA-5
- Category changed from Safety to Parser/Interpreter
- Assignee set to Anna Maria Bigatti
- Target version changed from CoCoALib-0.99800 to CoCoA-5.4.0
#7 Updated by John Abbott over 2 years ago
- Status changed from In Progress to Resolved
- % Done changed from 10 to 80
Similar to issue #1614, I have "hacked" the interpreter, and the examples seem to work now.
But I am not confident that the hack is sound and robust, so fear a future nasty jumping out on us at so point.
#8 Updated by John Abbott over 2 years ago
- Status changed from Resolved to Closed
- % Done changed from 80 to 100
- Estimated time set to 2.66 h