[Bug c/87927] ICE: segmentation fault with patchable_function_entry attribute for msp430-elf -mlarge

2018-11-07 Thread jozef.l at mittosystems dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87927

Jozef Lawrynowicz  changed:

   What|Removed |Added

  Attachment #44968|0   |1
is obsolete||

--- Comment #2 from Jozef Lawrynowicz  ---
Created attachment 44969
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44969=edit
proposed patch (fixed)

Fixed wrong ordering of new elements in "struct asm_int_op"

[Bug c/87927] ICE: segmentation fault with patchable_function_entry attribute for msp430-elf -mlarge

2018-11-07 Thread jozef.l at mittosystems dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87927

--- Comment #1 from Jozef Lawrynowicz  ---
Created attachment 44968
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44968=edit
proposed patch

In default_print_patchable_function_entry, integer_asm_op is passed
POINTER_SIZE_UNITS. For msp430-elf -mlarge, this is 3, which is not handled in
integer_asm_op, so it returns NULL.
fputs is directly writing out the return value of integer_asm_op, so when this
is NULL we are segfaulting.

Attached is a proposed patch which implements
TARGET_ASM_{,UN}ALIGNED_P{S,D,T}I_OP, so integer_asm_op will not return NULL
for values < 16.

This fixes the c-c++-common/patchable_function_entry* tests but is otherwise
untested.