source: tests/.expect/functions.x64.txt @ eae8b37

Last change on this file since eae8b37 was 81e768d, checked in by Michael Brooks <mlbrooks@…>, 3 weeks ago

Fix #276; add support for c-array parameters using dependent lengths.

Without this fix, declarations like

void f( int m, int n, float[m][n] );

would either

  • generate bad C code, with unmangled variable names appearing in the function definition, or
  • refuse to resolve a valid-c call of such a function.

tests/array-collections/c-dependent: add direct tests of such cases
tests/tuplearray: activate and expand cases which were blocked on #276
tests/array: activate case fm5y, which was blocked on #276; [noise] adjust source line numbers in .expect
tests/typedefRedef: expand coverage of "error, an array detail is different" cases; [noise] adjust source line numbers in .expect
tests/functions: [noise] adjust .expect to have resolved array sizes (extra casts) in the diffed code dump

The fix is:

  • (ResolvExpr/ResolveTypeof?, ResolvExpr/Resolver?) Resolve the dimension expressions, where they were missed.
  • (ResolvExpr/Resolver?) Prevent dimension expressions that are bound to other parameters from escaping in the function's type, to where they are out of scope. In the f example above, redact the type shown to callers from void (*)(int, int, float[m][n]) to void (*)(int, int, float[][*]).
  • (ResolvExpr/Unify?) Relax the matching rules for such a type, when used at a call site, letting the patameters wildcard type match with the concrete type in scope at the caller's side.
  • (Validate/ReplaceTypedef?) Apply the former, stricter matching rules to the one place where they are still needed: detecting inconsistent typedefs.
  • Property mode set to 100644
