#1016 Functions modifying parameters by asm inline incorrectly

gcc (462)

The included file produces a segfault during execution when compiled with -O1 -finline-functions. It does not segfault when compiled with -finline-options and all the options that make up -O1 as per http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

The function "foo" will segfault if called with a parameter other than 1. Analysis of the compiler output shows that GCC does not restore the value of the "bar" parameter if consecutive calls to the function "foo" are inlined.


  • Krzysztof Kosiński

    Program demonstrating the bug, compile with -O1 -finline-functions

  • Krzysztof Kosiński

    Logged In: YES
    Originator: YES

    System: Windows XP
    GCC version: 3.4.2 (mingw-special)

  • Krzysztof Kosiński

    • summary: Certain functions fail when inlined --> Functions modifying parameters by asm inline incorrectly
  • Danny Smith

    Danny Smith - 2007-03-19
    • status: open --> closed-wont-fix
  • Danny Smith

    Danny Smith - 2007-03-19

    Logged In: YES
    Originator: NO

    Fixed in later versions of gcc. GCC-3.4.2 won't be fixed.

    gcc-3.4.5 -O1 -finline-functions -c test.c works fine.
    This is available in Candidate section of SF Files page.

    gcc-4.2.0 -01 -finline-functions -c test.c works fine.
    Mingw binaries of this will be uploaded as soon as officially released by FSF.


  • Earnie Boyd

    Earnie Boyd - 2013-01-23
    • status: closed-wont-fix --> closed
    • resolution: --> wont-fix
    • category: --> component_package
    • milestone: --> OTHER

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