repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
2018-01-24 Richard Biener <rguenther@suse.de>
[official-gcc.git]
/
gcc
/
testsuite
/
gcc.dg
/
nrv1.c
blob
ca700924a239c04d01509940b491fba3ac12f487
1
/* Test that the NRV optimization doesn't cause a1 to change too soon. This
2
is equivalent to c++/19317. */
3
/* { dg-do run } */
4
5
void
abort
(
void
);
6
7
struct
A
8
{
9
int
i
[
100
];
10
};
11
12
struct
A a1
;
13
14
struct
A
f
()
15
{
16
struct
A a2
;
17
a2
.
i
[
0
] =
42
;
18
/* a1.i[0] should still be 0 until we return. */
19
if
(
a1
.
i
[
0
] !=
0
)
20
abort
();
21
return
a2
;
22
}
23
24
int
main
()
25
{
26
a1
=
f
();
27
return
0
;
28
}