🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

GCC-2.2.2, build_method_call: incorrect calculation of type info?

#982
From: Gerald Baumgartner
Date: Sun, 27 Sep 1992 04:46
37 lines
1628 bytes
In cp-call.c, build_method_call, there is the following code for
computing the type of a class instance:

    {
      /* The MAIN_VARIANT of the type that `instance_ptr' winds up being.  */
      tree inst_ptr_basetype;

      ...

	      /* @@ Should we call comp_target_types here?  */
	      inst_ptr_basetype = TREE_TYPE (TREE_TYPE (instance_ptr));
	      if (TYPE_MAIN_VARIANT (basetype) == TYPE_MAIN_VARIANT (inst_ptr_basetype))
		basetype = inst_ptr_basetype;
	      else
		{
		  instance_ptr = convert (TYPE_POINTER_TO (basetype), instance_ptr);
		  if (instance_ptr == error_mark_node)
		    return error_mark_node;
		}
	    }
	  else
	    inst_ptr_basetype = TREE_TYPE (TREE_TYPE (instance_ptr));
	}

      if (basetype_path == NULL_TREE)
	basetype_path = TYPE_BINFO (inst_ptr_basetype);

Since `inst_ptr_basetype' is supposed to be the basetype of
`instance_ptr' (according to the comment above), shouldn't it be
recomputed after `instance_ptr' is converted to
`TYPE_POINTER_TO (basetype)'?  I.e., to have

		  inst_ptr_basetype = TREE_TYPE (TREE_TYPE (instance_ptr));

after the call to `convert'?

--Gerald
Technical Details
Message-ID: <19732@ector.cs.purdue.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.purdue.edu!gb

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cs.purdue.edu!gb
From: gb@cs.purdue.edu (Gerald Baumgartner)
Subject: GCC-2.2.2, build_method_call: incorrect calculation of type info?
Message-ID: <19732@ector.cs.purdue.edu>
Sender: gnulists@ai.mit.edu
Organization: Department of Computer Science, Purdue University
Distribution: gnu
Date: Sun, 27 Sep 1992 04:46:38 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 38