[LLVMbugs] [Bug 3238] New: Peculiar use of ‘unsigned’ indices in ‘PostRASchedulerList . cpp’

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Dec 19 14:07:22 PST 2008


http://llvm.org/bugs/show_bug.cgi?id=3238

           Summary: Peculiar use of ‘unsigned’ indices in
                    ‘PostRASchedulerList.cpp’
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: trivial
          Priority: P2
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: danchr at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=2320)
 --> (http://llvm.org/bugs/attachment.cgi?id=2320)
Fix

The file ‘lib/CodeGen/PostRASchedulerList.cpp’ contains two index arrays of
unsigned type, where the value ‘-1u’ is used to invalidate an index. GCC
3.4.6 on RHEL5.2 issued warnings about this. To be honest, I know little about
C++ or what exactly this code does; it's just that it feels very wrong to me to
store -1 in a variable which is explicitly declared to not have that value.

The attached patch fixes this by using a signed integer for the index; I've had
it in my local branch for a few days, and it seems to work fine :) If using a
signed integer is unacceptable, perhaps using ~0 or UINT_MAX to designate an
invalid index would be better?


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list