Backport the fix for PR51799

Bug #917967 reported by Michael Hope
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
Fix Released
High
Michael Hope
gcc
Fix Released
Medium

Bug Description

Ira says:

"""
In over-widening pattern we expect the last statement to be a type
demotion, but don't check this properly. The patch fixes the check, and
also updates vect-widen-shift-u8.c to expect additional widening shift
pattern instead of over-widening pattern.
"""

We have the same patches. Backport the fix.

Related branches

Revision history for this message
In , Matthew Gretton-Dann (matthew-gretton-dann) wrote :

Created attachment 26281
Failing test case.

The attached test case causes the compiler to ICE as follows:

$ arm-none-eabi-gcc -O1 -ftree-vectorize -mcpu=cortex-a9 \
      -mfpu=neon -mfloat-abi=softfp ice.c
ice.c: In function 'f0a':
ice.c:7:1: internal compiler error: in vect_is_simple_use_1, at tree-vect-stmts.c:5987
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Checked against trunk revision 183018.

Revision history for this message
In , Rguenth (rguenth) wrote :

Did it work with 4.6.x? If so, please mark it as regression.

Revision history for this message
In , Matthew Gretton-Dann (matthew-gretton-dann) wrote :

Doesn't ICE with GCC 4.6.2.

Revision history for this message
In , Rguenth (rguenth) wrote :

Thanks for checking.

Revision history for this message
In , Ira Rosen (irar) wrote :

This is actually the same problem as in pr 51301, and the fix of 51301 looks incomplete: we want an over-promoted sequence to end with type demotion operation, so we need to check that properly:

Index: tree-vect-patterns.c
===================================================================
--- tree-vect-patterns.c (revision 182840)
+++ tree-vect-patterns.c (working copy)
@@ -1186,13 +1186,15 @@
     {
       use_lhs = gimple_assign_lhs (use_stmt);
       use_type = TREE_TYPE (use_lhs);
- /* Support only type promotion or signedess change. Check that USE_TYPE
- is not bigger than the original type. */
+ /* Support only type demotion or signedess change. */
       if (!INTEGRAL_TYPE_P (use_type)
- || TYPE_PRECISION (new_type) > TYPE_PRECISION (use_type)
- || TYPE_PRECISION (type) < TYPE_PRECISION (use_type))
+ || TYPE_PRECISION (type) <= TYPE_PRECISION (use_type))
         return NULL;

+ /* Check that NEW_TYPE is not bigger than the conversion result. */
+ if (TYPE_PRECISION (new_type) > TYPE_PRECISION (use_type))
+ return NULL;
+
       if (TYPE_UNSIGNED (new_type) != TYPE_UNSIGNED (use_type)
           || TYPE_PRECISION (new_type) != TYPE_PRECISION (use_type))
         {

I am going to test this patch.

Revision history for this message
In , Irar-j (irar-j) wrote :

Author: irar
Date: Thu Jan 12 14:41:44 2012
New Revision: 183126

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183126
Log:

        PR tree-optimization/51799
        * tree-vect-patterns.c (vect_recog_over_widening_pattern): Check
        that the last operation is a type demotion.

Added:
    trunk/gcc/testsuite/gcc.dg/vect/pr51799.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/vect/vect-widen-shift-u8.c
    trunk/gcc/tree-vect-patterns.c

Revision history for this message
In , Jakub-gcc (jakub-gcc) wrote :

Fixed.

Michael Hope (michaelh1)
Changed in gcc-linaro:
assignee: nobody → Michael Hope (michaelh1)
status: Triaged → In Progress
Changed in gcc:
importance: Unknown → Medium
status: Unknown → Fix Released
Revision history for this message
Michael Hope (michaelh1) wrote :

Confirmed that the fault exists in gcc-linaro:

michaelh@crucis:~/linaro/gcc/build/a7-support$ ./install/bin/arm-linux-gnueabi-gcc -O3 -mfpu=neon -mcpu=cortex-a9 -mfloat-abi=hard -S ../../pr51799/gcc/testsuite/gcc.dg/vect/pr51799.c
../../pr51799/gcc/testsuite/gcc.dg/vect/pr51799.c: In function ‘f0a’:
../../pr51799/gcc/testsuite/gcc.dg/vect/pr51799.c:8:1: internal compiler error: in vect_is_simple_use_1, at tree-vect-stmts.c:5867

Backported and confirmed that the fault is cleared.

Michael Hope (michaelh1)
Changed in gcc-linaro:
status: In Progress → Fix Committed
milestone: none → 4.6-2012.02
Changed in gcc-linaro:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.