Skip site navigation (1) Skip section navigation (2)

Re: int8.c compile problem on UnixWare 7.x

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Billy G(dot) Allie" <bga(at)mug(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Billy G(dot) Allie" <Bill(dot)Allie(at)mug(dot)org>, pgsql-patches(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: int8.c compile problem on UnixWare 7.x
Date: 2000-04-05 03:45:25
Message-ID: 200004050345.XAA18599@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
> > I agree that I'm not eager to uglify the code that much to avoid a
> > single-platform compiler bug.  Can it be worked around with less-ugly
> > changes?  I'd try changing the --i to i--, for example; and/or swapping
> > the order of the two initialization assignments.  Neither of those would
> > impair readability noticeably.
> > 
> > 			regards, tom lane
> 
> I found a different patch that will fix the problem.  It compiles and the 
> resulting binary passes the regression tests.

Here is the patch.  I am inclined not to apply it.  While I realizes it
fixes  the problem on your platform, it is one of those bugs I would
rather pass back to the compiler author than fix it in our code. 

Comments from others?  Is this a popular compiler, or are you the only
one likely to be using that version with that bug?

The change is i > 0 to 0 < i.  Wow, if such a change fixes your compiler
for int8's, I really would not trust it for anything.

---------------------------------------------------------------------------


	*** ./src/backend/utils/adt/int8.c.orig Mon Apr  3 13:24:12 2000
	--- ./src/backend/utils/adt/int8.c      Mon Apr  3 13:28:47 2000
	***************
	*** 410,416 ****
	        if (*arg1 < 1)
	                *result = 0;
	        else
	!               for (i = *arg1, *result = 1; i > 0; --i)
	                        *result *= i;
	  
	        return result;
	--- 410,416 ----
	        if (*arg1 < 1)
	                *result = 0;
	        else
	!               for (i = *arg1, *result = 1; 0 < i; --i)
	                        *result *= i;
  


-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-hackers by date

Next:From: Hiroshi InoueDate: 2000-04-05 04:02:06
Subject: RE: postgres crash on CURSORS
Previous:From: Ryan KirkpatrickDate: 2000-04-05 03:20:46
Subject: Re: [HACKERS] Linux/Alpha and Postgres 7.0 Beta Status

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group