diff mbox

rdma-core compiler warnings on RHEL6.8

Message ID 01ea01d3d34e$32fe6900$98fb3b00$@opengridcomputing.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Steve Wise April 13, 2018, 5:38 p.m. UTC
Hey guys, compiling rdma-core on RHEL6.8 shows at least two sets of
warnings.   Should these be fixed?

1) enum type treated as a signed int:

/root/stevo/rdma-core/libibverbs/enum_strs.c: In function
'ibv_port_state_str':
/root/stevo/rdma-core/libibverbs/enum_strs.c:63: warning: comparison of
unsigned expression < 0 is always false
/root/stevo/rdma-core/libibverbs/enum_strs.c: In function
'ibv_event_type_str':
/root/stevo/rdma-core/libibverbs/enum_strs.c:94: warning: comparison of
unsigned expression < 0 is always false
/root/stevo/rdma-core/libibverbs/enum_strs.c: In function
'ibv_wc_status_str':
/root/stevo/rdma-core/libibverbs/enum_strs.c:129: warning: comparison of
unsigned expression < 0 is always false

2) strict aliasing warnings:

/root/stevo/rdma-core/libibverbs/verbs.c: In function 'ibv_init_ah_from_wc':
/root/stevo/rdma-core/libibverbs/verbs.c:648: warning: dereferencing pointer
'sgid.163' does break strict-aliasing rules
/root/stevo/rdma-core/libibverbs/verbs.c:647: warning: dereferencing pointer
'sgid.163' does break strict-aliasing rules
/root/stevo/rdma-core/libibverbs/verbs.c:646: warning: dereferencing pointer
'sgid.163' does break strict-aliasing rules
/root/stevo/rdma-core/libibverbs/verbs.c:645: warning: dereferencing pointer
'sgid.163' does break strict-aliasing rules
/root/stevo/rdma-core/libibverbs/verbs.c:724: note: initialized from here

I avoided #2 by adding this...but is there some way to do this only for
certain compilers?


---
Steve.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Jason Gunthorpe April 13, 2018, 7:23 p.m. UTC | #1
On Fri, Apr 13, 2018 at 12:38:13PM -0500, Steve Wise wrote:
> Hey guys, compiling rdma-core on RHEL6.8 shows at least two sets of
> warnings.   Should these be fixed?

No, I ignore almost all warnings from that old compiler.

> 1) enum type treated as a signed int:
> 
> /root/stevo/rdma-core/libibverbs/enum_strs.c: In function
> 'ibv_port_state_str':
> /root/stevo/rdma-core/libibverbs/enum_strs.c:63: warning: comparison of
> unsigned expression < 0 is always false

The code is right as is, as the standard does not require all
implementations to use unsigned storage for an enum. Newer compilers
must be supressing this as bogus because it is true.

> 2) strict aliasing warnings:
> 
> /root/stevo/rdma-core/libibverbs/verbs.c: In function 'ibv_init_ah_from_wc':
> /root/stevo/rdma-core/libibverbs/verbs.c:648: warning: dereferencing pointer
> 'sgid.163' does break strict-aliasing rules
> /root/stevo/rdma-core/libibverbs/verbs.c:647: warning: dereferencing pointer
> 'sgid.163' does break strict-aliasing rules
> /root/stevo/rdma-core/libibverbs/verbs.c:646: warning: dereferencing pointer
> 'sgid.163' does break strict-aliasing rules
> /root/stevo/rdma-core/libibverbs/verbs.c:645: warning: dereferencing pointer
> 'sgid.163' does break strict-aliasing rules
> /root/stevo/rdma-core/libibverbs/verbs.c:724: note: initialized from here
> 
> I avoided #2 by adding this...but is there some way to do this only for
> certain compilers?

aliasing analysis is pretty broken in that compiler.

If you can make a simple test program that triggers the above warning
send it to me and I will make cmake turn off strict aliasing globally if the
compiler is too old..

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/libibverbs/CMakeLists.txt b/libibverbs/CMakeLists.txt
index 7218783..29998f6 100644
--- a/libibverbs/CMakeLists.txt
+++ b/libibverbs/CMakeLists.txt
@@ -1,3 +1,5 @@ 
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NO_STRICT_ALIASING_FLAGS}")
+
 publish_headers(infiniband
   arch.h
   opcode.h