public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/22210] New: gfc_conv_array_initializer weirdness
@ 2005-06-27 23:33 giovannibajo at libero dot it
  2005-06-27 23:46 ` [Bug fortran/22210] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: giovannibajo at libero dot it @ 2005-06-27 23:33 UTC (permalink / raw)
  To: gcc-bugs

There seems to be something weird going on in gfc_conv_array_initializer. In 
the EXPR_ARRAY case, the code builds both an "index" and a "range". Then, 
optionally, it adds both of them to the constructor list being built. This is 
strange: I would expect either of them to be added, but not both.

A testcase which triggers this behaviour is execute/data.f90. I caught this by 
adding this additional verification hunk in varasm.c (but my tree is not clean 
so I am not sure this is enough):


*************** output_constructor (tree exp, unsigned H
*** 4089,4094 ****
--- 4109,4115 ----
             if each element has the proper size.  */
          if ((field != 0 || index != 0) && pos != total_bytes)
            {
+             gcc_assert (pos >= total_bytes);
              assemble_zeros (pos - total_bytes);
              total_bytes = pos;
            }
*************** output_constructor (tree exp, unsigned H
*** 4164,4169 ****
--- 4185,4191 ----
              /* If still not at proper byte, advance to there.  */
              if (next_offset / BITS_PER_UNIT != total_bytes)
                {
+                 gcc_assert (next_offset / BITS_PER_UNIT >= total_bytes);
                  assemble_zeros (next_offset / BITS_PER_UNIT - total_bytes);
                  total_bytes = next_offset / BITS_PER_UNIT;
                }



Also, gfc_conv_array_initializer, in the EXPR_CONSTANT/EXPR_STRUCTURE case, 
contains some code which builts a repeated initializer by hand. It looks like 
it would be easier but much more memory friendly to just use a RANGE_EXPR.

Steven asked me to assign this to him. This is part of my work to make 
CONSTRUCTOR use VECs (actually, it's the only issue left AFAICT).

-- 
           Summary: gfc_conv_array_initializer weirdness
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: fortran
        AssignedTo: stevenb at suse dot de
        ReportedBy: giovannibajo at libero dot it
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug fortran/22210] gfc_conv_array_initializer weirdness
  2005-06-27 23:33 [Bug fortran/22210] New: gfc_conv_array_initializer weirdness giovannibajo at libero dot it
@ 2005-06-27 23:46 ` pinskia at gcc dot gnu dot org
  2005-06-29 22:04 ` giovannibajo at libero dot it
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-27 23:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-27 23:46 -------
This is not the first time I have seen this in both the Ada and gfortran front-ends.

-- 


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


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

* [Bug fortran/22210] gfc_conv_array_initializer weirdness
  2005-06-27 23:33 [Bug fortran/22210] New: gfc_conv_array_initializer weirdness giovannibajo at libero dot it
  2005-06-27 23:46 ` [Bug fortran/22210] " pinskia at gcc dot gnu dot org
@ 2005-06-29 22:04 ` giovannibajo at libero dot it
  2005-07-09 16:51 ` pinskia at gcc dot gnu dot org
  2005-09-18  6:15 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: giovannibajo at libero dot it @ 2005-06-29 22:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2005-06-29 22:04 -------
Created an attachment (id=9175)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9175&action=view)
Current CONSTRUCTOR patch

As per Steven's request in private mail, I attach the current patch to make
CONSTRUCTOR use VECs.

-- 


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


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

* [Bug fortran/22210] gfc_conv_array_initializer weirdness
  2005-06-27 23:33 [Bug fortran/22210] New: gfc_conv_array_initializer weirdness giovannibajo at libero dot it
  2005-06-27 23:46 ` [Bug fortran/22210] " pinskia at gcc dot gnu dot org
  2005-06-29 22:04 ` giovannibajo at libero dot it
@ 2005-07-09 16:51 ` pinskia at gcc dot gnu dot org
  2005-09-18  6:15 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-09 16:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-09 16:46 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-07-09 16:46:58
               date|                            |


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


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

* [Bug fortran/22210] gfc_conv_array_initializer weirdness
  2005-06-27 23:33 [Bug fortran/22210] New: gfc_conv_array_initializer weirdness giovannibajo at libero dot it
                   ` (2 preceding siblings ...)
  2005-07-09 16:51 ` pinskia at gcc dot gnu dot org
@ 2005-09-18  6:15 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-18  6:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-18 06:15 -------
Isn't this fixed or did the output_constructor part never get committed?

-- 


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


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

end of thread, other threads:[~2005-09-18  6:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-27 23:33 [Bug fortran/22210] New: gfc_conv_array_initializer weirdness giovannibajo at libero dot it
2005-06-27 23:46 ` [Bug fortran/22210] " pinskia at gcc dot gnu dot org
2005-06-29 22:04 ` giovannibajo at libero dot it
2005-07-09 16:51 ` pinskia at gcc dot gnu dot org
2005-09-18  6:15 ` pinskia at gcc dot gnu dot org

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