Path: utzoo!attcan!uunet!synaptx!glenn From: glenn@synaptx.Synaptics.Com (Glenn Gribble) Newsgroups: comp.lang.c++ Subject: Re: cfront bug Message-ID: <1026@synaptx.Synaptics.Com> Date: 6 Jul 90 23:41:55 GMT References: <1022@synaptx.Synaptics.Com> Reply-To: glenn@synaptx.UUCP (Glenn Gribble) Organization: Synaptics Inc., San Jose, CA Lines: 66 In article <1022@synaptx.Synaptics.Com> I wrote: >The following bit of C++ generates illegal C code: > > int x; > int y = x = 0; In this example, it is not clear that these are *GLOBAL* variables. Here is another example that is totally clear and shows another part of the same problem. The two problems here: 1) Cfront generated illegal C code. 2) Cfront reports a warning in the local-variable case, but not in the global variable case--it should have also warned: "bug.cxx", line 5: warning: a used before set synaptx% cat -n bug.cxx 1 extern int f(int); 2 extern int x; 3 int y = (x = f(x)); 4 5 int a = (x = f(a)); 6 7 void foo() 8 { 9 int b = (x = f(b)); 10 } synaptx% CC -c +i bug.cxx CC bug.cxx: "bug.cxx", line 9: warning: b used before set cc -Qpath /usr/CC/sun3 -c -I/usr/CC/incl bug.c "bug.c", line 16: illegal initialization "bug.c", line 16: cannot recover from earlier errors: goodbye! synaptx% cat -n /tmp/bug..c 1 2 /* <> */ 3 /* < bug.cxx > */ 4 5 char *__vec_new (); 6 7 char __vec_delete (); 8 typedef int (*__vptp)(); 9 struct __mptr {short d; short i; __vptp f; }; 10 11 12 extern int x ; 13 14 extern int f__Fi (); 15 16 int y = (x = f__Fi ( x ) ); 17 18 int a = (x = f__Fi ( a ) ); 19 20 char foo__Fv () 21 { 22 int __1b ; 23 24 __1b = (x = f__Fi ( __1b ) ); 25 26 } 27 28 29 /* the end */ -- Glenn Gribble glenn@synaptics.com uunet!synaptx!glenn