On 11.07.2023 18:40, Roberto Bagnara wrote: > Mandatory Rule 19.1 (An object shall not be assigned or copied to an > overlapping object) is directly targeted at two undefined behaviors, > one of which is the subject of 6.5.16.1p3, namely: > > If the value being stored in an object is read from another object > that overlaps in any way the storage of the first object, then the > overlap shall be exact and the two objects shall have qualified or > unqualified versions of a compatible type; otherwise, the behavior > is undefined. > > You can see a number of definite violations in the X86_64 build > at this link: > > > https://saas.eclairit.com:3787/fs/var/local/eclair/XEN.ecdf/ECLAIR_normal/origin/staging/X86_64-Set1/149/PROJECT.ecd;/by_service/MC3R1.R19.1.html
Hmm, gives me "Unauthorized". > As the rule is mandatory, it cannot be deviated. Which is odd, and that's in turn because the C spec is overly strict imo. Considering the one example we looked at yesterday, I have a hard time seeing what UB there would be on little-endian hardware. Both fields (rip and eip) don't overlap exactly, but their low halves (which is all we care about here) do. With this I cannot come up with a way in which the compiler could screw us up, even if it wanted to. Jan
