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]

[Tru64 PATCH] Fix failures of gcc.c-torture/compile/labels-3.c


Hi Rainer,

The following patch resolves the six failures of the dejagnu testcase
gcc.c-torture/compile/labels-3.c on alphaev67-dec-osf5.1 at different
compilation levels.  The problem is that the native Tru64 assembler
complains about the following assembler syntax:

	.word $L4-($L2)

with the error message:

as0: Error: labels-3.c, line 1: Symbol must have absolute value: $L2

However, the following syntax (without parenthesis) works fine.

	.word $L4-$L2


The code responsible for emitting this expression is final.c's
output_addr_const, in the case MINUS: section.  Fortunately, the
good news is that this use of parenthesis in the assembler can be
controlled by targetm.asm_out.open_paren and targetm.asm_out.close_paren.
Indeed, config/i386/i386.c, config/s390/s390.c and config/pdp11/pdp11.c
all unconditionally override TARGET_ASM_{OPEN,CLOSE}_PAREN.  The tricky
bit is that all the above backends override this definition at the
processor architecture level, where as for alpha, we'd prefer to redefine
these macros for Tru64, and leave the Linux and OpenVMS setttings
unchanged.  To support this we need to make some minor tweaks to
target-def.h, to use #ifndef, as described in the commentary at the
top of target-def.h.


The following patch has been tested on alphaev67-dec-osf5.1 with a "make
bootstrap" of just C, and regression tested with a "make check-gcc" in the
gcc/ directory with no new failures, where it resolves six unexpected
failures.

Ok for mainline?  labels-3.c was added by RTH on 2002-02-08, and as the
Tru64 port predates that, this is presumably a regression.  It also only
affects the Tru64 backend, so should be exceptionally safe.

Thanks in advance,



2006-08-31  Roger Sayle  <roger@eyesopen.com>

	* target-def.h (TARGET_ASM_OPEN_PAREN): Guard with an #ifndef.
	(TARGET_ASM_CLOSE_PAREN): Likewise.
	* config/alpha/osf5.h (TARGET_ASM_OPEN_PAREN): Define.
	(TARGET_ASM_CLOSE_PAREN): Likewise.


Index: target-def.h
===================================================================
*** target-def.h	(revision 116415)
--- target-def.h	(working copy)
*************** Foundation, 51 Franklin Street, Fifth Fl
*** 30,37 ****
--- 30,42 ----
     definition in a #ifndef, since files include tm.h before this one.  */

  /* Assembler output.  */
+ #ifndef TARGET_ASM_OPEN_PAREN
  #define TARGET_ASM_OPEN_PAREN "("
+ #endif
+ #ifndef TARGET_ASM_CLOSE_PAREN
  #define TARGET_ASM_CLOSE_PAREN ")"
+ #endif
+
  #define TARGET_ASM_BYTE_OP "\t.byte\t"

  #define TARGET_ASM_ALIGNED_HI_OP "\t.short\t"
Index: config/alpha/osf5.h
===================================================================
*** config/alpha/osf5.h	(revision 116415)
--- config/alpha/osf5.h	(working copy)
***************
*** 51,53 ****
--- 51,59 ----
  #undef TARGET_C99_FUNCTIONS
  #define TARGET_C99_FUNCTIONS  1

+ /* The native assembler doesn't understand parenthesis.  */
+ #undef TARGET_ASM_OPEN_PAREN
+ #define TARGET_ASM_OPEN_PAREN ""
+ #undef TARGET_ASM_CLOSE_PAREN
+ #define TARGET_ASM_CLOSE_PAREN ""
+


Roger
--


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