Re: Optimize mul_var() for var1ndigits >= 8 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Optimize mul_var() for var1ndigits >= 8
Date
Msg-id 2440650.1724523440@sss.pgh.pa.us
Whole thread Raw
In response to Re: Optimize mul_var() for var1ndigits >= 8  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Responses Re: Optimize mul_var() for var1ndigits >= 8
List pgsql-hackers
Dean Rasheed <dean.a.rasheed@gmail.com> writes:
> On Wed, 14 Aug 2024 at 07:31, Joel Jacobson <joel@compiler.org> wrote:
>> I think this is acceptable, since it produces more correct results.

> Thanks for checking. I did a bit more testing myself and didn't see
> any problems, so I have committed both these patches.

About a dozen buildfarm members are complaining thus (eg [1]):

gcc -std=gnu99 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels
-Wmissing-format-attribute-Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O2
-ftree-vectorize-I. -I. -I../../../../src/include  -D_GNU_SOURCE -I/usr/include/libxml2   -c -o numeric.o numeric.c 
numeric.c: In function \342\200\230mul_var\342\200\231:
numeric.c:9209:9: warning: \342\200\230carry\342\200\231 may be used uninitialized in this function
[-Wmaybe-uninitialized]
    term = PRODSUM1(var1digits, 0, var2digits, 0) + carry;
         ^
numeric.c:8972:10: note: \342\200\230carry\342\200\231 was declared here
  uint32  carry;
          ^

I guess these compilers aren't able to convince themselves that the
first switch must initialize "carry".

            regards, tom lane

[1] https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=arowana&dt=2024-08-24%2004%3A19%3A29&stg=build



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: list of acknowledgments for PG17
Next
From: "Joel Jacobson"
Date:
Subject: Re: Optimising numeric division