This is the mail archive of the gcc-bugs@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]

[Bug middle-end/28176] FAIL: gfortran.dg/actual_array_constructor_1.f90 -O0 (ICE)



------- Comment #9 from dave at hiauly1 dot hia dot nrc dot ca  2006-10-22 16:18 -------
Subject: Re:  FAIL: gfortran.dg/actual_array_constructor_1.f90  -O0  (ICE)

> ------- Comment #8 from sje at cup dot hp dot com  2006-10-19 18:09 -------
> Well, I found that the TImode is getting introduced in layout_type.  For an
> ARRAY_TYPE tree there is this line:
> 
>             TYPE_SIZE (type) = size_binop (MULT_EXPR, element_size,
>                                            fold_convert (bitsizetype,
>                                                          length));
> 
> If you look at bitsizetype, you will find that it is TImode and thus the
> resulting expression is TImode.  bitsizetype is set in set_sizetype based on 2
> * BITS_PER_UNIT_LOG which is 64 for hppa64.  Thus our problem.

It appears bitsizetype gets set to a precision that requires TImode here:

void
set_sizetype (tree type)
{
  int oprecision = TYPE_PRECISION (type);
  /* The *bitsizetype types use a precision that avoids overflows when
     calculating signed sizes / offsets in bits.  However, when
     cross-compiling from a 32 bit to a 64 bit host, we are limited to 64 bit
     precision.  */
  int precision = MIN (oprecision + BITS_PER_UNIT_LOG + 1,
                       2 * HOST_BITS_PER_WIDE_INT);

In the above, I don't think a precision larger than MAX_FIXED_MODE_SIZE
should be used.  This is currently 64 on hppa64.  However, oprecision
is 64 and BITS_PER_UNIT_LOG is 3, so the first argument of MIN is 68.
The second argument is 128.  Thus, precision ends up as 68 and the
following re layout uses TImode.

I'm trying the patch below.  I think other limits come into play
long before a calculation overflow would bit.

The other alternative is to add TImode support.  This is much more
complicated and probably not suitable for stage3.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

Index: stor-layout.c
===================================================================
--- stor-layout.c       (revision 117956)
+++ stor-layout.c       (working copy)
@@ -1934,7 +1934,8 @@
      calculating signed sizes / offsets in bits.  However, when
      cross-compiling from a 32 bit to a 64 bit host, we are limited to 64 bit
      precision.  */
-  int precision = MIN (oprecision + BITS_PER_UNIT_LOG + 1,
+  int precision = MIN (MIN (oprecision + BITS_PER_UNIT_LOG + 1,
+                           MAX_FIXED_MODE_SIZE),
                       2 * HOST_BITS_PER_WIDE_INT);
   tree t;



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28176


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