Bug 1803029 - FTBFS: false-positive "maybe-uninitialized" warning on s390x
Summary: FTBFS: false-positive "maybe-uninitialized" warning on s390x
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 33
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: ZedoraTracker
TreeView+ depends on / blocked
 
Reported: 2020-02-14 11:00 UTC by Daiki Ueno
Modified: 2021-11-30 16:26 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-30 16:26:43 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
preprocessed source (503.92 KB, text/plain)
2020-02-14 11:22 UTC, Dan Horák
no flags Details
preprocessed source (527.40 KB, text/plain)
2020-02-21 11:36 UTC, Dan Horák
no flags Details

Description Daiki Ueno 2020-02-14 11:00:58 UTC
Description of problem:
We build our package (nss) with -Werror=maybe-uninitialized, but only on s390x, the warning is issued.  Conceptually, the relevant code is something like:
```
    int value;
[...]
    parseNextCmdInput(extKeyUsageKeyWordArray, &value, &nextPos,
                      &isCriticalExt); /* assign value */
[...]
    keyUsage |= (0x80 >> value); /* 'value' may be used uninitialized in this function [-Werror=maybe-uninitialized] */
```
though there are some indirections with functions and macros.

Version-Release number of selected component (if applicable):
10.0.1-0.7.fc32

How reproducible:
100%

Steps to Reproduce:
1. fedpkg clone nss
2. cd nss
3. fedpkg scratch-build --arches s390x

Actual results:
build error

Expected results:
build succeeds

Additional info:
The complete log around the failure:
```
cc -o Linux5.4_s390x_cc_glibc_PTH_64_OPT.OBJ/certext.o -c -std=c99 -O2 -fPIC   -pipe -ffunction-sections -fdata-sections -DHAVE_STRERROR -DLINUX -Dlinux -Wall -Wshadow -Werror -DXP_UNIX -DNSPR20 -UDEBUG -DNDEBUG -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -D_REENTRANT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -I/usr/include/nspr4  -iquote ../../../dist/Linux5.4_s390x_cc_glibc_PTH_64_OPT.OBJ/../public/nss -iquote ../../../dist/Linux5.4_s390x_cc_glibc_PTH_64_OPT.OBJ/../private/nss -I../../../dist/Linux5.4_s390x_cc_glibc_PTH_64_OPT.OBJ/include -I../../../dist/public/nss  -I../../../dist/private/nss  -I../../../dist/public/dbm -I../../../dist/public/seccmd -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=zEC12 -mtune=z13 -fasynchronous-unwind-tables -fstack-clash-protection certext.c
certext.c: In function 'AddExtKeyUsage':
certext.c:513:9: error: 'value' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  513 |     int value;
      |         ^~~~~
certext.c: In function 'AddExtensions':
certext.c:706:31: error: 'value' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  706 |             keyUsage |= (0x80 >> value);
      |                         ~~~~~~^~~~~~~~~
certext.c:667:9: note: 'value' was declared here
  667 |     int value;
      |         ^~~~~
certext.c:368:31: error: 'value' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  368 |             keyUsage |= (0x80 >> value);
      |                         ~~~~~~^~~~~~~~~
certext.c:330:9: note: 'value' was declared here
  330 |     int value;
      |         ^~~~~
cc1: all warnings being treated as errors
```

Comment 1 Dan Horák 2020-02-14 11:22:09 UTC
Created attachment 1663107 [details]
preprocessed source

Comment 2 Jeff Law 2020-02-21 04:12:27 UTC
Umm, the preprocessed source is for pkix_list.c, but the bug complains about certext.c.  Did you get the right file Dan?

Comment 3 Dan Horák 2020-02-21 11:36:56 UTC
Created attachment 1664703 [details]
preprocessed source

Aha, I see, there were multiple "maybe-uninitialized" issues. Attaching the right file now :-)

Comment 4 Dan Horák 2020-02-21 11:44:58 UTC
For the record, the original attachment failed with

cc -o Linux5.6_s390x_cc_glibc_PTH_64_OPT.OBJ/pkix_list.o -c -std=c99 -O2 -fPIC   -pipe -ffunction-sections -fdata-sections -DHAVE_STRERROR -DLINUX -Dlinux -Wall -Wshadow -Werror -DXP_UNIX -UDEBUG -DNDEBUG -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -D_REENTRANT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -I/usr/include/nspr4  -iquote ../../../../../dist/Linux5.6_s390x_cc_glibc_PTH_64_OPT.OBJ/../public/nss -iquote ../../../../../dist/Linux5.6_s390x_cc_glibc_PTH_64_OPT.OBJ/../private/nss -I../../../../../dist/Linux5.6_s390x_cc_glibc_PTH_64_OPT.OBJ/include -I../../../../../dist/public/nss -I../../../../../dist/private/nss -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=zEC12 -mtune=z13 -fasynchronous-unwind-tables -fstack-clash-protection pkix_list.c
In file included from pkix_list.h:14,
                 from pkix_list.c:11:
pkix_list.c: In function 'PKIX_List_SetItem':
pkix_tools.h:255:10: error: 'element' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  255 |      obj = NULL; \
      |          ^
pkix_list.c:1538:20: note: 'element' was declared here
 1538 |         PKIX_List *element;
      |                    ^~~~~~~
cc1: all warnings being treated as errors

there was a workaround applied as a patch (https://src.fedoraproject.org/rpms/nss/blob/37c40ebd3db65bdc34bd7cdeb29181b98db18b40/f/nss-libpkix-maybe-uninitialized.patch), but later removed. Maybe this is also a false-positive.

Comment 5 Ben Cotton 2020-08-11 13:08:10 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 33 development cycle.
Changing version to 33.

Comment 6 Ben Cotton 2021-11-04 17:30:03 UTC
This message is a reminder that Fedora 33 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '33'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 33 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Ben Cotton 2021-11-30 16:26:43 UTC
Fedora 33 changed to end-of-life (EOL) status on 2021-11-30. Fedora 33 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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