* Re: [patch, C++] Fix g++.dg/cpp0x/nullptr21.C on IA64 HP-UX
2011-06-13 18:06 [patch, C++] Fix g++.dg/cpp0x/nullptr21.C on IA64 HP-UX Steve Ellcey
@ 2011-06-13 18:06 ` Jason Merrill
0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2011-06-13 18:06 UTC (permalink / raw)
To: sje; +Cc: gcc-patches, magfr
OK.
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
* [patch, C++] Fix g++.dg/cpp0x/nullptr21.C on IA64 HP-UX
@ 2011-06-13 18:06 Steve Ellcey
2011-06-13 18:06 ` Jason Merrill
0 siblings, 1 reply; 2+ messages in thread
From: Steve Ellcey @ 2011-06-13 18:06 UTC (permalink / raw)
To: gcc-patches; +Cc: jason, magfr
The test g++.dg/cpp0x/nullptr21.C fails on IA64 HP-UX in 32 bit mode and
in looking at the problem I tracked it down to some code in
cxx_init_decl_processing that was added in r159131 to create nullptr_node:
2010-05-06 Magnus Fromreide <magfr@lysator.liu.se>
Jason Merrill <jason@redhat.com>
Add support for C++0x nullptr.
The type for nullptr_node is nullptr_type_node and it is set up with a type,
size, and alignment of ptr_mode. But the actual mode set with SET_TYPE_MODE
is set to Pmode instead of ptr_mode. I don't know why, it may just be a typo.
This causes problems on IA64 HP-UX in 32 bit mode because ptr_mode is 4 bytes
(and 4 byte aligned) but Pmode is 8 bytes and 8 byte aligned. The code
generated for nullptr21.C winds up doing an 8 byte load for nullptr on an
address that is only 4 btye aligned and the code seg faults with a misaligned
read.
This patch changes Pmode to ptr_mode in the SET_TYPE_MODE call and that fixes
the problem. It also caused no regressions on IA64 HP-UX, IA64 Linux, or
x86 Linux.
OK for checkin?
Steve Ellcey
sje@cup.hp.com
2011-06-13 Steve Ellcey <sje@cup.hp.com>
* decl.c (cxx_init_decl_processing): Use ptr_mode instead of Pmode.
Index: decl.c
===================================================================
--- decl.c (revision 174979)
+++ decl.c (working copy)
@@ -3672,7 +3672,7 @@
TYPE_SIZE_UNIT (nullptr_type_node) = size_int (GET_MODE_SIZE (ptr_mode));
TYPE_UNSIGNED (nullptr_type_node) = 1;
TYPE_PRECISION (nullptr_type_node) = GET_MODE_BITSIZE (ptr_mode);
- SET_TYPE_MODE (nullptr_type_node, Pmode);
+ SET_TYPE_MODE (nullptr_type_node, ptr_mode);
record_builtin_type (RID_MAX, "decltype(nullptr)", nullptr_type_node);
nullptr_node = build_int_cst (nullptr_type_node, 0);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-06-13 18:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-13 18:06 [patch, C++] Fix g++.dg/cpp0x/nullptr21.C on IA64 HP-UX Steve Ellcey
2011-06-13 18:06 ` Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).