🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1954

gcc typecheck bug

#1954
From: Jean-Daniel FEKETE
Date: Mon, 21 Nov 1988 07:27
56 lines
1455 bytes
The following code outputs a warning in gcc 1.30 :
gcc -O -W -S foo.c

----------------------------------------------------------------------
typedef int func_typed(struct _object *);


struct _object {
  func_typed *fn;
};

typedef struct _object object;

object o;

int doit_on(obj)
     object *obj;
{
  
  int b;
  b = (* o.fn)(obj);
  /* it says : warning: argument passing between incompatible pointer types */
  bar(b);			/* this is to avoid optimization maybe */
  return b;
}
     
----------------------------------------------------------------------

whereas the following does not:

----------------------------------------------------------------------

struct _object {
  int	(* fn)(struct _object *);
};

typedef struct _object object;

object o;

int doit_on(obj)
     object *obj;
{
  
  int b;
  b = (* o.fn)(obj);
  bar(b);			/* this is to avoid optimization maybe */
  return b;
}
     
----------------------------------------------------------------------

	strange isn't it ?

		Jean-Daniel.
Technical Details
Message-ID: <8811210727.AA23168@litp.unip6-7.fr>
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!UUNET.UU.NET!mcvax!litp!jdf

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!mcdchg!rutgers!tut.cis.ohio-state.edu!UUNET.UU.NET!mcvax!litp!jdf
From: mcvax!litp!jdf@UUNET.UU.NET (Jean-Daniel FEKETE)
Newsgroups: gnu.gcc.bug
Subject: gcc typecheck bug
Message-ID: <8811210727.AA23168@litp.unip6-7.fr>
Date: 21 Nov 88 07:27:43 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 56