[Bug 1535] New: doubts on test_posix_memalign

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Fri May 28 22:54:58 CDT 2010


           Summary: doubts on test_posix_memalign
           Product: RTEMS
           Version: 4.10
          Platform: All
        OS/Version: RTEMS
            Status: NEW
          Severity: normal
          Priority: P3
         Component: tests
        AssignedTo: joel.sherrill at oarcorp.com
        ReportedBy: ralf.corsepius at rtems.org

I am having several doubts on test_posix_memalign-test in

a) The maxShift-loop iterates over "sizeof(int)" to set up the 2nd arg of

However, posix_memalign's 2nd arg is a size_t, not an int. Therefore, the loop
should iterate over a sizeof(size_t), IMO.

b) The computation of maxShift can be improved.
Instead of an if sizeof(X) == Y cascade, it can be computed from 
(sizeof(X) * CHAR_BIT)

c) SUSv4 says:
"The posix_memalign() function shall allocate size bytes aligned on a boundary
specified by alignment, and shall return a pointer to the allocated memory in
memptr. The value of alignment shall be a power of two multiple of 
sizeof( void *)."

Linux's man posix_memalign says:
"... alignment, which must be a power of two and a multiple of sizeof(void *)."

AFAIU, test_posix_memalign does not take this consideration into account,
instead it starts its checks at "2".

Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.

More information about the rtems-bugs mailing list