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

Reply via email to