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]

Reduce alloca 'ted memory in mips.c


Description : in gcc/config/mips/mips.c, some memory allocated with alloca
request too much. Just ask for what is needed

NOT BOOT STRAPPED.


2005-02-13  Christophe Jaillet <christophe.jaillet@wanadoo.fr>

    * mips.c (build_mips16_function_stub): reduce memory requested by alloca
to what is really needed
    * mips.c (build_mips16_call_stub): same


*** gcc-4.0-20050130/gcc/config/mips/mips.c Thu Feb 10 19:26:34 2005
--- my_patch/mips.c Sun Feb 13 18:45:32 2005
*************** build_mips16_function_stub (FILE *file)
*** 7247,7255 ****
    unsigned int f;

    fnname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
!   secname = (char *) alloca (strlen (fnname) + 20);
    sprintf (secname, ".mips16.fn.%s", fnname);
!   stubname = (char *) alloca (strlen (fnname) + 20);
    sprintf (stubname, "__fn_stub_%s", fnname);
    stubid = get_identifier (stubname);
    stubdecl = build_decl (FUNCTION_DECL, stubid,
--- 7247,7255 ----
    unsigned int f;

    fnname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
!   secname = (char *) alloca (11 + strlen (fnname) + 1);
    sprintf (secname, ".mips16.fn.%s", fnname);
!   stubname = (char *) alloca (10 + strlen (fnname) + 1);
    sprintf (stubname, "__fn_stub_%s", fnname);
    stubid = get_identifier (stubname);
    stubdecl = build_decl (FUNCTION_DECL, stubid,
*************** build_mips16_call_stub (rtx retval, rtx
*** 7471,7481 ****
        .mips16.call.fp.FNNAME
    */

!       secname = (char *) alloca (strlen (fnname) + 40);
        sprintf (secname, ".mips16.call.%s%s",
          fpret ? "fp." : "",
          fnname);
!       stubname = (char *) alloca (strlen (fnname) + 20);
        sprintf (stubname, "__call_stub_%s%s",
          fpret ? "fp_" : "",
          fnname);
--- 7471,7481 ----
        .mips16.call.fp.FNNAME
    */

!       secname = (char *) alloca (13 + strlen (fnname) + 3 + 1);
        sprintf (secname, ".mips16.call.%s%s",
          fpret ? "fp." : "",
          fnname);
!       stubname = (char *) alloca (12 + strlen (fnname) + 3 + 1);
        sprintf (stubname, "__call_stub_%s%s",
          fpret ? "fp_" : "",
          fnname);





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