I think that you should upgrade to a newer version of CIL. When I compiled your code in 1.3.7, both the assignment to c and the first case statement use '\212'.

On 05/04/2012 07:45 AM, Dany Vereertbrugghen wrote:
Hi,

We're having a problem with a simple switch command, in which cilly seems to turn an char literal into a signed value, although cilly is compiled with char being unsigned.
Included is the original program, the preprocessor output and the output after 
cilly.

As you can see, cilly has turned '\x8a' into -118, which gives compilation 
warnings.

This seems to be a bug, and it should either put the unsigned value there or leave it in the original notation. Is there some option to control this behavior, or can we easily tweak it somewhere (any hints are greatly appriciated).

Thanks,
Dany





t.instr.c
/* Generated by CIL v. 1.3.6 buildtime Fri Sep  9 14:23:19 CEST 2011  */
/* print_CIL_Input is true */

#line 3 "t.c"
int main(void)
{ char c ;

   {

#line 5
   c = '\212';
#line 7
   switch (c) {
   case -118:
#line 9
   return (1);
   default: ;
#line 11
   return (2);
   }
#line 14
   return (0);
}
}

t.prep.c
# 1 "t.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "t.c"


int main(void)
{
     char c = '\x8a';

     switch (c) {
         case '\x8a':
             return 1;
         default:
             return 2;
     }

     return 0;
}

t.c
#define LONG '\x8a'

int main(void)
{
     char c = LONG;

     switch (c) {
         case LONG:
             return 1;
         default:
             return 2;
     }

     return 0;
}


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to