On Fri, Apr 3, 2009 at 12:07 PM, Chris Lattner <clattner at apple.com> wrote:> It is impossible to tell with this amount of detail. Does it work > correctly if you build with -O0 ?Yes, with -O0 the resulting executable looks fine. --enable-debug actually sets -O0 (otherwise -O2). Clang can build/test php 5.2.9 with either -O0 or -O2, but not for php 5.3RC0 with -O2. I further looked into the php code. It seems that php 5.3 is using inline asm. Is that the reason? - xi
What version of clang are you using? It could be a regression between head and the version I used. (some days old) - Anders On Fri, Apr 3, 2009 at 6:37 PM, Xi Wang <xi.wang at gmail.com> wrote:> On Fri, Apr 3, 2009 at 12:07 PM, Chris Lattner <clattner at apple.com> wrote: >> It is impossible to tell with this amount of detail. Does it work >> correctly if you build with -O0 ? > > Yes, with -O0 the resulting executable looks fine. --enable-debug > actually sets -O0 (otherwise -O2). > > Clang can build/test php 5.2.9 with either -O0 or -O2, but not for php > 5.3RC0 with -O2. I further looked into the php code. It seems that > php 5.3 is using inline asm. Is that the reason? > > - xi > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
I tried the version you used, too. the resulting executable was still broken. I guess the reason is due to fastcall on function pointers, which Clang does not recognize. Consider the following snippet. #include <stdio.h> void __attribute__((fastcall)) f(int i) { printf("%d\n", i); } typedef void (*__attribute__((fastcall)) f_t)(int i); //typedef void __attribute__((fastcall)) (*f_t)(int i); int main() { f(42); f_t fp = f; fp(42); } Clang does not catch the attribute on f_t; instead it produces a warning "'fastcall' attribute only applies to function types". so the function pointer might be miscompiled. stdcall should cause the similar problem as well. On x64 there is no use of fastcall or stdcall. so Clang produces a correct php executable. - xi On Fri, Apr 3, 2009 at 1:20 PM, Anders Johnsen <skabet at gmail.com> wrote:> What version of clang are you using? It could be a regression between > head and the version I used. (some days old) > > - Anders