[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ICE] couldn't promote integral to integral struct
From: |
Mohammad-Reza Nabipoor |
Subject: |
Re: [ICE] couldn't promote integral to integral struct |
Date: |
Wed, 6 Apr 2022 19:17:59 +0430 |
Hi, apache2.
On Wed, Apr 06, 2022 at 04:38:57PM +0200, apache2 wrote:
> #!!# type a = struct uint<32> { uint<16> field1; uint<16> field2; };
> #!!# type b = struct { little uint<32> my_a; }
> #!!# var x = open("*data*");
> #!!# (b @ x : 0#B) as a;
> 1:2: internal compiler error: couldn't promote integral to integral struct
> Important information has been dumped in /tmp/pokeiQKOL3.
> Please attach it to a bug report and send it to poke-devel@gnu.org.
>
Thanks for the report.
> This is a bit surprising, I stumbled into it when trying to write:
> #!!# type b = struct { little a my_a; };
> which results in:
> #!!# type b = struct { little a my_a; }
> <stdin>:1:19: warning: useless endianness annotation in field
> type b = struct { little a my_a; };
> ^~~~~~~~~~~~~~
>
> (maybe that's also a bug?)
This behavior is documented in "Field Endianness" section of manual:
```
However, note that the scope of the @code{big} and @code{little}
annotations is lexical. Therefore, in these types:
@example
type Foo =
struct
@{
int a;
int b;
@};
type Bar =
struct
@{
big Foo f;
int c;
@};
@end example
@noindent
The endianness of the @code{a} and @code{b} fields stored in @code{f}
is the default endianness, not @code{big}.
```