🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #929

Extraneous warning w/ -ansi -pedantic

#929
From: Jim Russell
Date: Wed, 12 Aug 1992 04:31
25 lines
1075 bytes
The following program:
    struct goo {
      int i;
    } a, b;

    main()
    {
      int x, y;

      y = ( x ? a : b ).i;
    }

when compiled with "gcc -ansi -pedantic" gets the following warning:
    goo.c: In function `main':
    goo.c:9: warning: ANSI C forbids use of conditional expressions as lvalues

However, ANSI does not requre that the first operand of the . operator be
an lvalue.  In fact, they even give an example (sec 3.3.2.3, pg 43 line 14)
where the first operand is not an lvalue (it's a function return in their
example).

We got this warning with gcc version 2.2 on the RS/6000, and gcc version
2.2.2 on the Sparc.

- Jim
Technical Details
Message-ID: <9208121231.AA33001@pequod.watson.ibm.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!watson.ibm.com!jrussell

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!watson.ibm.com!jrussell
From: jrussell@watson.ibm.com (Jim Russell)
Subject: Extraneous warning w/ -ansi -pedantic
Message-ID: <9208121231.AA33001@pequod.watson.ibm.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 12 Aug 1992 04:31:13 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 27