gtk-fortran icon indicating copy to clipboard operation
gtk-fortran copied to clipboard

With Intel ifort, the list_demo example shows garbage characters in its "Name" column

Open vmagnin opened this issue 3 years ago • 7 comments

Describe the bug When gtk-fortran is built with ifort, the list_demo example shows garbage characters in its "Name" column. And in the terminal some warnings about UTF-8 appear:

(list_demo:16562): Pango-WARNING **: 10:11:52.168: Invalid UTF-8 string passed to pango_layout_set_text()

And each time the example is run, the garbage characters are different.

Expected behavior Should show some persons names.

Your system:

  • OS version: Ubuntu 21.04 64 bits
  • Compiler version: ifort (IFORT) 2021.2.0 20210228
  • GTK branch: tested only in gtk4.

Additional context No problem with gfortran. Note that the pango_layout_set_text() function is not called directly by the example source code. Is there some problem with the c_loc() function in that kind of lines?

call g_value_set_static_string(c_loc(valt), "Heinz El-Mann"//c_null_char)

vmagnin avatar Jun 07 '21 15:06 vmagnin

That example is crashing in MSYS2/Windows 10 (tested with gfortran):

$ ./list_demo.exe

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0xe4c6c21b
...

vmagnin avatar Jun 08 '21 09:06 vmagnin

Same problem with GTK 4.4 and ifort 2021.4.0.

vmagnin avatar Oct 21 '21 19:10 vmagnin

The regex example is also printing some garbage:

 LET'S LOOK FOR THE FUNCTIONS CITED IN THE TEXT:
 SOME MATCHES WERE FOUND:
 ����

vmagnin avatar Oct 21 '21 19:10 vmagnin

https://docs.gtk.org/gobject/method.Value.set_static_string.html

The string is a NUL terminated UTF-8 string.

Maybe related to that post https://fortran-lang.discourse.group/t/using-box-drawing-characters/645/3

vmagnin avatar Oct 23 '21 16:10 vmagnin

Concerning regex.f90: https://docs.gtk.org/glib/method.MatchInfo.fetch.html

Returns: utf8

vmagnin avatar Oct 23 '21 16:10 vmagnin

See also: https://docs.gtk.org/glib/method.MatchInfo.fetch.html?q=utf8

vmagnin avatar Oct 23 '21 16:10 vmagnin

The issue is still present with ifort 2021.5.0 20211109 but there is no problem with ifx 2022.0.0 20211123

vmagnin avatar Feb 07 '22 15:02 vmagnin

The problem is still present with ifort (IFORT) 2021.7.0 20220726. But it is OK with ifx which will replace ifort.

vmagnin avatar Oct 11 '22 07:10 vmagnin