cpp-proposals-pub icon indicating copy to clipboard operation
cpp-proposals-pub copied to clipboard

P2642: Avoid division by zero

Open mhoemmen opened this issue 1 year ago • 1 comments

Para 12.3 of the converting constructor from layout_stride::mapping explicitly divides by zero if the leftmost resp. rightmost extent is zero.

This a general issue with other constructors as well, e.g., if padding_value is zero.

The two-parameter constructor mapping(ext, pad) has a precondition that extents_type::index-cast(pad) is greater than zero. Thus, we already check in some cases. We should consider extending these checks to all the cases, so the mappings behave reasonably.

mhoemmen avatar Feb 04 '24 21:02 mhoemmen

  • [ ] Check whether commit c010f8123f69a0e3e752d5704a493f4e32ef83f0 in PR https://github.com/ORNL/cpp-proposals-pub/pull/441 may fix this.

mhoemmen avatar Feb 05 '24 00:02 mhoemmen