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] defaults.h: Fix ASM_OUTPUT_ADDR_VEC_ELT.


Hi,

Attached is a patch to fix ASM_OUTPUT_ADDR_VEC_ELT.

The unit of POINTER_SIZE is bit.  The unit of the first argument of
integer_asm_op() is byte.  So the correct way to compute the size of a
pointer is bytes should be POINTER_SIZE / BITS_PER_UNIT.

I noticed this while I was trying to use the default definition of
ASM_OUTPUT_ADDR_VEC_ELT on H8.

A natural question is why nobody noticed this.  Well, no port seems to
be using it!

o all targets except arm and rs6000 defines its own
  ASM_OUTPUT_ADDR_VEC_ELT in <target>.h.

o rs6000 does not define ASM_OUTPUT_ADDR_VEC_ELT, but
  CASE_VECTOR_PC_RELATIVE is always 1, so it probably does not matter.

o arm/arm.h does not define ASM_OUTPUT_ADDR_VEC_ELT, but even arm-elf
  seems to use ASM_OUTPUT_ADDR_VEC_ELT defined in arm/aout.h

Built cc1 on arm-elf.  OK to apply?

Kazu Hirata

2004-01-18  Kazu Hirata  <kazu@cs.umass.edu>

	* defaults.h (ASM_OUTPUT_ADDR_VEC_ELT): Fix the computation of
	the size of a pointer in bytes.

Index: defaults.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/defaults.h,v
retrieving revision 1.123
diff -u -r1.123 defaults.h
--- defaults.h	16 Jan 2004 01:44:06 -0000	1.123
+++ defaults.h	18 Jan 2004 20:23:04 -0000
@@ -80,7 +80,7 @@
 
 #ifndef ASM_OUTPUT_ADDR_VEC_ELT
 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
-do { fputs (integer_asm_op (POINTER_SIZE / UNITS_PER_WORD, TRUE), FILE); \
+do { fputs (integer_asm_op (POINTER_SIZE / BITS_PER_UNIT, TRUE), FILE); \
      (*targetm.asm_out.internal_label) (FILE, "L", (VALUE));			\
      fputc ('\n', FILE);						\
    } while (0)


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