Skip to content

Commit

Permalink
Merge pull request #84 from czgdp1807/ptr_02
Browse files Browse the repository at this point in the history
Ported ``integration_tests/associate_03.f90`` from LFortran
  • Loading branch information
czgdp1807 authored Feb 2, 2024
2 parents bed4733 + 6b08b70 commit d85c4b6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,5 +214,6 @@ RUN(NAME struct_03.cpp LABELS gcc llvm NOFAST)
RUN(NAME struct_04.cpp LABELS gcc llvm NOFAST)

RUN(NAME pointer_01.cpp LABELS gcc llvm NOFAST)
RUN(NAME pointer_02.cpp LABELS gcc llvm NOFAST)

RUN(NAME function_01.cpp LABELS gcc llvm NOFAST)
29 changes: 29 additions & 0 deletions integration_tests/pointer_02.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <iostream>

int main() {

int* p1;
int t1 = 2, t2 = 1;
int i;

std::cout << t1 << t2 << std::endl;

if (t1 > t2) {
p1 = &t1;
} else {
p1 = &t2;
}

std::cout << *p1 << std::endl;

if (*p1 == t2) {
exit(2);
}

i = *p1;
if (i == t2) {
exit(2);
}

return 0;
}

0 comments on commit d85c4b6

Please sign in to comment.