poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug Compiler/26900] New: Union constructors are not aware of field coup


From: jose.marchesi at oracle dot com
Subject: [Bug Compiler/26900] New: Union constructors are not aware of field coupling
Date: Sat, 14 Nov 2020 19:02:18 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=26900

            Bug ID: 26900
           Summary: Union constructors are not aware of field coupling
           Product: poke
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Compiler
          Assignee: unassigned at sourceware dot org
          Reporter: jose.marchesi at oracle dot com
                CC: poke-devel at gnu dot org
  Target Milestone: ---

+ The algorithm used by the struct constructors assumes that the fields
+ are disjoint.  Therefore, this works as intended:
+ 
+   (poke) type Bar = union { int a : a == 10; int b : b == 10;  };
+   (poke) Bar { a = 11}
+   unhandled constraint violation exception
+ 
+ But this doesn't:
+ 
+   (poke) type Bar = union { int a : a == 10; int b : b < 10;  };
+   (poke) Bar { a = 11}
+   Bar {
+     b=0x0
+   }
+ 
+ The solution for this is to make the constructor to be aware of the
+ coupling of fields.  For unions, this coupling is determined only by
+ their size: labels are not allowed in unions.  Therefore, this should
+ be calculated at run-time.  This is a difficult problem.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]