re PR c/25183 (internal compiler error triggered by overflow in constant expression)

2006-01-03  Richard Guenther  <rguenther@suse.de>

        PR c/25183
	* stmt.c (add_case_node): Make sure to clear overflow flags
	from ranges.

	* gcc.dg/torture/pr25183.c: New testcase.

From-SVN: r109272
This commit is contained in:
Richard Guenther 2006-01-03 09:15:08 +00:00 committed by Richard Biener
parent 396b535a72
commit b2ecb7a8e6
4 changed files with 38 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2006-01-03 Richard Guenther <rguenther@suse.de>
PR c/25183
* stmt.c (add_case_node): Make sure to clear overflow flags
from ranges.
2006-01-03 Jakub Jelinek <jakub@redhat.com>
Merge from gomp-branch.

View File

@ -2104,10 +2104,12 @@ add_case_node (struct case_node *head, tree type, tree low, tree high,
}
/* Add this label to the chain. */
/* Add this label to the chain. Make sure to drop overflow flags. */
r = ggc_alloc (sizeof (struct case_node));
r->low = low;
r->high = high;
r->low = build_int_cst_wide (TREE_TYPE (low), TREE_INT_CST_LOW (low),
TREE_INT_CST_HIGH (low));
r->high = build_int_cst_wide (TREE_TYPE (high), TREE_INT_CST_LOW (high),
TREE_INT_CST_HIGH (high));
r->code_label = label;
r->parent = r->left = NULL;
r->right = head;

View File

@ -1,3 +1,8 @@
2006-01-03 Richard Guenther <rguenther@suse.de>
PR c/25183
* gcc.dg/torture/pr25183.c: New testcase.
2006-01-03 Jakub Jelinek <jakub@redhat.com>
Merge from gomp-branch.

View File

@ -0,0 +1,22 @@
/* { dg-do compile } */
/* { dg-options "-pedantic" } */
enum err {
err_IO = 0x8a450000, /* { dg-warning "int" } */
err_NM,
err_EOF,
err_SE,
err_PT
};
static enum err E_;
int error()
{
switch (E_) {
case err_IO : break; /* { dg-warning "overflow" } */
case err_NM : break; /* { dg-warning "overflow" } */
case err_EOF : break; /* { dg-warning "overflow" } */
case err_SE : break; /* { dg-warning "overflow" } */
case err_PT : break; /* { dg-warning "overflow" } */
default : return 0;
}
}