🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1236

(expr?f: g)(arg) bug

#1236
From: Doug Moore
Date: Mon, 23 Nov 1992 22:30
91 lines
3568 bytes
The program that follows successfully compiles and runs as expected
under gcc 2.3.1 (patched).  Under g++ 2.3.1, however, it produces a
compiler fault.  It is not clear whether the operation it attempts to
perform is valid C++, or a documented extension in gcc, or an invalid
operation that gcc accidentally accepts.  Anyway, any compiler fault
is bad.

The compiler output:
===========================================================================
cd /home/dougm/
g++ -v -Wall bug.cc
Reading specs from /blossom/lib/gcc-lib/sun4/2.3.1/specs
gcc version 2.3.1
 /blossom/lib/gcc-lib/sun4/2.3.1/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix -Wall bug.cc /usr/tmp/cca27267.i
GNU CPP version 2.3.1 (sparc)
 /blossom/lib/gcc-lib/sun4/2.3.1/cc1plus /usr/tmp/cca27267.i -quiet -dumpbase bug.cc -Wall -version -o /usr/tmp/cca27267.s
GNU C++ version 2.3.1 (sparc) compiled by GNU C version 2.3.1.
bug.cc: In function `int  main (int, char **)':
bug.cc:13: not enough type information
/blossom/bin/sun4/gcc: Internal compiler error: program cc1plus got fatal signal 10

Compilation exited abnormally with code 1 at Mon Nov 23 16:28:56
===========================================================================

The program:
===========================================================================
int foo(int x)
{
  return x;
}

int baz(int x)
{
  return x+1;
}

int main(int argc, char** argv)
{
  int x = ((argc-1)? foo: baz)(4);
  return x;
}
===========================================================================

The compilation is on a Sparc running SunOS 4.1.2.

The patches applied to the 2.3.1 source are from the net, and appeared
with these headings:

From: eggert@twinsun.COM (Paul Eggert)
Newsgroups: gnu.gcc.bug
Subject: enquire 4.3 (GCC 2.3.1) generates some garbage bits in float.h
Date: 2 Nov 92 22:08:31 GMT

From: eggert@twinsun.COM (Paul Eggert)
Newsgroups: gnu.gcc.bug
Subject: typo in fold-const.c prevents GCC 2.3.1 from catching some overflows
Date: 2 Nov 92 23:54:39 GMT

From: eggert@twinsun.COM (Paul Eggert)
Newsgroups: gnu.gcc.bug
Subject: LDBL_MIN etc should be constant exprs (GCC 2.3.1, enquire 4.3, sparc)
Date: 2 Nov 92 22:31:15 GMT

From: cliff@cs.cornell.edu (Cliff Krumvieda)
Newsgroups: gnu.gcc.bug
Subject: index, rindex, and gcc-2.3.1
Date: 2 Nov 92 12:09:18 GMT

From: eggert@twinsun.COM (Paul Eggert)
Newsgroups: gnu.gcc.bug
Subject: GCC 2.3.1 overlooks int overflow in constant expressions
Date: 3 Nov 92 01:33:26 GMT

From: cliff@cs.cornell.edu (Cliff Krumvieda)
Newsgroups: gnu.gcc.bug
Subject: more on index, rindex, and gcc-2.3.1
Date: 2 Nov 92 16:43:13 GMT

From: gb@cs.purdue.edu (Gerald Baumgartner)
Newsgroups: gnu.g++.bug
Subject: GCC 2.3.1: incorrect error reporting in cp-decl.c, includes bug fix
Date: 2 Nov 92 20:15:13 GMT

From: eric@pau.synnet.com (Eric Baur)
Newsgroups: gnu.gcc.bug
Subject: gcc-2.3.1 build problem under i386-mach
Date: 3 Nov 92 19:01:53 GMT

If you have further questions, contact
Doug Moore
(dougm@cs.rice.edu)
Technical Details
Message-ID: <9211232230.AA27306@cs.rice.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.rice.edu!dougm

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.rice.edu!dougm
From: dougm@cs.rice.edu (Doug Moore)
Subject: (expr?f: g)(arg) bug
Message-ID: <9211232230.AA27306@cs.rice.edu>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 23 Nov 1992 22:30:37 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 92