Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoadError: syntax: malformed expression #39705

Closed
jagot opened this issue Feb 17, 2021 · 1 comment · Fixed by #39709
Closed

LoadError: syntax: malformed expression #39705

jagot opened this issue Feb 17, 2021 · 1 comment · Fixed by #39709
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage)

Comments

@jagot
Copy link
Contributor

jagot commented Feb 17, 2021

Running on latest nightly, I get this cryptic error:

ERROR: LoadError: syntax: malformed expression
Stacktrace:
  [1] top-level scope
    @ ~/debug-julia/he-gst.jl:13
  [2] EnergyExpressions.NBodyMatrixElement(bcs::EnergyExpressions.BitConfigurations{EnergyExpressions.Orbitals{SpinOrbital{Orbital{Int64}, Tuple{Int64, HalfIntegers.Half{Int64}}}, SparseArrays.SparseMatrixCSC{EnergyExpressions.NBodyTerm, Int64}, BitMatrix, BitVector}}, op::EnergyExpressions.FieldFreeOneBodyHamiltonian, i::Int64, j::Int64)
    @ EnergyExpressions ~/.julia/dev/EnergyExpressions/src/bit_configurations.jl:423
  [3] EnergyExpressions.NBodyMatrixElement(bcs::EnergyExpressions.BitConfigurations{EnergyExpressions.Orbitals{SpinOrbital{Orbital{Int64}, Tuple{Int64, HalfIntegers.Half{Int64}}}, SparseArrays.SparseMatrixCSC{EnergyExpressions.NBodyTerm, Int64}, BitMatrix, BitVector}}, op::EnergyExpressions.LinearCombinationOperator, i::Int64, j::Int64)
    @ EnergyExpressions ~/.julia/dev/EnergyExpressions/src/bit_configurations.jl:431
  [4] (Matrix{T} where T)(bcs::EnergyExpressions.BitConfigurations{EnergyExpressions.Orbitals{SpinOrbital{Orbital{Int64}, Tuple{Int64, HalfIntegers.Half{Int64}}}, SparseArrays.SparseMatrixCSC{EnergyExpressions.NBodyTerm, Int64}, BitMatrix, BitVector}}, rows::UnitRange{Int64}, op::EnergyExpressions.LinearCombinationOperator, cols::UnitRange{Int64}; verbosity::Int64)
    @ EnergyExpressions ~/.julia/dev/EnergyExpressions/src/bit_configurations.jl:453

Project attached, which should reproduce the problem: malformed-syntax.zip

This appeared a few days ago, e.g. I see the error on

Julia Version 1.7.0-DEV.560
Commit dff13e157d* (2021-02-17 07:24 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD Ryzen 9 3950X 16-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, znver2)

but not on

julia> versioninfo()
Julia Version 1.7.0-DEV.499
Commit 21557721f2* (2021-02-09 08:54 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD Ryzen 9 3950X 16-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, znver2)

julia> include("he-gst.jl")
Fock operator with
- quantum system: Atom{Float64}(R=Staggered finite differences basis {Float64} on 0.0..10.049999999999999 with 100 points spaced by ρ = 0.1; Z = 2 [helium]; 2 e⁻  Q = 0) with 1 SpinConfiguration{SpinOrbital{Orbital{Int64}, Tuple{Int64, HalfIntegers.Half{Int64}}}}: 1s₀α 1s₀β
- SCF equations:
  - Hartree–Fock equation: E|1s₀α⟩ = OrbitalEquation(1s₀α):
 + 1ĥ₀|1s₀α⟩ + 1r⁻¹×Y⁰(1s₀β,1s₀β)|1s₀α⟩

⟨1s₀α| 𝓗 |1s₀α⟩ = -0.7500579719133716 Ha = -20.409827473734754 eV

  - Hartree–Fock equation: E|1s₀β⟩ = OrbitalEquation(1s₀β):
 + 1ĥ₀|1s₀β⟩ + 1r⁻¹×Y⁰(1s₀α,1s₀α)|1s₀β⟩

⟨1s₀β| 𝓗 |1s₀β⟩ = -0.7500579719133716 Ha = -20.409827473734754 eV
@simeonschaub
Copy link
Member

Reduced to:

julia> Meta.lower(Main, :($(Expr(:||)) && true))
:($(Expr(:error, "malformed expression")))

Likely introduced by me in #39618. The Expr(:||) was emitted by Base.Cartesian.@nany 0 ..., which is a bit iffy, but since it was allowed before, I think we can just fix the lowering.

@simeonschaub simeonschaub added the compiler:lowering Syntax lowering (compiler front end, 2nd stage) label Feb 17, 2021
simeonschaub added a commit that referenced this issue Feb 17, 2021
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this issue May 4, 2021
antoine-levitt pushed a commit to antoine-levitt/julia that referenced this issue May 9, 2021
KristofferC pushed a commit that referenced this issue Jul 12, 2021
KristofferC pushed a commit that referenced this issue Aug 31, 2021
staticfloat pushed a commit that referenced this issue Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants