Opened 7 years ago

Closed 7 years ago

#10046 closed defect (fixed)

tor- possible bad assert ?

Reported by: dcb Owned by:
Priority: Medium Milestone: Tor: 0.2.5.x-final
Component: Metrics/Analysis Version:
Severity: Keywords: tor-client pt 024-backport
Cc: asn Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description (last modified by nickm)

I just tried to compile tor- with Linux gcc compiler flag -Wlogical-op

It said

transports.c:330:5: warning: logical 'or' of collectively exhaustive tests is always true [-Wlogical-op]

Source code is

tor_assert(mp->conf_state != PT_PROTO_BROKEN

mp->conf_state != PT_PROTO_FAILED_LAUNCH);

Suggest swap || for &&

Child Tickets

Change History (4)

comment:1 Changed 7 years ago by nickm

Cc: asn added
Description: modified (diff)
Keywords: tor-client pt 024-backport added

Looks like should add -Wlogical-op to our big list of warnings. (It's available in GCC 4.3 or later, it seems.)

George, is && correct here?

I'll suggest trying this out in 0.2.5 and considering it for backport if the assertion doesn't trigger.

comment:2 Changed 7 years ago by asn

Yes, && is correct here.

I can make a patch for this later tonight.

comment:3 Changed 7 years ago by asn

Status: newneeds_review

Please check bug10046 in

Maybe we should make another ticket for adding -Wlogical-op to our gcc flags?

comment:4 Changed 7 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Okay. If we do backport this to 0.2.4, the thing to cherry-pick is 9e0ed8136a53665a21ecdf2bc335cc8ce438e0c8.

Added -Wlogical-op to in 9b0a4cbe9256f3b9dda7a5b6d0611a8449994548.

Note: See TracTickets for help on using tickets.