linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] verbs: fix compilation error with ICC
@ 2017-09-26 14:05 Nelio Laranjeiro
       [not found] ` <1506434711-3828-1-git-send-email-nelio.laranjeiro-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Nelio Laranjeiro @ 2017-09-26 14:05 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Adrien Mazarguil, yishaih-VPRAkNaXOzVWk0Htik3J/w

Compiling a program including verbs.h with ICC fails with the following
error (seen with DPDK):

 /root/development/rdma-core/build/include/infiniband/verbs.h(84):
 warning #61: integer operation result is out of range
   static void *__VERBS_ABI_IS_EXTENDED = ((uint8_t *) NULL) - 1;

Fixes: 6be16586e081 ("Infrastructure to support verbs extensions")
Cc: yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
Acked-by: Adrien Mazarguil <adrien.mazarguil-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
---
 libibverbs/verbs.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index 8cdf8ab..cc633a1 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -42,6 +42,7 @@
 #include <errno.h>
 #include <string.h>
 #include <linux/types.h>
+#include <stdint.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
@@ -81,7 +82,7 @@ union ibv_gid {
 
 #define vext_field_avail(type, fld, sz) (offsetof(type, fld) < (sz))
 
-static void *__VERBS_ABI_IS_EXTENDED = ((uint8_t *) NULL) - 1;
+static void *__VERBS_ABI_IS_EXTENDED = (void *)UINTPTR_MAX;
 
 enum ibv_node_type {
 	IBV_NODE_UNKNOWN	= -1,
-- 
2.1.4

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] verbs: fix compilation error with ICC
       [not found] ` <1506434711-3828-1-git-send-email-nelio.laranjeiro-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
@ 2017-09-28 14:02   ` Leon Romanovsky
  2017-09-28 16:44   ` Jason Gunthorpe
  2017-10-04 17:11   ` Leon Romanovsky
  2 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2017-09-28 14:02 UTC (permalink / raw)
  To: Nelio Laranjeiro
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Adrien Mazarguil,
	yishaih-VPRAkNaXOzVWk0Htik3J/w

[-- Attachment #1: Type: text/plain, Size: 694 bytes --]

On Tue, Sep 26, 2017 at 04:05:11PM +0200, Nelio Laranjeiro wrote:
> Compiling a program including verbs.h with ICC fails with the following
> error (seen with DPDK):
>
>  /root/development/rdma-core/build/include/infiniband/verbs.h(84):
>  warning #61: integer operation result is out of range
>    static void *__VERBS_ABI_IS_EXTENDED = ((uint8_t *) NULL) - 1;
>
> Fixes: 6be16586e081 ("Infrastructure to support verbs extensions")
> Cc: yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org
>
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
> Acked-by: Adrien Mazarguil <adrien.mazarguil-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
> ---

Thanks, applied.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] verbs: fix compilation error with ICC
       [not found] ` <1506434711-3828-1-git-send-email-nelio.laranjeiro-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
  2017-09-28 14:02   ` Leon Romanovsky
@ 2017-09-28 16:44   ` Jason Gunthorpe
  2017-10-04 17:11   ` Leon Romanovsky
  2 siblings, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2017-09-28 16:44 UTC (permalink / raw)
  To: Nelio Laranjeiro
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Adrien Mazarguil,
	yishaih-VPRAkNaXOzVWk0Htik3J/w

On Tue, Sep 26, 2017 at 04:05:11PM +0200, Nelio Laranjeiro wrote:

> -static void *__VERBS_ABI_IS_EXTENDED = ((uint8_t *) NULL) - 1;
> +static void *__VERBS_ABI_IS_EXTENDED = (void *)UINTPTR_MAX;

Hurm, this shouldn't be a static in a header file :(

Patch looks OK to me.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] verbs: fix compilation error with ICC
       [not found] ` <1506434711-3828-1-git-send-email-nelio.laranjeiro-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
  2017-09-28 14:02   ` Leon Romanovsky
  2017-09-28 16:44   ` Jason Gunthorpe
@ 2017-10-04 17:11   ` Leon Romanovsky
  2 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2017-10-04 17:11 UTC (permalink / raw)
  To: Nelio Laranjeiro
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Adrien Mazarguil,
	yishaih-VPRAkNaXOzVWk0Htik3J/w, Jason Gunthorpe, Doug Ledford

[-- Attachment #1: Type: text/plain, Size: 1894 bytes --]

On Tue, Sep 26, 2017 at 04:05:11PM +0200, Nelio Laranjeiro wrote:
> Compiling a program including verbs.h with ICC fails with the following
> error (seen with DPDK):
>
>  /root/development/rdma-core/build/include/infiniband/verbs.h(84):
>  warning #61: integer operation result is out of range
>    static void *__VERBS_ABI_IS_EXTENDED = ((uint8_t *) NULL) - 1;
>
> Fixes: 6be16586e081 ("Infrastructure to support verbs extensions")
> Cc: yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org
>
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
> Acked-by: Adrien Mazarguil <adrien.mazarguil-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
> ---
>  libibverbs/verbs.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
> index 8cdf8ab..cc633a1 100644
> --- a/libibverbs/verbs.h
> +++ b/libibverbs/verbs.h
> @@ -42,6 +42,7 @@
>  #include <errno.h>
>  #include <string.h>
>  #include <linux/types.h>
> +#include <stdint.h>
>
>  #ifdef __cplusplus
>  #  define BEGIN_C_DECLS extern "C" {
> @@ -81,7 +82,7 @@ union ibv_gid {
>
>  #define vext_field_avail(type, fld, sz) (offsetof(type, fld) < (sz))
>
> -static void *__VERBS_ABI_IS_EXTENDED = ((uint8_t *) NULL) - 1;
> +static void *__VERBS_ABI_IS_EXTENDED = (void *)UINTPTR_MAX;
>

Nelio,

I applied the patch, but it broke C++ users of the rdma-core.
UINTPTR_MAX is declared in <cstdint> for C++ and not in stdint.h [1].

Please provide fix or we will be required to revert it prior next
release.

Thanks

[1] http://en.cppreference.com/w/cpp/header/cstdint


>  enum ibv_node_type {
>  	IBV_NODE_UNKNOWN	= -1,
> --
> 2.1.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-04 17:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-26 14:05 [PATCH] verbs: fix compilation error with ICC Nelio Laranjeiro
     [not found] ` <1506434711-3828-1-git-send-email-nelio.laranjeiro-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2017-09-28 14:02   ` Leon Romanovsky
2017-09-28 16:44   ` Jason Gunthorpe
2017-10-04 17:11   ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).