Bug 1575884

Summary: gcc 8.0 prints strange error when compiling Samba with -Wstrict-overflow=2
Product: [Fedora] Fedora Reporter: Andreas Schneider <asn>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 28CC: aoliva, asn, davejohansen, dmalcolm, fweimer, gdeschner, jakub, jwakely, law, mpolacek, msebor, nickc
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-28 20:21:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Description Flags
debug.i none

Description Andreas Schneider 2018-05-08 07:49:43 UTC
Created attachment 1433041 [details]

Description of problem:

gcc --version
gcc (GCC) 8.0.1 20180324 (Red Hat 8.0.1-0.20)

gcc -O3 -g -ggdb -Wstrict-overflow -Wall -Wcomment -Wpointer-arith -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wdeclaration-after-statement -fstrict-aliasing -DDEVELOPER -DDEBUG_PASSWORD -fPIC -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -fstack-protector -Wshadow -Wcast-qual -fno-common -Werror=address -Werror=strict-prototypes -Werror=write-strings -Werror-implicit-function-declaration -Werror=pointer-arith -Werror=declaration-after-statement -Werror=return-type -Wreturn-type -Werror=uninitialized -Wuninitialized -Wimplicit-fallthrough -Werror=strict-overflow -Wstrict-overflow=2 -Wformat=2 -Wno-format-y2k -Wno-format-zero-length -Werror=format-security -Wformat-security -Werror=format -Werror -Wno-error=deprecated-declarations -Wno-error=tautological-compare -DSTATIC_samba_debug_MODULES=NULL -DSTATIC_samba_debug_MODULES_PROTO='extern void __samba_debug_dummy_module_proto(void)' -MD -Idefault/include/public -I../include/public -Idefault/source4 -I../source4 -Idefault/lib -I../lib -Idefault/source4/lib -I../source4/lib -Idefault/source4/include -I../source4/include -Idefault/include -I../include -Idefault/lib/replace -I../lib/replace -Idefault -I.. -I/usr/local/include -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE_EXTENDED=1 ../lib/util/debug.c -c -o default/lib/util/debug_11.o
../lib/util/debug.c: In function ‘debug_parse_levels’:
../lib/util/debug.c:788:5: error: assuming pointer wraparound does not occur when comparing P +- C1 with P +- C2 [-Werror=strict-overflow]                               
 bool debug_parse_levels(const char *params_str)
cc1: all warnings being treated as errors

Attached is the pre-processed C file (debug.i)

Comment 1 Marek Polacek 2018-05-08 17:00:28 UTC
Seems to have changed in r250619 so before that the warning would appear with -ftree-vectorize.  Not sure what there is to change...

Comment 2 Jakub Jelinek 2018-05-09 09:20:01 UTC
Using -Werror with -Wstrict-overflow?  Why would one do that?  It doesn't make much sense.
The -Wstrict-overflow warning informs the user about cases where the compiler optimizes something and assumes no UB happens.  There is usually nothing wrong with the code and there is nothing wrong with what the compiler does (except when you rely on the UB in the code).

Comment 3 Andreas Schneider 2018-05-09 11:47:38 UTC
Well, the warning doesn't make sense at all. It points to the function declaration! I don't see any pointer arithmetic involved here.

Comment 4 Andreas Schneider 2018-05-15 16:13:39 UTC
Still happens with GCC 8.1.1

The error points to the function declaration!

Comment 5 Andreas Schneider 2018-05-23 09:23:26 UTC
Fixed, upstream. Please add the patch to Fedora!

Comment 6 Ben Cotton 2019-05-02 21:43:03 UTC
This message is a reminder that Fedora 28 is nearing its end of life.
On 2019-May-28 Fedora will stop maintaining and issuing updates for
Fedora 28. 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 '28'.

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 28 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 2019-05-28 20:21:41 UTC
Fedora 28 changed to end-of-life (EOL) status on 2019-05-28. Fedora 28 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

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