1 /* Verify that NRV optimizations are prohibited when the LHS is an
2 indirect reference to something that may be call-clobbered. */
3 /* { dg-do compile } */
4 /* { dg-options "-O -fdump-tree-optimized" } */
6 typedef struct { int x
[20]; void *y
; } S
;
7 S
nrv_candidate (void);
9 void make_escape (S
*);
16 /* We can't perform return slot optimization because global_S is
17 global and may be clobbered by nrv_candidate. */
19 *result
= nrv_candidate ();
22 /* We can't perform return slot optimization because local_S is
23 call_clobbered (its address escapes prior to invoking
25 make_escape (&local_S
);
27 *result
= nrv_candidate ();
31 /* { dg-final { scan-tree-dump-times "return slot optimization" 0 "optimized" } } */
32 /* { dg-final { cleanup-tree-dump "optimized" } } */