Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 92377 - Code generated with "bison -y" fails with g++
Summary: Code generated with "bison -y" fails with g++
Keywords:
Status: CLOSED DUPLICATE of bug 92262
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: bison
Version: 1.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Roland McGrath
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-06-05 16:22 UTC by John Ellson
Modified: 2007-04-18 16:54 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-02-21 18:53:28 UTC
Embargoed:


Attachments (Terms of Use)

Description John Ellson 2003-06-05 16:22:21 UTC
Description of problem:
Code generated with "bison -y" fails with g++
 
The problem originates from the fragment: /usr/share/bison/yacc.c:1116
 
    #if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
      __attribute__ ((__unused__))
    #endif
 
The "__attribute__ ((__unused__))" feature is supported by gcc, but 
apparently not by g++.

Version-Release number of selected component (if applicable):
bison-1.875-2
gcc-3.2.3-4

How reproducible:
100%

Steps to Reproduce:
1.   --- test.c ---

    int main() {
    yyerrlab1:
    __attribute__ ((__unused__))
        goto yyerrlab2;
    yyerrlab2:
        return(0);
    }

2.  gcc -Wall test.c
3.  g++ -Wall test.c
    
Actual results:
gcc OK
g++ fails with:

    test.c: In function `int main()':
    test.c:4: syntax error before `goto'
    test.c:5: warning: label `yyerrlab2' defined but not used
    test.c:2: warning: label `yyerrlab1' defined but not used

Expected results:
Either g++ should support __attribute__ in the same way as gcc, or yacc.c
should take account of the different behavior.

Additional info:
g++296 fails in the same way.
Problem does not occur with bison-1.35-4, from RH8.0, which had bison.simple
instead of yacc.c.

Comment 1 John Ellson 2003-06-05 16:57:58 UTC
Also fails with g++ from today's gcc-3.3-4

Comment 2 Chris Chabot 2003-06-09 13:40:00 UTC
Verified that it also happens for me on RH9 and rawhide-current (20030609) 
with gcc-3.3-5 and bison-1.875.

Commenting out the macro from yacc.c is a workaround i gues

(ran into the problem while compiling groff)

Comment 3 Bill Nottingham 2003-07-24 22:49:04 UTC

*** This bug has been marked as a duplicate of 92262 ***

Comment 4 Red Hat Bugzilla 2006-02-21 18:53:28 UTC
Changed to 'CLOSED' state since 'RESOLVED' has been deprecated.


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