Date: Mon, 12 May 1997 11:33:01 -0400 (EDT) From: "Art S. Kagel" To: "Salvador Eduardo Tropea (SET)" Cc: djgpp AT delorie DOT com Subject: Re: C++ front end bug In-Reply-To: Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Fri, 9 May 1997, Salvador Eduardo Tropea (SET) wrote: > Hi everybody: > > Here SET again with bad news. I'm comunicating bugs of GCC to the list > because it can affect to somebody and I know how hard is to find a bug in > a program when the fault is in the compiler. > "Daniel W. Moore" reported a bug to the FSF in the C++ > front end. Looks like a bug but perhaps is something related to C++. > The following code outputs different results in C and C++. GCC just says > that (void *)aa isn't equal to (void*)&aa, but if we ask for the value of > each expression it return the same number. > So is that a bug or is something related to C++? From my point of view the > cast to (void *) must kill any difference and hence that's a bug. > > #include > > int aa[3]={7,8,9}; > > main() > { > int i; > > /* the following statements should print the same value twice */ > printf("(void *)aa is %X and (void*)&aa is %X so they are %s equal!?!\n", > (void *)aa,(void*)&aa,((void*) aa != (void*) &aa) ? "not" : ""); > > i = (((void*) aa != (void*) &aa) ? 0 : sizeof(aa)); > printf(" %d\n", i); > > i = (((void*) aa == (void*) &aa) ? sizeof(aa) : 0); > printf(" %d\n", i); > > return 0; > } > ------------------------------------ 0 -------------------------------- > Visit my home page: http://www.geocities.com/SiliconValley/Vista/6552/ > Salvador Eduardo Tropea (SET). (Electronics Engineer) > Address: Curapaligue 2124, Caseros, 3 de Febrero > Buenos Aires, (1678), ARGENTINA > TE: +(541) 759 0013 > I have verified that this is a G++ 'problem'. It shows the same results on DG/UX gcc/g++ as SET describes. Weird! Art S. Kagel, kagel AT bloomberg DOT com