Public bug reported: Hi,
I've upgraded to Ubuntu 12.10 on Intel i7 2600 (64-bit version) and -as a developer- compiled SWI-Prolog using the standard gcc 4.7 compiler. All seems to work, except for the `semweb' package. It works with compiled without optimization, but fails at -O2. After a bit searching with gdb, it appears that a structure assignment is simply omitted. I've forced it to work by adding a dummy function and call this using the structure field as argument. Not sure how to report this as building the whole system is a bit work. So, I'll first provide a pointer to the work-around commit. This can be found at the address below. The first change is irrelevant, but indicates the location of the missing assignment. http://www.swi- prolog.org/git/packages/semweb.git/blobdiff/192d052db9b7c44519723fa3186a5786a1562127..af7fb1bb50ec30295bc2e1a7473bbe36ee0c03bf:/rdf_db.c The dummy function itself is simply #if __GNUC__ == 4 && __GNUC_MINOR__ == 7 void gcc_47_dummy(void *ptr) { static void *p; if ( p != ptr ) p = ptr; } #endif Of course, I know that adding dummy calls can make the difference without the compiler being at fault, but - I can see in gdb that the assignment is not done without the hack. Of course, I also know that gdb sometimes does weird things with optimized code. Adding a print statement fixes the problem ... The failed assignment does however explain subsequent (wrong) behaviour. I'll leave it here, providing further details as deemed necessary on request. Thanks --- Jan ** Affects: gcc-4.7 (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1074662 Title: Optimized code fails to assign struct member To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/gcc-4.7/+bug/1074662/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs