[Bug tree-optimization/51481] [4.7 Regression] ice: dead STMT in EH table

2011-12-13 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51481

--- Comment #8 from Richard Guenther rguenth at gcc dot gnu.org 2011-12-13 
11:24:44 UTC ---
The following is a real fix I'm going to test.

@@ -1601,6 +1605,7 @@ replace_uses_by (tree name, tree val)
   if (gimple_code (stmt) != GIMPLE_PHI)
{
  gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
+ gimple orig_stmt = stmt;
  size_t i;

  fold_stmt (gsi);
@@ -1619,7 +1624,7 @@ replace_uses_by (tree name, tree val)
recompute_tree_invariant_for_addr_expr (op);
}

- maybe_clean_or_replace_eh_stmt (stmt, stmt);
+ maybe_clean_or_replace_eh_stmt (orig_stmt, stmt);
  update_stmt (stmt);
}
 }


[Bug tree-optimization/51481] [4.7 Regression] ice: dead STMT in EH table

2011-12-13 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51481

--- Comment #9 from Richard Guenther rguenth at gcc dot gnu.org 2011-12-13 
12:56:13 UTC ---
Author: rguenth
Date: Tue Dec 13 12:56:09 2011
New Revision: 182280

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=182280
Log:
2011-12-13  Richard Guenther  rguent...@suse.de

PR middle-end/51481
* tree-cfg.c (replace_uses_by): Pass proper arguments to
maybe_clean_or_replace_eh_stmt.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/tree-cfg.c



[Bug tree-optimization/51481] [4.7 Regression] ice: dead STMT in EH table

2011-12-13 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51481

--- Comment #10 from Jakub Jelinek jakub at gcc dot gnu.org 2011-12-13 
14:01:04 UTC ---
Author: jakub
Date: Tue Dec 13 14:00:58 2011
New Revision: 182284

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=182284
Log:
Revert
2011-12-12  Jakub Jelinek  ja...@redhat.com

PR tree-optimization/51481
* gimple-fold.c (gimple_fold_call): Call
maybe_clean_or_replace_eh_stmt.  Avoid optimization if stmt has EH
edges, but gimple_fold_builtin result can't throw.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/gimple-fold.c


[Bug tree-optimization/51481] [4.7 Regression] ice: dead STMT in EH table

2011-12-12 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51481

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek jakub at gcc dot gnu.org 2011-12-12 
09:22:06 UTC ---
Started with http://gcc.gnu.org/viewcvs?root=gccview=revrev=181172


[Bug tree-optimization/51481] [4.7 Regression] ice: dead STMT in EH table

2011-12-12 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51481

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

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

--- Comment #4 from Jakub Jelinek jakub at gcc dot gnu.org 2011-12-12 
10:24:49 UTC ---
Created attachment 26053
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26053
gcc47-pr51481.patch

maybe_cleanup_or_replace_eh_stmt wasn't called, the patch fixes that.
Unfortunately, as it is deep inside of fold_stmt called from deep from various
passes, including cfg cleanup, I'm afraid handling eh edge dropping as opposed
to just replacing would be hard.  Let's just hope possibly throwing builtins
aren't optimized away.


[Bug tree-optimization/51481] [4.7 Regression] ice: dead STMT in EH table

2011-12-12 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51481

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

  Attachment #26053|0   |1
is obsolete||

--- Comment #5 from Jakub Jelinek jakub at gcc dot gnu.org 2011-12-12 
10:48:22 UTC ---
Created attachment 26054
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26054
gcc47-pr51481.patch

Updated patch that won't fold if gimple_purge_dead_eh_edges would be needed.


[Bug tree-optimization/51481] [4.7 Regression] ice: dead STMT in EH table

2011-12-12 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51481

--- Comment #6 from Jakub Jelinek jakub at gcc dot gnu.org 2011-12-12 
20:59:31 UTC ---
Author: jakub
Date: Mon Dec 12 20:59:28 2011
New Revision: 182264

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=182264
Log:
PR tree-optimization/51481
* gimple-fold.c (gimple_fold_call): Call
maybe_clean_or_replace_eh_stmt.  Avoid optimization if stmt has EH
edges, but gimple_fold_builtin result can't throw.

* gcc.dg/pr51481.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/pr51481.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/gimple-fold.c
trunk/gcc/testsuite/ChangeLog


[Bug tree-optimization/51481] [4.7 Regression] ice: dead STMT in EH table

2011-12-12 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51481

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED

--- Comment #7 from Jakub Jelinek jakub at gcc dot gnu.org 2011-12-12 
21:02:38 UTC ---
Fixed.


[Bug tree-optimization/51481] [4.7 Regression] ice: dead STMT in EH table

2011-12-09 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51481

Richard Guenther rguenth at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2011-12-09
  Component|c   |tree-optimization
  Known to work||4.6.2
   Target Milestone|--- |4.7.0
Summary|ice: dead STMT in EH table  |[4.7 Regression] ice: dead
   ||STMT in EH table
 Ever Confirmed|0   |1

--- Comment #1 from Richard Guenther rguenth at gcc dot gnu.org 2011-12-09 
08:54:30 UTC ---
Catched at IPA inline transform time.  Confirmed, regression from 4.6,
reducing.


[Bug tree-optimization/51481] [4.7 Regression] ice: dead STMT in EH table

2011-12-09 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51481

Richard Guenther rguenth at gcc dot gnu.org changed:

   What|Removed |Added

 CC||jamborm at gcc dot gnu.org

--- Comment #2 from Richard Guenther rguenth at gcc dot gnu.org 2011-12-09 
09:01:29 UTC ---
The following fails with -O -fexceptions -fipa-cp -fipa-cp-clone:

typedef __builtin_va_list __gnuc_va_list;
typedef __gnuc_va_list va_list;
extern struct _IO_FILE *stderr;
extern __const unsigned short int **__ctype_b_loc (void) 
 __attribute__ ((__nothrow__)) __attribute__ ((__const));
struct abcsym {
unsigned short colnum;
int linenum;
};
struct SYMBOL {
struct abcsym as;
};
typedef struct SYMBOL *INFO[26];
extern INFO info;
void error(int sev, struct SYMBOL *s, char *fmt, ...);
void bug(char *msg, int fatal)
{
  error(1, 0, Internal error: %s., msg);
}
void error(int sev, struct SYMBOL *s, char *fmt, ...)
{
  va_list args;
  static struct SYMBOL *t;
  if (t != info['T' - 'A'])
{
  char *p;
  t = info['T' - 'A'];
  while ((*__ctype_b_loc ())[(int) (((unsigned char) *p))])
p++;
}
  __builtin_fprintf(stderr, sev == 0 ? Warning  : Error );
  if (s != 0)
  __builtin_fprintf(stderr, in line %d.%d, s-as.linenum, s-as.colnum);
  __builtin_va_end(args);
}