This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/47457] New: g++ calls without optimisation incorrectly from explicitly optimised code
- From: "vas.gurevich at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 25 Jan 2011 13:20:46 +0000
- Subject: [Bug c++/47457] New: g++ calls without optimisation incorrectly from explicitly optimised code
- Auto-submitted: auto-generated
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.