Bugs item #3538514, was opened at 2012-06-27 14:38
Message generated for change (Comment added) made by kerneis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=742140&aid=3538514&group_id=138953

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: CIL core (parser, visitor, etc)
Group: Bug
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Jim Grundy (jimgrundy)
Assigned to: Nobody/Anonymous (nobody)
Summary: Pointer difference operations have the wrong type.

Initial Comment:
Pointer difference operations should have some type that corresponds to 
ptrdiff_t, but the cabs2cil transformation creates them with type "int".  The 
"int" type is often not as big as ptrdiff_t.  The result of this that sometimes 
the types of the arguments of binary operators do not match (though CIL thinks 
they do).

Consider the following program:

int main()
{
  int i;
  int *p = &i;
  int *q = &p;
  short s = 1;
  long d = (p - q) + s;
 
  return 0;
}

CIL will translate the statement "d = (p - q) + s;" to "d = (long)((p - q) + 
(int)s);". It should have created "d = (long)((p - q) + (ptrdiff_t)s);".

A patch to fix the bug is attached.

----------------------------------------------------------------------

>Comment By: Gabriel Kerneis (kerneis)
Date: 2012-07-03 22:36

Message:
Applied, thanks.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=742140&aid=3538514&group_id=138953

------------------------------------------------------------------------------
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