From 4ddea6ca6e80452b031a6202251fdd16af2cd4b0 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Fri, 5 Jan 2024 22:21:17 +0530 Subject: [PATCH 1/3] Following changes have been made, DEV: Added support for && and ! operators DEV: Process CXXBoolLiteralExpr --- src/lc/clang_ast_to_asr.h | 47 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/lc/clang_ast_to_asr.h b/src/lc/clang_ast_to_asr.h index 2f30b28..c25c1a4 100644 --- a/src/lc/clang_ast_to_asr.h +++ b/src/lc/clang_ast_to_asr.h @@ -1345,6 +1345,21 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitorgetValue(); + tmp = ASR::make_LogicalConstant_t(al, Lloc(x), b, + ASRUtils::TYPE(ASR::make_Logical_t(al, Lloc(x), 4))); + is_stmt_created = false; + return true; + } + bool TraverseFloatingLiteral(clang::FloatingLiteral* x) { double d = x->getValue().convertToDouble(); tmp = ASR::make_RealConstant_t(al, Lloc(x), d, @@ -1715,6 +1758,10 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor Date: Fri, 5 Jan 2024 22:23:59 +0530 Subject: [PATCH 2/3] TEST: Ported integration_tests/arrays_inputs_15.f90 from LFortran --- integration_tests/array_20.cpp | 47 ++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 integration_tests/array_20.cpp diff --git a/integration_tests/array_20.cpp b/integration_tests/array_20.cpp new file mode 100644 index 0000000..0f43184 --- /dev/null +++ b/integration_tests/array_20.cpp @@ -0,0 +1,47 @@ +#include +#include +#include +#include +#include "xtensor/xio.hpp" + +void copy_from_to(const xt::xtensor_fixed>& xa, + xt::xtensor_fixed>&xb) { + int i; + for( i = 0; i < xa.size(); i++ ) { + xb(i) = xa(i); + } +} + +bool verify(const xt::xtensor_fixed>& a, + const xt::xtensor_fixed>& b) { + int i; + bool r = true; + for( i = 0; i < a.size(); i++ ) { + r = r && (a(i) == b(i)); + } + + return r; +} + +int main() { + + xt::xtensor_fixed> x, y; + int i; + bool r; + + for( i = 0; i < x.size(); i++ ) { + x(i) = i; + } + + copy_from_to(x, y); + std::cout<< x << std::endl; + std::cout << y << std::endl; + r = verify(x, y); + std::cout << r << std::endl; + if (!r) { + exit(2); + } + + return 0; + +} From d89e76fdf76d5768d1ccb2c2cb0b4ffdaab88899 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Fri, 5 Jan 2024 22:24:15 +0530 Subject: [PATCH 3/3] TEST: Registered array_20.cpp --- integration_tests/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/integration_tests/CMakeLists.txt b/integration_tests/CMakeLists.txt index c80ca84..21c16ff 100644 --- a/integration_tests/CMakeLists.txt +++ b/integration_tests/CMakeLists.txt @@ -216,3 +216,5 @@ RUN(NAME array_18.cpp LABELS gcc llvm NOFAST EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include) RUN(NAME array_19.cpp LABELS gcc llvm NOFAST EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include) +RUN(NAME array_20.cpp LABELS gcc llvm NOFAST + EXTRA_ARGS --extra-arg=-I${CONDA_PREFIX}/include)