Re: [PATCH] Fix PR56694

2013-03-28 Thread Tejas Belagod

Richard Biener wrote:

This fixes PR56694 - the code keeping BLOCKs live is not looking
at the EH tree for references.  In the must-not-throw failure_loc
such references can now appear.

Fixed by reverting that to 4.7 behavior.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk
and 4.8 branch.

Richard.

2013-03-25  Richard Biener  rguent...@suse.de

PR middle-end/56694
* tree-eh.c (lower_eh_must_not_throw): Strip BLOCKs from the
must-not-throw stmt location.

* g++.dg/torture/pr56694.C: New testcase.

Index: gcc/tree-eh.c
===
*** gcc/tree-eh.c   (revision 197029)
--- gcc/tree-eh.c   (working copy)
*** lower_eh_must_not_throw (struct leh_stat
*** 1855,1861 
this_region = gen_eh_region_must_not_throw (state-cur_region);
this_region-u.must_not_throw.failure_decl
= gimple_eh_must_not_throw_fndecl (inner);
!   this_region-u.must_not_throw.failure_loc = gimple_location (tp);
  
/* In order to get mangling applied to this decl, we must mark it

 used now.  Otherwise, pass_ipa_free_lang_data won't think it
--- 1855,1862 
this_region = gen_eh_region_must_not_throw (state-cur_region);
this_region-u.must_not_throw.failure_decl
= gimple_eh_must_not_throw_fndecl (inner);
!   this_region-u.must_not_throw.failure_loc
!   = LOCATION_LOCUS (gimple_location (tp));
  
/* In order to get mangling applied to this decl, we must mark it

 used now.  Otherwise, pass_ipa_free_lang_data won't think it
Index: gcc/testsuite/g++.dg/torture/pr56694.C
===
*** gcc/testsuite/g++.dg/torture/pr56694.C  (revision 0)
--- gcc/testsuite/g++.dg/torture/pr56694.C  (working copy)
***
*** 0 
--- 1,30 
+ // { dg-do compile }
+ // { dg-options -fopenmp }
+ 


Hi,

This fails to build on 'bare-metal'(non-OS) targets. The attached patch fixes 
this from FAIL - UNSUPPORTED for bare-metal targets.


Tested on bare-metal aarch64 (aarch64-none-elf).

OK?

Thanks,
Tejas Belagod.
ARM.

Changelog:

2013-03-28  Tejas Belagod  tejas.bela...@arm.com

testsuite/
* g++.dg/torture/pr56694.C: Fix test case to build on bare-metal
targets.diff --git a/gcc/testsuite/g++.dg/torture/pr56694.C 
b/gcc/testsuite/g++.dg/torture/pr56694.C
index 22bfe3c..d3de051 100644
--- a/gcc/testsuite/g++.dg/torture/pr56694.C
+++ b/gcc/testsuite/g++.dg/torture/pr56694.C
@@ -1,5 +1,6 @@
 // { dg-do compile }
 // { dg-options -fopenmp }
+// { dg-require-effective-target fopenmp }
 
 class GException {
 public:

Re: [PATCH] Fix PR56694

2013-03-28 Thread Richard Biener
On Thu, 28 Mar 2013, Tejas Belagod wrote:

 Richard Biener wrote:
  This fixes PR56694 - the code keeping BLOCKs live is not looking
  at the EH tree for references.  In the must-not-throw failure_loc
  such references can now appear.
  
  Fixed by reverting that to 4.7 behavior.
  
  Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk
  and 4.8 branch.
  
  Richard.
  
  2013-03-25  Richard Biener  rguent...@suse.de
  
  PR middle-end/56694
  * tree-eh.c (lower_eh_must_not_throw): Strip BLOCKs from the
  must-not-throw stmt location.
  
  * g++.dg/torture/pr56694.C: New testcase.
  
  Index: gcc/tree-eh.c
  ===
  *** gcc/tree-eh.c   (revision 197029)
  --- gcc/tree-eh.c   (working copy)
  *** lower_eh_must_not_throw (struct leh_stat
  *** 1855,1861 
  this_region = gen_eh_region_must_not_throw (state-cur_region);
  this_region-u.must_not_throw.failure_decl
  = gimple_eh_must_not_throw_fndecl (inner);
  !   this_region-u.must_not_throw.failure_loc = gimple_location (tp);
/* In order to get mangling applied to this decl, we must mark it
   used now.  Otherwise, pass_ipa_free_lang_data won't think it
  --- 1855,1862 
  this_region = gen_eh_region_must_not_throw (state-cur_region);
  this_region-u.must_not_throw.failure_decl
  = gimple_eh_must_not_throw_fndecl (inner);
  !   this_region-u.must_not_throw.failure_loc
  !   = LOCATION_LOCUS (gimple_location (tp));
/* In order to get mangling applied to this decl, we must mark it
   used now.  Otherwise, pass_ipa_free_lang_data won't think it
  Index: gcc/testsuite/g++.dg/torture/pr56694.C
  ===
  *** gcc/testsuite/g++.dg/torture/pr56694.C  (revision 0)
  --- gcc/testsuite/g++.dg/torture/pr56694.C  (working copy)
  ***
  *** 0 
  --- 1,30 
  + // { dg-do compile }
  + // { dg-options -fopenmp }
  + 
 
 Hi,
 
 This fails to build on 'bare-metal'(non-OS) targets. The attached patch fixes
 this from FAIL - UNSUPPORTED for bare-metal targets.
 
 Tested on bare-metal aarch64 (aarch64-none-elf).
 
 OK?

Ok for trunk and branch.

Thanks,
Richard.

 Thanks,
 Tejas Belagod.
 ARM.
 
 Changelog:
 
 2013-03-28  Tejas Belagod  tejas.bela...@arm.com
 
 testsuite/
   * g++.dg/torture/pr56694.C: Fix test case to build on bare-metal
   targets.


[PATCH] Fix PR56694

2013-03-25 Thread Richard Biener

This fixes PR56694 - the code keeping BLOCKs live is not looking
at the EH tree for references.  In the must-not-throw failure_loc
such references can now appear.

Fixed by reverting that to 4.7 behavior.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk
and 4.8 branch.

Richard.

2013-03-25  Richard Biener  rguent...@suse.de

PR middle-end/56694
* tree-eh.c (lower_eh_must_not_throw): Strip BLOCKs from the
must-not-throw stmt location.

* g++.dg/torture/pr56694.C: New testcase.

Index: gcc/tree-eh.c
===
*** gcc/tree-eh.c   (revision 197029)
--- gcc/tree-eh.c   (working copy)
*** lower_eh_must_not_throw (struct leh_stat
*** 1855,1861 
this_region = gen_eh_region_must_not_throw (state-cur_region);
this_region-u.must_not_throw.failure_decl
= gimple_eh_must_not_throw_fndecl (inner);
!   this_region-u.must_not_throw.failure_loc = gimple_location (tp);
  
/* In order to get mangling applied to this decl, we must mark it
 used now.  Otherwise, pass_ipa_free_lang_data won't think it
--- 1855,1862 
this_region = gen_eh_region_must_not_throw (state-cur_region);
this_region-u.must_not_throw.failure_decl
= gimple_eh_must_not_throw_fndecl (inner);
!   this_region-u.must_not_throw.failure_loc
!   = LOCATION_LOCUS (gimple_location (tp));
  
/* In order to get mangling applied to this decl, we must mark it
 used now.  Otherwise, pass_ipa_free_lang_data won't think it
Index: gcc/testsuite/g++.dg/torture/pr56694.C
===
*** gcc/testsuite/g++.dg/torture/pr56694.C  (revision 0)
--- gcc/testsuite/g++.dg/torture/pr56694.C  (working copy)
***
*** 0 
--- 1,30 
+ // { dg-do compile }
+ // { dg-options -fopenmp }
+ 
+ class GException {
+ public:
+ class vector_mismatch {
+ public:
+   vector_mismatch(int size1, int size2);
+ };
+ };
+ class GVector{
+ public:
+ GVector operator+=(const GVector v);
+ int m_num;
+ double* m_data;
+ };
+ inline GVector GVector::operator+= (const GVector v)
+ {
+   if (m_num != v.m_num)
+ throw GException::vector_mismatch(m_num, v.m_num);
+   for (int i = 0; i  m_num; ++i)  m_data[i] += v.m_data[i];
+ };
+ void eval(GVector* m_gradient, GVector* vect_cpy_grad, int n)
+ {
+ #pragma omp sections
+ {
+   for (int i = 0; i  n; ++i)
+   *m_gradient += vect_cpy_grad[i];
+ }
+ }