History

Fix arm64-gen.c when passing a struct ptr to va_arg.

Christian Jullien committed 6 years ago

Commit ec0e9361 parent 6fa78a32 files · +18 −2Browse files

Unified · Split

2 files
  1. arm64-gen.c +7 −2
  2. tests/tests2/73_arm64.c +11 −0
arm64-gen.c+7−2
@@ -242,17 +242,22 @@ ST_FUNC void gsym_addr(int t_, int a_) · 241 unmodified lines
242242
243243 static int arm64_type_size(int t)
244244 {
245+ /*
246+ * case values are in increasing order (from 1 to 11).
247+ * which 'may' help compiler optimizers. See tcc.h
248+ */
245249 switch (t & VT_BTYPE) {
246− case VT_INT: return 2;
247250 case VT_BYTE: return 0;
248251 case VT_SHORT: return 1;
252+ case VT_INT: return 2;
253+ case VT_LLONG: return 3;
249254 case VT_PTR: return 3;
250255 case VT_FUNC: return 3;
256+ case VT_STRUCT: return 3;
251257 case VT_FLOAT: return 2;
252258 case VT_DOUBLE: return 3;
253259 case VT_LDOUBLE: return 4;
254260 case VT_BOOL: return 0;
255− case VT_LLONG: return 3;
256261 }
257262 assert(0);
258263 return 0;
tests/tests2/73_arm64.c+11−0
@@ -230,6 +230,17 @@ void ret(void) · 229 unmodified lines
230230 printf("%.1Lf %.1Lf\n", fr_hfa34().a, fr_hfa34().d);
231231 }
232232
233+void*
234+va_arg_with_struct_ptr(va_list ap) {
235+ /*
236+ * This was a BUG identified with FFTW-3.3.8 on arm64.
237+ * The test case only checks it compiles.
238+ */
239+ struct X { int _x; };
240+ struct X *x = va_arg(ap, struct X *);
241+ return x;
242+}
243+
233244 int match(const char **s, const char *f)
234245 {
235246 const char *p = *s;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t