From 888a1049c2561ccad90da753ab9234b10052eee7 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 14 Jul 2014 11:22:34 +0000 Subject: [PATCH] re PR lto/61786 (wrong code by LTO on x86_64-linux-gnu) 2014-07-14 Richard Biener PR tree-optimization/61786 * gcc.dg/torture/pr61786.c: New testcase. * gcc.dg/lto/pr61786_0.c: Likewise. * gcc.dg/lto/pr61786_1.c: Likewise. From-SVN: r212515 --- gcc/testsuite/ChangeLog | 7 ++++++ gcc/testsuite/gcc.dg/lto/pr61786_0.c | 27 ++++++++++++++++++++++ gcc/testsuite/gcc.dg/lto/pr61786_1.c | 8 +++++++ gcc/testsuite/gcc.dg/torture/pr61786.c | 31 ++++++++++++++++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/lto/pr61786_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/pr61786_1.c create mode 100644 gcc/testsuite/gcc.dg/torture/pr61786.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a2529fc17b3..a6483a68ec1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2014-07-14 Richard Biener + + PR tree-optimization/61786 + * gcc.dg/torture/pr61786.c: New testcase. + * gcc.dg/lto/pr61786_0.c: Likewise. + * gcc.dg/lto/pr61786_1.c: Likewise. + 2014-07-14 Richard Biener PR tree-optimization/61757 diff --git a/gcc/testsuite/gcc.dg/lto/pr61786_0.c b/gcc/testsuite/gcc.dg/lto/pr61786_0.c new file mode 100644 index 00000000000..442b5b2c302 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr61786_0.c @@ -0,0 +1,27 @@ +/* { dg-lto-do run } */ +/* { dg-lto-options { { -flto } } } */ +/* { dg-extra-ld-options "-O" } */ + +int a, *c = &a, d; +char b = 1; + +void +fn1 (void) +{ + d = 1; +lbl: + if (b == d) + { + d = *c; + if (b) + goto lbl; + } +} + +int +fn2 (void) +{ + fn1 (); + return 0; +} + diff --git a/gcc/testsuite/gcc.dg/lto/pr61786_1.c b/gcc/testsuite/gcc.dg/lto/pr61786_1.c new file mode 100644 index 00000000000..4cfd0aa0b69 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr61786_1.c @@ -0,0 +1,8 @@ +int fn2 (void); + +int +main () +{ + fn2 (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr61786.c b/gcc/testsuite/gcc.dg/torture/pr61786.c new file mode 100644 index 00000000000..1e32a822b2e --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr61786.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ + +int a, *c = &a, d; +char b = 1; + +void +fn1 () +{ + d = 1; +lbl: + if (b == d) + { + d = *c; + if (b) + goto lbl; + } +} + +int +fn2 () +{ + fn1 (); + return 0; +} + +int +main () +{ + fn2 (); + return 0; +}