public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/49536] New: latent bug in FSF gcc with creation of vector of arrays
@ 2011-06-26 22:45 howarth at nitro dot med.uc.edu
  2011-06-27  7:46 ` [Bug middle-end/49536] " baldrick at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2011-06-26 22:45 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: latent bug in FSF gcc with creation of vector of
                    arrays
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: howarth@nitro.med.uc.edu


Duncan Sands has determined that http://llvm.org/bugs/show_bug.cgi?id=10042
exposes a bug in FSF gcc where vectors of arrays are being created. He proposes
that the following patch to FSF gcc exposes the latent issue...


Index: tree-vect-data-refs.c
===================================================================
--- tree-vect-data-refs.c    (revision 174743)
+++ tree-vect-data-refs.c    (working copy)
@@ -2734,6 +2734,10 @@
       scalar_type = TREE_TYPE (DR_REF (dr));
       STMT_VINFO_VECTYPE (stmt_info) =
                 get_vectype_for_scalar_type (scalar_type);
+      gcc_assert(!STMT_VINFO_VECTYPE (stmt_info) ||
+                 TREE_CODE (STMT_VINFO_VECTYPE (stmt_info)) != VECTOR_TYPE ||
+                 TREE_CODE (TREE_TYPE (STMT_VINFO_VECTYPE (stmt_info)))
+                 != ARRAY_TYPE);
       if (!STMT_VINFO_VECTYPE (stmt_info))
         {
           if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))

by triggering an assertion failure when the tree-vectorizer tries to form a
vector of arrays.


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

* [Bug middle-end/49536] latent bug in FSF gcc with creation of vector of arrays
  2011-06-26 22:45 [Bug middle-end/49536] New: latent bug in FSF gcc with creation of vector of arrays howarth at nitro dot med.uc.edu
@ 2011-06-27  7:46 ` baldrick at gcc dot gnu.org
  2011-06-27  8:43 ` [Bug middle-end/49536] latent bug " ebotcazou at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: baldrick at gcc dot gnu.org @ 2011-06-27  7:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Duncan Sands <baldrick at gcc dot gnu.org> 2011-06-27 07:46:26 UTC ---
Created attachment 24605
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24605
testcase reduced from source/hbuild.f from xplor-nih 2.27

To reproduce, apply the patch to gcc.  Then compile hbuild_reduced.f from the
attached tar file like this:

gfortran -S hbuild_reduced.f -g -fdefault-integer-8 -ffixed-line-length-120
-fno-second-underscore -O3


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

* [Bug middle-end/49536] latent bug with creation of vector of arrays
  2011-06-26 22:45 [Bug middle-end/49536] New: latent bug in FSF gcc with creation of vector of arrays howarth at nitro dot med.uc.edu
  2011-06-27  7:46 ` [Bug middle-end/49536] " baldrick at gcc dot gnu.org
@ 2011-06-27  8:43 ` ebotcazou at gcc dot gnu.org
  2011-06-27  9:10 ` [Bug middle-end/49536] latent bug in FSF gcc " rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2011-06-27  8:43 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot
                   |                            |gnu.org
            Summary|latent bug in FSF gcc with  |latent bug with creation of
                   |creation of vector of       |vector of arrays
                   |arrays                      |

--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2011-06-27 08:42:51 UTC ---
There is no other GCC as what you call "FSF gcc" as far as we are concerned.


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

* [Bug middle-end/49536] latent bug in FSF gcc with creation of vector of arrays
  2011-06-26 22:45 [Bug middle-end/49536] New: latent bug in FSF gcc with creation of vector of arrays howarth at nitro dot med.uc.edu
  2011-06-27  7:46 ` [Bug middle-end/49536] " baldrick at gcc dot gnu.org
  2011-06-27  8:43 ` [Bug middle-end/49536] latent bug " ebotcazou at gcc dot gnu.org
@ 2011-06-27  9:10 ` rguenth at gcc dot gnu.org
  2011-06-27 10:32 ` [Bug middle-end/49536] latent bug " rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-06-27  9:10 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011.06.27 09:09:35
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |
            Summary|latent bug with creation of |latent bug in FSF gcc with
                   |vector of arrays            |creation of vector of
                   |                            |arrays
     Ever Confirmed|0                           |1

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-06-27 09:09:35 UTC ---
Confirmed.  I also get into the issue that get_vectype_for_scalar_type_and_size
is called with a vector typed scalar_type (from basic-block vectorization).

Your case ends up with character(kind=1)[1:4] which has SImode.

The issue is that we really would only care for the component mode
(and we make sure it is either int or float mode), but not really for
what type it does represent (I can imagine we'll happily create a
vector type of RECORD_TYPE components this way).

Nothing on the GIMPLE level is prepared for non-scalar types here
though, so I'm not sure what issues we run into with this right now.
OTOH vectorization will very likely fail later anyway if we are not
only presented with a memory copy loop.  So, for gimple hygiene
we should reject component types we cannot easily handle.


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

* [Bug middle-end/49536] latent bug with creation of vector of arrays
  2011-06-26 22:45 [Bug middle-end/49536] New: latent bug in FSF gcc with creation of vector of arrays howarth at nitro dot med.uc.edu
                   ` (2 preceding siblings ...)
  2011-06-27  9:10 ` [Bug middle-end/49536] latent bug in FSF gcc " rguenth at gcc dot gnu.org
