Bug 77771 - internal compiler error: in cxx_eval_bit_field_ref, at cp/constexpr.c:2090
Summary: internal compiler error: in cxx_eval_bit_field_ref, at cp/constexpr.c:2090
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 5.4.1
: P3 normal
Target Milestone: ---
Assignee: Marek Polacek
URL:
Keywords: ice-on-valid-code
: 83231 (view as bug list)
Depends on:
Blocks: constexpr
  Show dependency treegraph
 
Reported: 2016-09-28 09:31 UTC by Michael Bruck
Modified: 2019-06-08 00:18 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.7.4, 4.8.5, 4.9.4, 5.4.0, 6.2.0
Last reconfirmed: 2016-09-29 00:00:00


Attachments
code that fails (250 bytes, text/plain)
2016-11-27 17:17 UTC, Vlad Petric
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Bruck 2016-09-28 09:31:56 UTC
struct S
{
    char	x[2];
    unsigned	y;
};

constexpr bool func(const S s)
{
    return s.x[0] != 42 || s.x[1] != 0;
}

static_assert(!func({{42, 7}, 0}), "bla");

---

Compiled with -std=c++11 -O on various compilers (http://gcc.godbolt.org/)
starting with 4.7.1 up to 7 I get an ICE:

Example with 5.4:
12 : in constexpr expansion of 'func(S{char [2]{'*', '\007'}, 0u})'
12 : internal compiler error: in cxx_eval_bit_field_ref, at cp/constexpr.c:2090
static_assert(!func({{42, 7}, 0}), "bla");
Comment 1 Martin Liška 2016-09-29 11:37:10 UTC
Confirmed.
Comment 2 Vlad Petric 2016-11-27 17:17:49 UTC
Created attachment 40165 [details]
code that fails
Comment 3 Vlad Petric 2016-11-27 17:22:14 UTC
Sorry - accidentally added test case attachment to this bug. The bug I reported is likely related https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78551
Comment 4 Paolo Carlini 2017-10-23 11:59:08 UTC
Likely related to PR57335.
Comment 5 Volker Reichelt 2018-02-11 20:48:23 UTC
*** Bug 83231 has been marked as a duplicate of this bug. ***
Comment 6 Marek Polacek 2019-06-08 00:14:38 UTC
Fixed by r250659; will add the test.
Comment 7 Marek Polacek 2019-06-08 00:17:44 UTC
Author: mpolacek
Date: Sat Jun  8 00:17:13 2019
New Revision: 272068

URL: https://gcc.gnu.org/viewcvs?rev=272068&root=gcc&view=rev
Log:
	PR c++/77771
	* g++.dg/cpp0x/constexpr-77771.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-77771.C
Modified:
    trunk/gcc/testsuite/ChangeLog
Comment 8 Marek Polacek 2019-06-08 00:18:46 UTC
Fixed.