Thread: Re: [HACKERS] Platform status

Re: [HACKERS] Platform status

From
t-ishii@sra.co.jp (Tatsuo Ishii)
Date:
At  4:06 PM 98.2.19 +0000, Thomas G. Lockhart wrote:
>Here is my current list of supported platforms. The outstanding issues
>are:

>mklinux/ppc - still core dumping on regression tests? why??

I finally found the source of the problem. function "_readConst" in
backend/nodes/readfuncs.c there is a line:

local_node->constlen = strtoul(token,NULL,10);

(before 6.3beta, this was:
local_node->constlen = atol(token);
)

For text type constant, token would be "-1." In this case
strtoul() of mklinux/ppc returns 0 not ULONG_MAX (same bit
pattern as -1). This is a problem.
So quick workaround might be surrounding the line by #ifdef like:

#ifdef PPC
local_node->constlen = atol(token);
#else
local_node->constlen = strtoul(token,NULL,10);
#endif

P.S.
Sure current code works except MkLinux/ppc. However calling with
strtoul() with minus value is not well-mannered IMHO
(strtoul() returns error code ERANGE in this case).
To make matters worse, there are some codes that comparing
constlen and -1.
What about changing constlen to signed int and using
strtol() instead of strtoul() here?
Tatsuo Ishii
t-ishii@sra.co.jp


Re: [HACKERS] Platform status

From
Bruce Momjian
Date:
I will fix this.  Thanks for the report.  Must have been tough to find.



>
> At  4:06 PM 98.2.19 +0000, Thomas G. Lockhart wrote:
> >Here is my current list of supported platforms. The outstanding issues
> >are:
>
> >mklinux/ppc - still core dumping on regression tests? why??
>
> I finally found the source of the problem. function "_readConst" in
> backend/nodes/readfuncs.c there is a line:
>
> local_node->constlen = strtoul(token,NULL,10);
>
> (before 6.3beta, this was:
> local_node->constlen = atol(token);
> )
>
> For text type constant, token would be "-1." In this case
> strtoul() of mklinux/ppc returns 0 not ULONG_MAX (same bit
> pattern as -1). This is a problem.
> So quick workaround might be surrounding the line by #ifdef like:
>
> #ifdef PPC
> local_node->constlen = atol(token);
> #else
> local_node->constlen = strtoul(token,NULL,10);
> #endif
>
> P.S.
> Sure current code works except MkLinux/ppc. However calling with
> strtoul() with minus value is not well-mannered IMHO
> (strtoul() returns error code ERANGE in this case).
> To make matters worse, there are some codes that comparing
> constlen and -1.
> What about changing constlen to signed int and using
> strtol() instead of strtoul() here?
> Tatsuo Ishii
> t-ishii@sra.co.jp
>
>
>


--
Bruce Momjian
maillist@candle.pha.pa.us