@ 2011-06-27 10:32 ` rguenth at gcc dot gnu.org
  2011-06-27 10:33 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-06-27 10:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-06-27 10:31:33 UTC ---
Author: rguenth
Date: Mon Jun 27 10:31:30 2011
New Revision: 175475

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175475
Log:
2011-06-27  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/49536
    * tree-vect-stmts.c (get_vectype_for_scalar_type_and_size):
    For non-scalar inner types use a scalar type according to
    the scalar inner mode.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-vect-stmts.c


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

* [Bug middle-end/49536] latent bug with creation of vector of arrays
  2011-06-26 22:45 [Bug middle-end/49536] New: latent bug in FSF gcc with creation of vector of arrays howarth at nitro dot med.uc.edu
                   ` (3 preceding siblings ...)
  2011-06-27 10:32 ` [Bug middle-end/49536] latent bug " rguenth at gcc dot gnu.org
@ 2011-06-27 10:33 ` rguenth at gcc dot gnu.org
  2011-06-27 16:32 ` howarth at nitro dot med.uc.edu
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-06-27 10:33 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-06-27 10:32:12 UTC ---
Fixed.


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

* [Bug middle-end/49536] latent bug with creation of vector of arrays
  2011-06-26 22:45 [Bug middle-end/49536] New: latent bug in FSF gcc with creation of vector of arrays howarth at nitro dot med.uc.edu
                   ` (4 preceding siblings ...)
  2011-06-27 10:33 ` rguenth at gcc dot gnu.org
@ 2011-06-27 16:32 ` howarth at nitro dot med.uc.edu
  2011-06-27 17:10 ` howarth at nitro dot med.uc.edu
  2012-02-10 12:34 ` baldrick at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2011-06-27 16:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jack Howarth <howarth at nitro dot med.uc.edu> 2011-06-27 13:08:38 UTC ---
Can we get this fix backported to gcc-4_5-branch and gcc-4_6-branch as well?
Dragonegg currently only builds against those FSF gcc releases.


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

* [Bug middle-end/49536] latent bug with creation of vector of arrays
  2011-06-26 22:45 [Bug middle-end/49536] New: latent bug in FSF gcc with creation of vector of arrays howarth at nitro dot med.uc.edu
                   ` (5 preceding siblings ...)
  2011-06-27 16:32 ` howarth at nitro dot med.uc.edu
@ 2011-06-27 17:10 ` howarth at nitro dot med.uc.edu
  2012-02-10 12:34 ` baldrick at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2011-06-27 17:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jack Howarth <howarth at nitro dot med.uc.edu> 2011-06-27 16:46:17 UTC ---
I can confirm that the adjusted backport of...

Index: gcc/tree-vect-stmts.c
===================================================================
--- gcc/tree-vect-stmts.c    (revision 175535)
+++ gcc/tree-vect-stmts.c    (working copy)
@@ -4660,6 +4660,15 @@ get_vectype_for_scalar_type (tree scalar
       && GET_MODE_BITSIZE (inner_mode) != TYPE_PRECISION (scalar_type))
     return NULL_TREE;

+  /* We shouldn't end up building VECTOR_TYPEs of non-scalar components.
+     When the component mode passes the above test simply use a type
+     corresponding to that mode.  The theory is that any use that
+     would cause problems with this will disable vectorization anyway.  */
+  if (!SCALAR_FLOAT_TYPE_P (scalar_type)
+      && !INTEGRAL_TYPE_P (scalar_type)
+      && !POINTER_TYPE_P (scalar_type))
+    scalar_type = lang_hooks.types.type_for_mode (inner_mode, 1);
+
   /* FORNOW: Only a single vector size per mode (UNITS_PER_SIMD_WORD)
      is expected.  */
   nunits = UNITS_PER_SIMD_WORD (inner_mode) / nbytes;

on current gcc-4_5-branch solves the ICE under dragonegg in the original
testcase from  http://llvm.org/bugs/show_bug.cgi?id=10042.


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

* [Bug middle-end/49536] latent bug with creation of vector of arrays
  2011-06-26 22:45 [Bug middle-end/49536] New: latent bug in FSF gcc with creation of vector of arrays howarth at nitro dot med.uc.edu
                   ` (6 preceding siblings ...)
  2011-06-27 17:10 ` howarth at nitro dot med.uc.edu
@ 2012-02-10 12:34 ` baldrick at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: baldrick at gcc dot gnu.org @ 2012-02-10 12:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Duncan Sands <baldrick at gcc dot gnu.org> 2012-02-10 12:34:21 UTC ---
Author: baldrick
Date: Fri Feb 10 12:34:17 2012
New Revision: 184090

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184090
Log:
Backport the fix for PR tree-optimization/49536 from mainline.
Patch by Jack Howarth, approved by Richard Guenther.

Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/tree-vect-stmts.c


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

end of thread, other threads:[~2012-02-10 12:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-26 22:45 [Bug middle-end/49536] New: latent bug in FSF gcc with creation of vector of arrays howarth at nitro dot med.uc.edu
2011-06-27  7:46 ` [Bug middle-end/49536] " baldrick at gcc dot gnu.org
2011-06-27  8:43 ` [Bug middle-end/49536] latent bug " ebotcazou at gcc dot gnu.org
2011-06-27  9:10 ` [Bug middle-end/49536] latent bug in FSF gcc " rguenth at gcc dot gnu.org
2011-06-27 10:32 ` [Bug middle-end/49536] latent bug " rguenth at gcc dot gnu.org
2011-06-27 10:33 ` rguenth at gcc dot gnu.org
2011-06-27 16:32 ` howarth at nitro dot med.uc.edu
2011-06-27 17:10 ` howarth at nitro dot med.uc.edu
2012-02-10 12:34 ` baldrick at gcc dot gnu.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).