diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-20 22:54:35 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-02-20 22:54:35 +0000 |
commit | c53485bbb81a5ddaeeceb228bb0ed1328b5c2e0e (patch) | |
tree | 92091a1ae9884506ec5a5bd1f121978289726ebf /gcc/testsuite/gcc.dg | |
parent | 00c7100f102b06d2844bffb7bbf69c78f1bd5d55 (diff) | |
download | gcc-c53485bbb81a5ddaeeceb228bb0ed1328b5c2e0e.tar.gz |
PR c/4389
* tree.c (host_integerp): Ensure that the constant integer is
representable in a HOST_WIDE_INT or an unsigned HOST_WIDE_INT
when pos is zero or non-zero respectively. Clarify comment.
* c-format.c (check_format_info_recurse): Fix host_integerp
usage; the pos argument should be zero when assigning to a
signed HOST_WIDE_INT.
* gcc.dg/20020219-1.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49914 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r-- | gcc/testsuite/gcc.dg/20020219-1.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/20020219-1.c b/gcc/testsuite/gcc.dg/20020219-1.c new file mode 100644 index 00000000000..c879f230db6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20020219-1.c @@ -0,0 +1,28 @@ +/* PR c/4389 + This testcase failed because host_integerp (x, 0) was returning + 1 even for constants bigger than 2^31. */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +extern void abort (void); +extern void exit (int); +struct A { + int a[10000][10000]; +}; +int b[2] = { 213151, 0 }; + +void foo (struct A *x, int y) +{ + if (x->a[9999][9999] != x->a[y][y]) + abort (); + if (x->a[9999][9999] != 213151) + abort (); +} + +int main (void) +{ + struct A *x; + asm ("" : "=r" (x) : "0" (&b[1])); + foo (x - 1, 9999); + exit (0); +} |