🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #2463

int *x = (u(),0)

#2463
From: Dave Hanson
Date: Sat, 25 Mar 1989 19:18
23 lines
1136 bytes
gcc erroneously warns about assignment of 0 to a pointer
when the 0 is buried in a comma expression; e.g., in
lines 4 & 8 below.

% cat bug.c
struct foo *x;
struct foo *a(n) {
        x = 0;
        x = (u(),0);
        if (n)
                return (0);
        else
                return (u(),0);
}
% gcc -v -S bug.c
gcc version 1.34
 /usr/local/gnu/lib/gcc-cpp -v -undef -D__GNUC__ -Dvax -Dunix -D__vax__ -D__unix__ bug.c /tmp/cc023461.cpp
GNU CPP version 1.34
 /usr/local/gnu/lib/gcc-cc1 /tmp/cc023461.cpp -quiet -dumpbase bug.c -version -o bug.s
GNU C version 1.34 (vax) compiled by GNU C version 1.34.
bug.c: In function a:
bug.c:4: warning: assignment of pointer from integer lacks a cast
bug.c:8: warning: return of pointer from integer lacks a cast
Technical Details
Message-ID: <8903251918.AA23971@notecnirp.Princeton.EDU>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!PRINCETON.EDU!drh

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!tut.cis.ohio-state.edu!PRINCETON.EDU!drh
From: drh@PRINCETON.EDU (Dave Hanson)
Newsgroups: gnu.gcc.bug
Subject: int *x = (u(),0)
Message-ID: <8903251918.AA23971@notecnirp.Princeton.EDU>
Date: 25 Mar 89 19:18:03 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 23