[PATCH] Fix PR25183, ICE on valid code
Richard Guenther
rguenther@suse.de
Mon Jan 2 16:26:00 GMT 2006
This fixes PR25183 by making sure not to carry over overflow flags
from switch to the range list.
Bootstrapped and regtested on x86_64-unknown-linux-gnu.
Ok for 4.1, mainline and 4.0?
Thanks,
Richard.
:ADDPATCH middle-end:
2006-01-02 Richard Guenther <rguenther@suse.de>
* stmt.c (add_case_node): Make sure to clear overflow flags
from ranges.
* gcc.dg/torture/pr25183.c: New testcase.
Index: stmt.c
===================================================================
*** stmt.c (revision 108947)
--- stmt.c (working copy)
*************** add_case_node (struct case_node *head, t
*** 2104,2113 ****
}
! /* Add this label to the chain. */
r = ggc_alloc (sizeof (struct case_node));
! r->low = low;
! r->high = high;
r->code_label = label;
r->parent = r->left = NULL;
r->right = head;
--- 2104,2115 ----
}
! /* Add this label to the chain. Make sure to drop overflow flags. */
r = ggc_alloc (sizeof (struct case_node));
! 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;
/* { 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;
}
}
More information about the Gcc-patches
mailing list