File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -2117,8 +2117,8 @@ bool DiagTypeid(InterpState &S, CodePtr OpPC) {
21172117
21182118bool arePotentiallyOverlappingStringLiterals (const Pointer &LHS,
21192119 const Pointer &RHS) {
2120- unsigned LHSOffset = LHS.getIndex ();
2121- unsigned RHSOffset = RHS.getIndex ();
2120+ unsigned LHSOffset = LHS.isOnePastEnd () ? LHS. getNumElems () : LHS. getIndex ();
2121+ unsigned RHSOffset = RHS.isOnePastEnd () ? RHS. getNumElems () : RHS. getIndex ();
21222122 unsigned LHSLength = (LHS.getNumElems () - 1 ) * LHS.elemSize ();
21232123 unsigned RHSLength = (RHS.getNumElems () - 1 ) * RHS.elemSize ();
21242124
Original file line number Diff line number Diff line change @@ -287,6 +287,8 @@ namespace OverlappingStrings {
287287 constexpr bool may_overlap_4 = &" xfoo" [1 ] == &" xfoo" [1 ]; // both-error {{}} both-note {{addresses of potentially overlapping literals}}
288288
289289
290+ // / Used to crash.
291+ const bool x = &" ab" [0 ] == &" ba" [3 ];
290292
291293}
292294
You can’t perform that action at this time.
0 commit comments