[Patch, MIPS] Remove definition of TARGET_PROMOTE_PROTOTYPES

Matthew Fortune Matthew.Fortune@imgtec.com
Sat Dec 12 08:53:00 GMT 2015


Steve Ellcey <Steve.Ellcey@imgtec.com> writes:
> On Tue, 2015-11-10 at 15:57 -0800, Steve Ellcey wrote:
> > 2015-11-10  Steve Ellcey  <sellcey@imgtec.com>
> >
> > 	* config/mips/mips.c (mips_promote_function_mode): New function.
> > 	(TARGET_PROMOTE_FUNCTION_MODE): Define as above function.
> > 	(TARGET_PROMOTE_PROTOTYPES): Remove.

I'm OK with this change on the basis that MIPS has been providing stronger
guarantees than required by the various standards. I.e. after this change
MIPS will have undefined behaviour for a mismatch in types between a
call to an un-prototyped function and its definition:

extern void foo();

void caller(int a)
{
  foo(a);
}

--

void foo(short a)
{
  // the value of 'a' can be out of range of a short because the caller
  // did not get the right type for the argument.
}

Thanks,
Matthew



More information about the Gcc-patches mailing list