GithubHelp home page GithubHelp logo

Comments (19)

interkosmos avatar interkosmos commented on August 19, 2024

I’ve just experienced a seg fault when closing the program. Do you start the executable from within its directory?

$ cd examples/voxel/
$ ./voxel

from fortran-sdl2.

sebastian-mutz avatar sebastian-mutz commented on August 19, 2024

Yes, I do navigate to its directory and start it as you describe. I tried alternatively compiling explicitly with gfortran-8 and gfortran-9, but the problem remains unfortunately.

from fortran-sdl2.

milancurcic avatar milancurcic commented on August 19, 2024

I can reproduce with gcc-9.2.0. Here's the output:

$ ./voxel 
free(): double free detected in tcache 2

Program received signal SIGABRT: Process abort signal.

Backtrace for this error:
#0  0x7f7656bc9f7f in ???
#1  0x7f7656bc9efb in ???
#2  0x7f7656bb45b8 in ???
#3  0x7f7656c0c7b6 in ???
#4  0x7f7656c12c0b in ???
#5  0x7f7656c14674 in ???
#6  0x7f7657c36912 in ???
#7  0x40337f in read_voxels
	at examples/voxel/voxel.f90:284
#8  0x401fab in MAIN__
	at examples/voxel/voxel.f90:104
#9  0x4037a3 in main
	at examples/voxel/voxel.f90:12
Aborted (core dumped)

L284 is:

        call sdl_free_format(color_map%pixel_format)

from fortran-sdl2.

milancurcic avatar milancurcic commented on August 19, 2024

Recompiled with added flags -O0 -fbounds-check. Now I get:

$ ./voxel 
At line 263 of file examples/voxel/voxel.f90
Fortran runtime error: Index '0' of dimension 1 of array 'color_map%pixels' below lower bound of 1

Error termination. Backtrace:
#0  0x403625 in read_voxels
	at examples/voxel/voxel.f90:263
#1  0x401fab in MAIN__
	at examples/voxel/voxel.f90:104
#2  0x404069 in main
	at examples/voxel/voxel.f90:12

from fortran-sdl2.

milancurcic avatar milancurcic commented on August 19, 2024

In addition to voxel, wiith -fbounds-check the following examples fail (which I believe otherwise work):

  • fire:
At line 219 of file examples/fire/fire.f90
Fortran runtime error: Index '0' of dimension 1 of array 'palette' below lower bound of 1
  • pixel:
At line 107 of file examples/pixel/pixel.f90
Fortran runtime error: Index '22801' of dimension 1 of array 'image%surface_pixels' above upper bound of 22800

from fortran-sdl2.

interkosmos avatar interkosmos commented on August 19, 2024

Thank you for reporting, issues should be fixed now.

from fortran-sdl2.

sebastian-mutz avatar sebastian-mutz commented on August 19, 2024

Unfortunately this did not seem to fix the problem for me. I can have a closer look myself at some point, but I can say that I keep getting a seg fault.

from fortran-sdl2.

interkosmos avatar interkosmos commented on August 19, 2024

Can you create a backtrace? Set the FFLAGS in Makefile to -g -O0:

FFLAGS     = -Wall -g -O0 -fbounds-check -std=f2008 -fmax-errors=1 $(SDL_CFLAGS)

Then, recompile the voxel example:

$ make clean
$ make voxel

Run the executable inside GDB:

$ sudo gdb ./voxel
(gdb) run

After the seg fault, show the backtrace:

(gdb) bt

from fortran-sdl2.

milancurcic avatar milancurcic commented on August 19, 2024

Thanks, Philipp, here's my traceback from voxel:

(gdb) bt
#0  0x00007ffff6aa5efb in raise () from /lib64/libc.so.6
#1  0x00007ffff6a905b9 in abort () from /lib64/libc.so.6
#2  0x00007ffff6ae87b7 in __libc_message () from /lib64/libc.so.6
#3  0x00007ffff6aeec0c in malloc_printerr () from /lib64/libc.so.6
#4  0x00007ffff6af0675 in _int_free () from /lib64/libc.so.6
#5  0x00007ffff7af9913 in SDL_free_REAL () from /lib64/libSDL2-2.0.so.0
#6  0x0000000000403fcd in read_voxels (color_map_path=..., height_map_path=..., width=1024, height=1024, pixel_format=..., 
    voxels=<error reading variable: value requires 8388608 bytes, which is more than max-value-size>, _color_map_path=7, _height_map_path=7)
    at examples/voxel/voxel.f90:271
#7  0x0000000000401f93 in MAIN__ () at examples/voxel/voxel.f90:106
(gdb) 

To my naive eyes this perhaps looked like stack overflow as my stack size was 8M, but unlimiting the stack didn't make a difference.

from fortran-sdl2.

interkosmos avatar interkosmos commented on August 19, 2024

