Re: double argument casting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



laurent <laurent.poche@xxxxxxxxx> writes:

> When a caller function calls a callee function with short or char
> arguments, the arguments are casted twice: inside the caller function
> and inside the callee function, see the example. It is a waste of
> performance in code density and speed!
>
> I don't understand why there is a double casting.  Is there any
> optimization I could activate in GCC to remove it?

It's basically a bug.  gcc should only do it on the caller side.  Doing
it on the callee side is a holdover from the good pre-C90 days, when
code like

int f(i)
    char i;
{
  ...
}

had to be treated as equivalent to

int f(int passed_i)
{
  char i = (char) passed_i;
  ...
}

These days I think we can just drop the cast on the callee side.  As I
recall that was done for x86 a while back, somebody just needs to do it
for SPARC.

Please file a bug report according to the instructions at
http://gcc.gnu.org/bugs/ (unless there is already a bug report for
this).  Thanks.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux