Index: combine.c
===================================================================
--- combine.c	(revision 162849)
+++ combine.c	(working copy)
@@ -7093,7 +7093,9 @@ make_compound_operation (rtx x, enum rtx
      address, we stay there.  If we have a comparison, set to COMPARE,
      but once inside, go back to our default of SET.  */
 
-  next_code = (code == MEM || code == PLUS || code == MINUS ? MEM
+  next_code = (code == MEM ? MEM
+	       : ((code == PLUS || code == MINUS)
+		  && SCALAR_INT_MODE_P (mode)) ? MEM
 	       : ((code == COMPARE || COMPARISON_P (x))
 		  && XEXP (x, 1) == const0_rtx) ? COMPARE
 	       : in_code == COMPARE ? SET : in_code);
@@ -7127,8 +7129,8 @@ make_compound_operation (rtx x, enum rtx
     case PLUS:
       lhs = XEXP (x, 0);
       rhs = XEXP (x, 1);
-      lhs = make_compound_operation (lhs, MEM);
-      rhs = make_compound_operation (rhs, MEM);
+      lhs = make_compound_operation (lhs, next_code);
+      rhs = make_compound_operation (rhs, next_code);
       if (GET_CODE (lhs) == MULT && GET_CODE (XEXP (lhs, 0)) == NEG
 	  && SCALAR_INT_MODE_P (mode))
 	{
@@ -7157,8 +7159,8 @@ make_compound_operation (rtx x, enum rtx
     case MINUS:
       lhs = XEXP (x, 0);
       rhs = XEXP (x, 1);
-      lhs = make_compound_operation (lhs, MEM);
-      rhs = make_compound_operation (rhs, MEM);
+      lhs = make_compound_operation (lhs, next_code);
+      rhs = make_compound_operation (rhs, next_code);
       if (GET_CODE (rhs) == MULT && GET_CODE (XEXP (rhs, 0)) == NEG
 	  && SCALAR_INT_MODE_P (mode))
 	{
Index: testsuite/gcc.c-torture/compile/pr45182.c
===================================================================
--- testsuite/gcc.c-torture/compile/pr45182.c	(revision 0)
+++ testsuite/gcc.c-torture/compile/pr45182.c	(revision 0)
@@ -0,0 +1,10 @@
+typedef struct TypHeader {
+  struct TypHeader ** ptr;
+} *TypHandle;
+void PlainRange (TypHandle hdList, long lenList, long low, long inc)
+{
+  long i;
+  for (i = 1; i <= lenList; i++ )
+    (((TypHandle*)((hdList)->ptr))[i] = (((TypHandle) (((long)(low + (i-1) *
+inc) << 2) + 1))));
+}
