CarlosAlbertoEnciso added a comment.

Hi @sdesmalen!

First of all my apologies for commenting after the issue has been closed, but I 
do not have an account to add a comment to the associated bugzilla.

I have found what it seems to be an issue with the current implementation.

For the given test case

  int main() {
    int size = 2;
  
    int vla_expr[size];
    vla_expr[1] = 1;
  
    return 0;
  }

and while debugging with LLDB, the following error is generated:

  (lldb) n
  Process 21014 stopped
  * thread #1, name = 'bad.out', stop reason = step over
      frame #0: 0x0000000000400502 bad.out`main at vla_2.cpp:7
     4            int vla_expr[size];
     5            vla_expr[1] = 1;
     6          
  -> 7            return 0;
     8          }
  
  (lldb) p vla_expr
  (unsigned long) $0 = 2
  
  (lldb) p vla_expr[1]
  error: subscripted value is not an array, pointer, or vector
  
  (lldb) 

Looking at the DWARF generated, there are 2 variables with the same name at the 
same scope

  DW_TAG_subprogram "main"
    ...
    DW_TAG_variable "size"
    DW_TAG_variable "vla_expr"
    DW_TAG_variable "vla_expr"

I think there are 2 issues:

The compiler generated variable 'vla_expr'

- should be flagged as artificial (DW_AT_artificial)
- its name should start with double underscore to avoid conflicting with 
user-defined names.

Thanks,
Carlos


Repository:
  rL LLVM

https://reviews.llvm.org/D41698



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to