Bug 2170551 - error: conversion to ‘gssize’ from ‘size_t’ [-Werror=sign-conversion]
Summary: error: conversion to ‘gssize’ from ‘size_t’ [-Werror=sign-conversion]
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: glib2
Version: rawhide
Hardware: All
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Matthias Clasen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: ZedoraTracker
TreeView+ depends on / blocked
 
Reported: 2023-02-16 17:16 UTC by Dan Horák
Modified: 2023-03-06 11:29 UTC (History)
5 users (show)

Fixed In Version: glib2-2.75.4-1.fc39
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-03-06 11:29:26 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNOME Gitlab GNOME glib issues 2919 0 None closed 2.75.3: g_string_append_len_inline: error: implicit conversion changes signedness 2023-03-06 11:29:26 UTC

Description Dan Horák 2023-02-16 17:16:02 UTC
Description of problem:
A check for the presence of glib2-devel package fails when building s390utils in rawhide with -Werror. There is no such problem in F-37, so either something changed in glib2 2.75 or rather gcc 13 is smarter ...

<mock-chroot> sh-5.2# cat test.c
#include <glib.h>

int main(void)
{
return 0;
}

<mock-chroot> sh-5.2# gcc -g -fstack-protector-all -W -Wall -Wformat-security -O3 -std=gnu11 -DOPENSSL_API_COMPAT=0x10101000L -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -pthread -Wall -Wextra -Wshadow -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wno-long-long -Wuninitialized -Wconversion -Wstrict-prototypes -Wpointer-arith -Wno-error=inline -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -Werror -fPIC -I ../include -D_GNU_SOURCE -c test.c

In file included from /usr/include/glib-2.0/glib/giochannel.h:36,
                 from /usr/include/glib-2.0/glib.h:56,
                 from test.c:1:
/usr/include/glib-2.0/glib/gstring.h: In function ‘g_string_append_len_inline’:
/usr/include/glib-2.0/glib/gstring.h:217:11: error: conversion to ‘gssize’ {aka ‘long int’} from ‘size_t’ {aka ‘long unsigned int’} may change the sign of the result [-Werror=sign-conversion]
  217 |     len = strlen (val);
      |           ^~~~~~
In file included from /usr/lib64/glib-2.0/include/glibconfig.h:9,
                 from /usr/include/glib-2.0/glib/gtypes.h:34,
                 from /usr/include/glib-2.0/glib/galloca.h:34,
                 from /usr/include/glib-2.0/glib.h:32:
/usr/include/glib-2.0/glib/gstring.h:219:30: error: conversion to ‘long unsigned int’ from ‘gssize’ {aka ‘long int’} may change the sign of the result [-Werror=sign-conversion]
  219 |   if (G_LIKELY (gstring->len + len < gstring->allocated_len))
      |                              ^
/usr/include/glib-2.0/glib/gmacros.h:1238:8: note: in definition of macro ‘_G_BOOLEAN_EXPR_IMPL’
 1238 |    if (expr)                                    \
      |        ^~~~
/usr/include/glib-2.0/glib/gmacros.h:1245:43: note: in expansion of macro ‘_G_BOOLEAN_EXPR’
 1245 | #define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1))
      |                                           ^~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gstring.h:219:7: note: in expansion of macro ‘G_LIKELY’
  219 |   if (G_LIKELY (gstring->len + len < gstring->allocated_len))
      |       ^~~~~~~~
/usr/include/glib-2.0/glib/gstring.h:223:27: error: conversion to ‘size_t’ {aka ‘long unsigned int’} from ‘gssize’ {aka ‘long int’} may change the sign of the result [-Werror=sign-conversion]
  223 |         memcpy (end, val, len);
      |                           ^~~
/usr/include/glib-2.0/glib/gstring.h:225:28: error: conversion to ‘size_t’ {aka ‘long unsigned int’} from ‘gssize’ {aka ‘long int’} may change the sign of the result [-Werror=sign-conversion]
  225 |         memmove (end, val, len);
      |                            ^~~
/usr/include/glib-2.0/glib/gstring.h:226:20: error: conversion to ‘long unsigned int’ from ‘gssize’ {aka ‘long int’} may change the sign of the result [-Werror=sign-conversion]
  226 |       gstring->len += len;
      |                    ^~
cc1: all warnings being treated as errors



Version-Release number of selected component (if applicable):
gcc-13.0.1-0.2.fc38.s390x
glib2-2.75.3-3.fc39.s390x

Comment 1 Dan Horák 2023-02-17 09:50:25 UTC
This doesn't seem to be s390x specific, it reproduced on ppc64le and x86_64 as well.

Comment 2 Dan Horák 2023-03-06 11:29:26 UTC
resolved via an upstream issue, closing


Note You need to log in before you can comment on or make changes to this bug.