Skip to content

Commit f8571dd

Browse files
committed
Data flow: Work around functionality-induced misoptimization
1 parent 6eda042 commit f8571dd

39 files changed

+195
-39
lines changed

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,11 @@ private predicate parameterFlowThroughAllowed(ParamNodeEx p, ReturnKindExt kind)
622622
}
623623

624624
private module Stage1 implements StageSig {
625-
class Ap = Unit;
625+
class Ap extends int {
626+
// workaround for bad functionality-induced joins (happens when using `Unit`)
627+
pragma[nomagic]
628+
Ap() { this in [0 .. 1] and this < 1 }
629+
}
626630

627631
private class Cc = boolean;
628632

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,11 @@ private predicate parameterFlowThroughAllowed(ParamNodeEx p, ReturnKindExt kind)
622622
}
623623

624624
private module Stage1 implements StageSig {
625-
class Ap = Unit;
625+
class Ap extends int {
626+
// workaround for bad functionality-induced joins (happens when using `Unit`)
627+
pragma[nomagic]
628+
Ap() { this in [0 .. 1] and this < 1 }
629+
}
626630

627631
private class Cc = boolean;
628632

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,11 @@ private predicate parameterFlowThroughAllowed(ParamNodeEx p, ReturnKindExt kind)
622622
}
623623

624624
private module Stage1 implements StageSig {
625-
class Ap = Unit;
625+
class Ap extends int {
626+
// workaround for bad functionality-induced joins (happens when using `Unit`)
627+
pragma[nomagic]
628+
Ap() { this in [0 .. 1] and this < 1 }
629+
}
626630

627631
private class Cc = boolean;
628632

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,11 @@ private predicate parameterFlowThroughAllowed(ParamNodeEx p, ReturnKindExt kind)
622622
}
623623

624624
private module Stage1 implements StageSig {
625-
class Ap = Unit;
625+
class Ap extends int {
626+
// workaround for bad functionality-induced joins (happens when using `Unit`)
627+
pragma[nomagic]
628+
Ap() { this in [0 .. 1] and this < 1 }
629+
}
626630

627631
private class Cc = boolean;
628632

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,11 @@ private predicate parameterFlowThroughAllowed(ParamNodeEx p, ReturnKindExt kind)
622622
}
623623

624624
private module Stage1 implements StageSig {
625-
class Ap = Unit;
625+
class Ap extends int {
626+
// workaround for bad functionality-induced joins (happens when using `Unit`)
627+
pragma[nomagic]
628+
Ap() { this in [0 .. 1] and this < 1 }
629+
}
626630

627631
private class Cc = boolean;
628632

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,11 @@ private predicate parameterFlowThroughAllowed(ParamNodeEx p, ReturnKindExt kind)
622622
}
623623

624624
private module Stage1 implements StageSig {
625-
class Ap = Unit;
625+
class Ap extends int {
626+
// workaround for bad functionality-induced joins (happens when using `Unit`)
627+
pragma[nomagic]
628+
Ap() { this in [0 .. 1] and this < 1 }
629+
}
626630

627631
private class Cc = boolean;
628632

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,11 @@ private predicate parameterFlowThroughAllowed(ParamNodeEx p, ReturnKindExt kind)
622622
}
623623

624624
private module Stage1 implements StageSig {
625-
class Ap = Unit;
625+
class Ap extends int {
626+
// workaround for bad functionality-induced joins (happens when using `Unit`)
627+
pragma[nomagic]
628+
Ap() { this in [0 .. 1] and this < 1 }
629+
}
626630

627631
private class Cc = boolean;
628632

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,11 @@ private predicate parameterFlowThroughAllowed(ParamNodeEx p, ReturnKindExt kind)
622622
}
623623

624624
private module Stage1 implements StageSig {
625-
class Ap = Unit;
625+
class Ap extends int {
626+
// workaround for bad functionality-induced joins (happens when using `Unit`)
627+
pragma[nomagic]
628+
Ap() { this in [0 .. 1] and this < 1 }
629+
}
626630

627631
private class Cc = boolean;
628632

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplLocal.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,11 @@ private predicate parameterFlowThroughAllowed(ParamNodeEx p, ReturnKindExt kind)
622622
}
623623

624624
private module Stage1 implements StageSig {
625-
class Ap = Unit;
625+
class Ap extends int {
626+
// workaround for bad functionality-induced joins (happens when using `Unit`)
627+
pragma[nomagic]
628+
Ap() { this in [0 .. 1] and this < 1 }
629+
}
626630

627631
private class Cc = boolean;
628632

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,11 @@ private predicate parameterFlowThroughAllowed(ParamNodeEx p, ReturnKindExt kind)
622622
}
623623

624624
private module Stage1 implements StageSig {
625-
class Ap = Unit;
625+
class Ap extends int {
626+
// workaround for bad functionality-induced joins (happens when using `Unit`)
627+
pragma[nomagic]
628+
Ap() { this in [0 .. 1] and this < 1 }
629+
}
626630

627631
private class Cc = boolean;
628632

0 commit comments

Comments
 (0)