[LLVMbugs] [Bug 12448] New: Tags for variable length array not getting generated in the Assembly file.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 3 06:16:51 PDT 2012


             Bug #: 12448
           Summary: Tags for variable length array not getting generated
                    in the Assembly file.
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: mayurthebond at gmail.com
                CC: jyoti.yalamanchili at gmail.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

// PR debug/42800

// { dg-options "-gdwarf-2 -dA" }

// { dg-final { scan-assembler "DW_AT_upper_bound" } }

f (int i)

  char a[i];
 return a[0];

Compiler options used for compiling: -gdwarf-2 -dA -S

This TC verifies generation of DW_AT_upper_bound for the VLA 'a' in the
resulting assembler .
The assember file does not contain DW_TAG_array_type and DW_TAG_subrange type.

Please confirm if this is due to a missing implementation.This seems to be a
bug. Is there a patch available for this already ?

On further analysis it was found that there is a failure condition for creation
of DwarfDebug::constructVariableDIE for VLA 'a'
which is because DwarfDebug::  DenseMap<LexicalScope *, SmallVector<DbgVariable
*, 8> > ScopeVariables;
is empty and not 1.

On further analysis it was found out that 
the loop in the function collectVariableInfoFromMMITable(MF, Processed) is not
getting executed for the variable array 'a' 
It gets executed for all other variables. the conditions of loop are:
for (MachineModuleInfo::VariableDbgInfoMapTy::iterator VI = VMap.begin(),
         VE = VMap.end(); VI != VE; ++VI)

and the VMap is formed as:         
MachineModuleInfo::VariableDbgInfoMapTy &VMap = MMI->getVariableDbgInfo();

Note : 
DW_AT_array-type and DW_subrange type are generated when there are more than
one VLAs. These tags get generated for all VLAs except one 


Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list