View Issue Details

IDProjectCategoryView StatusLast Update
0033176CommunityOCCT:Foundation Classespublic2022-10-19 23:52
Reporterirschcaldsh Assigned Toabv 
PrioritynormalSeveritycrash 
Status newResolutionopen 
PlatformLinuxOSUbuntu 20.04 
Product Version7.5.3 
Summary0033176: UnitsAPI::AnyToAny reports incorrect unit conversion or segfaults when called with example arguments from API Documentation
DescriptionThe documentation for UnitsAPI::AnyToAny includes an example for converting inches to millimeters. However, when I call UnitsAPI::AnyToAny with the arguments from the example, I get `Units_Measurement: can not convert - incorrect unit => result is not correct` spammed to stderr, and a value of 1.0 is returned, regardless of what is specified for the 'aData' argument. Re-arranging the arguments in the example to convert from millimeters to inches results in a segmentation fault.
Steps To Reproduce#include <UnitsAPI.hxx>

/** ... */

   double inchesToMM = UnitsAPI::AnyToAny(1.0, "in.", "millimeter"); // <= Returns 1.0 rather than 25.4 and prints "Units_Measurement: can not convert - incorrect unit => result is not correct" to stderr
   double inchesToMM = UnitsApi::AnyToAny(1.0, "millimeter", "in."); // <= Segmentation Fault
Additional information
and documentation updates
The call stack of the segmentation fault is:

libTKernel.so.7!TCollection_AsciiString::TCollection_AsciiString(TCollection_AsciiString const&)
libTKernel.so.7!Units_Token::Divide(opencascade::handle<Units_Token> const&) const
libTKernel.so.7!operator/(opencascade::handle<Units_Token> const&, opencascade::handle<Units_Token> const&)
libTKernel.so.7!Units_Measurement::Convert(char const*)
libTKernel.so.7!Units::Convert(double, char const*, char const*)

This is from a debug build of OCCT 7.5.3, but apparently CMake strips the binaries of the debug build for some reason, so I'm not sure exactly where or why the crash is occurring.
TagsNo tags attached.
Test case number

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2022-10-19 23:52 irschcaldsh New Issue
2022-10-19 23:52 irschcaldsh Assigned To => abv