From 07e1d16d929bfdd59c8eeda83b74d2fecb24f045 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 23 Apr 2014 12:45:23 +0000 Subject: [PATCH] re PR lto/60635 (ICE when mixing C and Fortran lto1: error: use operand missing for stmt) 2014-04-23 Richard Biener PR middle-end/60635 * gimplify.c (gimple_regimplify_operands): Update the re-gimplifed stmt. * gfortran.dg/lto/pr60635_0.f90: New testcase. * gfortran.dg/lto/pr60635_1.c: Likewise. From-SVN: r209696 --- gcc/ChangeLog | 6 ++++++ gcc/gimplify.c | 2 ++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/lto/pr60635_0.f90 | 16 ++++++++++++++++ gcc/testsuite/gfortran.dg/lto/pr60635_1.c | 14 ++++++++++++++ 5 files changed, 44 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/lto/pr60635_0.f90 create mode 100644 gcc/testsuite/gfortran.dg/lto/pr60635_1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index de4c7891344a..8f7d2441d060 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-04-23 Richard Biener + + PR middle-end/60635 + * gimplify.c (gimple_regimplify_operands): Update the + re-gimplifed stmt. + 2014-04-21 Michael Meissner Back port from the trunk, subversion id 209546. diff --git a/gcc/gimplify.c b/gcc/gimplify.c index a9a9229f45f2..52fbfc5732c3 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -8632,6 +8632,8 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p) gsi_insert_after (gsi_p, post_stmt, GSI_NEW_STMT); pop_gimplify_context (NULL); + + update_stmt (stmt); } /* Expand EXPR to list of gimple statements STMTS. GIMPLE_TEST_F specifies diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 22f1669e92aa..226f7e749c60 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2014-04-23 Richard Biener + + PR middle-end/60635 + * gfortran.dg/lto/pr60635_0.f90: New testcase. + * gfortran.dg/lto/pr60635_1.c: Likewise. + 2014-04-21 Michael Meissner Back port from the trunk, subversion id 209546. diff --git a/gcc/testsuite/gfortran.dg/lto/pr60635_0.f90 b/gcc/testsuite/gfortran.dg/lto/pr60635_0.f90 new file mode 100644 index 000000000000..e12187985900 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/lto/pr60635_0.f90 @@ -0,0 +1,16 @@ +! { dg-lto-do link } +program test + use iso_fortran_env + + interface + integer(int16) function bigendc16(x) bind(C) + import + integer(int16), intent(in) :: x + end function + end interface + + integer(int16) :: x16 = 12345 + x16 = bigendc16(x16) + print *,x16 +end program + diff --git a/gcc/testsuite/gfortran.dg/lto/pr60635_1.c b/gcc/testsuite/gfortran.dg/lto/pr60635_1.c new file mode 100644 index 000000000000..eddc569e6504 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/lto/pr60635_1.c @@ -0,0 +1,14 @@ +#include +#include + +static bool littleendian=true; + +uint16_t bigendc16(union{uint16_t * n;uint8_t* b;}x){ + + if (!littleendian) return *x.n; + + uint16_t res = ((uint16_t)(x.b[1])<<0) | + ((uint16_t)(x.b[0])<<8); + return res; +} + -- 2.47.2