Skip to content

Commit d85c4b6

Browse files
authored
Merge pull request #84 from czgdp1807/ptr_02
Ported ``integration_tests/associate_03.f90`` from LFortran
2 parents bed4733 + 6b08b70 commit d85c4b6

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

integration_tests/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -214,5 +214,6 @@ RUN(NAME struct_03.cpp LABELS gcc llvm NOFAST)
214214
RUN(NAME struct_04.cpp LABELS gcc llvm NOFAST)
215215

216216
RUN(NAME pointer_01.cpp LABELS gcc llvm NOFAST)
217+
RUN(NAME pointer_02.cpp LABELS gcc llvm NOFAST)
217218

218219
RUN(NAME function_01.cpp LABELS gcc llvm NOFAST)

integration_tests/pointer_02.cpp

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#include <iostream>
2+
3+
int main() {
4+
5+
int* p1;
6+
int t1 = 2, t2 = 1;
7+
int i;
8+
9+
std::cout << t1 << t2 << std::endl;
10+
11+
if (t1 > t2) {
12+
p1 = &t1;
13+
} else {
14+
p1 = &t2;
15+
}
16+
17+
std::cout << *p1 << std::endl;
18+
19+
if (*p1 == t2) {
20+
exit(2);
21+
}
22+
23+
i = *p1;
24+
if (i == t2) {
25+
exit(2);
26+
}
27+
28+
return 0;
29+
}

0 commit comments

Comments
 (0)