This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch to use ld -z on IA64 HP-UX
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 6 Mar 2005 18:45:59 +0000 (UTC)
- Subject: Patch to use ld -z on IA64 HP-UX
This patch adds -z (fault on NULL pointer dereference) to the linker
options GCC uses on IA64 HP-UX. It is already used on PA HP-UX and
there isn't a known reason to be inconsistent in this regard between
HP-UX on different architectures; faulting on NULL pointer dereference
is also the norm on other platforms and can cause certain GCC bugs to
yield an ICE quickly rather than making the compiler hang.
This patch also changes ia64_function_value to avoid giving
(parallel:BLK []) as the location where an empty structure is
returned, because otherwise the IA64 HP-UX compiler gets a NULL
pointer dereference compiling gcc.c-torture/compile/920928-5.c (among
other tests involving empty structures). (I see nothing in principle
wrong with an empty PARALLEL here, but NULL pointers are used in place
of empty vectors and this only works when NULL can be dereferenced.)
I don't think what gets specified for the return of an empty structure
actually matters, and the compat testsuite passes both before an after
this patch (but not if -z is added without the other part of the
patch) which is a good sign that the change is working.
Bootstrapped with no regressions on ia64-hp-hpux11.23. OK for
mainline? OK for 4.0 branch?
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
jsm@polyomino.org.uk (personal mail)
joseph@codesourcery.com (CodeSourcery mail)
jsm28@gcc.gnu.org (Bugzilla assignments and CCs)
2005-03-06 Joseph S. Myers <joseph@codesourcery.com>
* config/ia64/hpux.h (LINK_SPEC): Add -z.
* config/ia64/ia64.c (ia64_function_value): Return a REG not a
PARALLEL for an empty structure.
diff -rupN GCC.orig/gcc/config/ia64/hpux.h GCC/gcc/config/ia64/hpux.h
--- GCC.orig/gcc/config/ia64/hpux.h 2005-02-25 22:03:39.000000000 +0000
+++ GCC/gcc/config/ia64/hpux.h 2005-03-03 01:44:32.000000000 +0000
@@ -75,7 +75,7 @@ do { \
#undef LINK_SPEC
#define LINK_SPEC \
- "+Accept TypeMismatch \
+ "-z +Accept TypeMismatch \
%{shared:-b} \
%{!shared: \
-u main \
diff -rupN GCC.orig/gcc/config/ia64/ia64.c GCC/gcc/config/ia64/ia64.c
--- GCC.orig/gcc/config/ia64/ia64.c 2005-02-19 21:00:51.000000000 +0000
+++ GCC/gcc/config/ia64/ia64.c 2005-03-05 23:42:55.000000000 +0000
@@ -3915,6 +3915,8 @@ ia64_function_value (tree valtype, tree
offset = 0;
bytesize = int_size_in_bytes (valtype);
+ if (bytesize == 0)
+ return gen_rtx_REG (mode, GR_RET_FIRST);
for (i = 0; offset < bytesize; i++)
{
loc[i] = gen_rtx_EXPR_LIST (VOIDmode,