Last change
on this file since 502a107 was
f02f546,
checked in by Michael Brooks <mlbrooks@…>, 17 months ago
|
Implement new rules for array dimension expression matching.
Core changes:
src/ResolvExpr/Unify.cc: add sense of "these two expressions unify"
src/InitTweak/GenInit.cc: make hoisting happen more often
tests/array-container/*: reconfigure the array-dimension test to use non-"classic" expectation rules
Misc contributors and noise:
libcfa/src/parseargs.cfa: ,ake a parameter, that's used as a length expression, constant (example of an array user following new rules)
src/ResolvExpr/ResolveTypeof.h: make fixArrayType public
src/Validate/GenericParameter.cpp: do the array-type desugaring in both AST corners that forall-variables can be found (not just in one of them)
tests/.expect/typedefRedef-ERR1.txt: old one was "expecting" a bug, that new array rules handle correctly
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Rev | Line | |
---|
[f02f546] | 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.