http://llvm.org/bugs/show_bug.cgi?id=19463

            Bug ID: 19463
           Summary: VLAIS - false positive
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Compiling the kernel fails with 

  CC      arch/x86/xen/mmu.o
/home/dl9pf/llvmlinux/targets/x86_64/src/linux/arch/x86/xen/mmu.c:1347:18:
error: fields must have a constant size: 'variable length array in structure'
      extension will never be supported
                DECLARE_BITMAP(mask, num_processors);
                               ^
/home/dl9pf/llvmlinux/targets/x86_64/src/linux/include/linux/types.h:10:16:
note: expanded from macro 'DECLARE_BITMAP'
        unsigned long name[BITS_TO_LONGS(bits)]
                      ^
1 error generated.


include/linux/types.h:
######################

#define DECLARE_BITMAP(name,bits) \
        unsigned long name[BITS_TO_LONGS(bits)]

include/linux/bitops.h:
#######################
#define BITS_TO_LONGS(nr)       DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))

include/linux/kernel.h:
#######################
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))

So DECLARE_BITMAP(mask, num_processors)  should actually expand to a fixed -
but indeed platform-specific - size.

from mmu.i:
###########

static void xen_flush_tlb_others(const struct cpumask *cpus,
     struct mm_struct *mm, unsigned long start,
     unsigned long end)
{
 struct {
  struct mmuext_op op;

  unsigned long mask[(((num_processors) + (8 * sizeof(long)) - 1) / (8 *
sizeof(long)))];



 } *args;
 struct multicall_space mcs;



I totally agree this looks and smells like VLAIS, but is it? 
Can we deal with this in llvm/clang ?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to