[Bug target/52918] [4.8 Regression] ICE: Invalid bb-loop_father (NULL) in add_bb_to_loop

2012-04-11 Thread ktietz at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52918

--- Comment #6 from Kai Tietz ktietz at gcc dot gnu.org 2012-04-11 09:31:58 
UTC ---
Created attachment 27129
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27129
Preprocessed eh_allocator.cc

With patch posted to ML, this shows new error (compile with -O2):

../../../../../gcc/libstdc++-v3/src/c++98/bitmap_allocator.cc: In member
functio
n 'std::size_t* __gnu_cxx::free_list::_M_get(std::size_t)':
../../../../../gcc/libstdc++-v3/src/c++98/bitmap_allocator.cc:104:3: error:
loop
 4's latch does not belong directly to it
../../../../../gcc/libstdc++-v3/src/c++98/bitmap_allocator.cc:104:3: internal
co
mpiler error: in verify_loop_structure, at cfgloop.c:1567
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.


[Bug target/52918] [4.8 Regression] ICE: Invalid bb-loop_father (NULL) in add_bb_to_loop

2012-04-11 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52918

--- Comment #7 from Richard Guenther rguenth at gcc dot gnu.org 2012-04-11 
10:44:41 UTC ---
Reduced testcase for the first source:

typedef __SIZE_TYPE__ size_t;
void*   __cxa_allocate_exception(size_t) throw();
typedef struct { } __gthread_mutex_t;
extern int __gthr_win32_mutex_unlock (__gthread_mutex_t *);
int __gthread_mutex_lock (__gthread_mutex_t *__mutex);
int __gthread_mutex_unlock (__gthread_mutex_t *__mutex);
void   __throw_concurrence_lock_error();
void   __throw_concurrence_unlock_error();
class __mutex   {
__gthread_mutex_t _M_mutex;
public:
void lock() {
if (__gthread_mutex_lock(_M_mutex) != 0)
  __throw_concurrence_lock_error();
}
void unlock() {
if (__gthread_mutex_unlock(_M_mutex) != 0)
  __throw_concurrence_unlock_error();
}
};
class __scoped_lock   {
typedef __mutex __mutex_type;
__mutex_type _M_device;
public:
explicit __scoped_lock(__mutex_type __name) : _M_device(__name) {
_M_device.lock();
}
~__scoped_lock() throw(){
_M_device.unlock();
}
};
__mutex emergency_mutex;
void * __cxa_allocate_exception(size_t thrown_size) throw()
{
  void *ret;
  if (! ret)
__scoped_lock sentry(emergency_mutex);
}


[Bug target/52918] [4.8 Regression] ICE: Invalid bb-loop_father (NULL) in add_bb_to_loop

2012-04-11 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52918

--- Comment #8 from Richard Guenther rguenth at gcc dot gnu.org 2012-04-11 
11:11:45 UTC ---
And for the 2nd:

typedef __SIZE_TYPE__ size_t;
class bad_alloc   { };
typedef struct {
} __gthread_mutex_t;
int __gthread_mutex_unlock (__gthread_mutex_t *__mutex);
class __concurrence_unlock_error   {
};
inline void   __throw_concurrence_unlock_error()   {
throw __concurrence_unlock_error();
}
class __mutex   {
__gthread_mutex_t _M_mutex;
public:
void unlock() {
if (__gthread_mutex_unlock(_M_mutex) != 0)
  __throw_concurrence_unlock_error();
}
};
class free_list   {
typedef __mutex __mutex_type;
__mutex_type _M_get_mutex();
void _M_get(size_t __sz) throw(bad_alloc);
};
void  free_list::_M_get(size_t __sz) throw(bad_alloc)
{
  __mutex_type __bfl_mutex = _M_get_mutex();
  __bfl_mutex.unlock();
  int __ctr = 2;
  while (__ctr)  {
  size_t* __ret = 0;
  --__ctr;
  try {
  __ret = (size_t*) (::operator new(__sz + sizeof(size_t)));
  }
  catch(const bad_alloc) { }
  }
}


[Bug target/52918] [4.8 Regression] ICE: Invalid bb-loop_father (NULL) in add_bb_to_loop

2012-04-11 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52918

Richard Guenther rguenth at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 AssignedTo|unassigned at gcc dot   |rguenth at gcc dot gnu.org
   |gnu.org |

--- Comment #9 from Richard Guenther rguenth at gcc dot gnu.org 2012-04-11 
11:26:48 UTC ---
Created attachment 27132
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27132
patch

