vermaseren / form

The FORM project for symbolic manipulation of very big expressions
GNU General Public License v3.0
985 stars 118 forks source link

Freeze in parsing complex conjugate #499

Closed tueda closed 1 month ago

tueda commented 2 months ago

FORM freezes when running the following program:

S x#c;
L F = x#;
.end
jodavies commented 2 months ago

The freeze is due to a missing *in++; at token.c:370, but then it crashes instead.

jodavies commented 2 months ago

So CodeGenerator does not have a case for TCONJUGATE, which only appears twice in the whole codebase (in token.c and its definition in ftypes.h). It seems, that no one has ever used this feature?

Since the manual says "The latest approach is that it is seen as obsolete. If possible, please avoid using it. " maybe we can just remove it entirely?

vermaseren commented 2 months ago

As far as I know, nobody had been really using it. It was created in version 1 in anticipation of a conjugation operation, but that never materialised. Hence I must have forgotten about it when making the parser for version3 and later. For backward compatibility I never took out the conjugation #. One can do either of two things: 1: take out this conjugation thing and see whether people complain. 2: fix up the parser. Probably 2 is not too much work, although I have no idea whether there are still some surprises.

On 26 Apr 2024, at 12:39, jodavies @.***> wrote:

So CodeGenerator does not have a case for TCONJUGATE, which only appears twice in the whole codebase (in token.c and its definition in ftypes.h). It seems, that no one has ever used this feature?

— Reply to this email directly, view it on GitHub https://github.com/vermaseren/form/issues/499#issuecomment-2079135036, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJPCEWZYB3GIQUIZBXVIADY7IVH7AVCNFSM6AAAAABGSTKBQCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZZGEZTKMBTGY. You are receiving this because you are subscribed to this thread.

tueda commented 2 months ago

The manual also says

This property is only relevant, when the complex conjugation operator is used. This operator has not been implemented and currently there are no plans to do so.

I think we can just display a "not implemented" error (and that is much better than the crash/freeze).

jodavies commented 2 months ago

That seems reasonable, just print the error and terminate. Do you want to make the PR @tueda ?

tueda commented 2 months ago

@jodavies OK, I will create a PR for that.