v icon indicating copy to clipboard operation
v copied to clipboard

Crash: vlang -autofree run examples/flappylearning

Open markus-oberhumer opened this issue 4 years ago • 3 comments
trafficstars

V version: V 0.2.2 565dbc4 OS: linux x86_64

What did you do?

vlang -autofree run examples/flappylearning

What did you expect to see?

No crash.

What did you see instead?

free(): invalid pointer
7f06bcb802a2 : at ???: RUNTIME ERROR: abort() called

markus-oberhumer avatar May 22 '21 11:05 markus-oberhumer

Update with latest V 0.3.2 21d6bd9, on Ubuntu 20.04:

  • ./v -autofree run examples/flappylearning works, probably because currently the GC is on by default.
  • ./v -g -gc none -autofree run examples/flappylearning produces a runtime panic:
#0 11:44:39 ᛋ master /v/vnew❱./v -g -gc none -autofree run examples/flappylearning
================ V panic ================
   module: builtin
 function: get()
  message: array.get: index out of range (i == 0, a.len == 0)
     file: /v/vnew/vlib/builtin/array.v:408
   v hash: 21d6bd9
=========================================
/tmp/v_1000/../../../../../../v/vnew/vlib/builtin/builtin.c.v:68: at panic_debug: Backtrace
/tmp/v_1000/../../../../../../v/vnew/vlib/builtin/array.v:408: by array_get
/tmp/v_1000/../../../../../../v/vnew/examples/flappylearning/game.v:131: by main__App_update
/tmp/v_1000/../../../../../../v/vnew/examples/flappylearning/game.v:207: by main__App_run
/tmp/v_1000/flappylearning.10258541624906720014.tmp.c:5787: by main__App_run_thread_wrapper
7ffff7f63609 : by ???
#1 11:46:12 ᛋ master /v/vnew❱

game.v:131 looks like this:

130            res := app.gen[j].compute(inputs)
131            if res[0] > 0.5 {
132                bird.flap()
133            }

spytheman avatar Dec 25 '22 09:12 spytheman

Still crashes with current git head V 0.3.3 aee76c5

./v -g -gc none -autofree run examples/flappylearning

What is the status of autofree anyway?

markus-oberhumer avatar Mar 17 '23 23:03 markus-oberhumer

Still WIP.

JalonSolov avatar Mar 18 '23 01:03 JalonSolov