After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 795138 - gobject build failure with gcc <= 4.7
gobject build failure with gcc <= 4.7
Product: glib
Classification: Platform
Component: gobject
Other Linux
: Normal critical
: ---
Assigned To: gtkdev
Depends on:
Reported: 2018-04-10 18:27 UTC by Fabrice Fontaine
Modified: 2018-04-20 10:33 UTC
See Also:
GNOME target: ---
GNOME version: ---

Patch fixing issue (1.54 KB, patch)
2018-04-10 18:27 UTC, Fabrice Fontaine
none Details | Review
Second patch (replacing former one) (2.04 KB, patch)
2018-04-12 20:24 UTC, Fabrice Fontaine
committed Details | Review

Description Fabrice Fontaine 2018-04-10 18:27:55 UTC
Created attachment 370739 [details] [review]
Patch fixing issue

On powerpc, we got the following error:

error: value computed is not used [-Werror=unused-value]

This error has been added by commit
The patch put back old behavior if __powerpc__ is defined

Comment 1 Daniel Boles 2018-04-10 18:31:40 UTC
I don't see GLib defining -Werror=unused-value... Are you adding it? If so, why not just stop doing that? I'm not sure I see how KOing the feature on a specific architecture is the correct answer. Can you explain why it is?
Comment 2 Fabrice Fontaine 2018-04-10 18:43:21 UTC
-Wall is added by the tpm2-abrmd package (which is using glib):

I agree that disabling the feature for a specific architecture is not the perfect solution however I don't think that removing -Wall from tpm2-abrmd (and all other glib packages that could use glib) is better. I will wait from feedback of the other buildroot members perhaps they will find an explanation on why this breaks (only) on powerpc.
Comment 3 Daniel Boles 2018-04-10 18:47:55 UTC
Well, it's not the -Wall that's the immediate issue; it's the unspecific -Werror.
Comment 4 Fabrice Fontaine 2018-04-10 18:51:09 UTC
Yes, that's the combination of -Wall and -Werror. I will suggest to remove -Werror from tpm2-abrmd package and hope that other glib packages won't have the same issue.
Comment 5 Emmanuele Bassi (:ebassi) 2018-04-10 19:11:40 UTC
(In reply to Fabrice Fontaine from comment #4)
> Yes, that's the combination of -Wall and -Werror. I will suggest to remove
> -Werror from tpm2-abrmd package and hope that other glib packages won't have
> the same issue.

In any case, the fix of ignoring the typeof cast on PowerPC is wrong: the warning comes from GCC only on PPC, so it points to a compiler issue.

There's no annotation on g_object_ref() that you must use the returned value, and adding a cast on the return value should not magically add a requirement on using the returned value.

I'd strongly encourage you to file a bug against GCC.
Comment 6 Fabrice Fontaine 2018-04-12 14:52:35 UTC
After more investigations (, it seems that this issue is indeed due to GCC. So, will you accept a patch that enable this definition only if GCC version is above or equal to 4.8?
Comment 7 Emmanuele Bassi (:ebassi) 2018-04-12 15:05:17 UTC
We don't usually work around compiler bugs that way.

On the other hand, we do have a bunch of conditional macro definition for ancient GCC versions, even though we don't have CI set up to test that we're not actually breaking stuff, so we could make this conditional to GCC ≥ 4.8.

Feel free to attach a patch — and re-open the bug when you do so. I'll be happy to review it.
Comment 8 Fabrice Fontaine 2018-04-12 20:24:36 UTC
Created attachment 370873 [details] [review]
Second patch (replacing former one)
Comment 9 Fabrice Fontaine 2018-04-12 20:26:11 UTC
Thanks for your answer, I attached a new patch
Comment 10 Philip Withnall 2018-04-20 10:29:32 UTC
Review of attachment 370873 [details] [review]:

OK, thanks.
Comment 11 Philip Withnall 2018-04-20 10:33:41 UTC
Pushed to master and backported to glib-2-56:

b93788ac1 (HEAD -> master, origin/master, origin/HEAD) gobject: fix compilation with gcc <= 4.7
8de72c56a (HEAD -> glib-2-56) gobject: fix compilation with gcc <= 4.7