@@ -83,6 +83,10 @@ static int float8_cmp_internal(float8 a, float8 b);
83
83
static double sind_q1 (double x );
84
84
static double cosd_q1 (double x );
85
85
86
+ /* This is INTENTIONALLY NOT STATIC. Don't "fix" it. */
87
+ void init_degree_constants (float8 thirty , float8 forty_five , float8 sixty ,
88
+ float8 one_half , float8 one );
89
+
86
90
#ifndef HAVE_CBRT
87
91
/*
88
92
* Some machines (in particular, some versions of AIX) have an extern
@@ -1771,11 +1775,16 @@ dtan(PG_FUNCTION_ARGS)
1771
1775
* want exact results, we must ensure that none of the scaling constants used
1772
1776
* in the degree-based trig functions are computed that way.
1773
1777
*
1778
+ * The whole approach fails if init_degree_constants() gets inlined into the
1779
+ * call sites, since then constant-folding can happen anyway. Currently it
1780
+ * seems sufficient to declare it non-static to prevent that. We have no
1781
+ * expectation that other files will call this, but don't tell gcc that.
1782
+ *
1774
1783
* Other hazards we are trying to forestall with this kluge include the
1775
1784
* possibility that compilers will rearrange the expressions, or compute
1776
1785
* some intermediate results in registers wider than a standard double.
1777
1786
*/
1778
- static void
1787
+ void
1779
1788
init_degree_constants (float8 thirty , float8 forty_five , float8 sixty ,
1780
1789
float8 one_half , float8 one )
1781
1790
{
0 commit comments