Issue Details (XML | Word | Printable)

Key: PCC-348
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Iain Hibbert
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

enum may need to be considered unsigned

Created: 10/May/11 08:41 AM   Updated: 11/May/11 04:38 PM
Component/s: C frontend
Affects Version/s: None
Fix Version/s: None

File Attachments: 1. File enum.c (0.4 kB)

Environment: NetBSD/i386

 Description  « Hide
The attached source enum.c illustrates a problem I found with GNU make; when
run, it outputs the following:

 0 0 0
 1 1 1
 2 -2 fail
 3 -1 fail

as pcc always uses signed integer type for storing enum, but when used in
conjunction with an enum bitfield (I guess this is gcc compatibility) this can
cause sign extension issues

gcc uses signed for enum only when negative values are assigned, and
the gmake source uses enum bitfields whenever __GNUC__ is defined.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 11/May/11 04:38 PM
Fixed. I think it's as good as any to use the gcc enum defaults.