* [For help] rdma-roce build quesiton
@ 2016-10-26 7:23 oulijun
[not found] ` <581059FA.6070507-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: oulijun @ 2016-10-26 7:23 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: Linuxarm, linux-rdma
Hi, Jason
I am building my userspace library code using cmake.
after i fix some lines, it is failed.
I directly called the min() from the ccan/minmax.h, the min()
as follows:
#if HAVE_BUILTIN_TYPES_COMPATIBLE_P
#define MINMAX_ASSERT_COMPATIBLE(a, b) \
BUILD_ASSERT(__builtin_types_compatible_p(a, b))
#else
#define MINMAX_ASSERT_COMPATIBLE(a, b) \
do { } while (0)
#endif
#define min(a, b) \
({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
MINMAX_ASSERT_COMPATIBLE(typeof(_a), typeof(_b)); \
_a < _b ? _a : _b; \
})
and use #include <ccan/minmax.h> in my .c file where is used the min()
according to the modification, I use the cmd as follows:
CC=aarch64-linux-gnu-gcc cmake -GNinja -DENABLE_RESOLVE_NEIGH=0 -DHAVE_ARCH_ARM64=1 ..
the build is fail and the print log as follows:
error: size of unnamed array is negative
attr->cap.max_recv_wr = min(context->max_qp_wr, attr->cap.max_recv_wr);
Now, after fixed, the error is elimed. the fix as follows:
Fix the HAVE_BUILTIN_TYPES_COMPATIBLE_P for 0 in config.h.in or use the origin definition in my .h file
the origin defintion:
#define min(a, b) \
({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
_a < _b ? _a : _b; \
})
but I think that the above modification is not a better approach
I try to change the Optimization Option(from -O0 to -O2) in aarch64-linux-gnu-gcc by finded some material.
CC=aarch64-linux-gnu-gcc cmake -O2 -GNinja -DENABLE_RESOLVE_NEIGH=0 -DHAVE_ARCH_ARM64=1 ..
But the error is not elimed.
Can you give me some guide?
thanks
Lijun ou
--
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] 3+ messages in thread[parent not found: <581059FA.6070507-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>]
* Re: [For help] rdma-roce build quesiton [not found] ` <581059FA.6070507-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> @ 2016-10-26 16:09 ` Jason Gunthorpe [not found] ` <20161026160902.GD24898-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Jason Gunthorpe @ 2016-10-26 16:09 UTC (permalink / raw) To: oulijun; +Cc: Linuxarm, linux-rdma On Wed, Oct 26, 2016 at 03:23:38PM +0800, oulijun wrote: > the build is fail and the print log as follows: > > error: size of unnamed array is negative > attr->cap.max_recv_wr = min(context->max_qp_wr, attr->cap.max_recv_wr); It is telling you the types are not the same, and this is a source of bugs as C has some counter intuitive rules regarding type promotion. 1) Audit max_qp_wr and max_recv_wr to see if they really should be different types, if not fix context->max_qp_wr to match 2) If they are legitimately different then use min_t(<desired type>, context->max_qp_wr, attr->cap.max_recv_wr); Think carefully about what common type is used because both arguments will be casted, and the goal is to avoid a loss of precision or signdedness in the cast. 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] 3+ messages in thread
[parent not found: <20161026160902.GD24898-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>]
* Re: [For help] rdma-roce build quesiton [not found] ` <20161026160902.GD24898-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> @ 2016-10-27 2:15 ` oulijun 0 siblings, 0 replies; 3+ messages in thread From: oulijun @ 2016-10-27 2:15 UTC (permalink / raw) To: Jason Gunthorpe; +Cc: Linuxarm, linux-rdma 在 2016/10/27 0:09, Jason Gunthorpe 写道: > On Wed, Oct 26, 2016 at 03:23:38PM +0800, oulijun wrote: > >> the build is fail and the print log as follows: >> >> error: size of unnamed array is negative >> attr->cap.max_recv_wr = min(context->max_qp_wr, attr->cap.max_recv_wr); > > It is telling you the types are not the same, and this is a source of bugs > as C has some counter intuitive rules regarding type promotion. > > 1) Audit max_qp_wr and max_recv_wr to see if they really should be > different types, if not fix context->max_qp_wr to match > > 2) If they are legitimately different then use > > min_t(<desired type>, context->max_qp_wr, attr->cap.max_recv_wr); > > Think carefully about what common type is used because both arguments > will be casted, and the goal is to avoid a loss of precision or > signdedness in the cast. > > Jason > > . > thanks, I see it. -- 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] 3+ messages in thread
end of thread, other threads:[~2016-10-27 2:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-26 7:23 [For help] rdma-roce build quesiton oulijun
[not found] ` <581059FA.6070507-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2016-10-26 16:09 ` Jason Gunthorpe
[not found] ` <20161026160902.GD24898-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-10-27 2:15 ` oulijun
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.