[Bug c/42231] New: [4.4.x Regression] Wrong generated code when using a callback function (possible callback function inlining bug ?)

roche+gccbugs at exalead dot com gcc-bugzilla@gcc.gnu.org
Mon Nov 30 14:27:00 GMT 2009


Bug reproduced with GCC 4.4.2 and GCC 4.4.1, on x86_64.

The following simple test program should succeed (EXIT_SUCCESS return code from
main()), but fails with GCC 4.4.2 when compiling with -O3.

The program succeed with "-O2", _AND_ "-O2 -finline-functions -funswitch-loops
-fpredictive-commoning -fgcse-after-reload -ftree-vectorize" (which is supposed
to be the same as -O3, according to the manual, but there must be some
additional optimization out there)

The problem might be related to some inlining magic of the callback function,
because
* if you remove the "&& !fun(0);" in the CallFunction() function, the program
works again.
* if you change the function arguments "int depth" into "const int depth", the
program works again
* when the program works (for example, by adding "const" to the function
arguments), the callback function "callback" is NOT inlined


-- 
           Summary: [4.4.x Regression] Wrong generated code when using a
                    callback function (possible callback function inlining
                    bug ?)
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: roche+gccbugs at exalead dot com
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42231



More information about the Gcc-bugs mailing list