Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-862

[Sun C++ 5.9] 0.char test failed due to different binary representation of "long double ld1 = 0" and "long double ld2 = 0."

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 4.2.0
    • 4.2.1
    • Tests
    • None
    • Linux

    • Incorrect Behavior

    Description

      $ cat test.cpp && CC test.cpp -o test && ./test
      #include <cassert>
      #include <cstring>
      
      int main ()
      {
          long double ld1 = 0;
          long double ld2 = 0.;
          
          assert (ld1 == ld2);
          assert (0 == memcmp (&ld1, &ld2, sizeof (ld1)));
          
          return 0;
      }
      test: test.cpp:10: Assertion `0 == memcmp (&ld1, &ld2, sizeof (ld1))' failed.
      Aborted
      

      Attachments

        Activity

          People

            farid Farid Zaripov
            farid Farid Zaripov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h
                1h