The following patch fixes PR40900, which points out an unnecessary sign-extension for the following code: extern short shortv2(); short shortv1() { return shortv2(); } The idea is to represent the sign-extension in the RTL call patterns, choosing extending variants in calls.c when we notice a suitable promotion. Then we let combine do its work; this needed another little tweak to make sure it recorded the extension of the return register. Bootstrapped and regression tested on i686-linux. An earlier version, which had some unnecessary code and other small differences, was regression tested on arm-linux-gnueabi(qemu-system-armv7{arch=armv7-a/thumb,thumb,}). Ok? Bernd