[gnu.gcc.bug] gcc 1.30 hangs

how@IRIS.UCDAVIS.EDU (W. Wilson Ho) (11/08/88)

I got the following bug report from a local user.  The version of gcc
is 1.30, running on a VAX 8600 under ultrix 2.2

> Date: Mon, 7 Nov 88 12:46:50 PST
> From: olsson@ivy (Ron Olsson)
> To: gnu@ivy.ucdavis.edu
> Cc: mcnamee@ivy.ucdavis.edu, sr-project@arizona.edu@arizona.edu
> Subject: gcc 1.30 hangs
> 
> gcc hangs as follows
> 
> % gcc -c z.c
> z.c: In function Pt:
> z.c:7: unterminated comment
> z.c:7: parse error at end of input
> ^C%
> 
> on attached program
> 
> #define RE(n) *(int*)(rv+n)
> static Pt(rv)
> char *rv;
> {
> RE(24)=(RE(20)/RE(16));
> }
> 
>

After running the preprocessor, I got:
# 1 "test.c"

static Pt(rv)
char *rv;
{
*(int*)(rv+24) =(*(int*)(rv+20) /*(int*)(rv+16) );
}                               

Apparently gcc takes the /*... as the start of the comment.  But
according to the ANSI draft, comment elimination occurs before macro
replacement.  So this is a bug.  Secondly, even if there is
unterminated comment, gcc should not go into infinite loop.  So this
is bug number two.

Thanks for your attention!

Wilson Ho

-------------------------------------------------------------------------------
  W. Wilson Ho		        |  INTERNET: how@iris.ucdavis.edu
  Division of Computer Science	|  UUCP:     {lll-crg, ucbvax}!ucdavis!iris!how
  EECS Department		|
  University of California	|  Phone:    (916)752-7109
  Davis, CA 95616		|
-------------------------------------------------------------------------------