pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix overflow handling in plpgsql's integer FOR loops. 6+ messages / 1 participants [nested] [flat]
* pgsql: Fix overflow handling in plpgsql's integer FOR loops. @ 2018-03-17 19:38 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-03-17 19:38 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix overflow handling in plpgsql's integer FOR loops. The test to exit the loop if the integer control value would overflow an int32 turns out not to work on some ICC versions, as it's dependent on the assumption that the compiler will execute the code as written rather than "optimize" it. ICC lacks any equivalent of gcc's -fwrapv switch, so it was optimizing on the assumption of no integer overflow, and that breaks this. Rewrite into a form that in fact does not do any overflowing computations. Per Tomas Vondra and buildfarm member fulmar. It's been like this for a long time, although it was not till we added a regression test case covering the behavior (in commit dd2243f2a) that the problem became apparent. Back-patch to all supported versions. Discussion: https://postgr.es/m/50562fdc-0876-9843-c883-15b8566c7511@2ndquadrant.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/2dbee9f19f6c6ac6c013f668611492486e623807 Modified Files -------------- src/pl/plpgsql/src/pl_exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix overflow handling in plpgsql's integer FOR loops. @ 2018-03-17 19:38 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-03-17 19:38 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix overflow handling in plpgsql's integer FOR loops. The test to exit the loop if the integer control value would overflow an int32 turns out not to work on some ICC versions, as it's dependent on the assumption that the compiler will execute the code as written rather than "optimize" it. ICC lacks any equivalent of gcc's -fwrapv switch, so it was optimizing on the assumption of no integer overflow, and that breaks this. Rewrite into a form that in fact does not do any overflowing computations. Per Tomas Vondra and buildfarm member fulmar. It's been like this for a long time, although it was not till we added a regression test case covering the behavior (in commit dd2243f2a) that the problem became apparent. Back-patch to all supported versions. Discussion: https://postgr.es/m/50562fdc-0876-9843-c883-15b8566c7511@2ndquadrant.com Branch ------ REL9_5_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b3fade55cba65f551fd7315ceedbca930248a525 Modified Files -------------- src/pl/plpgsql/src/pl_exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix overflow handling in plpgsql's integer FOR loops. @ 2018-03-17 19:38 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-03-17 19:38 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix overflow handling in plpgsql's integer FOR loops. The test to exit the loop if the integer control value would overflow an int32 turns out not to work on some ICC versions, as it's dependent on the assumption that the compiler will execute the code as written rather than "optimize" it. ICC lacks any equivalent of gcc's -fwrapv switch, so it was optimizing on the assumption of no integer overflow, and that breaks this. Rewrite into a form that in fact does not do any overflowing computations. Per Tomas Vondra and buildfarm member fulmar. It's been like this for a long time, although it was not till we added a regression test case covering the behavior (in commit dd2243f2a) that the problem became apparent. Back-patch to all supported versions. Discussion: https://postgr.es/m/50562fdc-0876-9843-c883-15b8566c7511@2ndquadrant.com Branch ------ REL9_3_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f1f7a85d8c3ed914f4d0df93e40f0144931af315 Modified Files -------------- src/pl/plpgsql/src/pl_exec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix overflow handling in plpgsql's integer FOR loops. @ 2018-03-17 19:38 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-03-17 19:38 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix overflow handling in plpgsql's integer FOR loops. The test to exit the loop if the integer control value would overflow an int32 turns out not to work on some ICC versions, as it's dependent on the assumption that the compiler will execute the code as written rather than "optimize" it. ICC lacks any equivalent of gcc's -fwrapv switch, so it was optimizing on the assumption of no integer overflow, and that breaks this. Rewrite into a form that in fact does not do any overflowing computations. Per Tomas Vondra and buildfarm member fulmar. It's been like this for a long time, although it was not till we added a regression test case covering the behavior (in commit dd2243f2a) that the problem became apparent. Back-patch to all supported versions. Discussion: https://postgr.es/m/50562fdc-0876-9843-c883-15b8566c7511@2ndquadrant.com Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/5917297bfd25ea78416506b2d606316a8052b028 Modified Files -------------- src/pl/plpgsql/src/pl_exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix overflow handling in plpgsql's integer FOR loops. @ 2018-03-17 19:38 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-03-17 19:38 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix overflow handling in plpgsql's integer FOR loops. The test to exit the loop if the integer control value would overflow an int32 turns out not to work on some ICC versions, as it's dependent on the assumption that the compiler will execute the code as written rather than "optimize" it. ICC lacks any equivalent of gcc's -fwrapv switch, so it was optimizing on the assumption of no integer overflow, and that breaks this. Rewrite into a form that in fact does not do any overflowing computations. Per Tomas Vondra and buildfarm member fulmar. It's been like this for a long time, although it was not till we added a regression test case covering the behavior (in commit dd2243f2a) that the problem became apparent. Back-patch to all supported versions. Discussion: https://postgr.es/m/50562fdc-0876-9843-c883-15b8566c7511@2ndquadrant.com Branch ------ REL9_4_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/092401b14fa19d0ea28d57ba2f73b7aee64f960d Modified Files -------------- src/pl/plpgsql/src/pl_exec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix overflow handling in plpgsql's integer FOR loops. @ 2018-03-17 19:38 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2018-03-17 19:38 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix overflow handling in plpgsql's integer FOR loops. The test to exit the loop if the integer control value would overflow an int32 turns out not to work on some ICC versions, as it's dependent on the assumption that the compiler will execute the code as written rather than "optimize" it. ICC lacks any equivalent of gcc's -fwrapv switch, so it was optimizing on the assumption of no integer overflow, and that breaks this. Rewrite into a form that in fact does not do any overflowing computations. Per Tomas Vondra and buildfarm member fulmar. It's been like this for a long time, although it was not till we added a regression test case covering the behavior (in commit dd2243f2a) that the problem became apparent. Back-patch to all supported versions. Discussion: https://postgr.es/m/50562fdc-0876-9843-c883-15b8566c7511@2ndquadrant.com Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/04c76acab46fe3ea1c630868fbf53cd12146e3cd Modified Files -------------- src/pl/plpgsql/src/pl_exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2018-03-17 19:38 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2018-03-17 19:38 pgsql: Fix overflow handling in plpgsql's integer FOR loops. Tom Lane <tgl@sss.pgh.pa.us> 2018-03-17 19:38 pgsql: Fix overflow handling in plpgsql's integer FOR loops. Tom Lane <tgl@sss.pgh.pa.us> 2018-03-17 19:38 pgsql: Fix overflow handling in plpgsql's integer FOR loops. Tom Lane <tgl@sss.pgh.pa.us> 2018-03-17 19:38 pgsql: Fix overflow handling in plpgsql's integer FOR loops. Tom Lane <tgl@sss.pgh.pa.us> 2018-03-17 19:38 pgsql: Fix overflow handling in plpgsql's integer FOR loops. Tom Lane <tgl@sss.pgh.pa.us> 2018-03-17 19:38 pgsql: Fix overflow handling in plpgsql's integer FOR loops. Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox