This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/30364] [4.1 Regression] Wrong variable ranges due to constant folding
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Aug 2007 16:33:11 -0000
- Subject: [Bug middle-end/30364] [4.1 Regression] Wrong variable ranges due to constant folding
- References: <bug-30364-7904@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #17 from jakub at gcc dot gnu dot org 2007-08-24 16:33 -------
Does this make sense to do this for POINTER_TYPE_P in 4.1/4.2, which
reassociate
in many other places?
I belive in 4.3 that changed with POINTER_PLUS_EXPR stuff.
struct A { int i; int v[10000]; };
int *foo (struct A *a, int x)
{
return &a->v[x - 2147483646];
}
in 4.2/4.1 gives:
foo (a, x)
{
<bb 2>:
return &a->v[0] - 4294967288B + (int *) ((unsigned int) x * 4);
}
so it will overflow (well, underflow).
E.g. on Linux kernel code this commit causes some stack size usage regressions.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30364