Commit 6fc3c3c0 by Tom Tromey Committed by Tom Tromey

re PR c/34457 (ICE with VLA and -combine)

gcc/
	PR c/34457:
	* c-common.c (c_type_hash): Handle VLAs.
gcc/testsuite
	PR c/34457:
	* gcc.dg/pr34457-2.c: New file.
	* gcc.dg/pr34457-1.c: New file.

From-SVN: r131311
parent 1af0d737
2008-01-03 Tom Tromey <tromey@redhat.com>
PR c/34457:
* c-common.c (c_type_hash): Handle VLAs.
2008-01-03 Jan Hubicka <jh@suse.cz> 2008-01-03 Jan Hubicka <jh@suse.cz>
PR tree-optimization/31081 PR tree-optimization/31081
/* Subroutines shared by all languages that are variants of C. /* Subroutines shared by all languages that are variants of C.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -3171,7 +3171,11 @@ c_type_hash (const void *p) ...@@ -3171,7 +3171,11 @@ c_type_hash (const void *p)
} }
for (; t2; t2 = TREE_CHAIN (t2)) for (; t2; t2 = TREE_CHAIN (t2))
i++; i++;
size = TREE_INT_CST_LOW (TYPE_SIZE (t)); /* We might have a VLA here. */
if (TREE_CODE (TYPE_SIZE (t)) != INTEGER_CST)
size = 0;
else
size = TREE_INT_CST_LOW (TYPE_SIZE (t));
return ((size << 24) | (i << shift)); return ((size << 24) | (i << shift));
} }
......
2008-01-03 Tom Tromey <tromey@redhat.com>
PR c/34457:
* gcc.dg/pr34457-2.c: New file.
* gcc.dg/pr34457-1.c: New file.
2008-01-03 Sebastian Pop <sebastian.pop@amd.com> 2008-01-03 Sebastian Pop <sebastian.pop@amd.com>
Revert fix for PR tree-optimization/34458. Revert fix for PR tree-optimization/34458.
/* PR c/34457 */
/* { dg-do compile } */
/* { dg-options "--combine -O2" } */
/* { dg-additional-sources "pr34457-2.c" } */
typedef __SIZE_TYPE__ size_t;
extern int printf (const char *, ...);
extern void *memset (void *, int, size_t);
int bar (int (*)(), int, void *);
int
main(int argc, char **argv)
{
struct s { int a; char b[argc]; };
int nested (struct s x) { return x.a + sizeof(x); }
struct s t;
memset (&t, 0, sizeof(t));
t.a = 123;
printf("%d\n", bar (nested, argc, &t));
return 0;
}
/* Additional file for PR c/34457. */
int x;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment