Project

General

Profile

Actions

Bug #5282

open

Incompatible types when assigning to type ‘struct <anonymous>’ from type ‘struct <anonymous>’

Added by Vadim Mutilin about 10 years ago. Updated almost 9 years ago.

Status:
Open
Priority:
High
Category:
C back-end
Start date:
09/19/2014
Due date:
% Done:

0%

Estimated time:
Detected in build:
svn
Platform:
Published in build:

Description

For the driver
linux-3.17-rc1.tar.xz 32_7a drivers/scsi/lpfc/lpfc.ko

CIF generates code (function lpfc_get_hba_model_desc):

  switch (( int ) dev_id)
  {
# 2067 "drivers/scsi/lpfc/lpfc_init.o.c.prepared" 
    case 6885:;
    m = ( struct
    {
# 2040 "drivers/scsi/lpfc/lpfc_init.o.c.prepared" 
      char *name;
      char *bus;
      char *function;
    } ) { . name =
# 2068 "drivers/scsi/lpfc/lpfc_init.o.c.prepared" 
    ( char *) "LP6000" , . bus = ( char *) "PCI" , . function =
# 2069 "drivers/scsi/lpfc/lpfc_init.o.c.prepared" 
    ( char *) "Obsolete, Unsupported Fibre Channel Adapter" };

GCC fails to compile it

drivers/scsi/lpfc/lpfc_init.o.c.prepared: In function ‘lpfc_get_hba_model_desc’:
drivers/scsi/lpfc/lpfc_init.o.c.prepared:2068:7: error: incompatible types when assigning to type ‘struct <anonymous>’ from type ‘struct <anonymous>’

Original code

         switch (dev_id) {
         case PCI_DEVICE_ID_FIREFLY:
                 m = (typeof(m)){"LP6000", "PCI",
                                 "Obsolete, Unsupported Fibre Channel Adapter"};

Actions #1

Updated by Evgeny Novikov about 10 years ago

  • Status changed from New to Open
  • Assignee set to Evgeny Novikov

Looks nice. "m" is a local variable defined as follows:

struct {
        char *name;
        char *bus;
        char *function;
} m = {"<Unknown>", "", ""};

BTW, use "code" tags to enable syntax highlighting.

Actions #2

Updated by Evgeny Novikov almost 9 years ago

  • Category set to C back-end
  • Priority changed from Normal to High
Actions

Also available in: Atom PDF