C++: Add testcase that demonstrates a FP caused by spurious flow through phi nodes in IR dataflow.

This commit is contained in:
Mathias Vorreiter Pedersen
2022-01-14 13:34:27 +00:00
parent 5031d6c4a3
commit e8afec413a
2 changed files with 16 additions and 1 deletions

View File

@@ -570,6 +570,9 @@ postWithInFlow
| test.cpp:481:24:481:30 | FieldAddress [post update] | PostUpdateNode should not be the target of local flow. |
| test.cpp:481:24:481:30 | content [post update] | PostUpdateNode should not be the target of local flow. |
| test.cpp:482:8:482:16 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. |
| test.cpp:489:7:489:7 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. |
| test.cpp:491:5:491:5 | x [post update] | PostUpdateNode should not be the target of local flow. |
| test.cpp:494:5:494:5 | x [post update] | PostUpdateNode should not be the target of local flow. |
| true_upon_entry.cpp:9:7:9:7 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. |
| true_upon_entry.cpp:10:12:10:12 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. |
| true_upon_entry.cpp:10:27:10:27 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. |

View File

@@ -481,4 +481,16 @@ void local_field_flow_def_by_ref_steps_with_local_flow(MyStruct * s) {
writes_to_content(s->content);
int* p_content = s->content;
sink(*p_content);
}
}
bool unknown();
void regression_with_phi_flow(int clean1) {
int x = 0;
while (unknown()) {
x = clean1;
if (unknown()) { }
sink(x); // $ SPURIOUS: ir
x = source();
}
}