User account creation filtered due to spam.

Bug 48909 - [C++0x] ICE in cxx_eval_conditional_expression, at cp/semantics.c:6213
Summary: [C++0x] ICE in cxx_eval_conditional_expression, at cp/semantics.c:6213
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.1
Assignee: Jason Merrill
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-06 05:30 UTC by sscrisk
Modified: 2011-05-06 22:00 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-05-06 09:26:05


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sscrisk 2011-05-06 05:30:58 UTC
Souce:

constexpr int const * is_sorted_until(int const * first, int const * last)
{
 return first == last || first + 1 == last ? last
  : (*(first + 1) < *first) != false ? first + 1
  : is_sorted_until(first + 1, last);
}

int main()
{
 static constexpr int array[2] = {0, 1};
 constexpr int const * last = is_sorted_until(array, array + 2);
}


Compile errors:

a.cpp: In function 'int main()':
a.cpp:11:56:   in constexpr expansion of 'is_sorted_until(((const int*)(& b)), (((const int*)(& b)) + 8u))'
a.cpp:11:56: internal compiler error: in cxx_eval_conditional_expression, at cp/semantics.c:6213
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Paolo Carlini 2011-05-06 09:26:05 UTC
Confirmed mainline and 4_6-branch.
Comment 2 Jason Merrill 2011-05-06 21:57:52 UTC
Author: jason
Date: Fri May  6 21:57:49 2011
New Revision: 173511

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173511
Log:
	PR c++/48909
	* semantics.c (cxx_eval_conditional_expression): Check
	integer_zerop/onep instead.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-condition2.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 Jason Merrill 2011-05-06 21:58:47 UTC
Author: jason
Date: Fri May  6 21:58:44 2011
New Revision: 173516

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173516
Log:
	PR c++/48909
	* semantics.c (cxx_eval_conditional_expression): Check
	integer_zerop/onep instead.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/cpp0x/constexpr-condition2.C
Modified:
    branches/gcc-4_6-branch/gcc/cp/ChangeLog
    branches/gcc-4_6-branch/gcc/cp/semantics.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Comment 4 Jason Merrill 2011-05-06 22:00:58 UTC
Fixed for 4.6.1.