Trying to compile SWI-Prolog (www.swi-prolog.org) on Debian-Alpha the
following is not compiled correctly (function initPrologThreads())

  info = &threads[1];
  info->tid = pthread_self();
  info->pl_tid = 1;                      // this assignment is simply not done
  info->thread_data = &PL_local_data;
  info->status = PL_THREAD_RUNNING;
  PL_local_data.thread.info = info;
  PL_local_data.thread.magic = PL_THREAD_MAGIC;

Swapping the last two lines just below the first is a `work around'.

Compiled with the commandline:

gcc -c -I. -I/home/wielemaker/src/pl/src -I/home/wielemaker/src/pl/src/rc -Wall
-O3 -fno-strict-aliasing -mieee pl-thread.c -o pl-thread.o

$ gcc -v
Using built-in specs.
Target: alphaev67-unknown-linux-gnu
Configured with: ../gcc-4.0.2/configure --prefix=/usr/local
Thread model: posix
gcc version 4.0.2

I'll attach pl-thread.i.  If you need the full source, please download
version 5.6.6 tarball from www.swi-prolog.org.  There have been some patches
since, but the bug reproduces on that version.


-- 
           Summary: Using -O3, doesn't assign in a pointer to a global
                    structure
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wielemak at science dot uva dot nl
 GCC build triplet: alphaev67-unknown-linux-gnu
  GCC host triplet: alphaev67-unknown-linux-gnu
GCC target triplet: alphaev67-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26511

Reply via email to