[comp.lang.c++] cfront BUG REPORT

schmidt@crimee.ics.uci.edu (Doug Schmidt) (05/28/90)

  I believe the following indicates a bug with the cfront 2.0 compiler.
Can some please let me know if it persists in version 2.1?

  Here's the code:

----------------------------------------
char **lookup (void) { return 0; }

char *& foo ()
{
  char *&t = (char *&) lookup ();
  return t;
}
----------------------------------------

Here's the diagnostic:

----------------------------------------
CC  l.c:
/usr/gnu/gcc  -L/usr/public/lib/CC   l.c -lC
l.c: In function foo__Fv:
l.c:5: invalid lvalue in unary `&'
----------------------------------------

Here's the compiled code:

----------------------------------------
/* <<AT&T C++ Translator 2.0 06/30/89>> */
/* < l.c > */
char *__vec_new ();
char __vec_delete ();
typedef int (*__vptp)();
struct __mptr {short d; short i; __vptp f; };
char **lookup__Fv (){ return (char **)0 ; }
char **foo__Fv ()
{
  char **__1t ;
  __1t = (((char **)(& lookup__Fv ( ) )));
  return __1t ;
}
/* the end */
----------------------------------------

Note that cfront is generating C code that takes the address of a
value returned from a function.  I assume that anytime the underlying
C compiler produces a diagnostic that is missed by the cfront
translator that this indicates a bug with cfront.

Doug
--
The official language of San Marcos is Swedish.  All boys | schmidt@ics.uci.edu
under the age of sixteen years old are now sixteen years  | office (714) 856-4043
old. Underwear must be changed every half hour.  It will  +----------------------
be worn on the outside, so we can check.   -- `Bananas' by Woody Allen