This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Unbreak AVR (PR17735)


I appears that I broke AVR with one of my previous patches to avoid gas bignum 
bugs.
http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02140.html

I assumed that gcc would never need to output integer values larger than word 
size[1]. This is not true for AVR because pointers are larger than word-size.

The patch below fixes this by also allowing values not larger than a pointer.

Tested on arm-none-eabi, and by building avr cross.
Ok?

Paul

[1] Anything larger can be broken into word-sized chunks.

2004-11-18  Paul Brook  <paul@codesourcery.com>

 PR target/17735
 * varasm.c (default_assemble_integer): Allow pointer-sized values.
 Expand comment.

Index: varasm.c
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/varasm.c,v
retrieving revision 1.460
diff -u -p -r1.460 varasm.c
--- varasm.c 13 Nov 2004 02:08:39 -0000 1.460
+++ varasm.c 17 Nov 2004 22:25:52 -0000
@@ -2026,8 +2026,9 @@ default_assemble_integer (rtx x ATTRIBUT
      int aligned_p ATTRIBUTE_UNUSED)
 {
   const char *op = integer_asm_op (size, aligned_p);
-  /* Avoid GAS bugs for values > word size.  */
-  if (size > UNITS_PER_WORD)
+  /* Avoid GAS bugs for large values.  Specifically negative values whose
+     absolute value fits in a bfd_vma, but not in a bfd_signed_vma.  */
+  if (size > UNITS_PER_WORD && size > POINTER_SIZE / BITS_PER_UNIT)
     return false;
   return op && (assemble_integer_with_op (op, x), true);
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]