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 network/15347] New: __FD_MASK triggers undefined behavior


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

             Bug #: 15347
           Summary: __FD_MASK triggers undefined behavior
           Product: glibc
           Version: 2.17
            Status: NEW
          Severity: normal
          Priority: P2
         Component: network
        AssignedTo: fweimer@redhat.com
        ReportedBy: fweimer@redhat.com
    Classification: Unclassified


typedef long int __fd_mask;
#define __FD_MASK(d)    ((__fd_mask) 1 << ((d) % __NFDBITS))

1 can be shifted into the sign position, which isn't legal C.

I think we should just use 1UL and cast the result of the shift.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- 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]