https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70646

--- Comment #4 from Denis Vlasenko <vda.linux at googlemail dot com> ---
Shorter reproducer:

typedef __signed__ char __s8;
typedef unsigned char __u8;
typedef __signed__ short __s16;
typedef unsigned short __u16;
typedef __signed__ int __s32;
typedef unsigned int __u32;
__extension__ typedef __signed__ long long __s64;
__extension__ typedef unsigned long long __u64;
typedef signed char s8;
typedef unsigned char u8;
typedef signed short s16;
typedef unsigned short u16;
typedef signed int s32;
typedef unsigned int u32;
typedef signed long long s64;
typedef unsigned long long u64;
typedef __u64 __be64;
static inline __attribute__((no_instrument_function))
__attribute__((__const__)) __u64 __fswab64(__u64 val)
{
 return __builtin_bswap64(val);
}
static inline __attribute__((no_instrument_function))
__attribute__((always_inline)) __u64 __swab64p(const __u64 *p)
{
 return (__builtin_constant_p((__u64)(*p)) ? ((__u64)( (((__u64)(*p) &
(__u64)0x00000000000000ffULL) << 56) | (((__u64)(*p) &
(__u64)0x000000000000ff00ULL) << 40) | (((__u64)(*p) &
(__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(*p) &
(__u64)0x00000000ff000000ULL) << 8) | (((__u64)(*p) &
(__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(*p) &
(__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(*p) &
(__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(*p) &
(__u64)0xff00000000000000ULL) >> 56))) : __fswab64(*p));
}
static inline __attribute__((no_instrument_function))
__attribute__((always_inline)) __u64 __be64_to_cpup(const __be64 *p)
{
 return __swab64p((__u64 *)p);
}
static inline __attribute__((no_instrument_function))
__attribute__((always_inline)) u64 get_unaligned_be64(const void *p)
{
 return __be64_to_cpup((__be64 *)p);
}
static inline __attribute__((no_instrument_function)) u64 wwn_to_u64(u8 *wwn)
{
 return get_unaligned_be64(wwn);
}

struct Scsi_Host {
 unsigned long base;
 unsigned long io_port;
 unsigned char n_io_port;
 unsigned char dma_channel;
 unsigned int irq;
 void *shost_data;
 unsigned long hostdata[0]
  __attribute__ ((aligned (sizeof(unsigned long))));
};
static inline __attribute__((no_instrument_function)) void *shost_priv(struct
Scsi_Host *shost)
{
 return (void *)shost->hostdata;
}
typedef struct scsi_qla_host {
 u8 fabric_node_name[8];
 u32 device_flags;
} scsi_qla_host_t;
struct fc_host_attrs {
 u64 node_name;
 u64 port_name;
 u64 permanent_port_name;
 u32 supported_classes;
 u8 supported_fc4s[32];
 u32 supported_speeds;
 u32 maxframe_size;
 u16 max_npiv_vports;
 char serial_number[80];
 char manufacturer[80];
 char model[256];
 char model_description[256];
 char hardware_version[64];
 char driver_version[64];
 char firmware_version[64];
 char optionrom_version[64];
 u32 port_id;
 u8 active_fc4s[32];
 u32 speed;
 u64 fabric_name;
};

static void
qla2x00_get_host_fabric_name(struct Scsi_Host *shost)
{
 scsi_qla_host_t *vha = shost_priv(shost);
 u8 node_name[8] = { 0xFF, 0xFF, 0xFF, 0xFF,
  0xFF, 0xFF, 0xFF, 0xFF};
 u64 fabric_name = wwn_to_u64(node_name);

 if (vha->device_flags & 0x1)
  fabric_name = wwn_to_u64(vha->fabric_node_name);

 (((struct fc_host_attrs *)(shost)->shost_data)->fabric_name) = fabric_name;
}

void *get_host_fabric_name = qla2x00_get_host_fabric_name;

Reply via email to