public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch]: Fix ICE on VMS when using SImode pointers
@ 2012-04-04  8:13 Tristan Gingold
  2012-04-04  8:18 ` Richard Guenther
  0 siblings, 1 reply; 3+ messages in thread
From: Tristan Gingold @ 2012-04-04  8:13 UTC (permalink / raw)
  To: GCC Patches; +Cc: Richard Guenther

Hi,

this patch fixes a build time failure on VMS (while compiling Ada RTS file i-cstrin.adb) due to the use of short pointers:

i-cstrin.adb: In function 'Interfaces.C.Strings.To_Chars_Ptr':
i-cstrin.adb:236:8: error: unrecognizable insn:
(insn 80 79 81 13 (set (reg:SI 384)
        (const_int 4294967288 [0xfffffff8])) i-cstrin.adb:234 -1
     (nil))
+===========================GNAT BUG DETECTED==============================+
| Pro 7.1.0w (20120403-47) (ia64-hp-openvms) GCC error:                    |
| in extract_insn, at recog.c:2123                                         |
| Error detected around i-cstrin.adb:236:8                                 |


Expansion of POINTER_PLUS_EXPR doesn't handle the case of PRECISION(sizetype) > PRECISION(type), leading to RTL expressions with different modes.

This patch fixes the build issue, tested on ia64-hp-openvms.
Also tested with our internal testsuite.
I haven't run the GCC testsuite on a regular platform, as the condition will never trigger.

Ok for trunk ?

Tristan.

2012-04-04  Tristan Gingold  <gingold@adacore.com>

	* expr.c (expand_expr_real_2): Handle larger sizetype in
	POINTER_PLUS_EXPR.

--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -7957,6 +7957,9 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_m
        treeop1 = fold_convert_loc (loc, type,
                                    fold_convert_loc (loc, ssizetype,
                                                      treeop1));
+      else if (TYPE_PRECISION (sizetype) > TYPE_PRECISION (type))
+       treeop1 = fold_convert_loc (loc, type, treeop1);
+
     case PLUS_EXPR:
       /* If we are adding a constant, a VAR_DECL that is sp, fp, or ap, and
         something else, make sure we add the register to the constant and
u


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

* Re: [Patch]: Fix ICE on VMS when using SImode pointers
  2012-04-04  8:13 [Patch]: Fix ICE on VMS when using SImode pointers Tristan Gingold
@ 2012-04-04  8:18 ` Richard Guenther
  2012-04-04  8:27   ` Tristan Gingold
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Guenther @ 2012-04-04  8:18 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: GCC Patches

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2181 bytes --]

On Wed, 4 Apr 2012, Tristan Gingold wrote:

> Hi,
> 
> this patch fixes a build time failure on VMS (while compiling Ada RTS file i-cstrin.adb) due to the use of short pointers:
> 
> i-cstrin.adb: In function 'Interfaces.C.Strings.To_Chars_Ptr':
> i-cstrin.adb:236:8: error: unrecognizable insn:
> (insn 80 79 81 13 (set (reg:SI 384)
>         (const_int 4294967288 [0xfffffff8])) i-cstrin.adb:234 -1
>      (nil))
> +===========================GNAT BUG DETECTED==============================+
> | Pro 7.1.0w (20120403-47) (ia64-hp-openvms) GCC error:                    |
> | in extract_insn, at recog.c:2123                                         |
> | Error detected around i-cstrin.adb:236:8                                 |
> 
> 
> Expansion of POINTER_PLUS_EXPR doesn't handle the case of PRECISION(sizetype) > PRECISION(type), leading to RTL expressions with different modes.
> 
> This patch fixes the build issue, tested on ia64-hp-openvms.
> Also tested with our internal testsuite.
> I haven't run the GCC testsuite on a regular platform, as the condition will never trigger.
> 
> Ok for trunk ?

Ok if you add a comment why this is needed.

Richard.

> Tristan.
> 
> 2012-04-04  Tristan Gingold  <gingold@adacore.com>
> 
> 	* expr.c (expand_expr_real_2): Handle larger sizetype in
> 	POINTER_PLUS_EXPR.
> 
> --- a/gcc/expr.c
> +++ b/gcc/expr.c
> @@ -7957,6 +7957,9 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_m
>         treeop1 = fold_convert_loc (loc, type,
>                                     fold_convert_loc (loc, ssizetype,
>                                                       treeop1));
> +      else if (TYPE_PRECISION (sizetype) > TYPE_PRECISION (type))
> +       treeop1 = fold_convert_loc (loc, type, treeop1);
> +
>      case PLUS_EXPR:
>        /* If we are adding a constant, a VAR_DECL that is sp, fp, or ap, and
>          something else, make sure we add the register to the constant and
> u
> 
> 
> 

-- 
Richard Guenther <rguenther@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer

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

* Re: [Patch]: Fix ICE on VMS when using SImode pointers
  2012-04-04  8:18 ` Richard Guenther
@ 2012-04-04  8:27   ` Tristan Gingold
  0 siblings, 0 replies; 3+ messages in thread
From: Tristan Gingold @ 2012-04-04  8:27 UTC (permalink / raw)
  To: Richard Guenther; +Cc: GCC Patches


On Apr 4, 2012, at 10:18 AM, Richard Guenther wrote:

> On Wed, 4 Apr 2012, Tristan Gingold wrote:
> 
>> Hi,
>> 
>> this patch fixes a build time failure on VMS (while compiling Ada RTS file i-cstrin.adb) due to the use of short pointers:
>> 
>> i-cstrin.adb: In function 'Interfaces.C.Strings.To_Chars_Ptr':
>> i-cstrin.adb:236:8: error: unrecognizable insn:
>> (insn 80 79 81 13 (set (reg:SI 384)
>>        (const_int 4294967288 [0xfffffff8])) i-cstrin.adb:234 -1
>>     (nil))
>> +===========================GNAT BUG DETECTED==============================+
>> | Pro 7.1.0w (20120403-47) (ia64-hp-openvms) GCC error:                    |
>> | in extract_insn, at recog.c:2123                                         |
>> | Error detected around i-cstrin.adb:236:8                                 |
>> 
>> 
>> Expansion of POINTER_PLUS_EXPR doesn't handle the case of PRECISION(sizetype) > PRECISION(type), leading to RTL expressions with different modes.
>> 
>> This patch fixes the build issue, tested on ia64-hp-openvms.
>> Also tested with our internal testsuite.
>> I haven't run the GCC testsuite on a regular platform, as the condition will never trigger.
>> 
>> Ok for trunk ?
> 
> Ok if you add a comment why this is needed.

Thanks, committed with this comment:

      /* If sizetype precision is larger than pointer precision, truncate the
	 offset to have matching modes.  */
      else if (TYPE_PRECISION (sizetype) > TYPE_PRECISION (type))
	treeop1 = fold_convert_loc (loc, type, treeop1);


Tristan.

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

end of thread, other threads:[~2012-04-04  8:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-04  8:13 [Patch]: Fix ICE on VMS when using SImode pointers Tristan Gingold
2012-04-04  8:18 ` Richard Guenther
2012-04-04  8:27   ` Tristan Gingold

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