This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/16554] New: memset incorrect for negative signed char


http://sourceware.org/bugzilla/show_bug.cgi?id=16554

            Bug ID: 16554
           Summary: memset incorrect for negative signed char
           Product: glibc
           Version: 2.13
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: geoff at dyalog dot com
                CC: drepper.fsp at gmail dot com

memset() for the ARM does not honour the "converted to an unsigned char"
required by 7.21.6.1 of ISO/IEC 9899:1999(E)

signed char smallint = -3;
signed char smallarray[10];

memset(smallarray, smallint, 10);

results in smallarray[0] ââ -3
           smallarray[1] ââ -1
           smallarray[2] ââ -1
           smallarray[3] ââ -1
           smallarray[4] ââ -3
...
code widens the smallint of -3 to int with sign extension - correctly. memset()
fails to AND this with 0xff before shifting and ORing.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]