source: tests/limits.cfa @ 2c7eee0

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 2c7eee0 was 6fbe9a5, checked in by Michael Brooks <mlbrooks@…>, 4 years ago

Fixing code-gen of constants. Fixes #182? Removes workaround 58b6d1.

Forcing recent GCC versions to place CFA-initialized constants in writeable memory, so CFA initialization doesn't segfault when writing them. See the const-init test for specifics about recent GCC versions.

src/InitTweak/FixGlobalInit.cc: generating the attribute to control GCC's placement
libcfa/src/limits.* : removing workaround from 58b6d1, making these limits const again
tests//limits.* : commenting old test that uses the constants from licfa-limits, explaining what the test doesn't exercise
tests/
/const-init.* : new test of static constants, taken from #182, and comments explaining how to test this issue

  • Property mode set to 100644
File size: 3.7 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// limits.cfa --
8//
9// Author           : Peter A. Buhr
10// Created On       : Tue May 10 20:44:20 2016
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Sun Sep 27 08:45:43 2020
13// Update Count     : 10
14//
15
16// Note: For testing the ability to load the constants defined in libcfa/src/limits.cfa,
17// see discussion in test const-init.
18
19#include <limits.hfa>
20
21// Integral Constants
22
23signed char m = MIN;
24unsigned char m = MIN;
25short int m = MIN;
26unsigned short int m = MIN;
27int m = MIN;
28unsigned int m = MIN;
29long int m = MIN;
30unsigned long int m = MIN;
31long long int m = MIN;
32unsigned long long int m = MIN;
33
34signed char M = MAX;
35unsigned char M = MAX;
36short int M = MAX;
37unsigned short int M = MAX;
38int M = MAX;
39unsigned int M = MAX;
40long int M = MAX;
41unsigned long int M = MAX;
42long long int M = MAX;
43unsigned long long int M = MAX;
44
45// Floating-Point Constants
46
47float m = MIN;
48double m = MIN;
49long double m = MIN;
50float _Complex m = MIN;
51double _Complex m = MIN;
52long double _Complex m = MIN;
53
54float M = MAX;
55double M = MAX;
56long double M = MAX;
57float _Complex M = MAX;
58double _Complex M = MAX;
59long double _Complex M = MAX;
60
61float pi = PI;
62float pi_2 = PI_2;
63float pi_4 = PI_4;
64float _1_pi = _1_PI;
65float _2_pi = _2_PI;
66float _2_sqrt_pi = _2_SQRT_PI;
67
68double pi = PI;
69double pi_2 = PI_2;
70double pi_4 = PI_4;
71double _1_pi = _1_PI;
72double _2_pi = _2_PI;
73double _2_SQRT_pi = _2_SQRT_PI;
74
75long double pi = PI;
76long double pi_2 = PI_2;
77long double pi_4 = PI_4;
78long double _1_pi = _1_PI;
79long double _2_pi = _2_PI;
80long double _2_sqrt_pi = _2_SQRT_PI;
81
82float _Complex pi = PI;
83float _Complex pi_2 = PI_2;
84float _Complex pi_4 = PI_4;
85float _Complex _1_pi = _1_PI;
86float _Complex _2_pi = _2_PI;
87float _Complex _2_sqrt_pi = _2_SQRT_PI;
88
89double _Complex pi = PI;
90double _Complex pi_2 = PI_2;
91double _Complex pi_4 = PI_4;
92double _Complex _1_pi = _1_PI;
93double _Complex _2_pi = _2_PI;
94double _Complex _2_sqrt_pi = _2_SQRT_PI;
95
96long double _Complex pi = PI;
97long double _Complex pi_2 = PI_2;
98long double _Complex pi_4 = PI_4;
99long double _Complex _1_pi = _1_PI;
100long double _Complex _2_pi = _2_PI;
101long double _Complex _2_sqrt_pi = _2_SQRT_PI;
102
103float e = E;
104float log2_e = LOG2_E;
105float log10_e = LOG10_E;
106float ln_2 = LN_2;
107float ln_10 = LN_10;
108float sqrt_2 = SQRT_2;
109float _1_sqrt_2 = _1_SQRT_2;
110
111double e = E;
112double log2_e = LOG2_E;
113double log10_e = LOG10_E;
114double ln_2 = LN_2;
115double ln_10 = LN_10;
116double sqrt_2 = SQRT_2;
117double _1_sqrt_2 = _1_SQRT_2;
118
119long double e = E;
120long double log2_e = LOG2_E;
121long double log10_e = LOG10_E;
122long double ln_2 = LN_2;
123long double ln_10 = LN_10;
124long double sqrt_2 = SQRT_2;
125long double _1_sqrt_2 = _1_SQRT_2;
126
127float _Complex e = E;
128float _Complex log2_e = LOG2_E;
129float _Complex log10_e = LOG10_E;
130float _Complex ln_2 = LN_2;
131float _Complex ln_10 = LN_10;
132float _Complex sqrt_2 = SQRT_2;
133float _Complex _1_sqrt_2 = _1_SQRT_2;
134
135double _Complex e = E;
136double _Complex log2_e = LOG2_E;
137double _Complex log10_e = LOG10_E;
138double _Complex ln_2 = LN_2;
139double _Complex ln_10 = LN_10;
140double _Complex sqrt_2 = SQRT_2;
141double _Complex _1_sqrt_2 = _1_SQRT_2;
142
143long double _Complex e = E;
144long double _Complex log2_e = LOG2_E;
145long double _Complex log10_e = LOG10_E;
146long double _Complex ln_2 = LN_2;
147long double _Complex ln_10 = LN_10;
148long double _Complex sqrt_2 = SQRT_2;
149long double _Complex _1_sqrt_2 = _1_SQRT_2;
150
151int main(int argc, char const *argv[]) {
152        #pragma message( "Compiled" )                                           // force non-empty .expect file
153}
154
155// Local Variables: //
156// tab-width: 4 //
157// compile-command: "cfa limits.cfa" //
158// End: //
Note: See TracBrowser for help on using the repository browser.