This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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]

Fix to gas/cgen.c to avoid a compile time warning


Hi Guys,

  Rebuilding various toolchains after enabling -Werror I came across a
  compile time warning in gas/cgen.c:

   cgen.c:315: warning: argument 'opinfo' might be clobbered by `longjmp' or `vfork'

  So I am applying the attached patch to work around this problem in
  the same way that it has been avoided with other arguments to the
  gas_cgen_parse_operand() function.

Cheers
  Nick

gas/ChangeLog
2005-03-16  Nick Clifton  <nickc@redhat.com>

	* cgen.c (gas_cgen_parse_operand): Copy opinfo parameter into a
	local variable in case it is clobbered by the setjmp.

Index: gas/cgen.c
===================================================================
RCS file: /cvs/src/src/gas/cgen.c,v
retrieving revision 1.26
diff -c -3 -p -r1.26 cgen.c
*** gas/cgen.c	23 Feb 2005 12:28:02 -0000	1.26
--- gas/cgen.c	16 Mar 2005 18:04:05 -0000
*************** gas_cgen_parse_operand (cd, want, strP, 
*** 320,328 ****
--- 320,330 ----
    /* These are volatile to survive the setjmp.  */
    char * volatile hold;
    enum cgen_parse_operand_result * volatile resultP_1;
+   volatile int opinfo_1;
  #else
    static char *hold;
    static enum cgen_parse_operand_result *resultP_1;
+   int opinfo_1;
  #endif
    const char *errmsg;
    expressionS exp;
*************** gas_cgen_parse_operand (cd, want, strP, 
*** 336,341 ****
--- 338,344 ----
    resultP_1 = resultP;
    hold = input_line_pointer;
    input_line_pointer = (char *) *strP;
+   opinfo_1 = opinfo;
  
    /* We rely on md_operand to longjmp back to us.
       This is done via gas_cgen_md_operand.  */
*************** gas_cgen_parse_operand (cd, want, strP, 
*** 356,362 ****
    input_line_pointer = hold;
  
  #ifdef TC_CGEN_PARSE_FIX_EXP
!   opinfo = TC_CGEN_PARSE_FIX_EXP (opinfo, & exp);
  #endif 
  
    /* FIXME: Need to check `want'.  */
--- 359,365 ----
    input_line_pointer = hold;
  
  #ifdef TC_CGEN_PARSE_FIX_EXP
!   opinfo = TC_CGEN_PARSE_FIX_EXP (opinfo_1, & exp);
  #endif 
  
    /* FIXME: Need to check `want'.  */
*************** gas_cgen_parse_operand (cd, want, strP, 
*** 383,389 ****
        break;
      de_fault:
      default:
!       queue_fixup (opindex, opinfo, &exp);
        *valueP = 0;
        *resultP = CGEN_PARSE_OPERAND_RESULT_QUEUED;
        break;
--- 386,392 ----
        break;
      de_fault:
      default:
!       queue_fixup (opindex, opinfo_1, &exp);
        *valueP = 0;
        *resultP = CGEN_PARSE_OPERAND_RESULT_QUEUED;
        break;

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