Bug 31498 - [4.1 Regression] ICE with vector initializer in template
Summary: [4.1 Regression] ICE with vector initializer in template
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P1 normal
Target Milestone: 4.2.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code, monitored
Depends on:
Blocks:
 
Reported: 2007-04-06 22:56 UTC by Andrew Pinski
Modified: 2008-07-04 16:04 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.3 3.3.6 4.2.0 4.2.2 4.3.0
Known to fail: 3.4.0 3.4.6 4.0.0 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3
Last reconfirmed: 2007-12-27 17:10:04


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2007-04-06 22:56:51 UTC
Testcase:
typedef __attribute__((__vector_size__(16) )) unsigned char vec_uchar16;
template<typename Tx, typename Ty, typename Tz, typename Tw>
void permute(Tx x, Ty y, Tz z, Tw w)
{
    const vec_uchar16 pattern =
        (vec_uchar16){4*x, 4*x+1, 4*x+2, 4*x+3,
                      4*y, 4*y+1, 4*y+2, 4*y+3,
                      4*z, 4*z+1, 4*z+2, 4*z+3,
                      4*w, 4*w+1, 4*w+2, 4*w+3};
}
int main()
{
  permute(1,2,3,4);
  return 0;
}
Comment 1 Janis Johnson 2007-04-20 19:35:56 UTC
This starts passing for me between 2007-03-10 and 2007-03-20.  Andrew, if it fails for you with a later mainline than that, perhaps it's an intermittent failure rather than a regression.
Comment 2 Andrew Pinski 2007-04-20 20:30:09 UTC
I was testing at the time "4.3.0 20070306" and I tested with yesterday's trunk and it passes.  It also works on the 4.2 branch as of "4.2.0 20070415".
Comment 3 Janis Johnson 2007-04-23 23:28:28 UTC
A regression hunt on powerpc-linux for mainline shows that it was fixed by this patch:

    http://gcc.gnu.org/viewcvs?view=rev&rev=122829

    r122829 | mmitchel | 2007-03-12 00:26:39 +0000 (Mon, 12 Mar 2007)

That patch was added to the 4.2 branch at the same time, and the test now passes on that branch.

The failure still occurs on the 4.1 branch as of 2007-04-19.
Comment 4 Jakub Jelinek 2007-04-27 17:23:20 UTC
Yeah, this is fixed by the PR31038 patch and that patch fixes this even
on gcc-4_1-branch.  But the original PR31038 testcase still ICEs on 4.1 even
with PR31038 patch.
Comment 5 Volker Reichelt 2007-12-27 17:10:04 UTC
Confirmed.
Comment 6 Andrew Pinski 2008-05-29 00:36:16 UTC
Index: pt.c
===================================================================
--- pt.c        (revision 2500)
+++ pt.c        (working copy)
@@ -12464,6 +12464,20 @@ value_dependent_expression_p (tree expre
 
        return value_dependent_expression_p (args);
       }
+      
+    case CONSTRUCTOR:
+      {
+       unsigned HOST_WIDE_INT idx;
+       tree value;
+       VEC(constructor_elt,gc) *v = CONSTRUCTOR_ELTS (expression);
+
+       FOR_EACH_CONSTRUCTOR_VALUE (v, idx, value)
+         {
+           if (value_dependent_expression_p (value))
+             return true;
+         }
+       return false;
+      }
 
     default:
       /* A constant expression is value-dependent if any subexpression is
Comment 7 Joseph S. Myers 2008-07-04 16:04:57 UTC
Closing 4.1 branch.