This is the mail archive of the
mailing list for the GCC project.
Re: [patch] Fix PR middle-end/56474
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 17 Apr 2013 01:12:30 +0200
- Subject: Re: [patch] Fix PR middle-end/56474
- References: <1630485 dot 0zg5rbKfGZ at polaris> <4747807 dot yAnva0Zvtb at polaris> <CAFiYyc07zkSiH44Q62Rgi4YhYfN+VOs-oYbSPo75kAY4T=Lz1g at mail dot gmail dot com>
> For the C family I found exactly one - the layout_type case, and fixed
> it in the FEs by making empty arrays use [1, 0] domains or signed domains
> (I don't remember exactly). I believe the layout_type change was to make
> Ada happy.
I'm skeptical, I had to narrow down the initial kludge because it hurted Ada.
> It may be that enabling overflow detection for even unsigned sizetype was
> because of Ada as well. After all only Ada changed its sizetype sign
Not true, overflow detection has _always_ been enabled for sizetypes.
But sizetypes, including unsigned ones, were sign-extended so 0 -1 didn't
overflow and we need that behavior back for Ada to work properly,
> I don't like special casing 0 - 1 in a general compute function. Maybe
> you want to use size_diffop for the computation? That would result in
> a signed result and thus no overflow for 0 - 1.
But it's not a general compute function, it's size_binop which is meant to be
used for sizetypes only and which forces overflow on unsigned types. We need
overflow detection for sizetypes but we can also tailor it to fit our needs.
> The other option is to for example disable overflow handling for _all_
> constants and MINUS_EXPR (and then please PLUS_EXPR as well)
> in size_binop. Maybe it's only the MULT_EXPR overflow we want to
> know (byte-to-bit conversion / element size scaling IIRC).
Well, we just need 0 - 1 because of the way we compute size expressions for