Can you test the attached?


[Bug target/52918] [4.8 Regression] ICE: Invalid bb-loop_father (NULL) in add_bb_to_loop

2012-04-11 Thread ktietz at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52918

--- Comment #10 from Kai Tietz ktietz at gcc dot gnu.org 2012-04-11 12:05:27 
UTC ---
(In reply to comment #9)
 Created attachment 27132 [details]
 patch
 
 Can you test the attached?

Bootstrap and regression test passes.  Thanks


[Bug target/52918] [4.8 Regression] ICE: Invalid bb-loop_father (NULL) in add_bb_to_loop

2012-04-11 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52918

--- Comment #11 from Richard Guenther rguenth at gcc dot gnu.org 2012-04-11 
14:02:37 UTC ---
Author: rguenth
Date: Wed Apr 11 14:02:26 2012
New Revision: 186320

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=186320
Log:
2012-04-11  Richard Guenther  rguent...@suse.de

PR middle-end/52918
* except.c (sjlj_emit_dispatch_table): Properly update loop
structure.

* g++.dg/torture/pr52918-1.C: New testcase.
* g++.dg/torture/pr52918-2.C: Likewise.

Added:
trunk/gcc/testsuite/g++.dg/torture/pr52918-1.C
trunk/gcc/testsuite/g++.dg/torture/pr52918-2.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/except.c
trunk/gcc/testsuite/ChangeLog


[Bug target/52918] [4.8 Regression] ICE: Invalid bb-loop_father (NULL) in add_bb_to_loop

2012-04-11 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52918

Richard Guenther rguenth at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED

--- Comment #12 from Richard Guenther rguenth at gcc dot gnu.org 2012-04-11 
14:19:35 UTC ---
Fixed.


[Bug target/52918] [4.8 Regression] ICE: Invalid bb-loop_father (NULL) in add_bb_to_loop

2012-04-11 Thread bscottm at ieee dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52918

--- Comment #13 from B. Scott Michel bscottm at ieee dot org 2012-04-11 
18:38:24 UTC ---
Thanks!


[Bug target/52918] [4.8 Regression] ICE: Invalid bb-loop_father (NULL) in add_bb_to_loop

2012-04-10 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52918

Richard Guenther rguenth at gcc dot gnu.org changed:

   What|Removed |Added

  Component|c++ |target
   Target Milestone|--- |4.8.0
Summary|ICE: Invalid|[4.8 Regression] ICE:
   |bb-loop_father (NULL) in   |Invalid bb-loop_father
   |add_bb_to_loop  |(NULL) in add_bb_to_loop

--- Comment #2 from Richard Guenther rguenth at gcc dot gnu.org 2012-04-10 
12:25:22 UTC ---
The bug is that bb has no loop_father.  Without preprocessed source I cannot
verify with a cross compiler.


[Bug target/52918] [4.8 Regression] ICE: Invalid bb-loop_father (NULL) in add_bb_to_loop

2012-04-10 Thread ktietz at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52918

Kai Tietz ktietz at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2012-04-10
 CC||ktietz at gcc dot gnu.org
 Ever Confirmed|0   |1

--- Comment #3 from Kai Tietz ktietz at gcc dot gnu.org 2012-04-10 12:31:39 
UTC ---
I am on it.  It is related to target's use of SjLj's exception, but target hook
TARGET_EXCEPT_UNWIND_INFO isn't set and so DWARF2 is used.  I am just about
testing a patch for it.


[Bug target/52918] [4.8 Regression] ICE: Invalid bb-loop_father (NULL) in add_bb_to_loop

2012-04-10 Thread bscottm at ieee dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52918

--- Comment #4 from B. Scott Michel bscottm at ieee dot org 2012-04-10 
21:28:25 UTC ---
Created attachment 27128
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27128
Preprocessed eh_alloc.cc, for reference

Per request, preprocessed source attached.


[Bug target/52918] [4.8 Regression] ICE: Invalid bb-loop_father (NULL) in add_bb_to_loop

2012-04-10 Thread bscottm at ieee dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52918

--- Comment #5 from B. Scott Michel bscottm at ieee dot org 2012-04-10 
21:31:13 UTC ---
I deduced that add_bb_to_loop and a null bb-loop_father meant that the
enclosing basic block was either missing or incorrectly annotated. The fix,
however, is not obvious without getting heavily involved in gcc development.

Preprocessed source uploaded for additional insight.