Skip to content

clang-repl: Typing an error in a formula may be followed by an unresolved while linking error #146770

Open
@guitargeek

Description

@guitargeek

In some cases, clang-repl doesn't recover correctly from input errors, resulting in a state where unexpected linker errors can happen in correct statements given afterwards.

It seems that this kind of error occurs only with "pow".

@vgvassilev @Vipul-Cariappa

Reproducer (I ran it with the LLVM 20 packages in NixOS):

LLVM (http://llvm.org/):
  LLVM version 20.1.6
  Optimized build.
clang-repl> #include <iostream>
clang-repl> #include <cmath>
clang-repl> (10-)*std::pow(2,2);
In file included from <<< inputs >>>:1:
input_line_3:1:5: error: expected expression
    1 | (10-)*std::pow(2,2);
      |     ^
error: Parsing failed.
clang-repl> std::cout << ((10-1)*std::pow(2,2)) << std::endl;
JIT session error: Symbols not found: [ _ZSt3powIiiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_ ]
error: Failed to materialize symbols: { (main, { $.incr_module_3.__inits.0, __orc_init_func.incr_module_3 }) }
clang-repl>

What is expected:

clang-repl> #include <iostream>
clang-repl> #include <cmath>
clang-repl> (10-)*std::pow(2,2);
In file included from <<< inputs >>>:1:
input_line_3:1:5: error: expected expression
    1 | (10-)*std::pow(2,2);
      |     ^
error: Parsing failed.
clang-repl> std::cout << ((10-1)*std::pow(2,2)) << std::endl;
36
clang-repl>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions