Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 39929 - gcc-2.96 errors out if typedef ... ident precedes #ident line
gcc-2.96 errors out if typedef ... ident precedes #ident line
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
#ident directive produces
Depends On:
  Show dependency treegraph
Reported: 2001-05-09 15:16 EDT by Mike Wescott
Modified: 2007-04-18 12:33 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-05-10 03:54:35 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Mike Wescott 2001-05-09 15:16:04 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.2.16-3 i686)

Description of problem:
gcc-2.96-81 on RH 7.0 and 7.1

if a line like
typedef char *ident;
precedes a #ident line the compiler errors out
with "invalid #-line"

How reproducible:

Steps to Reproduce:
1. cat - > xxx.c <<XXX
typedef char *ident;
#ident "xxx.c"
main() { exit(0);}

2. gcc -o xxx xxx.c


Actual Results:  gcc complains:
xxx.c:2: invalid #-line

Expected Results:  clean compile producing xxx

Additional info:

works on 6.2 with gcc from egcs-1.1.2-30
works on 7.1 with kgcc from compat-egcs-6.2-

-fno-ident doesn't help
Comment 1 Jakub Jelinek 2001-05-10 03:54:29 EDT
Will be fixed in gcc-2.96-86. The fix is easy:
--- gcc/c-lex.c.jj      Wed May  9 20:56:44 2001
+++ gcc/c-lex.c Thu May 10 11:07:14 2001
@@ -614,7 +614,7 @@ check_newline ()

   token = yylex ();

-  if (token == IDENTIFIER)
+  if (token == IDENTIFIER || token == TYPENAME || token == OBJECTNAME)
       /* If a letter follows, then if the word here is `line', skip
         it and ignore it; otherwise, ignore the line, with an error

Note You need to log in before you can comment on or make changes to this bug.