From: mrs@cygnus.com (Mike Stump)
Subject: Re: Compiler error in "?: " and fprintf.
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 15 Sep 1992 07:49:02 GMT

This problem should not exist in the next release of gcc.

The second one is fixed in InterViews 3.1 beta3.  (Not released yet.)

> From: kevin@tamri.com (Kevin Dalley)
> In-Reply-To: ebubra@anah.ericsson.COM's message of Wed, 17 Jun 1992 00:50:28 GMT
> Message-Id: <KEVIN.92Jun24183718@polkacide.tamri.com>
> Reply-To: kevin@tamri.com
> Organization: TOSHIBA America MRI, South San Francisco, CA
> References: <9206170050.AA00997@proton.ebu.ericsson.se>
> Date: Thu, 25 Jun 92 01:37:21 GMT
> Apparently-To: gnu-g++-bug@uunet.uu.net
> To: bug-g++@prep.ai.mit.edu

> This bug report consists of two bugs.  The second one is a problem in the
> source code.  It needs:

> #include <stdio.h>

> The first bug, however is more serious:

> I'm using gcc-2.2.2 on an SGi 4D/35 running Irix 4.0.1
> I compiled gcc using configure mips-sgi-irix4, using the standard distribution.

> Here's a simple file that produces the bug.  It contains an error
> message about assignment between incompatible types, even though fred
> and test are the same type.  Curiously, this same program works as a C
> program using the same compiler, gcc-2.2.2

> polkacide$ cat abcd.cc
> main(void)
> {
>     char *test = 0;
>     char *fred = "fred";
>     test = (test == 0)? "a" : fred ;
> }
> polkacide$ gcc -E abcd.cc
> # 1 "abcd.cc"
> main(void)
> {
>     char *test = 0;
>     char *fred = "fred";
>     test = (test == 0)? "a" : fred ;
> }
> polkacide$ gcc -v abcd.cc
> Reading specs from /usr/local/lib/gcc-lib/mips-sgi-irix4/2.2.2/specs
> gcc version 2.2.2
>  /usr/local/lib/gcc-lib/mips-sgi-irix4/2.2.2/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dunix -Dmips -Dsgi -DSVR3 -Dhost_mips -DMIPSEB -DSYSTYPE_SYSV -D__unix__ -D__mips__ -D__sgi__ -D__SVR3__ -D__host_mips__ -D__MIPSEB__ -D__SYSTYPE_SYSV__ -D__unix -D__mips -D__sgi -D__SVR3 -D__host_mips -D__MIPSEB -D__SYSTYPE_SYSV -D__CHAR_UNSIGNED__ -D__EXTENSIONS__ -D_MIPSEB -D_SYSTYPE_SYSV -D_LANGUAGE_C_PLUS_PLUS abcd.cc /usr/tmp/cca18797.i
> GNU CPP version 2.2.2 [AL 1.1, MM 19] Silicon Graphics Mips
>  /usr/local/lib/gcc-lib/mips-sgi-irix4/2.2.2/cc1plus /usr/tmp/cca18797.i -quiet -dumpbase abcd.cc -version -o /usr/tmp/cca18797.s
> GNU C++ version 2.2.2 [AL 1.1, MM 19] Silicon Graphics Mips compiled by GNU C version 2.2.2.
> abcd.cc: In function `int  main ()':
> abcd.cc:5: assignment between incompatible pointer types




> >>>>> On Wed, 17 Jun 1992 00:50:28 GMT, ebubra@anah.ericsson.COM (Bertil Askelid 6344) said:

> Bertil>    [this is the first time I send a bug report to you. If you need more
> Bertil>    information, please let me know.]

> Bertil>    I am trying to compile InterViews-3.0.1 (with usual patches applied)
> Bertil>    on a Sparc-IPX running SunOs 4.1.1 using gcc-2.2.2 and libg++-2.1. I
> Bertil>    get the following errors. The first error can easily be circumvented
> Bertil>    by using an "if" instead, but the second one looks more tricky. 
> Bertil>    
> Bertil> g++    -Dcplusplus_2_1 -Div2_6_compatible   -I../../../.././src/include/InterViews/2.6 -I../../../.././src/include/IV-look/2.6 -I../../../.././src/include -I/home/springfield0/ebubra/Verktyg/X11/include    -c ../catcmds.c
> Bertil> ./catcmds.c: In method `void  ViewCompCmd::Execute ()':
> Bertil> ./catcmds.c:271: assignment between incompatible pointer types

> Bertil>       .../iv/src/lib/Unidraw/catcmds.c:
> Bertil>          ...
> Bertil>          void ViewCompCmd::Execute () {
> Bertil>             ...
> Bertil>             const char* domain = unidraw->GetCatalog()->GetAttribute("domain");
> -271->      domain = (domain == nil) ? "component" : domain;
> Bertil>             ...

> Bertil>    This looks like a COMPILER ERROR to me -- it worked for gcc-2.1 and
> Bertil>    libg++-2.0 ! 
> Bertil>       
> Bertil> g++ -Dcplusplus_2_1 -Div2_6_compatible
> Bertil> -I../../../.././src/include/InterViews/2.6
> Bertil> -I../../../.././src/include/IV-look/2.6
> Bertil> -I../../../.././src/include
> Bertil> -I/home/springfield0/ebubra/Verktyg/X11/include -c
> Bertil> ../idcatalog.c ./idcatalog.c: In method `class GraphicComp*
> Bertil> IdrawCatalog::ReadPostScript (class istream&)':
> Bertil> ./idcatalog.c:178: warning: implicit declaration of function
> Bertil> `fprintf' ./idcatalog.c:178: `stderr' undeclared (first use
> Bertil> this function) ./idcatalog.c:178: (Each undeclared identifier
> Bertil> is reported only once ./idcatalog.c:178: for each function it
> Bertil> appears in.)  ./idcatalog.c: In method `void
> Bertil> IdrawCatalog::PSReadChildren (class istream&, class
> Bertil> GraphicComp*)': ./idcatalog.c:266: `stderr' undeclared (first
> Bertil> use this function) ./idcatalog.c: In method `void
> Bertil> IdrawCatalog::PSReadPattern (class istream&, class Graphic*)':
> Bertil> ./idcatalog.c:658: warning: implicit declaration of function
> Bertil> `sscanf' *** Error code 1

Newsgroups: gnu.g++.bug