Fix target/61336 -- alpha ice on questionable asm

Richard Henderson rth@redhat.com
Mon Jun 2 16:43:00 GMT 2014


The scheme that alpha uses to split symbolic references into trackable pairs of
relocations doesn't really handle asms.  Of course, normal asms don't have the
problem seen here because they're interested in producing instructions, whereas
this case is system tap creating some annotations.

The most important part of the patch is the call to output_operand_lossage,
which eliminates the ICE.

The rest of the patch is somewhat debatable.  It certainly "works" for the
given test case, in that the assembly hunk is producing string data.  But I
doubt that system tap has actually been ported to alpha, so whether it "works"
in the more specific sense of doing the right thing, I have no idea.

In order to more "properly" handle symbolic references in asms, we'd probably
have to write a dedicated pass rather than rely on post-reload splitting.
Which is more of a viable option now than in olden times.  But "properly" in
this particular case would almost certainly *not* work for system tap, since it
would result in a weird symbol+reloc string that I'm certain would not be
handled properly by system tap.


r~
-------------- next part --------------
        PR target/61336
        * config/alpha/alpha.c (print_operand_address): Allow symbolic
        addresses inside asms.  Use output_operand_lossage instead of
        gcc_unreachable.


diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index efef1e9..7663e20 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -5450,22 +5450,23 @@ print_operand_address (FILE *file, rtx addr)
       offset = INTVAL (addr);
       break;
 
-#if TARGET_ABI_OPEN_VMS
     case SYMBOL_REF:
+      gcc_assert(TARGET_ABI_OPEN_VMS || this_is_asm_operands);
       fprintf (file, "%s", XSTR (addr, 0));
       return;
 
     case CONST:
+      gcc_assert(TARGET_ABI_OPEN_VMS || this_is_asm_operands);
       gcc_assert (GET_CODE (XEXP (addr, 0)) == PLUS
 		  && GET_CODE (XEXP (XEXP (addr, 0), 0)) == SYMBOL_REF);
       fprintf (file, "%s+" HOST_WIDE_INT_PRINT_DEC,
 	       XSTR (XEXP (XEXP (addr, 0), 0), 0),
 	       INTVAL (XEXP (XEXP (addr, 0), 1)));
       return;
-    
-#endif
+
     default:
-      gcc_unreachable ();
+      output_operand_lossage ("invalid operand address");
+      return;
     }
 
   fprintf (file, HOST_WIDE_INT_PRINT_DEC "($%d)", offset, basereg);


More information about the Gcc-patches mailing list