NNPDF / pineappl

PineAPPL is not an extension of APPLgrid
https://nnpdf.github.io/pineappl/
GNU General Public License v3.0
12 stars 3 forks source link

Panic while optimizing grids #213

Closed cschwan closed 1 year ago

cschwan commented 1 year ago
thread '<unnamed>' panicked at 'slice index starts at 50 but ends at 0', pineappl/src/import_only_subgrid.rs:402:23
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::slice::index::slice_index_order_fail_rt
   3: core::slice::index::slice_index_order_fail
   4: <pineappl::import_only_subgrid::ImportOnlySubgridV2 as core::convert::From<&pineappl::subgrid::SubgridEnum>>::from
   5: pineappl::grid::Grid::optimize
   6: _ZN13summary_order19merge_PineAPPL_listEi
   7: _ZN15summary_generic11get_summaryEv
   8: _ZN6munich11get_summaryEv
   9: main
  10: __libc_start_main
  11: <unknown>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
fatal runtime error: failed to initiate panic, error 5
Aborted

This happens when a slice is accessed with a empty Range as follows:

array[50..0]

The range 50..0 is a valid one - it's empty according to the documentation - and in that case my expection would be that an empty slice is created. However, this shouldn't happen in any case, so we'll have to figure out why ImportOnlySubgridV2::from is called with an empty grid (that means Subgrid::is_empty() returns true).

cschwan commented 1 year ago

Should be fixed with commit 905b19ed3992a1e4cacb5dca4e02e64b9fbafec4.