Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf4f55d5

Browse files
committed
Dodge a compiler bug affecting timetz_zone/timetz_izone.
This avoids a compiler bug occurring in AIX's xlc, even in prettylate-model revisions. Buildfarm testing has now confirmed thatonly 64-bit xlc is affected. Although we are contemplatingdropping support for xlc in v17, it's still supported in theback branches, so we need this fix.Back-patch of code changes from HEAD commit19fa977.(The test cases were already back-patched, in4a427b8 et al.)Discussion:https://postgr.es/m/CA+hUKGK=DOC+hE-62FKfZy=Ybt5uLkrg3zCZD-jFykM-iPn8yw@mail.gmail.com
1 parentcdbe9c3 commitf4f55d5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎src/backend/utils/adt/date.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2861,10 +2861,11 @@ timetz_zone(PG_FUNCTION_ARGS)
28612861
result= (TimeTzADT*)palloc(sizeof(TimeTzADT));
28622862

28632863
result->time=t->time+ (t->zone-tz)*USECS_PER_SEC;
2864+
/* C99 modulo has the wrong sign convention for negative input */
28642865
while (result->time<INT64CONST(0))
28652866
result->time+=USECS_PER_DAY;
2866-
while (result->time >=USECS_PER_DAY)
2867-
result->time-=USECS_PER_DAY;
2867+
if (result->time >=USECS_PER_DAY)
2868+
result->time%=USECS_PER_DAY;
28682869

28692870
result->zone=tz;
28702871

@@ -2894,10 +2895,11 @@ timetz_izone(PG_FUNCTION_ARGS)
28942895
result= (TimeTzADT*)palloc(sizeof(TimeTzADT));
28952896

28962897
result->time=time->time+ (time->zone-tz)*USECS_PER_SEC;
2898+
/* C99 modulo has the wrong sign convention for negative input */
28972899
while (result->time<INT64CONST(0))
28982900
result->time+=USECS_PER_DAY;
2899-
while (result->time >=USECS_PER_DAY)
2900-
result->time-=USECS_PER_DAY;
2901+
if (result->time >=USECS_PER_DAY)
2902+
result->time%=USECS_PER_DAY;
29012903

29022904
result->zone=tz;
29032905

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp