I've fixed this bug in 7.1RC1.  It may have been causing core dumps by
dereferencing a null function pointer.  As it was the Sun compiler
flagged it as an error.  (SC5.0 on Solaris 2.6.)

*** src/bin/pg_dump/pg_backup_null.c.orig       Sat Mar 24 00:54:54 2001
--- src/bin/pg_dump/pg_backup_null.c    Tue Mar 27 09:50:24 2001
***************
*** 98,104 ****
  static void
  _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
  {
!       if (*te->dataDumper)
        {
                AH->currToc = te;
                (*te->dataDumper) ((Archive *) AH, te->oid, te->dataDumperArg);
--- 98,104 ----
  static void
  _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
  {
!       if (te->dataDumper)
        {
                AH->currToc = te;
                (*te->dataDumper) ((Archive *) AH, te->oid, te->dataDumperArg);

Interestingly other compilers on other platforms accept a function as
a controlling expression in an if statement without complaint.  That
expression should have scalar type, i.e. either arithmetic or pointer.
This test program demonstrates Sun catching the error.

int (*f)(int);

int g(int x)
{
    return x;
}

int main(void)
{
    int y = 0;
    f = g;

    if (*f) {
        y = f(1);
    }
    
    return y;
}

        

$ cc funcptr.c
"funcptr.c", line 13: controlling expressions must have scalar type
cc: acomp failed for funcptr.c

-- 
Pete Forman                 -./\.- Disclaimer: This post is originated
WesternGeco                   -./\.-  by myself and does not represent
[EMAIL PROTECTED]     -./\.-  opinion of Schlumberger, Baker
http://www.crosswinds.net/~petef  -./\.-  Hughes or their divisions.

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to