1; RUN: not --crash opt %loadPolly -polly-import-jscop -analyze 2>&1 < %s | FileCheck %s
2;
3; Check that we do not allow to access elements not accessed before because the
4; alignment information would become invalid.
5;
6; CHECK: JScop file changes the accessed memory
7;
8;    void bad_alignment(int *A) {
9;      for (int i = 0; i < 1024; i += 2)
10;        A[i] = i;
11;    }
12;
13target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
14
15define void @bad_alignment(i32* %A) {
16entry:
17  br label %for.cond
18
19for.cond:                                         ; preds = %for.inc, %entry
20  %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
21  %cmp = icmp slt i64 %indvars.iv, 1024
22  br i1 %cmp, label %for.body, label %for.end
23
24for.body:                                         ; preds = %for.cond
25  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
26  %tmp = trunc i64 %indvars.iv to i32
27  store i32 %tmp, i32* %arrayidx, align 8
28  br label %for.inc
29
30for.inc:                                          ; preds = %for.body
31  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
32  br label %for.cond
33
34for.end:                                          ; preds = %for.cond
35  ret void
36}
37