Re: cvs head initdb hangs on unixware - Mailing list pgsql-hackers

From Tom Lane
Subject Re: cvs head initdb hangs on unixware
Date
Msg-id 18738.1228847061@sss.pgh.pa.us
Whole thread Raw
In response to cvs head initdb hangs on unixware  (ohp@pyrenet.fr)
Responses Re: cvs head initdb hangs on unixware
List pgsql-hackers
ohp@pyrenet.fr writes:
> FWIW, I have attached the 2 generated .s. Someone with knowledge of asm
> may want to have a look..

Hmm.  It looks to me like the compiler is getting confused by the
interaction between nodeno, leftnodeno, and rightnodeno.  Try this
patch to see if it gets around it.  (This is a tad better anyway
since it avoids examining the right child if not needed.)

            regards, tom lane

Index: fsmpage.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/storage/freespace/fsmpage.c,v
retrieving revision 1.2
diff -c -r1.2 fsmpage.c
*** fsmpage.c    7 Oct 2008 21:10:11 -0000    1.2
--- fsmpage.c    9 Dec 2008 18:18:53 -0000
***************
*** 243,259 ****
       */
      while (nodeno < NonLeafNodesPerPage)
      {
!         int leftnodeno = leftchild(nodeno);
!         int rightnodeno = leftnodeno + 1;
!         bool leftok = (leftnodeno < NodesPerPage) &&
!             (fsmpage->fp_nodes[leftnodeno] >= minvalue);
!         bool rightok = (rightnodeno < NodesPerPage) &&
!             (fsmpage->fp_nodes[rightnodeno] >= minvalue);
!
!         if (leftok)
!             nodeno = leftnodeno;
!         else if (rightok)
!             nodeno = rightnodeno;
          else
          {
              /*
--- 243,262 ----
       */
      while (nodeno < NonLeafNodesPerPage)
      {
!         int childnodeno = leftchild(nodeno);
!
!         if (childnodeno < NodesPerPage &&
!             fsmpage->fp_nodes[childnodeno] >= minvalue)
!         {
!             nodeno = childnodeno;
!             continue;
!         }
!         childnodeno++;            /* point to right child */
!         if (childnodeno < NodesPerPage &&
!             fsmpage->fp_nodes[childnodeno] >= minvalue)
!         {
!             nodeno = childnodeno;
!         }
          else
          {
              /*

pgsql-hackers by date:

Previous
From: "Vladimir Sitnikov"
Date:
Subject: Re: contrib/pg_stat_statements 1202
Next
From: "Robert Haas"
Date:
Subject: Re: contrib/pg_stat_statements 1202