public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* incorrect composite_type result for pointers with mode
@ 2012-01-25  9:15 Tristan Gingold
  2012-01-25 16:33 ` Joseph S. Myers
  0 siblings, 1 reply; 2+ messages in thread
From: Tristan Gingold @ 2012-01-25  9:15 UTC (permalink / raw)
  To: GCC Patches

Hi,

composite_type doesn't consider the pointer mode when creating a pointer.
As a consequence:

type char *p32 __attribute__((mode (SI));
type char *p32 __attribute__((mode (SI));

creates a 64-bit pointers (on ia64-hp-openvms and certainly some other configuration).
This breaks some compiler builds (depending on the build options).

As far as I know, this is not a regression, so it may not qualify for a stage 4 submission.

Tristan.

2012-01-25  Tristan Gingold  <gingold@adacore.com>

	* c-typeck.c (composite_type): Keep mode for pointers.

diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index b696e5e..2e33763 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -394,7 +394,7 @@ composite_type (tree t1, tree t2)
        tree pointed_to_1 = TREE_TYPE (t1);
        tree pointed_to_2 = TREE_TYPE (t2);
        tree target = composite_type (pointed_to_1, pointed_to_2);
-       t1 = build_pointer_type (target);
+       t1 = build_pointer_type_for_mode (target, TYPE_MODE (t1), false);
        t1 = build_type_attribute_variant (t1, attributes);
        return qualify_type (t1, t2);
       }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: incorrect composite_type result for pointers with mode
  2012-01-25  9:15 incorrect composite_type result for pointers with mode Tristan Gingold
@ 2012-01-25 16:33 ` Joseph S. Myers
  0 siblings, 0 replies; 2+ messages in thread
From: Joseph S. Myers @ 2012-01-25 16:33 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: GCC Patches

On Wed, 25 Jan 2012, Tristan Gingold wrote:

> 2012-01-25  Tristan Gingold  <gingold@adacore.com>
> 
> 	* c-typeck.c (composite_type): Keep mode for pointers.

OK.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-25 16:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-25  9:15 incorrect composite_type result for pointers with mode Tristan Gingold
2012-01-25 16:33 ` Joseph S. Myers

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).