History

73_arm64.c: Avoid taking address of return value.

Edmund Grimley Evans committed 11 years ago

Commit fc119f91 parent 8329fac1 file · +42 −21Browse files

Unified · Split

tests/tests2/73_arm64.c+42−21
@@ -180,24 +180,41 @@ struct hfa34 fr_hfa34(void) { return hfa34; } · 179 unmodified lines
180180
181181 void ret(void)
182182 {
183+ struct s1 t1 = fr_s1();
184+ struct s2 t2 = fr_s2();
185+ struct s3 t3 = fr_s3();
186+ struct s4 t4 = fr_s4();
187+ struct s5 t5 = fr_s5();
188+ struct s6 t6 = fr_s6();
189+ struct s7 t7 = fr_s7();
190+ struct s8 t8 = fr_s8();
191+ struct s9 t9 = fr_s9();
192+ struct s10 t10 = fr_s10();
193+ struct s11 t11 = fr_s11();
194+ struct s12 t12 = fr_s12();
195+ struct s13 t13 = fr_s13();
196+ struct s14 t14 = fr_s14();
197+ struct s15 t15 = fr_s15();
198+ struct s16 t16 = fr_s16();
199+ struct s17 t17 = fr_s17();
183200 printf("Return values:\n");
184− printf("%.1s\n", &fr_s1().x[0]);
185− printf("%.2s\n", &fr_s2().x[0]);
186− printf("%.3s\n", &fr_s3().x[0]);
187− printf("%.4s\n", &fr_s4().x[0]);
188− printf("%.5s\n", &fr_s5().x[0]);
189− printf("%.6s\n", &fr_s6().x[0]);
190− printf("%.7s\n", &fr_s7().x[0]);
191− printf("%.8s\n", &fr_s8().x[0]);
192− printf("%.9s\n", &fr_s9().x[0]);
193− printf("%.10s\n", &fr_s10().x[0]);
194− printf("%.11s\n", &fr_s11().x[0]);
195− printf("%.12s\n", &fr_s12().x[0]);
196− printf("%.13s\n", &fr_s13().x[0]);
197− printf("%.14s\n", &fr_s14().x[0]);
198− printf("%.15s\n", &fr_s15().x[0]);
199− printf("%.16s\n", &fr_s16().x[0]);
200− printf("%.17s\n", &fr_s17().x[0]);
201+ printf("%.1s\n", t1.x);
202+ printf("%.2s\n", t2.x);
203+ printf("%.3s\n", t3.x);
204+ printf("%.4s\n", t4.x);
205+ printf("%.5s\n", t5.x);
206+ printf("%.6s\n", t6.x);
207+ printf("%.7s\n", t7.x);
208+ printf("%.8s\n", t8.x);
209+ printf("%.9s\n", t9.x);
210+ printf("%.10s\n", t10.x);
211+ printf("%.11s\n", t11.x);
212+ printf("%.12s\n", t12.x);
213+ printf("%.13s\n", t13.x);
214+ printf("%.14s\n", t14.x);
215+ printf("%.15s\n", t15.x);
216+ printf("%.16s\n", t16.x);
217+ printf("%.17s\n", t17.x);
201218 printf("%.1f\n", fr_hfa11().a);
202219 printf("%.1f %.1f\n", fr_hfa12().a, fr_hfa12().b);
203220 printf("%.1f %.1f\n", fr_hfa13().a, fr_hfa13().c);
@@ -230,10 +247,14 @@ void myprintf(const char *format, ...) · 26 unmodified lines
230247 va_list ap;
231248 va_start(ap, format);
232249 for (s = format; *s; s++) {
233− if (match(&s, "%7s"))
234− printf("%.7s", &va_arg(ap, struct s7).x[0]);
235− else if (match(&s, "%9s"))
236− printf("%.9s", &va_arg(ap, struct s9).x[0]);
250+ if (match(&s, "%7s")) {
251+ struct s7 t7 = va_arg(ap, struct s7);
252+ printf("%.7s", t7.x);
253+ }
254+ else if (match(&s, "%9s")) {
255+ struct s9 t9 = va_arg(ap, struct s9);
256+ printf("%.9s", t9.x);
257+ }
237258 else if (match(&s, "%hfa11")) {
238259 struct hfa11 x = va_arg(ap, struct hfa11);
239260 printf("%.1f,%.1f", x.a, x.a);

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