Skip to content

Commit b185c67

Browse files
committed
C++: Handle overlap with grouped memory locations.
1 parent e7c43b3 commit b185c67

File tree

1 file changed

+39
-1
lines changed
  • cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/internal

1 file changed

+39
-1
lines changed

cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/internal/AliasedSSA.qll

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,43 @@ private Overlap getExtentOverlap(MemoryLocation def, MemoryLocation use) {
642642
)
643643
)
644644
or
645+
exists(GroupedMemoryLocation group |
646+
group = def and
647+
def.getVirtualVariable() = use.getVirtualVariable()
648+
|
649+
(
650+
use instanceof UnknownMemoryLocation or
651+
use instanceof AllAliasedMemory
652+
) and
653+
result instanceof MayPartiallyOverlap
654+
or
655+
group.isAll() and
656+
(
657+
group.getAnAllocation() =
658+
[
659+
use.(EntireAllocationMemoryLocation).getAnAllocation(),
660+
use.(VariableMemoryLocation).getAnAllocation()
661+
]
662+
or
663+
use.(GroupedMemoryLocation).isSome()
664+
) and
665+
result instanceof MustTotallyOverlap
666+
or
667+
group.isAll() and
668+
use.(GroupedMemoryLocation).isAll() and
669+
result instanceof MustExactlyOverlap
670+
or
671+
group.isSome() and
672+
(
673+
use instanceof EntireAllocationMemoryLocation
674+
or
675+
use instanceof VariableMemoryLocation
676+
or
677+
use instanceof GroupedMemoryLocation
678+
) and
679+
result instanceof MayPartiallyOverlap
680+
)
681+
or
645682
exists(VariableMemoryLocation defVariableLocation |
646683
defVariableLocation = def and
647684
(
@@ -651,7 +688,8 @@ private Overlap getExtentOverlap(MemoryLocation def, MemoryLocation use) {
651688
(
652689
use instanceof UnknownMemoryLocation or
653690
use instanceof AllAliasedMemory or
654-
use instanceof EntireAllocationMemoryLocation
691+
use instanceof EntireAllocationMemoryLocation or
692+
use instanceof GroupedMemoryLocation
655693
) and
656694
result instanceof MayPartiallyOverlap
657695
or

0 commit comments

Comments
 (0)