[Open64-devel] Re: Open64/ORC as a source-to-source compiler (redux)
Brought to you by:
ributzka,
suneeljain
From: Marc Gonzalez-S. <mar...@in...> - 2004-11-18 10:57:23
|
Marc Gonzalez-Sigler wrote: > Take 183.equake, a single-file C program, from SPECfp2000 for example, > > $ orcc -fe -keep quake.c > $ w2c quake.B > whirl2c translates quake.B into quake.w2c.h and quake.w2c.c, based on > source quake.c > $ orcc -I. quake.w2c.c -lm (or gcc -I. quake.w2c.c -lm) > $ a.out < inp.in 1> stdout > $ head stdout > 3135: 4.60e+141 -1.40e+143 1.45e+142 > 3135: 4.60e+141 -1.40e+143 1.45e+142 > 3135: nan nan nan > 3135: nan nan nan > > As you can see, the output is incorrect. > > Has anybody tested whirl2c and whirl2f with the SPECfp2000 benchmarks? > Did it work for you? (Perhaps I built the compiler incorrectly.) $ cat testcase.c struct foo { int x; int y[3]; } bar; int main(void) { bar.y[1] = 666; return 0; } $ orcc -fe -keep testcase.c ; w2c testcase.B whirl2c translates testcase.B into testcase.w2c.h and testcase.w2c.c, based on source testcase.c !!! DevWarn during W2C Initialization: Should use ST_pu_type instead !!! DevWarn during WHIRL To C: Count limit reached on the following DevWarn: !!! DevWarn during WHIRL To C: Should use ST_pu_type instead !!! DevWarn during WHIRL To C: Rehashing TY pointer map -- this should NOT happen often $ cat testcase.w2c.c [...] _INT32 main() { (*(_INT32 *)(&((struct foo__0 *)(((_INT8 *) & bar) + 4LL))[1])) = 666; return 0; } /* main */ Let char *p = &(bar.y) ((_INT8 *) & bar) + 4LL == p (so far, so good) (*(_INT32 *)(&((struct foo__0 *)p)[1])) = 666; Then, p is incorrectly cast to a 'struct foo' pointer. Let struct foo *WRONG = (struct foo *)p (*(_INT32 *)(&WRONG[1])) = 666; &WRONG[1] == p + 1*sizeof(struct foo) We are now pointing *outside* bar :-) I will try to fix it. -- Regards, Marc |