File size: 16.2 KB
Line 
1void _X1hFv___1(void){
2}
3signed int _X1fFi_Fi__Fi_i_Fi__Fi_i_Fv____1(__attribute__ ((unused)) signed int (*__anonymous_object0)(void), __attribute__ ((unused)) signed int (*__anonymous_object1)(signed int __param_0), __attribute__ ((unused)) signed int (*__anonymous_object2)(void), __attribute__ ((unused)) signed int (*__anonymous_object3)(signed int __param_0), void (*_X1gFv___1)(void)){
4    __attribute__ ((unused)) signed int _X9_retval_fi_1;
5    {
6        ((void)(*_X1gFv___1)());
7    }
8
9    {
10        ((void)_X1gFv___1());
11    }
12
13    {
14        ((void)(_X1gFv___1=_X1hFv___1));
15    }
16
17}
18signed int _X2f1Fi___1(void){
19    __attribute__ ((unused)) signed int _X10_retval_f1i_1;
20}
21signed int _X2f2Fi___1(void){
22    __attribute__ ((unused)) signed int _X10_retval_f2i_1;
23}
24signed int (*_X2f3FFi_____1(void))(void){
25    __attribute__ ((unused)) signed int (*_X10_retval_f3Fi___1)(void);
26}
27signed int *_X2f4FPi___1(void){
28    __attribute__ ((unused)) signed int *_X10_retval_f4Pi_1;
29}
30signed int (*_X2f5FFi_____1(void))(void){
31    __attribute__ ((unused)) signed int (*_X10_retval_f5Fi___1)(void);
32}
33signed int *_X2f6FPi___1(void){
34    __attribute__ ((unused)) signed int *_X10_retval_f6Pi_1;
35}
36signed int *_X2f7FPi___1(void){
37    __attribute__ ((unused)) signed int *_X10_retval_f7Pi_1;
38}
39signed int **_X2f8FPPi___1(void){
40    __attribute__ ((unused)) signed int **_X10_retval_f8PPi_1;
41}
42signed int *const *_X2f9FPKPi___1(void){
43    __attribute__ ((unused)) signed int *const *_X10_retval_f9PKPi_1;
44}
45signed int (*_X3f10FPA0i___1(void))[]{
46    __attribute__ ((unused)) signed int (*_X11_retval_f10PA0i_1)[];
47}
48signed int (*_X3f11FPA0A0i___1(void))[][((unsigned long int )3)]{
49    __attribute__ ((unused)) signed int (*_X11_retval_f11PA0A0i_1)[][((unsigned long int )3)];
50}
51signed int (*_X3f12FPA0A0i___1(void))[][((unsigned long int )3)]{
52    __attribute__ ((unused)) signed int (*_X11_retval_f12PA0A0i_1)[][((unsigned long int )3)];
53}
54signed int _X4fII1Fi_i__1(signed int _X1ii_1){
55    __attribute__ ((unused)) signed int _X12_retval_fII1i_1;
56}
57const signed int _X4fII2Fi_i__1(signed int _X1ii_1){
58    __attribute__ ((unused)) const signed int _X12_retval_fII2Ki_1;
59}
60extern signed int _X4fII3Fi_i__1(signed int _X1ii_1){
61    __attribute__ ((unused)) signed int _X12_retval_fII3i_1;
62}
63extern const signed int _X4fII4Fi_i__1(signed int _X1ii_1){
64    __attribute__ ((unused)) const signed int _X12_retval_fII4Ki_1;
65}
66signed int *_X4fII5FPi___1(void){
67    __attribute__ ((unused)) signed int *_X12_retval_fII5Pi_1;
68}
69signed int *const _X4fII6FPi___1(void){
70    __attribute__ ((unused)) signed int *const _X12_retval_fII6KPi_1;
71}
72const signed long int *_X4fII7FPKl___1(void){
73    __attribute__ ((unused)) const signed long int *_X12_retval_fII7PKl_1;
74}
75static const signed long int *_X4fII8FPKl___1(void){
76    __attribute__ ((unused)) const signed long int *_X12_retval_fII8PKl_1;
77}
78static const signed long int *_X4fII9FPKl___1(void){
79    __attribute__ ((unused)) const signed long int *_X12_retval_fII9PKl_1;
80}
81signed int _X3fO1Fi_i__1(signed int _X1ii_1){
82    __attribute__ ((unused)) signed int _X11_retval_fO1i_1;
83}
84signed int _X3fO2Fi_i__1(signed int _X1ii_1){
85    __attribute__ ((unused)) signed int _X11_retval_fO2i_1;
86}
87const signed int _X3fO3Fi_i__1(signed int _X1ii_1){
88    __attribute__ ((unused)) const signed int _X11_retval_fO3Ki_1;
89}
90extern signed int _X3fO4Fi_i__1(signed int _X1ii_1){
91    __attribute__ ((unused)) signed int _X11_retval_fO4i_1;
92}
93extern const signed int _X3fO5Fi_i__1(signed int _X1ii_1){
94    __attribute__ ((unused)) const signed int _X11_retval_fO5Ki_1;
95}
96void _X1fFv___1(void);
97void _X1fFv___1(void);
98signed int _X1fFi___1(void);
99void _X1fFv_i__1(signed int __anonymous_object4);
100void _X1fFv_i__1(signed int __anonymous_object5);
101signed int _X1fFi_i__1(signed int __anonymous_object6);
102void _X1fFv___1(void){
103}
104void _X2fvFv___1(void){
105}
106signed int _X1fFi___1(void){
107    __attribute__ ((unused)) signed int _X9_retval_fi_1;
108}
109void _X1fFv_i__1(__attribute__ ((unused)) signed int __anonymous_object7){
110}
111void _X2fvFv_i__1(__attribute__ ((unused)) signed int __anonymous_object8){
112}
113signed int _X1fFi_i__1(__attribute__ ((unused)) signed int __anonymous_object9){
114    __attribute__ ((unused)) signed int _X9_retval_fi_1;
115}
116signed int _X1fFi___1(void);
117void _X1fFv_i__1(signed int _X1xi_1);
118void _X2fvFv_i__1(signed int _X1xi_1);
119void _X2f2Fv_i__1(signed int _X1xi_1){
120}
121void _X3fv1Fv_i__1(signed int _X1xi_1){
122}
123struct _tuple2_ {
124};
125static inline void _layoutof__tuple2_(unsigned long int *_sizeof__tuple2_, unsigned long int *_alignof__tuple2_, unsigned long int *_offsetof__tuple2_, const unsigned long int _sizeof_Y15tuple_param_2_0, const unsigned long int _alignof_Y15tuple_param_2_0, const unsigned long int _sizeof_Y15tuple_param_2_1, const unsigned long int _alignof_Y15tuple_param_2_1){
126    ((void)((*_sizeof__tuple2_)=0));
127    ((void)((*_alignof__tuple2_)=1));
128    ((void)(_offsetof__tuple2_[0]=(*_sizeof__tuple2_)));
129    ((void)((*_sizeof__tuple2_)+=_sizeof_Y15tuple_param_2_0));
130    if ( ((*_alignof__tuple2_)<_alignof_Y15tuple_param_2_0) ) ((void)((*_alignof__tuple2_)=_alignof_Y15tuple_param_2_0));
131
132    if ( ((*_sizeof__tuple2_)&(_alignof_Y15tuple_param_2_1-1)) ) ((void)((*_sizeof__tuple2_)+=(_alignof_Y15tuple_param_2_1-((*_sizeof__tuple2_)&(_alignof_Y15tuple_param_2_1-1)))));
133
134    ((void)(_offsetof__tuple2_[1]=(*_sizeof__tuple2_)));
135    ((void)((*_sizeof__tuple2_)+=_sizeof_Y15tuple_param_2_1));
136    if ( ((*_alignof__tuple2_)<_alignof_Y15tuple_param_2_1) ) ((void)((*_alignof__tuple2_)=_alignof_Y15tuple_param_2_1));
137
138    if ( ((*_sizeof__tuple2_)&((*_alignof__tuple2_)-1)) ) ((void)((*_sizeof__tuple2_)+=((*_alignof__tuple2_)-((*_sizeof__tuple2_)&((*_alignof__tuple2_)-1)))));
139
140}
141struct _conc__tuple2_0;
142struct _conc__tuple2_0 {
143    signed int field_0;
144    signed int field_1;
145};
146struct _conc__tuple2_0 _X1fFT2ii___1(void);
147void _X1fFv_ii__1(signed int __anonymous_object10, signed int _X1xi_1);
148void _X2fvFv_ii__1(signed int __anonymous_object11, signed int _X1xi_1);
149struct _conc__tuple2_0 _X1fFT2ii_ii__1(signed int __anonymous_object12, signed int _X1xi_1);
150struct _conc__tuple2_0 _X1fFT2ii___1(void){
151    __attribute__ ((unused)) struct _conc__tuple2_0 _X9_retval_fT2ii_1 = {  };
152}
153void _X1fFv_ii__1(__attribute__ ((unused)) signed int __anonymous_object13, signed int _X1xi_1){
154}
155void _X2fvFv_ii__1(__attribute__ ((unused)) signed int __anonymous_object14, signed int _X1xi_1){
156}
157struct _conc__tuple2_0 _X1fFT2ii_ii__1(__attribute__ ((unused)) signed int __anonymous_object15, signed int _X1xi_1){
158    __attribute__ ((unused)) struct _conc__tuple2_0 _X9_retval_fT2ii_1 = {  };
159}
160struct _tuple3_ {
161};
162static inline void _layoutof__tuple3_(unsigned long int *_sizeof__tuple3_, unsigned long int *_alignof__tuple3_, unsigned long int *_offsetof__tuple3_, const unsigned long int _sizeof_Y15tuple_param_3_0, const unsigned long int _alignof_Y15tuple_param_3_0, const unsigned long int _sizeof_Y15tuple_param_3_1, const unsigned long int _alignof_Y15tuple_param_3_1, const unsigned long int _sizeof_Y15tuple_param_3_2, const unsigned long int _alignof_Y15tuple_param_3_2){
163    ((void)((*_sizeof__tuple3_)=0));
164    ((void)((*_alignof__tuple3_)=1));
165    ((void)(_offsetof__tuple3_[0]=(*_sizeof__tuple3_)));
166    ((void)((*_sizeof__tuple3_)+=_sizeof_Y15tuple_param_3_0));
167    if ( ((*_alignof__tuple3_)<_alignof_Y15tuple_param_3_0) ) ((void)((*_alignof__tuple3_)=_alignof_Y15tuple_param_3_0));
168
169    if ( ((*_sizeof__tuple3_)&(_alignof_Y15tuple_param_3_1-1)) ) ((void)((*_sizeof__tuple3_)+=(_alignof_Y15tuple_param_3_1-((*_sizeof__tuple3_)&(_alignof_Y15tuple_param_3_1-1)))));
170
171    ((void)(_offsetof__tuple3_[1]=(*_sizeof__tuple3_)));
172    ((void)((*_sizeof__tuple3_)+=_sizeof_Y15tuple_param_3_1));
173    if ( ((*_alignof__tuple3_)<_alignof_Y15tuple_param_3_1) ) ((void)((*_alignof__tuple3_)=_alignof_Y15tuple_param_3_1));
174
175    if ( ((*_sizeof__tuple3_)&(_alignof_Y15tuple_param_3_2-1)) ) ((void)((*_sizeof__tuple3_)+=(_alignof_Y15tuple_param_3_2-((*_sizeof__tuple3_)&(_alignof_Y15tuple_param_3_2-1)))));
176
177    ((void)(_offsetof__tuple3_[2]=(*_sizeof__tuple3_)));
178    ((void)((*_sizeof__tuple3_)+=_sizeof_Y15tuple_param_3_2));
179    if ( ((*_alignof__tuple3_)<_alignof_Y15tuple_param_3_2) ) ((void)((*_alignof__tuple3_)=_alignof_Y15tuple_param_3_2));
180
181    if ( ((*_sizeof__tuple3_)&((*_alignof__tuple3_)-1)) ) ((void)((*_sizeof__tuple3_)+=((*_alignof__tuple3_)-((*_sizeof__tuple3_)&((*_alignof__tuple3_)-1)))));
182
183}
184struct _conc__tuple3_1;
185struct _conc__tuple3_1 {
186    signed int field_0;
187    signed int field_1;
188    signed int field_2;
189};
190struct _conc__tuple3_1 _X1fFT3iii___1(void);
191void _X1fFv_iii__1(signed int __anonymous_object16, signed int _X1xi_1, signed int __anonymous_object17);
192void _X2fvFv_iii__1(signed int __anonymous_object18, signed int _X1xi_1, signed int __anonymous_object19);
193struct _conc__tuple3_1 _X1fFT3iii_iii__1(signed int __anonymous_object20, signed int _X1xi_1, signed int __anonymous_object21);
194struct _conc__tuple3_1 _X1fFT3iii___1(void){
195    __attribute__ ((unused)) struct _conc__tuple3_1 _X9_retval_fT3iii_1 = {  };
196}
197void _X1fFv_iii__1(__attribute__ ((unused)) signed int __anonymous_object22, signed int _X1xi_1, __attribute__ ((unused)) signed int __anonymous_object23){
198}
199void _X2fvFv_iii__1(__attribute__ ((unused)) signed int __anonymous_object24, signed int _X1xi_1, __attribute__ ((unused)) signed int __anonymous_object25){
200}
201struct _conc__tuple3_1 _X1fFT3iii_iii__1(__attribute__ ((unused)) signed int __anonymous_object26, signed int _X1xi_1, __attribute__ ((unused)) signed int __anonymous_object27){
202    __attribute__ ((unused)) struct _conc__tuple3_1 _X9_retval_fT3iii_1 = {  };
203}
204struct _conc__tuple3_2;
205struct _conc__tuple3_2 {
206    signed int field_0;
207    signed int field_1;
208    signed int *field_2;
209};
210struct _conc__tuple3_2 _X1fFT3iiPi___1(void);
211void _X1fFv_iiPi__1(signed int __anonymous_object28, signed int _X1xi_1, signed int *_X1yPi_1);
212void _X2fvFv_iiPi__1(signed int __anonymous_object29, signed int _X1xi_1, signed int *_X1yPi_1);
213struct _conc__tuple3_2 _X1fFT3iiPi_iiPi__1(signed int __anonymous_object30, signed int _X1xi_1, signed int *_X1yPi_1);
214struct _conc__tuple3_2 _X1fFT3iiPi___1(void){
215    __attribute__ ((unused)) struct _conc__tuple3_2 _X9_retval_fT3iiPi_1 = {  };
216}
217void _X1fFv_iiPi__1(__attribute__ ((unused)) signed int __anonymous_object31, signed int _X1xi_1, signed int *_X1yPi_1){
218}
219void _X2fvFv_iiPi__1(__attribute__ ((unused)) signed int __anonymous_object32, signed int _X1xi_1, signed int *_X1yPi_1){
220}
221struct _conc__tuple3_2 _X1fFT3iiPi_iiPi__1(__attribute__ ((unused)) signed int __anonymous_object33, signed int _X1xi_1, signed int *_X1yPi_1){
222    __attribute__ ((unused)) struct _conc__tuple3_2 _X9_retval_fT3iiPi_1 = {  };
223}
224signed int _X3f11Fi_i__1(signed int __anonymous_object34);
225signed int _X3f12Fi___1(void);
226const double _X4bar1Fd___1(void);
227const double _X4bar2Fd_i__1(signed int __anonymous_object35);
228const double _X4bar3Fd_d__1(double __anonymous_object36);
229const double _X3fooFd___1(void);
230const double _X3fooFd_i__1(signed int __anonymous_object37);
231const double _X3fooFd_d__1(__attribute__ ((unused)) double __anonymous_object38){
232    __attribute__ ((unused)) const double _X11_retval_fooKd_1;
233    {
234        ((void)((*((double *)(&_X11_retval_fooKd_1)))=3.0) /* ?{} */);
235    }
236
237    return _X11_retval_fooKd_1;
238}
239struct S {
240    signed int _X1ii_1;
241};
242static inline void _X12_constructorFv_S1S_autogen___1(struct S *_X4_dstS1S_1);
243static inline void _X12_constructorFv_S1SS1S_autogen___1(struct S *_X4_dstS1S_1, struct S _X4_srcS1S_1);
244static inline void _X11_destructorFv_S1S_autogen___1(struct S *_X4_dstS1S_1);
245static inline struct S _X16_operator_assignFS1S_S1SS1S_autogen___1(struct S *_X4_dstS1S_1, struct S _X4_srcS1S_1);
246static inline void _X12_constructorFv_S1Si_autogen___1(struct S *_X4_dstS1S_1, signed int _X1ii_1);
247static inline void _X12_constructorFv_S1S_autogen___1(struct S *_X4_dstS1S_1){
248    {
249        ((void)((*_X4_dstS1S_1)._X1ii_1) /* ?{} */);
250    }
251
252}
253static inline void _X12_constructorFv_S1SS1S_autogen___1(struct S *_X4_dstS1S_1, struct S _X4_srcS1S_1){
254    {
255        ((void)((*_X4_dstS1S_1)._X1ii_1=_X4_srcS1S_1._X1ii_1) /* ?{} */);
256    }
257
258}
259static inline void _X11_destructorFv_S1S_autogen___1(struct S *_X4_dstS1S_1){
260    {
261        ((void)((*_X4_dstS1S_1)._X1ii_1) /* ^?{} */);
262    }
263
264}
265static inline struct S _X16_operator_assignFS1S_S1SS1S_autogen___1(struct S *_X4_dstS1S_1, struct S _X4_srcS1S_1){
266    struct S _X4_retS1S_1;
267    {
268        ((void)((*_X4_dstS1S_1)._X1ii_1=_X4_srcS1S_1._X1ii_1));
269    }
270
271    {
272        ((void)_X12_constructorFv_S1SS1S_autogen___1((&_X4_retS1S_1), (*_X4_dstS1S_1)));
273    }
274
275    return _X4_retS1S_1;
276}
277static inline void _X12_constructorFv_S1Si_autogen___1(struct S *_X4_dstS1S_1, signed int _X1ii_1){
278    {
279        ((void)((*_X4_dstS1S_1)._X1ii_1=_X1ii_1) /* ?{} */);
280    }
281
282}
283struct S _X3rtnFS1S_i__1(__attribute__ ((unused)) signed int __anonymous_object39){
284    __attribute__ ((unused)) struct S _X11_retval_rtnS1S_1;
285}
286signed int _X1fFi_Fi_ii_Fi_i___1(__attribute__ ((unused)) signed int (*__anonymous_object40)(signed int __param_0, signed int __param_1), __attribute__ ((unused)) signed int (*__anonymous_object41)(signed int __param_0)){
287    __attribute__ ((unused)) signed int _X9_retval_fi_1;
288    signed int (*(*_X2pcPA0A0PA0A0i_2)[][((unsigned long int )10)])[][((unsigned long int )3)];
289    signed int (*(*_X1pPA0A0PA0A0i_2)[][((unsigned long int )10)])[][((unsigned long int )3)];
290    signed int (*(*_X1pPA0Fi_i__2)[])(signed int __param_0);
291}
292static const signed int *_X2f1FPKi___1(void){
293    __attribute__ ((unused)) const signed int *_X10_retval_f1PKi_1;
294}
295static const signed int *_X2f2FPKi___1(void){
296    __attribute__ ((unused)) const signed int *_X10_retval_f2PKi_1;
297}
298static inline signed int *const _X2f3FPi___1(void){
299    __attribute__ ((unused)) signed int *const _X10_retval_f3KPi_1;
300}
301struct _conc__tuple2_3;
302struct _conc__tuple2_3 {
303    signed int *field_0;
304    signed int field_1;
305};
306static inline const struct _conc__tuple2_3 _X2f4FT2Pii___1(void){
307    __attribute__ ((unused)) const struct _conc__tuple2_3 _X10_retval_f4KT2Pii_1;
308}
309static const struct _conc__tuple2_3 _X2f5FT2PiKi___1(void){
310    __attribute__ ((unused)) const struct _conc__tuple2_3 _X10_retval_f5KT2PiKi_1;
311}
312signed int _X1fFi_Fi__FPi__FPPi__FPKPi__FPKPi__PiPiPPiPPiPPPiPPPiPPKPiPPKPiPKPKPiPKPKPi__1(signed int (*__anonymous_object42)(void), signed int *(*__anonymous_object43)(void), signed int **(*__anonymous_object44)(void), signed int *const *(*__anonymous_object45)(void), signed int *const *const (*__anonymous_object46)(void), signed int *__anonymous_object47, signed int __anonymous_object48[((unsigned long int )10)], signed int **__anonymous_object49, signed int *__anonymous_object50[((unsigned long int )10)], signed int ***__anonymous_object51, signed int **__anonymous_object52[((unsigned long int )10)], signed int *const **__anonymous_object53, signed int *const *__anonymous_object54[((unsigned long int )10)], signed int *const *const *__anonymous_object55, signed int *const *const __anonymous_object56[((unsigned long int )10)]);
313signed int _X1fFi_Fi__FPi__FPPi__FPKPi__FPKPi__PiPiPPiPPiPPPiPPPiPPKPiPPKPiPKPKPiPKPKPi__1(__attribute__ ((unused)) signed int (*__anonymous_object57)(void), __attribute__ ((unused)) signed int *(*__anonymous_object58)(void), __attribute__ ((unused)) signed int **(*__anonymous_object59)(void), __attribute__ ((unused)) signed int *const *(*__anonymous_object60)(void), __attribute__ ((unused)) signed int *const *const (*__anonymous_object61)(void), __attribute__ ((unused)) signed int *__anonymous_object62, __attribute__ ((unused)) signed int __anonymous_object63[((unsigned long int )10)], __attribute__ ((unused)) signed int **__anonymous_object64, __attribute__ ((unused)) signed int *__anonymous_object65[((unsigned long int )10)], __attribute__ ((unused)) signed int ***__anonymous_object66, __attribute__ ((unused)) signed int **__anonymous_object67[((unsigned long int )10)], __attribute__ ((unused)) signed int *const **__anonymous_object68, __attribute__ ((unused)) signed int *const *__anonymous_object69[((unsigned long int )10)], __attribute__ ((unused)) signed int *const *const *__anonymous_object70, __attribute__ ((unused)) signed int *const *const __anonymous_object71[((unsigned long int )10)]){
314    __attribute__ ((unused)) signed int _X9_retval_fi_1;
315}
316signed int _X1fFi_Pii__1(signed int *_X1fPi_1, signed int _X1ti_1){
317    __attribute__ ((unused)) signed int _X9_retval_fi_1;
318    signed int _X1Ti_2;
319}
Note: See TracBrowser for help on using the repository browser.