<< Back to previous view

[PCC-348] enum may need to be considered unsigned Created: 10/May/11  Updated: 11/May/11

Status: Resolved
Project: pcc
Component/s: C frontend
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Iain Hibbert Assignee: Anders Magnusson
Resolution: Fixed Votes: 0
Environment: NetBSD/i386

File Attachments: File enum.c    

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.

Comment by Anders Magnusson [ 11/May/11 04:38 PM ]
Fixed. I think it's as good as any to use the gcc enum defaults.
Generated at Fri Apr 27 08:36:29 CEST 2018 using JIRA Enterprise Edition, Version: 3.13.1-#333.