This is the mail archive of the gcc-bugs@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]

[Bug c++/47457] New: g++ calls without optimisation incorrectly from explicitly optimised code


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

           Summary: g++ calls without optimisation incorrectly from
                    explicitly optimised code
           Product: gcc
           Version: 4.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vas.gurevich@gmail.com


Created attachment 23116
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23116
preprocessed source

When build this code without optimisation, like that,
g++ -o optimizetest optimizetest.cpp
looks like function call from optimised function passes wrong parameters to
static inline function

#include <stdio.h>

static inline void bar(int a)
{
    printf("%d\n", a);
}

void foo() __attribute__((optimize("O2")));

void foo()
{
    int a = 10;
    bar(a);
}

int main(int, char**)
{
    foo();
    return 0;
}

If compile with more than 0 optimisation level this works fine and prints 10,
otherwise when compile without optimisation this produces garbage instead of
10.


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