www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/09/14:24:44

Message-Id: <m0wPoem-000S1mC@natacha.inti.edu.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT edu DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT edu DOT ar>
Organization: INTI
To: djgpp AT delorie DOT com
Date: Fri, 9 May 1997 15:38:02 +0000
MIME-Version: 1.0
Subject: C++ front end bug

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" <dwmoore AT clark DOT net> 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 <stdio.h>

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019