On May 21, 2010, at 12:30 PM, David Gay wrote:

On Fri, May 21, 2010 at 9:11 AM, Elnatan Reisner <elna...@cs.umd.edu> wrote:
On May 20, 2010, at 1:10 PM, Chucky Ellison wrote:


I've noticed some argument promotions that seem not to have been made
explicit.  In the code:

int testDifferent(int x, ...);

Aside from ellipses in function prototypes, CIL also exhibits this behavior
when functions are declared with no prototype, as in:
void f();

See bullet 6 in the "Compiling C to CIL" section of the CIL
documenation at http://hal.cs.berkeley.edu/cil. In a nutshell, CIL
rewrites prototypeless funcrtion declarations to have a prototype
(when possible). I'm pretty sure said prototypes follow the implicit
conversion rules...

Yes, CIL rewrites the function declarations to have a prototype, but it does not insert corresponding casts at the function calls.
For example:

void f();
int main() {
        short x;
        f(x);
        return 0;
}
void f(int x) { }

when passed through CIL becomes

void f(int x ) ;
int main(void)
{ short x ;
  f(x);
  return (0);
}
void f(int x ) { return; }

Notice the lack of an explicit cast in the call to f(x). However, if you change the first line of the original program to 'void f(int);', then the cast is inserted, but the output is otherwise identical.

Elnatan
------------------------------------------------------------------------------

_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to