| Last change
 on this file since f54e6ec was             0b8c951d, checked in by Peter A. Buhr <pabuhr@…>, 2 years ago | 
        
          | 
more rename directories containers to collections
 | 
        
          | 
              
Property                 mode
 set to                 100644 | 
        
          | File size:
            1.4 KB | 
      
      
| Line |  | 
|---|
| 1 | // A white-box case. | 
|---|
| 2 |  | 
|---|
| 3 | // Array dimension hoisting (gen-init, just before resolver) is the earliest pass that uses a | 
|---|
| 4 | // with-identifiers symbol table, so early that it's premature to have the symbol table report | 
|---|
| 5 | // on name collisions/inconsistencies, and so the symbol table runs in a mode that ignores them. | 
|---|
| 6 |  | 
|---|
| 7 | // This test exercises a dimention-hoisting symbol-table query that retrieves an inconsistently | 
|---|
| 8 | // defined identifier.  This fact can be verified manually in gdb by observing a call to | 
|---|
| 9 | // SymbolTable.cpp's OnFindError (during an addId call with key `collide_me`) that returns | 
|---|
| 10 | // without throwing an exception, followed by a lookupId call with key `collide_me`. | 
|---|
| 11 |  | 
|---|
| 12 | // The (black-box obvious) expected outcome is that cfa-cc rejects the input program on account | 
|---|
| 13 | // of the inconsistent identifier. | 
|---|
| 14 |  | 
|---|
| 15 | // The (white-box) relevance of achieving this outcome is the demonstration that an early ignorred | 
|---|
| 16 | // name collision leaves the compiler in a valid-enough state to reach the later collision | 
|---|
| 17 | // detection, without implementation shotcuts like, "Which, if either, declaration gets | 
|---|
| 18 | // ignorred?" becoming relevant. | 
|---|
| 19 |  | 
|---|
| 20 | // This test is unrelated to _why_ the dimension-hoising pass needs to disable symbol-table | 
|---|
| 21 | // validation; linking/manging/anon is such a case. | 
|---|
| 22 |  | 
|---|
| 23 | extern "C" { | 
|---|
| 24 | const long long unsigned collide_me = 42; | 
|---|
| 25 | const long      unsigned collide_me = 17; | 
|---|
| 26 | } | 
|---|
| 27 |  | 
|---|
| 28 | int main() { | 
|---|
| 29 | float a[collide_me]; | 
|---|
| 30 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.