aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-02-24 11:50:13 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2010-02-24 11:50:13 +0100
commit2e9577924bd1cbae69099af99b85b136d32f5b32 (patch)
tree3fbf67a8580b2d9b9b396119085e3e49b72754a6 /gcc
parent12a54f548bbf2111653d8d0ad018908c6d2c1f7b (diff)
downloadgcc-2e9577924bd1cbae69099af99b85b136d32f5b32.zip
gcc-2e9577924bd1cbae69099af99b85b136d32f5b32.tar.gz
gcc-2e9577924bd1cbae69099af99b85b136d32f5b32.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/gimplify.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/guality/vla-1.c36
-rw-r--r--gcc/var-tracking.c2
5 files changed, 54 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b5f7c1a..9298c2e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 618e3a6..1838747 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -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));
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4acf557..cce88bf 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
diff --git a/gcc/testsuite/gcc.dg/guality/vla-1.c b/gcc/testsuite/gcc.dg/guality/vla-1.c
new file mode 100644
index 0000000..2db1c29
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/guality/vla-1.c
@@ -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;
+}
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 049dca4..6e9af6e 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -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. */