Bug 1227581 - Bug report: Vala-generated C code produces int-conversion error in gcc14, causing build to fail
Summary: Bug report: Vala-generated C code produces int-conversion error in gcc14, cau...
Status: CONFIRMED
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: GNOME (show other bugs)
Version: Current
Hardware: All Other
: P5 - None : Minor (vote)
Target Milestone: ---
Assignee: Alynx Zhou
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: modern_C
  Show dependency treegraph
 
Reported: 2024-07-09 14:16 UTC by Gus Kenion
Modified: 2024-07-10 07:13 UTC (History)
5 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Build log (352.20 KB, text/x-log)
2024-07-09 14:16 UTC, Gus Kenion
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gus Kenion 2024-07-09 14:16:48 UTC
Created attachment 875963 [details]
Build log

Summary:

I have observed this issue while building the latest GNOME:Factory/gnome-boxes package using pre-release gcc14 from home:rguenther:plgrnd/gcc.  I'm building in home:gkenion:gcc14, in which the gnome-boxes and gcc packages are linked to GNOME:Factory and home:rguenther:plagrnd, respectively.

The build fails during C compilation, with the following error (from attatched boxes.gcc14.build.log):

2231 [   23s] In file included from /usr/include/glib-2.0/glib.h:64,
2232 [   23s]                  from /usr/include/glib-2.0/gobject/gbinding.h:30,
2233 [   23s]                  from /usr/include/glib-2.0/glib-object.h:24,
2234 [   23s]                  from src/gnome-boxes.p/libvirt-broker.c:6:
2235 [   23s] src/gnome-boxes.p/libvirt-broker.c: In function ‘boxes_libvirt_broker_add_domain_co’:
2236 [   23s] /usr/include/glib-2.0/glib/gmessages.h:671:16: error: returning ‘void *’ from a function with return type ‘gboolean’ {aka ‘int’} makes integer from pointer without a cast [-W     int-conversion]
2237 [   23s]   671 |         return (val); \
2238 [   23s]       |                ^




In this case, the errant call appears in gmessages.h, which is generated by vala during the build.

Workaround would be to specify more permissive c_args.  Would also be worthwhile to communicate this issue to upstream devs, if they aren't already aware.  I haven't found anything indicating they are, but I figured the OpenSUSE GNOME maintainers would follow upstream more closely than I do, and might have existing rapport with the devs.

Steps to reproduce:
Build the home:gkenion:gcc14/gnome:boxes package hosted on the OpenSUSE OBS instance.
Comment 1 Alynx Zhou 2024-07-10 02:49:07 UTC
I can reproduce this and I am trying to find the reason.
Comment 2 Alynx Zhou 2024-07-10 03:15:02 UTC
```
../src/libvirt-broker.vala:29:2: note: in expansion of macro ‘g_return_val_if_fail’
   29 |         return_val_if_fail (broker != null, null);
      |  ^      ~~~~~~~~~~~~~
```

I think the reason is vala translate async function into something returns boolean as status and pass the actual result as argument via pointer, but `g_return_val_if_fail` is a C macro, so it directly returns the generated function, which should return an boolean.

There are already upstream bugs: https://gitlab.gnome.org/GNOME/vala/-/issues/1005 , looks like return_val_if_fail should not be used in vala.

I'll open an issue to gnome-boxes.
Comment 3 Alynx Zhou 2024-07-10 03:23:21 UTC
There is already one bug: https://gitlab.gnome.org/GNOME/gnome-boxes/-/issues/1073
Comment 4 Gus Kenion 2024-07-10 07:13:01 UTC
(In reply to Alynx Zhou from comment #3)
> There is already one bug:
> https://gitlab.gnome.org/GNOME/gnome-boxes/-/issues/1073

Thank you for your looking into this.  I didn't realize #1073 was the same issue, sorry for duplicating.