Silence uninitialized variable warning with some compiler versions
Heikki Linnakangas <heikki.linnakangas@iki.fi>
Author:
Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: 2026-06-17T06:00:49Z
Releases:
19 (unreleased)
Silence uninitialized variable warning with some compiler versions The first "if (difffile)" block initializes the startpos variable, and the second "if (difffile)" block reads it. The second if-condition can only be true when the first one was true, so the startpos variable is always initialized when it's used. However, the compiler might not be able to deduce that, and warn about startpos being used uninitialized. To silence the warning, rearrange the if-checks. Also, bail out if the diff file cannot be opened, instead of ignoring it silently. Author: Mikhail Litsarev <m.litsarev@postgrespro.ru> Reviewed-by; Ewan Young <kdbase.hack@gmail.com> Discussion: https://www.postgresql.org/message-id/ee06f058c626cd37babd8c81579ffb1e@postgrespro.ru
Files
| Path | Change | +/− |
|---|---|---|
| src/test/regress/pg_regress.c | modified | +24 −22 |
Discussion
- Fix warning: ‘startpos’ may be used uninitialized in function ‘results_differ’ 7 messages · 2026-06-11 → 2026-06-18