------- Comment #9 from mh+gcc at glandium dot org 2010-09-15 11:45 ------- Created an attachment (id=21798) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21798&action=view) Reduced testcase
Both issues Taras mentioned are actually separated. One is an actual bug in ffi (to be filed), the other one is an optimization issue with gcc. I reduced the problematic code to the attached code, which prints "foo" with -O1 (and more), and "bar" with -O0, with gcc 4.5.1. gcc 4.4 compiled code correctly prints "bar" with any optimization level. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45623