public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* types in GIMPLE IR
@ 2023-06-28  9:15 Krister Walfridsson
  2023-06-28 15:46 ` Michael Matz
  0 siblings, 1 reply; 8+ messages in thread
From: Krister Walfridsson @ 2023-06-28  9:15 UTC (permalink / raw)
  To: gcc

I have some random questions concerning types in the GIMPLE IR that I 
would appreciate some clarification on.


Type safety
-----------
Some transformations treat 1-bit types as a synonym of _Bool and mix the 
types in expressions, such as:

   <unnamed-unsigned:1> _2;
   _Bool _3;
   _Bool _4;
   ...
   _4 = _2 ^ _3;

and similarly mixing _Bool and enum

   enum E:bool { E0, E1 };

in one operation.

I had expected this to be invalid... What are the type safety rules in the 
GIMPLE IR?


Somewhat related, gcc.c-torture/compile/pr96796.c performs a 
VIEW_CONVERT_EXPR from

   struct S1 {
     long f3;
     char f4;
   } g_3_4;

to an int

   p_51_9 = VIEW_CONVERT_EXPR<int>(g_3_4);

That must be wrong?


Semantics of <signed-boolean:32>
--------------------------------
"Wide" Booleans, such as <signed-boolean:32>, seems to allow more values 
than 0 and 1. For example, I've seen some IR operations like:

   _66 = _16 ? _Literal (<signed-boolean:32>) -1 : 0;

But I guess there must be some semantic difference between 
<signed-boolean:32> and a 32-bit int, otherwise the wide Boolean type 
would not be needed... So what are the difference?

    /Krister

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-06-29 19:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-28  9:15 types in GIMPLE IR Krister Walfridsson
2023-06-28 15:46 ` Michael Matz
2023-06-29  6:21   ` Richard Biener
2023-06-29 12:06     ` Krister Walfridsson
2023-06-29 12:24       ` Michael Matz
2023-06-29 13:19       ` Richard Biener
2023-06-29 19:08         ` Krister Walfridsson
2023-06-29 19:32           ` Andrew Pinski

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).