This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/83060] ICE on valid C++ code: in ignore_overflows, at cp/cvt.c:583
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 21 Nov 2017 16:25:38 +0000
- Subject: [Bug c++/83060] ICE on valid C++ code: in ignore_overflows, at cp/cvt.c:583
- Auto-submitted: auto-generated
- References: <bug-83060-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83060
--- Comment #6 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
I'd say for C it's valid to reject &a.s[-1] and &a.s[__PTRDIFF_MAX__] in
static initializers, because there is no guarantee that such addresses are
valid values of the pointer type (only pointers to actual array elements
or just-past-end-of-array are necessarily valid). I don't think it's
required to reject such initializers, however. Of course when not in a
static initializer, such expressions must be accepted, while causing
undefined behavior at runtime if executed.