https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122925

--- Comment #5 from Krister Walfridsson <kristerw at gcc dot gnu.org> ---
Created attachment 62955
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62955&action=edit
Assembly output

I have attached the assembly I get from compiling with:
  sh-elf-gcc -O3 -S pr122925.c

The assembly for the body of _foo looks correct to me, but it appears that foo
and main do not agree on the type of the argument b. foo uses r5 as if it holds
a zero-extended 16-bit value, while main passes it as
  mov #-1,r5

Adding
  extu.w  r5, r5
at the beginning of _foo solves the problem.

Reply via email to