search for: __builtin_offsetof

Displaying 19 results from an estimated 19 matches for "__builtin_offsetof".

2014 May 12
2
[LLVMdev] Build failure with libcxx
...ii working.ii and the difference explains the > problem: > > @@ -36617,7 +36628,7 @@ > } x; > }; > return Allocator.Allocate( > - Size, std::min((size_t)llvm::NextPowerOf2(Size), offsetof(S, x))); > + Size, std::min((size_t)llvm::NextPowerOf2(Size), > __builtin_offsetof(S, x))); > } > > > Looks like non-working clang is using offsetof where-as the working one > uses __builtin_offsetof > > > > On Fri, May 9, 2014 at 11:38 AM, İsmail Dönmez <ismail at donmez.ws> wrote: > >> Hi, >> >> Recently my libcxx enabled l...
2015 Jan 03
2
[LLVMdev] Evaluation of offsetof() macro
> >> So it handles all const expression evaluation in the front-end? >> >> > Yes, clang has it's own constant expression evaluator which understands > the rules of C++. > > Let's take an example. > The expression (long)&x/(long)&y divides two globals by each other. This > expression is lowered to the following LLVM IR Constant: > i64 sdiv
2020 Jul 16
0
[PATCH vhost next 08/10] vdpa/mlx5: Add support library for mlx5 VDPA implementation
...2, from include/linux/mlx5/driver.h:36, from drivers/vdpa/mlx5/core/resources.c:4: >> include/linux/compiler_types.h:135:35: error: invalid use of undefined type 'struct mlx5_ifc_create_uctx_out_bits' 135 | #define __compiler_offsetof(a, b) __builtin_offsetof(a, b) | ^~~~~~~~~~~~~~~~~~ include/uapi/linux/byteorder/big_endian.h:40:51: note: in definition of macro '__be32_to_cpu' 40 | #define __be32_to_cpu(x) ((__force __u32)(__be32)(x)) |...
2014 May 09
2
[LLVMdev] Build failure with libcxx
Hi, Recently my libcxx enabled llvm/clang builds has started to fail in stage2. I must admit I am stomped because I cannot make sense of the error: [ 723s] FAILED: /home/abuild/rpmbuild/BUILD/llvm/stage1/bin/clang++ -DLLVMSupport_EXPORTS -DNDEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -stdlib=libc++ -fPIC -fvisibility-inlines-hidden -Wall -W
2020 Aug 05
0
[PATCH V4 linux-next 00/12] VDPA support for Mellanox ConnectX devices
...from drivers/vdpa/mlx5/net/main.c:4: drivers/vdpa/mlx5/net/main.c: In function ?required_caps_supported?: ././include/linux/compiler_types.h:129:35: error: ?struct mlx5_ifc_device_virtio_emulation_cap_bits? has no member named ?event_mode? 129 | #define __compiler_offsetof(a, b) __builtin_offsetof(a, b) | ^~~~~~~~~~~~~~~~~~ ./include/uapi/linux/swab.h:115:54: note: in definition of macro ?__swab32? 115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x)) | ^ ./include/linux/byteorder/ge...
2020 Aug 05
0
[PATCH V4 linux-next 00/12] VDPA support for Mellanox ConnectX devices
.../vdpa/mlx5/net/main.c:4: > > drivers/vdpa/mlx5/net/main.c: In function ?required_caps_supported?: > > ././include/linux/compiler_types.h:129:35: error: ?struct mlx5_ifc_device_virtio_emulation_cap_bits? has no member named ?event_mode? > > 129 | #define __compiler_offsetof(a, b) __builtin_offsetof(a, b) > > | ^~~~~~~~~~~~~~~~~~ > > ./include/uapi/linux/swab.h:115:54: note: in definition of macro ?__swab32? > > 115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x)) > > |...
2020 Jul 16
0
[PATCH vhost next 10/10] vdpa/mlx5: Add VDPA driver for supported mlx5 devices
...acro 'MLX5_SET' 1192 | MLX5_SET(rqtc, rqtc, list_q_type, MLX5_RQTC_LIST_Q_TYPE_VIRTIO_NET_Q); | ^~~~~~~~ include/linux/compiler_types.h:135:35: error: 'struct mlx5_ifc_rqtc_bits' has no member named 'list_q_type' 135 | #define __compiler_offsetof(a, b) __builtin_offsetof(a, b) | ^~~~~~~~~~~~~~~~~~ include/uapi/linux/swab.h:115:54: note: in definition of macro '__swab32' 115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x)) | ^ include...
2020 Jul 16
0
[PATCH vhost next 09/10] vdpa/mlx5: Add shared memory registration code
...expansion of macro 'MLX5_SET' 194 | MLX5_SET(create_mkey_in, in, uid, mvdev->res.uid); | ^~~~~~~~ include/linux/compiler_types.h:135:35: error: 'struct mlx5_ifc_create_mkey_in_bits' has no member named 'uid' 135 | #define __compiler_offsetof(a, b) __builtin_offsetof(a, b) | ^~~~~~~~~~~~~~~~~~ include/uapi/linux/swab.h:115:54: note: in definition of macro '__swab32' 115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x)) | ^ include...
2007 Nov 13
0
[LLVMdev] BasicAliasAnalysis and out-of-bound GEP indices
...hcd *) (hcd->hcd_priv); > } > > static inline __attribute__((always_inline)) struct usb_hcd > *ehci_to_hcd (struct ehci_hcd *ehci) > { > return ({ const typeof( ((struct usb_hcd *)0)->hcd_priv ) *__mptr = > ((void *) ehci); (struct usb_hcd *)( (char *)__mptr - > __builtin_offsetof(struct usb_hcd,hcd_priv) );}); > } > > struct device *x; > > static int ehci_pci_setup(struct usb_hcd *hcd) > { > struct ehci_hcd *ehci = hcd_to_ehci(hcd); > // [...] > // store of expression added in order to prevent it from being DCE'ed > x = ehci_to_hcd(ehci...
2007 Nov 13
2
[LLVMdev] BasicAliasAnalysis and out-of-bound GEP indices
Hi! While investigating into the PR1782 I spent some time analyzing BasicAliasAnalysis.cpp. While the mentioned problem should be fixed now (I hope), I have discovered some other possibilities for a bug to occur. In the case of checking for aliasing of two pointer values, where at least one of them is a GEP instruction with out-of-bound indices, BasicAliasAnalysis can return NoAlias, even if the
2007 Nov 15
0
[LLVMdev] BasicAliasAnalysis and out-of-bound GEP indices
...; structure pointed by %hcd is of type %struct.ehci_hcd %tmp9 = getelementptr %struct.usb_hcd* %hcd, i32 0, i32 1 %tmp910 = bitcast [0 x i32]* %tmp9 to %struct.ehci_hcd* ; later in the source, a pointer to the parent struct is obtained ; from %tmp910 using inner field's offset knowledge ; (__builtin_offsetof operator in the C source) %tmp1415 = bitcast %struct.ehci_hcd* %tmp910 to [0 x i32]* %tmp1617 = bitcast [0 x i32]* %tmp1415 to i8* %tmp18 = getelementptr i8* %tmp1617, i32 -4 %tmp1819 = bitcast i8* %tmp18 to %struct.usb_hcd* -= after instcombine =- %tmp18 = getelementptr %struct.usb_hcd* %hcd, i32...
2007 Nov 15
3
[LLVMdev] BasicAliasAnalysis and out-of-bound GEP indices
On 11/15/07, Duncan Sands <baldrick at free.fr> wrote: > Hi, > > > Sadly, this will break a very common idiom. In GCC, we discovered it > > to be common enough that it broke a *bunch* of C code. > > > > In particular, you will break > > > > struct foo { > > int a; > > char name[0]; > > } > > > > bar = malloc(sizeof
2018 Apr 22
0
[cfe-dev] RFC: Implementing -fno-delete-null-pointer-checks in clang
...LVM assumed that a reachable load or a store of an pointer guaranteed that it was not NULL, but that a GEP did not. I believe that the correct fix is to explicitly permit GEPs with a NULL base in the LLVM IR spec. As I understand it, this is already implicitly permitted because code that predates __builtin_offsetof uses a cast of 0 to a struct type and takes the address of a field to get the offset. Any code that is loading or storing from null prior to a null check probably doesn’t mind if the null check is then elided, because it’s going to trap anyway (supporting C code that allows loads and stores from a...
2018 Apr 21
2
[cfe-dev] RFC: Implementing -fno-delete-null-pointer-checks in clang
> On Apr 20, 2018, at 2:06 AM, Csaba Raduly via cfe-dev <cfe-dev at lists.llvm.org> wrote: > > On 4/20/18, James Y Knight wrote: >> >> >> Yep. "-fnull-pointer-is-valid" has been suggested before. >> > > -fplacate-linux-kernel-developers ? Please, lets keep this discussion on topic and productive. The semantics described upstream of (the
2007 Nov 15
2
[LLVMdev] BasicAliasAnalysis and out-of-bound GEP indices
...t; } > > > > static inline __attribute__((always_inline)) struct usb_hcd > > *ehci_to_hcd (struct ehci_hcd *ehci) > > { > > return ({ const typeof( ((struct usb_hcd *)0)->hcd_priv ) *__mptr = > > ((void *) ehci); (struct usb_hcd *)( (char *)__mptr - > > __builtin_offsetof(struct usb_hcd,hcd_priv) );}); > > } > > > > struct device *x; > > > > static int ehci_pci_setup(struct usb_hcd *hcd) > > { > > struct ehci_hcd *ehci = hcd_to_ehci(hcd); > > // [...] > > // store of expression added in order to prevent it fro...
2013 May 29
3
[PATCH RFC] virtio-pci: new config layout: using memory BAR
Paolo Bonzini <pbonzini at redhat.com> writes: > Il 28/05/2013 19:32, Michael S. Tsirkin ha scritto: >>>> > > + >>>> > > + switch (addr) { >>>> > > + case offsetof(struct virtio_pci_common_cfg, device_feature_select): >>>> > > + return proxy->device_feature_select; >>> > >>> >
2017 Feb 02
2
AOSP buildbot fails with assert in :ScheduleDAGRRList::PickNodeToScheduleBottomUp
...tector-strong -Wa,--noexecstack -Werror=format-security -D_FORTIFY_SOURCE=2 -fno-short-enums -no-canonical-prefixes -DNDEBUG -g -Wstrict-aliasing=2 -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith -DNDEBUG -UDEBUG -fdebug-prefix-map=/proc/self/cwd= -D__compiler_offsetof=__builtin_offsetof -Werror=int-conversion -Wno-reserved-id-macro -Wno-format-pedantic -Wno-unused-command-line-argument -fcolor-diagnostics -Wno-expansion-to-defined -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Werror=date-time -nostdlibinc -msoft-float -mfloat-abi=softfp -mfpu...
2020 Jul 16
0
[PATCH vhost next 09/10] vdpa/mlx5: Add shared memory registration code
...expansion of macro 'MLX5_SET' 194 | MLX5_SET(create_mkey_in, in, uid, mvdev->res.uid); | ^~~~~~~~ include/linux/compiler_types.h:135:35: error: 'struct mlx5_ifc_create_mkey_in_bits' has no member named 'uid' 135 | #define __compiler_offsetof(a, b) __builtin_offsetof(a, b) | ^~~~~~~~~~~~~~~~~~ include/uapi/linux/swab.h:120:12: note: in definition of macro '__swab32' 120 | __fswab32(x)) | ^ include/linux/byteorder/generic.h:94:21: note: in expansion of macro '__cpu_to_be32'...
2013 Oct 26
2
[PATCH] 1. changes for vdiskadm on illumos based platform
...zfs/zfs-include/vdev_impl.h Thu Oct 24 22:46:20 2013 +0100 +++ b/tools/libfsimage/zfs/zfs-include/vdev_impl.h Sat Oct 26 20:03:06 2013 +0400 @@ -24,12 +24,30 @@ #ifndef _SYS_VDEV_IMPL_H #define _SYS_VDEV_IMPL_H +/* helper macros */ +#undef offsetof +#if defined(__GNUC__) +#define offsetof(s, m) __builtin_offsetof(s, m) +#else +#define offsetof(s, m) ((size_t)(&(((s *)0)->m))) +#endif +#define MAX(x, y) ((x) > (y) ? (x) : (y)) + #define VDEV_PAD_SIZE (8 << 10) /* 2 padding areas (vl_pad1 and vl_pad2) to skip */ #define VDEV_SKIP_SIZE VDEV_PAD_SIZE * 2 #define VDEV_PHYS_SIZE (112 <...