Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1803029

Summary: FTBFS: false-positive "maybe-uninitialized" warning on s390x
Product: [Fedora] Fedora Reporter: Daiki Ueno <dueno>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 33CC: aoliva, avi.kivity, dan, dmalcolm, fweimer, jakub, jwakely, law, mpolacek, msebor, nickc, sipoyare
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 467765    
Attachments:
Description Flags
preprocessed source
none
preprocessed source none

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.