HuaHuaY commented on issue #50010:
URL: https://github.com/apache/arrow/issues/50010#issuecomment-4508055561

   > Hi [@HuaHuaY](https://github.com/HuaHuaY) , Is this issue specific to 
certain environments?
   
   The UB is environment-independent. However, whether an error occurs during 
the construction of std::span is environment-dependent.
   
   In my environment, `std::span` will call `_LIBCPP_ASSERT_VALID_INPUT_RANGE`, 
which is conditionally compiled.
   ```cpp
   // <span>
     template <__span_compatible_iterator<element_type> _It>
     _LIBCPP_HIDE_FROM_ABI constexpr span(_It __first, size_type __count)
         : __data_{std::to_address(__first)}, __size_{__count} {
       _LIBCPP_ASSERT_VALID_INPUT_RANGE(__count == 0 || 
std::to_address(__first) != nullptr,
                                        "passed nullptr with non-zero length in 
span's constructor (iterator, len)");
     }
   
   // <__assert>
   #if _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_FAST
   
   // Enabled checks.
   #  define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message)       
_LIBCPP_ASSERT(expression, message)
   ......
   
   // Extensive hardening mode checks.
   
   #elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_EXTENSIVE
   
   // Enabled checks.
   #  define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message)       
_LIBCPP_ASSERT(expression, message)
   ......
   
   // Debug hardening mode checks.
   
   #elif _LIBCPP_HARDENING_MODE == _LIBCPP_HARDENING_MODE_DEBUG
   
   // All checks enabled.
   ......
   
   #else
   
   // All checks disabled.
   #  define _LIBCPP_ASSERT_VALID_INPUT_RANGE(expression, message)       
((void)0)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to