From 8ff6f5f134692420f4207fdd737c86f260d05bbf Mon Sep 17 00:00:00 2001 From: parth121101 Date: Sun, 14 Jul 2024 20:56:49 +0530 Subject: [PATCH] tests: update test references --- src/lfortran/semantics/ast_common_visitor.h | 8 ++------ tests/reference/asr-ishftc_size-1254b50.json | 13 +++++++++++++ tests/reference/asr-ishftc_size-1254b50.stderr | 5 +++++ 3 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 tests/reference/asr-ishftc_size-1254b50.json create mode 100644 tests/reference/asr-ishftc_size-1254b50.stderr diff --git a/src/lfortran/semantics/ast_common_visitor.h b/src/lfortran/semantics/ast_common_visitor.h index a2bdd4da85..0be7de6650 100644 --- a/src/lfortran/semantics/ast_common_visitor.h +++ b/src/lfortran/semantics/ast_common_visitor.h @@ -5350,9 +5350,9 @@ class CommonVisitor : public AST::BaseVisitor { } void fill_optional_args(std::string intrinsic_name, Vec &args, const Location &loc) { + ASR::ttype_t *int_type = ASRUtils::TYPE( + ASR::make_Integer_t(al, loc, 4)); if (intrinsic_name == "selected_real_kind") { - ASR::ttype_t *int_type = ASRUtils::TYPE( - ASR::make_Integer_t(al, loc, compiler_options.po.default_integer_kind)); ASR::expr_t* zero = ASRUtils::EXPR( ASR::make_IntegerConstant_t(al, loc, 0, int_type)); @@ -5371,8 +5371,6 @@ class CommonVisitor : public AST::BaseVisitor { } else if (intrinsic_name == "verify" || intrinsic_name == "index" || intrinsic_name == "scan") { ASR::ttype_t *bool_type = ASRUtils::TYPE( ASR::make_Logical_t(al, loc, 4)); - ASR::ttype_t *int_type = ASRUtils::TYPE( - ASR::make_Integer_t(al, loc, 4)); ASR::expr_t* f = ASRUtils::EXPR( ASR::make_LogicalConstant_t(al, loc, false, bool_type)); ASR::expr_t* four = ASRUtils::EXPR( @@ -5397,8 +5395,6 @@ class CommonVisitor : public AST::BaseVisitor { int value; int kind = ASRUtils::extract_kind_from_ttype_t(ASRUtils::expr_type(args[0])); value = kind*8; - ASR::ttype_t *int_type = ASRUtils::TYPE( - ASR::make_Integer_t(al, loc, kind)); ASR::expr_t* val = ASRUtils::EXPR( ASR::make_IntegerConstant_t(al, loc, value, int_type)); args.p[2] = val; diff --git a/tests/reference/asr-ishftc_size-1254b50.json b/tests/reference/asr-ishftc_size-1254b50.json new file mode 100644 index 0000000000..8d8d19ad39 --- /dev/null +++ b/tests/reference/asr-ishftc_size-1254b50.json @@ -0,0 +1,13 @@ +{ + "basename": "asr-ishftc_size-1254b50", + "cmd": "lfortran --show-asr --no-color {infile} -o {outfile}", + "infile": "tests/errors/ishftc_size.f90", + "infile_hash": "5765a2202b476e6d0522df41163ba488707e3b506dd4870c1b0eb7b4", + "outfile": null, + "outfile_hash": null, + "stdout": null, + "stdout_hash": null, + "stderr": "asr-ishftc_size-1254b50.stderr", + "stderr_hash": "9ce5eb1db3c8a9c92204d2bd13f6466f06e862c1b75c29dfe981a7d2", + "returncode": 2 +} \ No newline at end of file diff --git a/tests/reference/asr-ishftc_size-1254b50.stderr b/tests/reference/asr-ishftc_size-1254b50.stderr new file mode 100644 index 0000000000..118f056adc --- /dev/null +++ b/tests/reference/asr-ishftc_size-1254b50.stderr @@ -0,0 +1,5 @@ +semantic error: The SHIFT argument must be less than or equal to the of SIZE argument + --> tests/errors/ishftc_size.f90:2:14 + | +2 | print *, ishftc(10, 6, 4) + | ^^^^^^^^^^^^^^^^