public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/47457] New: g++ calls without optimisation incorrectly from explicitly optimised code
@ 2011-01-25 13:30 vas.gurevich at gmail dot com
  2011-01-25 13:41 ` [Bug c++/47457] " vas.gurevich at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: vas.gurevich at gmail dot com @ 2011-01-25 13:30 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-08-30  1:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-25 13:30 [Bug c++/47457] New: g++ calls without optimisation incorrectly from explicitly optimised code vas.gurevich at gmail dot com
2011-01-25 13:41 ` [Bug c++/47457] " vas.gurevich at gmail dot com
2011-01-25 13:46 ` vas.gurevich at gmail dot com
2011-01-25 13:54 ` juha.kallioinen at nokia dot com
2011-01-25 14:00 ` redi at gcc dot gnu.org
2011-01-25 14:11 ` vas.gurevich at gmail dot com
2011-01-25 16:39 ` [Bug target/47457] " rguenth at gcc dot gnu.org
2021-08-30  1:36 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).