From a1fefa1d0661268691bd31ede4852d7699448262 Mon Sep 17 00:00:00 2001
From: aph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu, 11 Jan 2007 13:54:49 +0000
Subject: [PATCH] 2007-01-11  Andrew Haley  <aph@redhat.com>

        * prims.cc (jdwpOptions) Fix deprecated cast from char[] constant
        to char*.
        * include/x86_64-signal.h (HANDLE_DIVIDE_OVERFLOW): Rewrite to fix
        aliasing violation.



git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120672 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libjava/ChangeLog               |  7 +++++++
 libjava/include/x86_64-signal.h | 15 ++++++++-------
 libjava/prims.cc                |  5 +++--
 3 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index a7bed7fc5ad0..23ec9f58c930 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,10 @@
+2007-01-11  Andrew Haley  <aph@redhat.com>
+
+	* prims.cc (jdwpOptions) Fix deprecated cast from char[] constant
+	to char*.
+	* include/x86_64-signal.h (HANDLE_DIVIDE_OVERFLOW): Rewrite to fix
+	aliasing violation.
+
 2007-01-10  Tom Tromey  <tromey@redhat.com>
 
 	* gnu/gcj/xlib/*.h: New files.
diff --git a/libjava/include/x86_64-signal.h b/libjava/include/x86_64-signal.h
index 479be3ff898b..ede92a482f49 100644
--- a/libjava/include/x86_64-signal.h
+++ b/libjava/include/x86_64-signal.h
@@ -29,9 +29,8 @@ static void _Jv_##_name (int, siginfo_t *,			\
 do									\
 {									\
   struct ucontext *_uc = (struct ucontext *)_p;				\
-  volatile struct sigcontext *_sc = (struct sigcontext *) &_uc->uc_mcontext; \
-									\
-  register unsigned char *_rip = (unsigned char *)_sc->rip;		\
+  gregset_t &_gregs = _uc->uc_mcontext.gregs;				\
+  unsigned char *_rip = (unsigned char *)_gregs[REG_RIP];		\
 									\
   /* According to the JVM spec, "if the dividend is the negative	\
    * integer of largest possible magnitude for the type and the		\
@@ -64,15 +63,17 @@ do									\
       if (((_modrm >> 3) & 7) == 7)					\
 	{								\
 	  if (_is_64_bit)						\
-	    _min_value_dividend = (_sc->rax == 0x8000000000000000L);	\
+	    _min_value_dividend =					\
+	      _gregs[REG_RAX] == (greg_t)0x8000000000000000UL;		\
 	  else								\
-	    _min_value_dividend = ((_sc->rax & 0xffffffff) == 0x80000000); \
+	    _min_value_dividend =					\
+	      (_gregs[REG_RAX] & 0xffffffff) == (greg_t)0x80000000UL;	\
 	}								\
 									\
       if (_min_value_dividend)						\
 	{								\
 	  unsigned char _rm = _modrm & 7;				\
-	  _sc->rdx = 0; /* the remainder is zero */			\
+	  _gregs[REG_RDX] = 0; /* the remainder is zero */		\
 	  switch (_modrm >> 6)						\
 	    {								\
 	    case 0:  /* register indirect */				\
@@ -95,7 +96,7 @@ do									\
 	      break;							\
 	    }								\
 	  _rip += 2;							\
-	  _sc->rip = (unsigned long)_rip;				\
+	  _gregs[REG_RIP] = (greg_t)_rip;				\
 	  return;							\
 	}								\
     }									\
diff --git a/libjava/prims.cc b/libjava/prims.cc
index 3f88fb7db764..00d547017f46 100644
--- a/libjava/prims.cc
+++ b/libjava/prims.cc
@@ -87,7 +87,7 @@ static java::lang::OutOfMemoryError *no_memory;
 // Number of bytes in largest array object we create.  This could be
 // increased to the largest size_t value, so long as the appropriate
 // functions are changed to take a size_t argument instead of jint.
-#define MAX_OBJECT_SIZE ((1<<31) - 1)
+#define MAX_OBJECT_SIZE (((size_t)1<<31) - 1)
 
 // Properties set at compile time.
 const char **_Jv_Compiler_Properties = NULL;
@@ -104,7 +104,8 @@ int _Jv_argc;
 
 // Debugging options
 static bool remoteDebug = false;
-static char *jdwpOptions = "";
+static char defaultJdwpOptions[] = "";
+static char *jdwpOptions = defaultJdwpOptions;
 
 // Argument support.
 int
-- 
GitLab