From f64c36badca16712f27b498b5db1802aee935c66 Mon Sep 17 00:00:00 2001
From: Eric Botcazou <ebotcazou@adacore.com>
Date: Sun, 8 May 2011 09:15:34 +0000
Subject: [PATCH] * config/avr/avr.c (print_operand_address): Fix invalid RTL
 access.

From-SVN: r173548
---
 gcc/ChangeLog        | 4 ++++
 gcc/config/avr/avr.c | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 30717f571443..c1a359d61d5d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2011-05-08  Eric Botcazou  <ebotcazou@adacore.com>
+
+	* config/avr/avr.c (print_operand_address): Fix invalid RTL access.
+
 2011-05-08  Eric Botcazou  <ebotcazou@adacore.com>
 
 	* config/rs6000/rs6000.c (output_profile_hook): Fix thinko.
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index ba78160281b0..522a3563e4ed 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -1318,7 +1318,9 @@ print_operand_address (FILE *file, rtx addr)
       if (CONSTANT_ADDRESS_P (addr)
 	  && text_segment_operand (addr, VOIDmode))
 	{
-	  rtx x = XEXP (addr,0);
+	  rtx x = addr;
+	  if (GET_CODE (x) == CONST)
+	    x = XEXP (x, 0);
 	  if (GET_CODE (x) == PLUS && GET_CODE (XEXP (x,1)) == CONST_INT)
 	    {
 	      /* Assembler gs() will implant word address. Make offset