From: Eric Botcazou <ebotcazou@adacore.com>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: gcc-patches@gcc.gnu.org, Richard Biener <richard.guenther@gmail.com>
Subject: Re: Add VIEW_CONVERT_EXPR to operand_equal_p
Date: Sat, 31 Oct 2015 17:39:00 -0000 [thread overview]
Message-ID: <1693727.sAndYEapaL@polaris> (raw)
In-Reply-To: <20151030151759.GJ37773@kam.mff.cuni.cz>
[-- Attachment #1: Type: text/plain, Size: 2445 bytes --]
> Lets go with this patch and hopefully stabilize the tree. I don't think the
> vector conversions represent an important case.
Unfortunately the patch introduces GIMPLE checking failures in Ada so it will
need to be completed/improved. But let's postpone it because we have another
class of GIMPLE checking failures introduced by the useless_type_conversion_p
change itself:
c37213j.adb:21:05: warning: variable "X" is read but never assigned
c37213j.adb: In function 'C37213J.PROC.CONSTPROP':
c37213j.adb:41:4: error: invalid conversion in gimple call
struct c37213j__proc__value___PAD
struct c37213j__proc__value___PAD
# .MEM_38 = VDEF <.MEM_37>
MEM[(struct c37213j__proc__value___PAD *)R.12_25] = c37213j.proc.value ();
[static-chain: &FRAME.39] [return slot optimization]
and:
eric@polaris:~/build/gcc/native> ~/install/gnat-head/bin/gcc -S c37213j.adb -
O2
c37213j.adb:21:05: warning: variable "X" is read but never assigned
c37213j.adb: In function 'C37213J.PROC.VALUE':
c37213j.adb:26:5: error: invalid conversion in return statement
struct c37213j__proc__value___PAD
struct c37213j__proc__value___PAD
# VUSE <.MEM_11>
return _9(D);
What happens here is that GIMPLE statements are remapped through cloning and
we have a variably-modified type returned by a nested function, so the type of
the LHS of a GIMPLE_CALL or that of the RHS of a GIMPLE_RETURN is remapped but
of course not the return type of the function. This used to be OK because
remapping is done by means of copy_node and preserves TYPE_CANONICAL, so the
conversion between remapped and original type was deemed useless; now the
TYPE_CANONICAL check is gone so the conversion is not useless anymore...
I don't think that we want to introduce an artificial VCE to fix this so we
probably need a couple of kludges in the GIMPLE verifier instead.
In any case, the more I look into the fallout of the useless_type_conversion_p
change, the more I find it ill-advised. We used to have a solid type system
in the middle-end by means of the predicate and now we have cases for which it
ought to return false and returns true (e.g. non-structurally equivalent types
with different calling conventions) and cases for which it can return true and
returns false (remapped types or types deemed equivalent by the languages).
I don't really know what it was made for, but there must be a better way...
* gnat.dg/discr45.adb: New test.
--
Eric Botcazou
[-- Attachment #2: discr45.adb --]
[-- Type: text/x-adasrc, Size: 806 bytes --]
-- { dg-do run }
-- { dg-options "-O2 -gnatws" }
procedure Discr45 is
function Ident_Int (I : Integer) return Integer is
begin
return I;
end;
procedure Proc (Signal : Boolean) is
subtype Index is Integer range 1..10;
type My_Arr is array (Index range <>) OF Integer;
type Rec (D3 : Integer := Ident_Int(1)) is record
case D3 is
when -5..10 => C1 : My_Arr(D3..Ident_Int(11));
when Others => C2 : Integer := Ident_Int(5);
end case;
end record;
X : Rec;
function Value return Rec;
pragma No_Inline (Value);
function Value return Rec is
begin
return X;
end;
begin
if X /= Value then
raise Constraint_Error;
elsif Signal then
raise Program_Error;
end if;
end;
begin
Proc (True);
end;
next prev parent reply other threads:[~2015-10-31 17:17 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-14 16:29 Jan Hubicka
2015-10-15 8:39 ` Richard Biener
2015-10-15 11:22 ` Eric Botcazou
2015-10-15 19:47 ` Eric Botcazou
2015-10-15 23:24 ` Jan Hubicka
2015-10-16 15:58 ` Eric Botcazou
2015-10-16 21:47 ` Richard Biener
2015-10-17 10:27 ` Eric Botcazou
2015-10-17 15:17 ` Richard Biener
2015-10-17 18:57 ` Jan Hubicka
2015-10-18 12:57 ` Eric Botcazou
2015-10-18 16:37 ` Jan Hubicka
2015-10-18 17:14 ` Richard Biener
2015-10-18 18:45 ` Jan Hubicka
2015-10-19 12:31 ` Richard Biener
2015-10-19 21:01 ` Jan Hubicka
2015-10-19 8:17 ` Eric Botcazou
2015-10-19 7:58 ` Eric Botcazou
2015-10-19 19:46 ` Jan Hubicka
2015-10-20 7:02 ` Eric Botcazou
2015-10-21 22:22 ` Jan Hubicka
2015-10-22 8:52 ` Andreas Schwab
2015-10-28 22:49 ` Eric Botcazou
2015-10-29 4:35 ` Jan Hubicka
2015-10-29 11:31 ` Richard Biener
2015-10-29 11:32 ` Richard Biener
2015-10-29 11:32 ` Richard Biener
2015-11-04 8:51 ` Eric Botcazou
2015-10-29 15:06 ` Jan Hubicka
2015-10-29 15:24 ` Richard Biener
2015-10-29 15:53 ` Jan Hubicka
2015-10-30 8:57 ` Richard Biener
2015-10-30 15:28 ` Jan Hubicka
2015-11-02 9:55 ` Richard Biener
2015-10-30 9:56 ` Eric Botcazou
2015-10-30 15:19 ` Jan Hubicka
2015-10-31 17:39 ` Eric Botcazou [this message]
2015-10-31 17:58 ` Richard Biener
2015-11-03 10:26 ` Eric Botcazou
2015-11-03 11:39 ` Richard Biener
2015-11-02 9:30 ` Andreas Schwab
2015-11-03 8:43 ` Eric Botcazou
2015-11-04 7:23 ` Jan Hubicka
2015-11-04 8:20 ` Eric Botcazou
2015-11-04 16:50 ` Jan Hubicka
2015-11-05 13:49 ` Richard Biener
2015-10-21 4:42 ` Jan Hubicka
2015-10-21 8:54 ` Richard Biener
2015-10-21 11:24 ` Eric Botcazou
2015-10-23 5:22 ` Jan Hubicka
2015-10-23 9:14 ` Richard Biener
2015-10-15 16:59 ` Jan Hubicka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1693727.sAndYEapaL@polaris \
--to=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
--cc=richard.guenther@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).