Bug 68180 - [ICE] at cp/constexpr.c:2768 in initializing __vector in a loop
Summary: [ICE] at cp/constexpr.c:2768 in initializing __vector in a loop
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: 7.0
Assignee: Not yet assigned to anyone
URL:
Keywords: easyhack, ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2015-11-02 14:20 UTC by vincenzo Innocente
Modified: 2023-07-06 02:14 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-11-25 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vincenzo Innocente 2015-11-02 14:20:06 UTC
typedef float __attribute__( ( vector_size( 16 ) ) ) float32x4_t;
constexpr float32x4_t fill(float x) {
  float32x4_t v{0};
  constexpr auto vs = sizeof(v)/sizeof(v[0]);
  for (auto i=0U; i<vs; ++i) v[i]=i;
  return v+x;
}

float32x4_t foo(float32x4_t x) {
  constexpr float32x4_t v = fill(1.f);
  return x+v;
}

gcc version 6.0.0 20151028 (experimental) [trunk revision 229474] (GCC)
ICE in
c++ -O2 avxconst.cc -std=c++17 -S
avxconst.cc: In function ‘float32x4_t foo(float32x4_t)’:
avxconst.cc:10:33:   in constexpr expansion of ‘fill(1.0e+0f)’
avxconst.cc:10:37: internal compiler error: tree check: expected constructor, have vector_cst in cxx_eval_store_expression, at cp/constexpr.c:2768
   constexpr float32x4_t v = fill(1.f);
                                     ^

avxconst.cc:10:37: internal compiler error: Abort trap: 6
c++: internal compiler error: Abort trap: 6 (program cc1plus)
Comment 1 Andrew Pinski 2016-08-05 01:12:27 UTC
t88.cc: In function ‘float32x4_t foo(float32x4_t)’:
t88.cc:10:33:   in constexpr expansion of ‘fill(1.0e+0f)’
t88.cc:10:37: internal compiler error: tree check: expected constructor, have vector_cst in cxx_eval_store_expression, at cp/constexpr.c:3051
   constexpr float32x4_t v = fill(1.f);
                                     ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://www.cavium.com/support.html> for instructions.

This should not be hard to fix.  Basically after:
ctx->values->get (object)

You convert VECTOR_CST back into a CONSTRUCTOR.  Then the rest will work.
Comment 2 paolo@gcc.gnu.org 2016-11-17 09:59:39 UTC
Author: paolo
Date: Thu Nov 17 09:59:07 2016
New Revision: 242541

URL: https://gcc.gnu.org/viewcvs?rev=242541&root=gcc&view=rev
Log:
2016-11-17  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/68180
	* g++.dg/cpp1y/pr68180.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1y/pr68180.C
Modified:
    trunk/gcc/testsuite/ChangeLog
Comment 3 Jakub Jelinek 2016-11-18 23:52:01 UTC
Author: jakub
Date: Fri Nov 18 23:51:30 2016
New Revision: 242610

URL: https://gcc.gnu.org/viewcvs?rev=242610&root=gcc&view=rev
Log:
	PR c++/68180
	* g++.dg/cpp1y/pr68180.C: Add -Wno-psabi as dg-additional-options.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/cpp1y/pr68180.C
Comment 4 Marek Polacek 2018-03-07 14:41:47 UTC
Testcase is now rejected with
error: modification of ‘(float [4])v’ is not a constant-expression
   constexpr float32x4_t v = fill(1.f);
since r236630.  ICE is gone.  Closing.