re PR debug/43150 (Proper debug info for debugging VLAs)

PR debug/43150
	* gimplify.c (gimplify_type_sizes): Clear DECL_IGNORED_P for VLA
	bounds even for -O+.
	* var-tracking.c (track_expr_p): If !need_rtl, don't mandate
	expr needs to have DECL_NAME set.

	* gcc.dg/guality/vla-1.c: New test.

From-SVN: r157032
This commit is contained in:
Jakub Jelinek 2010-02-24 11:50:13 +01:00 committed by Jakub Jelinek
parent 12a54f548b
commit 2e9577924b
5 changed files with 54 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2010-02-24 Jakub Jelinek <jakub@redhat.com>
PR debug/43150
* gimplify.c (gimplify_type_sizes): Clear DECL_IGNORED_P for VLA
bounds even for -O+.
* var-tracking.c (track_expr_p): If !need_rtl, don't mandate
expr needs to have DECL_NAME set.
2010-02-24 Nick Clifton <nickc@redhat.com>
* config/mep/mep.c: Include gimple.h.

View File

@ -7367,9 +7367,10 @@ gimplify_type_sizes (tree type, gimple_seq *list_p)
/* These types may not have declarations, so handle them here. */
gimplify_type_sizes (TREE_TYPE (type), list_p);
gimplify_type_sizes (TYPE_DOMAIN (type), list_p);
/* When not optimizing, ensure VLA bounds aren't removed. */
if (!optimize
&& TYPE_DOMAIN (type)
/* Ensure VLA bounds aren't removed, for -O0 they should be variables
with assigned stack slots, for -O1+ -g they should be tracked
by VTA. */
if (TYPE_DOMAIN (type)
&& INTEGRAL_TYPE_P (TYPE_DOMAIN (type)))
{
t = TYPE_MIN_VALUE (TYPE_DOMAIN (type));

View File

@ -1,3 +1,8 @@
2010-02-24 Jakub Jelinek <jakub@redhat.com>
PR debug/43150
* gcc.dg/guality/vla-1.c: New test.
2010-02-24 Tobias Burnus <burnus@net-b.de>
PR fortran/43042

View File

@ -0,0 +1,36 @@
/* PR debug/43150 */
/* { dg-do run } */
/* { dg-options "-g" } */
void __attribute__((noinline))
bar (short *p)
{
__builtin_memset (p, '\0', 17 * sizeof (*p));
asm volatile ("" : : "r" (p) : "memory");
}
int __attribute__((noinline))
f1 (int i)
{
char a[i + 1];
a[0] = 5; /* { dg-final { gdb-test 17 "i" "5" } } */
return a[0]; /* { dg-final { gdb-test 17 "sizeof (a)" "6" } } */
}
int __attribute__((noinline))
f2 (int i)
{
short a[i * 2 + 7]; /* { dg-final { gdb-test 24 "i" "5" } } */
bar (a); /* { dg-final { gdb-test 24 "sizeof (a)" "17 * sizeof (short)" } } */
return a[i + 4];
}
int
main ()
{
int i = 5;
asm volatile ("" : "=r" (i) : "0" (i));
f1 (i);
f2 (i);
return 0;
}

View File

@ -4150,7 +4150,7 @@ track_expr_p (tree expr, bool need_rtl)
return 0;
/* It also must have a name... */
if (!DECL_NAME (expr))
if (!DECL_NAME (expr) && need_rtl)
return 0;
/* ... and a RTL assigned to it. */