Looks like some of the calls of sdl_free() inside read_voxels() fails, probably sdl_free_format().

from fortran-sdl2.

sebastian-mutz avatar sebastian-mutz commented on August 19, 2024

When I run it with the debugger, I no longer get a seg fault on start or quitting (and no stack and backtrace), but the screen is simply blue and without the DEM.

from fortran-sdl2.

interkosmos avatar interkosmos commented on August 19, 2024

Do the other examples work (fire, pixel, cyclic, forest)?

from fortran-sdl2.

sebastian-mutz avatar sebastian-mutz commented on August 19, 2024

fire works perfectly
forest works perfectly
pixel gives me a seg fault after quitting, but not when I use the debugger
cyclic has issues when running with the debugger; bt:

#0 0x00007ffff6f2a9f9 in malloc_consolidate (av=av@entry=0x7ffff7285c40 <main_arena>) at malloc.c:4456
#1 0x00007ffff6f2e848 in _int_malloc (av=av@entry=0x7ffff7285c40 <main_arena>, bytes=bytes@entry=4096) at malloc.c:3703
#2 0x00007ffff6f3135d in GI___libc_malloc (bytes=4096) at malloc.c:3065
#3 0x00007fffee08c148 in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#4 0x00007fffee08c2a1 in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#5 0x00007fffedbc0b11 in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#6 0x00007fffedbb2b49 in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#7 0x00007fffedbb2ec7 in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#8 0x00007fffedbc362d in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#9 0x00007fffedbb49fb in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#10 0x00007fffedd43865 in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#11 0x00007fffedd2b254 in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#12 0x00007fffedd432a3 in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#13 0x00007fffede44832 in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#14 0x00007fffede45cdf in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so
#15 0x00007ffff7aefda9 in ?? () from /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0
#16 0x00007ffff7ae8b88 in ?? () from /usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0
#17 0x0000555555556abe in MAIN
()

from fortran-sdl2.

interkosmos avatar interkosmos commented on August 19, 2024

Have you set the FFLAGS options -g -O0 in Makefile?

from fortran-sdl2.

sebastian-mutz avatar sebastian-mutz commented on August 19, 2024

Sorry, I accidentally used the old Makefile for my last comment.
When compiled with the suggested flags:

cyclic:
[New Thread 0x7fffec57f700 (LWP 4545)]
At line 252 of file examples/cyclic/cyclic.f90
Fortran runtime error: Index '250001' of dimension 1 of array 'frame_buffer%pixels' above upper bound of 250000

Error termination. Backtrace:
#0 0x7ffff764638d in ???
#1 0x7ffff7646f25 in ???
#2 0x7ffff76472f7 in ???
#3 0x555555557343 in render
at examples/cyclic/cyclic.f90:252
#4 0x555555557d28 in MAIN__
at examples/cyclic/cyclic.f90:184
#5 0x55555555817e in main
at examples/cyclic/cyclic.f90:81
[Thread 0x7fffec57f700 (LWP 4545) exited]
[Inferior 1 (process 4540) exited with code 02]

fire
[New Thread 0x7fffec57f700 (LWP 4597)]
At line 77 of file examples/fire/fire.f90
Fortran runtime error: Index '-1' of dimension 1 of array 'fire' below lower bound of 0

Error termination. Backtrace:
#0 0x7ffff764638d in ???
#1 0x7ffff7646f25 in ???
#2 0x7ffff76472f7 in ???
#3 0x555555555c2c in doom_MOD_fire_burn
at examples/fire/fire.f90:77
#4 0x5555555563f8 in MAIN

at examples/fire/fire.f90:183
#5 0x5555555564de in main
at examples/fire/fire.f90:100
[Thread 0x7fffec57f700 (LWP 4597) exited]
[Inferior 1 (process 4592) exited with code 02]

forest - works fine

pixel - does not quit

voxel - does not quit and does not display the DEM

from fortran-sdl2.

interkosmos avatar interkosmos commented on August 19, 2024

cyclic and fire should be fixed now. But I can’t reproduce the behaviour of pixel and voxel.

What happends when you change the do concurrent loops in voxel.f90 to ordinary do loops`?

from fortran-sdl2.

interkosmos avatar interkosmos commented on August 19, 2024

I’ve installed Linux inside a virtual machine and build the voxel example. As long as no optimisation flags (-O1/-O2/-O3) are used, the example works fine. Otherwise, a seg fault happens.

from fortran-sdl2.

milancurcic avatar milancurcic commented on August 19, 2024

Thank you. As of commit 1e87f9d I can confirm that the voxel example works without optimization flags on my machine. It brings back nice memories of Comanche :).

from fortran-sdl2.

interkosmos avatar interkosmos commented on August 19, 2024

It seems the bug in the voxel example was caused by a missing convertion of the RGB values from unsigned integer (C) to signed integer (Fortran). Should be fixed now.

from fortran-sdl2.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.