Skip to content

Peculiar use of ‘unsigned’ indices in ‘PostRASchedulerList.cpp’ #3610

@danchr

Description

@danchr
mannequin
Bugzilla Link 3238
Resolution FIXED
Resolved on Mar 06, 2010 14:00
Version trunk
OS All
Attachments Fix
CC @asl,@sunfishcode

Extended Description

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions