On August 7, 2017 11:09:59 AM GMT+02:00, Marek Polacek <pola...@redhat.com> wrote: >On Mon, Aug 07, 2017 at 10:58:09AM +0200, Jakub Jelinek wrote: >> On Mon, Aug 07, 2017 at 10:47:51AM +0200, Marek Polacek wrote: >> > In my recent change I failed to check whether the type domain >> > of a type is non-NULL and this goof causes crashing on this >> > testcase. >> > >> > Bootstrapped/regtested on x86_64-linux, ok for trunk? >> > >> > 2017-08-07 Marek Polacek <pola...@redhat.com> >> > >> > PR middle-end/81737 >> > * fold-const.c (fold_indirect_ref_1): Check type_domain. >> > >> > * gcc.dg/pr81737.c: New test. >> >> The old code was assuming size_zero_node if type_domain is NULL >> or TYPE_MIN_VALUE is NULL, which is reasonable for C/C++, but indeed >might >> be wrong perhaps for Fortran or Ada.
It's how the middle-end defines it, so please restore this behavior (sorry for missing this in the review). IIRC there are at least one other 'copy' of the folding somewhere. Richard. >Yeah, I did what Richi suggested doing in >https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81695#c4 > >> Hopefully nothing will assume this has to be folded in these cases >(mainly >> thinking about C++ constexpr). > >We'll see soon I suspect ;). > >> So ok. > >Thanks, > > Marek