This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Add VIEW_CONVERT_EXPR to operand_equal_p
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: gcc-patches at gcc dot gnu dot org, Richard Biener <richard dot guenther at gmail dot com>
- Date: Wed, 28 Oct 2015 23:32:07 +0100
- Subject: Re: Add VIEW_CONVERT_EXPR to operand_equal_p
- Authentication-results: sourceware.org; auth=none
- References: <20151014162944 dot GE16672 at kam dot mff dot cuni dot cz> <1456448 dot Tt4DpGVrAE at polaris> <20151021215701 dot GA14675 at atrey dot karlin dot mff dot cuni dot cz>
> Added and comitted now.
Thanks. Now on to the wrong code issues. :-)
Up to the change, the useless_type_conversion_p predicate was relying on
structural equivalence via the TYPE_CANONICAL check, now it only looks at the
outermost level (size, mode). Now some back-ends, most notably x86-64, do a
deep structural scan to determine the calling conventions (classify_argument)
instead of just looking at the size and the mode, so consistency dictates that
the type of the argument and that of the parameter be structurally equivalent
and this sometimes can only be achieved by a VCE... which is now deleted. :-(
See the call to derivedIP in the attached testcase which now fails on x86-64.
How do we get away from here?
* gnat.dg/discr44.adb: New test.
--
Eric Botcazou
-- { dg-do run }
-- { dg-options "-gnatws" }
procedure Discr44 is
function Ident (I : Integer) return Integer is
begin
return I;
end;
type Int is range 1 .. 10;
type Str is array (Int range <>) of Character;
type Parent (D1, D2 : Int; B : Boolean) is record
S : Str (D1 .. D2);
end record;
type Derived (D : Int) is new Parent (D1 => D, D2 => D, B => False);
X1 : Derived (D => Int (Ident (7)));
begin
if X1.D /= 7 then
raise Program_Error;
end if;
end;