You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@serf.apache.org by "Lieven Govaerts (Jira)" <ji...@apache.org> on 2020/07/26 20:44:00 UTC

[jira] [Commented] (SERF-196) compile warning / logic error (autological-overlap-compare) in buckets/deflate_buckets.c:207

    [ https://issues.apache.org/jira/browse/SERF-196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17165330#comment-17165330 ] 

Lieven Govaerts commented on SERF-196:
--------------------------------------

Thanks for the report. 

 

A quick look at the code learns me that the second part of the boolean expression will indeed always evaluate to False, as {{STATE_COMPRESS_INIT and }}{{STATE_COMPRESS_FINISH are defined as two consecutive constants in enum deflate_state_t, so their is no state between and STATE_COMPRESS_FINISH.}}{{}}

 

{{if ((ctx->state > STATE_INIT && ctx->state <= STATE_FINISH) ||}}

{{}}{{    (ctx->state > STATE_COMPRESS_INIT && ctx->state < STATE_COMPRESS_FINISH))}}

 

The code was altered by Bert in 2015 (rev. 1713932), but unfortunately it's not clear what specific issue it was supposed to solve and if there is a unit test for the issue. 

Maybe Bert remembers?

 

 

> compile warning / logic error (autological-overlap-compare) in buckets/deflate_buckets.c:207
> --------------------------------------------------------------------------------------------
>
>                 Key: SERF-196
>                 URL: https://issues.apache.org/jira/browse/SERF-196
>             Project: serf
>          Issue Type: Bug
>    Affects Versions: serf-1.4.0, serf-trunk
>         Environment: gcc --version
> Configured with: --prefix=/Applications/Xcode-beta.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
> Apple clang version 12.0.0 (clang-1200.0.22.19)
> Target: arm64-apple-darwin20.0.0
> Thread model: posix
> InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
>            Reporter: AMD Dev
>            Priority: Major
>              Labels: newbie
>
> Maybe a logic error in buckets/deflate_buckets.c at line 207?
>  
> It's running a beta copy of Apple MacOS 10.11 (Big Sur) on AMD hardware.  But I've compiled 100's of open source packages in the past few days, and it's the first time I've seen this, so it's probably worth a closer look by someone more familiar with the code than I am.
>  
> I've listed the priority as Major, because I'm not sure the impact on the code at execution.  Theoretically the bug could be a higher or lower priority.
>  
> {{scons: Building targets ...}}{{gcc -o buckets/deflate_buckets.o -c -std=c89 -Wdeclaration-after-statement -Wmissing-prototypes -Wall -O2 -DNDEBUG -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -DSERF_NO_SSL_BIO_WRAPPERS -DSERF_NO_SSL_X509_STORE_WRAPPERS -DSERF_NO_SSL_X509_GET0_NOTBEFORE -DSERF_NO_SSL_X509_GET0_NOTAFTER -DSERF_NO_SSL_X509_GET0_CHAIN -DSERF_NO_SSL_ASN1_STRING_GET0_DATA -DHAVE_STDBOOL_H -I/Users/amd.dev/bin/include -I. -I/Users/amd.dev/bin/include/apr-1 -I/Users/amd.dev/bin/include/apr-1 -I/usr/include buckets/deflate_buckets.c}}{{buckets/deflate_buckets.c:207:13: warning: overlapping comparisons always evaluate to false [-Wtautological-overlap-compare]}}{{            && ctx->state < STATE_COMPRESS_FINISH))}}{{            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)