Gluon: Compiler crashes when using `<|` with recursion calls only in right side

Created on 9 Aug 2020  路  4Comments  路  Source: gluon-lang/gluon

Hi,

I found the following code would make compiler crash with information thread 'main' has overflowed its stack.

My environment is gluon_repl 0.16.1 rustc 1.45.2 (d3fb005a3 2020-07-31) Windows 10 v2004.

let g f x = x
let f a = 
    g a <| f a
{ f }

It would not crash if we change g a <| f a to g a (f a).
We can also make it not crash by also calling in the left side: g (f a) <| f a.
g a <| (f a) would not help.

BTW, I tried something similar in gluon-lang.org's playground, and the website is inaccessible as soon as my submitting the codes. Not sure the codes made the website crash or it was just a coincidence.

bug

All 4 comments

It probably made the website crash :) I haven't gotten around to setup a supervisor to reboot the server so a stack overflow like that would crash the server. Will look into it.

I haven't been able to reproduce this. Do you have a local reproduction?

I haven't been able to reproduce this. Do you have a local reproduction?

@Marwes Yes. I also tried on Linux Mint 19.2/kernel 5.6.14-050614-generic, I can still repro this:

image

I also tried Version 0.17.0 that you just released, the problem can also be reproduced.

Ok, got a reproduction now. Curiously this only crashes if <| is imported. If I define it directly (which is nice to make tests standalone it works).

Basically the crashs is because the inliner/constant folder is garbage. It is fixed in https://github.com/gluon-lang/gluon/pull/819 but that has many other issues. Going to remove inlining all together and build a new inliner from scratch (more or less).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jrpascucci picture jrpascucci  路  6Comments

Marwes picture Marwes  路  3Comments

typesanitizer picture typesanitizer  路  12Comments

dgellow picture dgellow  路  7Comments

brendanzab picture brendanzab  路  15Comments