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

Commite303a2d

Browse files
committed
Add last-ditch defense against attempts to compile datetime code with
-ffast-math.
1 parenteb3adab commite303a2d

File tree

2 files changed

+27
-11
lines changed

2 files changed

+27
-11
lines changed

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

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.72 2002/09/04 20:31:27 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.73 2002/09/21 19:52:41 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -27,11 +27,19 @@
2727
#include"utils/nabstime.h"
2828
#include"utils/timestamp.h"
2929

30+
/*
31+
* gcc's -ffast-math switch breaks routines that expect exact results from
32+
* expressions like timeval / 3600, where timeval is double.
33+
*/
34+
#ifdef__FAST_MATH__
35+
#error -ffast-math is known to break this code
36+
#endif
37+
3038

31-
inttime2tm(TimeADTtime,structtm*tm,fsec_t*fsec);
32-
inttimetz2tm(TimeTzADT*time,structtm*tm,fsec_t*fsec,int*tzp);
33-
inttm2time(structtm*tm,fsec_tfsec,TimeADT*result);
34-
inttm2timetz(structtm*tm,fsec_tfsec,inttz,TimeTzADT*result);
39+
staticinttime2tm(TimeADTtime,structtm*tm,fsec_t*fsec);
40+
staticinttimetz2tm(TimeTzADT*time,structtm*tm,fsec_t*fsec,int*tzp);
41+
staticinttm2time(structtm*tm,fsec_tfsec,TimeADT*result);
42+
staticinttm2timetz(structtm*tm,fsec_tfsec,inttz,TimeTzADT*result);
3543
staticvoidAdjustTimeForTypmod(TimeADT*time,int32typmod);
3644

3745
/*****************************************************************************
@@ -525,7 +533,7 @@ time_in(PG_FUNCTION_ARGS)
525533
/* tm2time()
526534
* Convert a tm structure to a time data type.
527535
*/
528-
int
536+
staticint
529537
tm2time(structtm*tm,fsec_tfsec,TimeADT*result)
530538
{
531539
#ifdefHAVE_INT64_TIMESTAMP
@@ -542,7 +550,7 @@ tm2time(struct tm * tm, fsec_t fsec, TimeADT *result)
542550
* For dates within the system-supported time_t range, convert to the
543551
*local time zone. If out of this range, leave as GMT. - tgl 97/05/27
544552
*/
545-
int
553+
staticint
546554
time2tm(TimeADTtime,structtm*tm,fsec_t*fsec)
547555
{
548556
#ifdefHAVE_INT64_TIMESTAMP
@@ -1285,7 +1293,7 @@ time_part(PG_FUNCTION_ARGS)
12851293
/* tm2timetz()
12861294
* Convert a tm structure to a time data type.
12871295
*/
1288-
int
1296+
staticint
12891297
tm2timetz(structtm*tm,fsec_tfsec,inttz,TimeTzADT*result)
12901298
{
12911299
#ifdefHAVE_INT64_TIMESTAMP
@@ -1357,7 +1365,7 @@ timetz_out(PG_FUNCTION_ARGS)
13571365
* For dates within the system-supported time_t range, convert to the
13581366
*local time zone. If out of this range, leave as GMT. - tgl 97/05/27
13591367
*/
1360-
int
1368+
staticint
13611369
timetz2tm(TimeTzADT*time,structtm*tm,fsec_t*fsec,int*tzp)
13621370
{
13631371
#ifdefHAVE_INT64_TIMESTAMP

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/*-------------------------------------------------------------------------
22
*
33
* timestamp.c
4-
* Functions for the built-in SQL92type "timestamp" and "interval".
4+
* Functions for the built-in SQL92types "timestamp" and "interval".
55
*
66
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.73 2002/09/04 20:31:29 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.74 2002/09/21 19:52:41 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -28,6 +28,14 @@
2828
#include"utils/array.h"
2929
#include"utils/builtins.h"
3030

31+
/*
32+
* gcc's -ffast-math switch breaks routines that expect exact results from
33+
* expressions like timeval / 3600, where timeval is double.
34+
*/
35+
#ifdef__FAST_MATH__
36+
#error -ffast-math is known to break this code
37+
#endif
38+
3139

3240
#ifdefHAVE_INT64_TIMESTAMP
3341
staticint64time2t(constinthour,constintmin,constintsec,constfsec_tfsec);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp