#31 Patch for GCC 4.7

Jerry James

I maintain the Fedora Clisp package. We were recently asked to compile all of our packages with what will soon be GCC 4.7, in order to find bugs. Clisp built, but failed a socket test on 32-bit x86. The current code uses a get_hostname() macro in socket.d that is unsafe. It creates a character array on the stack, saves a pointer to the first element of the array, exits the scope in which the array is defined, then accesses the (now out of scope) array via the pointer. A C compiler is free to reuse the stack space of out of scope variables, and it appears that GCC 4.7 does in fact do so, at least on 32-bit x86. This is the patch I applied to the Fedora build of Clisp in order to address this issue.


  • Jerry James

    Jerry James - 2012-01-17

    Patch to fix accessing an out of scope array

  • Sam Steingold

    Sam Steingold - 2012-01-17
    • assigned_to: nobody --> haible
  • Sam Steingold

    Sam Steingold - 2012-02-02

    I applied a slightly different patch.

  • Sam Steingold

    Sam Steingold - 2012-02-02
    • assigned_to: haible --> sds
    • status: open --> closed-accepted

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks