Actions
Bug #7673
closedWrong transformation with type conversion
Start date:
11/02/2016
Due date:
% Done:
0%
Estimated time:
Detected in build:
svn
Platform:
Linux x64
Published in build:
Description
CIF transforms
u8 *dst; *(u16 *)(dst + 4)
to *((u16 *)dst + 4U)
with different meaning: first has offset 32 from dst, second has offset 64 from dst.Source code is attached.
It seem that the same problem occurs with:
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
#define to_usb_device(d) container_of(d, struct usb_device, dev)
static inline struct usb_device *interface_to_usbdev(struct usb_interface *intf)
{
return to_usb_device(intf->dev.parent);
}
CIF omits conversion (char *)__mptr
__inline static struct usb_device *interface_to_usbdev(struct usb_interface *intf )
{
struct device const *__mptr ;
{
__mptr = (struct device const *)intf->dev.parent;
return ((struct usb_device *)__mptr + 0xffffffffffffff70UL);
}
}
Files
Updated by Evgeny Novikov over 7 years ago
I fixed the first part of the given issue in 841586c several months ago. The second part looks to be unrelated and more complicated.
Updated by Anton Vasilyev about 7 years ago
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
#define to_usb_device(d) container_of(d, struct usb_device, dev)
static inline struct usb_device *interface_to_usbdev(struct usb_interface *intf)
{
return to_usb_device(intf->dev.parent);
}
Should be:
__inline static struct usb_device *interface_to_usbdev(struct usb_interface *intf )
{
struct device const *__mptr ;
{
__mptr = (struct device const *)intf->dev.parent;
return ((struct usb_device *)( (char *)__mptr + 0xffffffffffffff70UL) );
}
}
but CIF produce:
__inline static struct usb_device *interface_to_usbdev(struct usb_interface *intf )
{
struct device const *__mptr ;
{
__mptr = (struct device const *)intf->dev.parent;
return ((struct usb_device *)__mptr + 0xffffffffffffff70UL);
}
}
Updated by Evgeny Novikov about 7 years ago
- Status changed from New to Closed
I fixed this issue at last in 54e8a248.
Updated by Evgeny Novikov almost 4 years ago
I fixed this issue one more time in e5f3be7 since my previous fix was broken when merging with the GCC master branch.
Actions