public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-jankratochvil-fedora-merge: cherry-pick: Fix dereferencing unbound C arrays (RHBZ#505163).
@ 2009-06-16 12:58 jkratoch
  0 siblings, 0 replies; only message in thread
From: jkratoch @ 2009-06-16 12:58 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-fedora-merge has been updated
       via  30c13da4efe18f43ee34aa4b29bc86e1a53de548 (commit)
      from  000db8b7bfef8581ef099ccca8689cfddfea1be8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 30c13da4efe18f43ee34aa4b29bc86e1a53de548
Author: Jan Kratochvil <jkratoch@host1.dyn.jankratochvil.net>
Date:   Thu Jun 11 00:23:54 2009 +0200

    cherry-pick: Fix dereferencing unbound C arrays (RHBZ#505163).
    
    gdb/
    	* gdbtypes.c (get_discrete_bounds): Remove the VLA-introduced check for
    	TYPE_RANGE_UPPER_BOUND_IS_UNDEFINED and
    	TYPE_RANGE_LOWER_BOUND_IS_UNDEFINED.
    
    gdb/testsuite/
    	* gdb.base/arrayidx.c (unbound): New variable.
    	* gdb.base/arrayidx.exp (p unbound.a == &unbound.a[0]): New test.

-----------------------------------------------------------------------

Summary of changes:
 gdb/gdbtypes.c                      |    3 ---
 gdb/testsuite/gdb.base/arrayidx.c   |    7 +++++++
 gdb/testsuite/gdb.base/arrayidx.exp |   10 +++++++++-
 3 files changed, 16 insertions(+), 4 deletions(-)

First 500 lines of diff:
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 012485c..9899727 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -769,9 +769,6 @@ get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
   switch (TYPE_CODE (type))
     {
     case TYPE_CODE_RANGE:
-      if (TYPE_RANGE_UPPER_BOUND_IS_UNDEFINED (type) 
-	  || TYPE_RANGE_LOWER_BOUND_IS_UNDEFINED (type))
-	return -1;
       *lowp = TYPE_LOW_BOUND (type);
       *highp = TYPE_HIGH_BOUND (type);
       return 1;
diff --git a/gdb/testsuite/gdb.base/arrayidx.c b/gdb/testsuite/gdb.base/arrayidx.c
index 98d4d35..f98a656 100644
--- a/gdb/testsuite/gdb.base/arrayidx.c
+++ b/gdb/testsuite/gdb.base/arrayidx.c
@@ -17,6 +17,13 @@
 
 int array[] = {1, 2, 3, 4};
 
+#ifdef __GNUC__
+struct
+  {
+    int a[0];
+  } unbound;
+#endif
+
 int
 main (void)
 {
diff --git a/gdb/testsuite/gdb.base/arrayidx.exp b/gdb/testsuite/gdb.base/arrayidx.exp
index 71ce4aa..af0e5f8 100644
--- a/gdb/testsuite/gdb.base/arrayidx.exp
+++ b/gdb/testsuite/gdb.base/arrayidx.exp
@@ -59,4 +59,12 @@ gdb_test "print array" \
          "\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \
          "Print array with array-indexes on"
 
-
+set test "p unbound.a == &unbound.a\[0\]"
+gdb_test_multiple $test $test {
+    -re " = 1\r\n$gdb_prompt $" {
+	pass $test
+    }
+    -re "No symbol \"unbound\" in current context.\r\n$gdb_prompt $" {
+	unsupported "$test (no GCC)"
+    }
+}


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-06-16 12:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-16 12:58 [SCM] archer-jankratochvil-fedora-merge: cherry-pick: Fix dereferencing unbound C arrays (RHBZ#505163) jkratoch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).