Path: utzoo!utgpu!watserv1!watmath!att!rutgers!sun-barr!cs.utexas.edu!uunet!indetech!schmidt From: schmidt@indetech.com (Douglas C. Schmidt) Newsgroups: comp.lang.c++ Subject: cfront 2.0 bug Message-ID: <1990Sep4.173447.6464@indetech.com> Date: 4 Sep 90 17:34:47 GMT Reply-To: schmidt@indetech.com (Douglas C. Schmidt) Organization: Independence Technologies, Inc. Fremont, CA Lines: 99 Disclaimer: Author bears full responsibility for contents of this article Howdy, The following twisted program seems to trip a bug in cfront 2.0. Does anyone know if this is fixed in 2.1? thanks, Doug ---------------------------------------- extern int foo (void); int a = 100; int i = 10 + foo (); int j = i + *new int (1); foo () { static int k = foo (); return 100 + a; } ---------------------------------------- Here's the result of compiling with CC: % CC t.c "t.c", line 5: k undefined And here's the mangled cfront code: ---------------------------------------- CC -F t.c #line 1 "t.c" /* <> */ /* < t.c > */ #line 1 "t.c" char *__vec_new (); #line 1 "t.c" char __vec_delete (); typedef int (*__vptp)(); struct __mptr {short d; short i; __vptp f; }; #line 1 "t.c" #line 3 "t.c" int a = 100 ; #line 1 "t.c" extern int foo__Fv (); #line 4 "t.c" int i = 0 ; int j = 0 ; #line 1 "t.c" int foo__Fv () #line 8 "t.c" { #line 9 "t.c" static int __1k ; #line 10 "t.c" static int __0__F2 ; #line 9 "t.c" __0__F2 ?0 :( (__1k = foo__Fv ( ) ), (__0__F2 = 1)) ; return (100 + a ); } #line 1 "t.c" extern char *__nw__FUi (); #line 13 "t.c" char __sti__t_c_a_ () #line 4 "t.c" { #line 4 "t.c" int *__0__N1 ; i = (10 + foo__Fv ( ) ); #line 5 "t.c" j = (i + ((*( ( (__0__N1 = (((int *)__nw__FUi ( sizeof (int )) ))), (((*__0__N1 ))= k )) , #line 5 "t.c" __0__N1 ) ))); } #line 13 "t.c" /* the end */ ---------------------------------------- -- ____*_ Douglas C. Schmidt schmidt@indetech.com \ / / Independence Technologies {sun,sharkey,pacbell}!indetech!schmidt \/ / 42705 Lawrence Place FAX: 415 438-2034 \/ Fremont, CA 94538 Voice: 415 438-2023