This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, BUILDROBOT] SH: Fix unused variable warning (was: [SH][committed] PR 53513 - Add __builtin_sh_get_fpscr, __builtin_sh_set_fpscr)





On 4 Nov 2014, at 11:50, Jan-Benedict Glaw <jbglaw@lug-owl.de> wrote:

> On Sat, 2014-10-18 12:54:33 +0200, Oleg Endo <oleg.endo@t-online.de> wrote:
>> Hi,
>> 
>> As discussed in the PR, this adds two new SH built-in functions
>> __builtin_sh_get_fpscr __builtin_sh_set_fpscr.  Tested on r216173 with  
>> 
>> make -k check RUNTESTFLAGS="--target_board=sh-sim\{-m4/-ml,-m4/-mb}"
>> 
>> and no new failures.  Committed as r216424.
>> 
>> Cheers,
>> Oleg
>> 
>> gcc/ChangeLog:
>>    PR target/53513
>>    * config/sh/sh-modes.def (PSI): Remove.
>>    * config/sh/sh-protos.h (get_fpscr_rtx): Remove.
>>    * config/sh/sh.c (fpscr_rtx, get_fpscr_rtx): Remove.
>>    (sh_reorg): Remove commented out FPSCR code.
>>    (fpscr_set_from_mem): Use SImode instead of PSImode.  Emit lds_fpscr
>>    insn instead of move insn.
>>    (sh_hard_regno_mode_ok): Return SImode for FPSCR.
>>    (sh_legitimate_address_p, sh_legitimize_reload_address): Remove PSImode
>>    handling.
>>    (sh_emit_mode_set): Emit lds_fpscr and sts_fpscr insns.
>>    (sh1_builtin_p): Uncomment.
>>    (SH_BLTIN_UV 25, SH_BLTIN_VU 26): New macros.
>>    (bdesc): Add __builtin_sh_get_fpscr and __builtin_sh_set_fpscr.
> 
> Change to emit_fpu_switch() is missing here.
> 
>> Index: gcc/config/sh/sh.c
>> ===================================================================
>> --- gcc/config/sh/sh.c    (revision 216350)
>> +++ gcc/config/sh/sh.c    (working copy)
> 
> This chunk is in emit_fpu_switch(), which drops every reference to
> `dst':
>> @@ -10055,13 +10032,12 @@
>>       emit_move_insn (scratch, XEXP (src, 0));
>>       if (index != 0)
>>    emit_insn (gen_addsi3 (scratch, scratch, GEN_INT (index * 4)));
>> -      src = adjust_automodify_address (src, PSImode, scratch, index * 4);
>> +      src = adjust_automodify_address (src, SImode, scratch, index * 4);
>>     }
>>   else
>> -    src = adjust_address (src, PSImode, index * 4);
>> +    src = adjust_address (src, SImode, index * 4);
>> 
>> -  dst = get_fpscr_rtx ();
>> -  emit_move_insn (dst, src);
>> +  emit_insn (gen_lds_fpscr (src));
>> }
>> 
>> static rtx get_free_reg (HARD_REG_SET);
> 
> ...which in turn results in fall-out when simply building it with
> config-list.mk, see eg.
> http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=372472 :
> 
> [...]
> g++ -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../../gcc/gcc -I../../../gcc/gcc/. -I../../../gcc/gcc/../include -I../../../gcc/gcc/../libcpp/include -I/opt/cfarm/mpc/include  -I../../../gcc/gcc/../libdecnumber -I../../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../../gcc/gcc/../libbacktrace    -o sh.o -MT sh.o -MMD -MP -MF ./.deps/sh.TPo ../../../gcc/gcc/config/sh/sh.c
> ../../../gcc/gcc/config/sh/sh.c: In function ‘void emit_fpu_switch(rtx, int)’:
> ../../../gcc/gcc/config/sh/sh.c:10027:7: error: unused variable ‘dst’ [-Werror=unused-variable]
>   rtx dst, src;
>       ^
> cc1plus: all warnings being treated as errors
> make[2]: *** [sh.o] Error 1
> 
> This should fix it, ok for mainline?

Yes, OK.  Thanks for catching it.

Cheers,
Oleg


> 
> 2014-11-04  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
> 
>    * config/sh/sh.c (emit_fpu_switch): Drop unused automatic variable.
> 
> 
> diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
> index 3a4f5e9..be944da 100644
> --- a/gcc/config/sh/sh.c
> +++ b/gcc/config/sh/sh.c
> @@ -10024,7 +10024,7 @@ static GTY(()) tree fpscr_values;
> static void
> emit_fpu_switch (rtx scratch, int index)
> {
> -  rtx dst, src;
> +  rtx src;
> 
>   if (fpscr_values == NULL)
>     {
> 
> 
> 
> MfG, JBG
> 
> -- 
>      Jan-Benedict Glaw      jbglaw@lug-owl.de              +49-172-7608481
> Signature of:            http://www.chiark.greenend.org.uk/~sgtatham/bugs.html
> the second  :


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]