Skip to content

Flang fails to compile examples julia_pixbuf.f90 and pixbuf_without_gui.f90 which calls gdk_pixbuf_savev() #300

@vmagnin

Description

@vmagnin

Describe the bug

[ 45%] Building Fortran object examples/CMakeFiles/julia_pixbuf.dir/julia_pixbuf.f90.o
error: Semantic errors in /home/osboxes/gtk-fortran/examples/julia_pixbuf.f90
/home/osboxes/gtk-fortran/examples/julia_pixbuf.f90:209:39: error: Whole scalar actual argument may not be associated with a dummy argument 'option_keys=' array
                                 & "png"//c_null_char, c_null_ptr, c_null_ptr, c_null_ptr)
                                                       ^^^^^^^^^^
/home/osboxes/gtk-fortran/examples/julia_pixbuf.f90:209:51: error: Whole scalar actual argument may not be associated with a dummy argument 'option_values=' array
				  & "png"//c_null_char, c_null_ptr, c_null_ptr, c_null_ptr)
                                                                    ^^^^^^^^^^
													
[ 60%] Building Fortran object examples/CMakeFiles/pixbuf_without_gui.dir/pixbuf_without_gui.f90.o
error: Semantic errors in /home/osboxes/gtk-fortran/examples/pixbuf_without_gui.f90
/home/osboxes/gtk-fortran/examples/pixbuf_without_gui.f90:91:37: error: Whole scalar actual argument may not be associated with a dummy argument 'option_keys=' array
				& "png"//c_null_char, c_null_ptr, c_null_ptr, c_null_ptr)
                                                       ^^^^^^^^^^
/home/osboxes/gtk-fortran/examples/pixbuf_without_gui.f90:91:49: error: Whole scalar actual argument may not be associated with a dummy argument 'option_values=' array
				& "png"//c_null_char, c_null_ptr, c_null_ptr, c_null_ptr)
                                                                    ^^^^^^^^^^

To Reproduce
Steps to reproduce the behavior:

$ cmake -D CMAKE_BUILD_TYPE=debug -D EXCLUDE_PLPLOT=true -D CMAKE_Fortran_COMPILER=$(which flang) ..
$ make

Your system:

  • OS version: Fedora 42
  • Compiler version: flang version 20.1.3 (Fedora 20.1.3-1.fc42)
  • GTK branch: gtk4-vmagnin (development branch)

Additional context
You can continue to build the project with make -i (ignore).

GFortran and Intel ifx do not complain.

According to https://docs.gtk.org/gdk-pixbuf/method.Pixbuf.savev.html
the two problematic arguments are arrays of utf8:

  char** option_keys,
  char** option_values,

The argument can be NULL.
The array must be NULL-terminated.
The data is owned by the caller of the method.
Each element is a NUL terminated UTF-8 string.

Maybe we could use https://docs.gtk.org/glib/struct.StrvBuilder.html

GStrvBuilder is a helper object to build a NULL-terminated string arrays.

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions